Sales order (SO) new BAPI_SALESORDER_CREATEFROMDAT2 or modify BAPI_SALESORDER_CHANGE price condition value expansion or contraction

The new and modified sales order BAPIs are as follows:

BAPI_SALESORDER_CREATEFROMDAT2

BAPI_SALESORDER_CHANGE

Corresponding price condition parameters

The creation and modification effects are as follows:

Summarized as follows:

The amount of the price that must be passed in the currency field (currency), no incoming or expanding the amount of lead

For this example: PR01 / ZPR0 / ZPR2 is the amount field and must be passed in currency

The amount of non-price conditions do not pass currency field, passing will lead to reduced amount

For this example: ZP01 percentage non-amount field, do not pass in currency

The ZPR0 parameter settings are as follows:

      READ TABLE lt_prcd INTO ls_prcd WITH KEY kschl = 'ZPR0'.
      IF sy-subrc = 0.
        lt_conditions_in = VALUE #( BASE lt_conditions_in
                                    ( itm_number = ls_item-posnr
                                      cond_st_no = ls_prcd-stunr
                                      cond_count = |{ ls_prcd-zaehk ALPHA = IN }|
                                      cond_type  = 'ZPR0'
                                      cond_value = ls_item-zkbetr
                                      currency   = ls_prcd-waers ) ).

        lt_conditions_inx = VALUE #( BASE lt_conditions_inx
                                    ( itm_number = ls_item-posnr
                                      cond_st_no = ls_prcd-stunr
                                      cond_count = |{ ls_prcd-zaehk ALPHA = IN }|
                                      cond_type  = 'ZPR0'
                                      updateflag = 'U'
                                      cond_value = 'X'
                                      currency   = 'X' ) ).
        lv_mod_flag = 'X'.
      ELSE.
        IF ls_item-zkbetr GT 0.
          lt_conditions_in = VALUE #( BASE lt_conditions_in
                                      ( itm_number = ls_item-posnr
                                        cond_type  = 'ZPR0'
                                        cond_value = ls_item-zkbetr
                                        currency   = gwa_item-zwaers ) ).

          lt_conditions_inx = VALUE #( BASE lt_conditions_inx
                                      ( itm_number = ls_item-posnr
                                        cond_type  = 'ZPR0'
                                        updateflag = 'I'
                                        cond_value = 'X'
                                        currency   = 'X' ) ).
          lv_mod_flag = 'X'.
        ENDIF.
      ENDIF.

ZP01 parameter setting:

    READ TABLE lt_prcd INTO ls_prcd WITH KEY kschl = 'ZR01'.
    IF sy-subrc = 0.
      IF ls_prcd-kbetr NE ls_item-zyj.
        lt_conditions_in = VALUE #( BASE lt_conditions_in
                                    ( itm_number = ls_item-posnr
                                      cond_st_no = ls_prcd-stunr
                                      cond_count = |{ ls_prcd-zaehk ALPHA = IN }|
                                      cond_type  = 'ZR01'
                                      cond_value = ls_item-zyj
                                      currency   = ls_prcd-waers ) ).

        lt_conditions_inx = VALUE #( BASE lt_conditions_inx
                                    ( itm_number = ls_item-posnr
                                      cond_st_no = ls_prcd-stunr
                                      cond_count = |{ ls_prcd-zaehk ALPHA = IN }|
                                      cond_type  = 'ZR01'
                                      updateflag = 'U'
                                      cond_value = 'X'
                                      currency   = 'X' ) ).
        lv_mod_flag = 'X'.
      ENDIF.
    ELSE.
      IF ls_item-zyj GT 0.
        lt_conditions_in = VALUE #( BASE lt_conditions_in
                                    ( itm_number = ls_item-posnr
                                      cond_type  = 'ZR01'
                                      cond_value = ls_item-zyj
                                       ) ).

        lt_conditions_inx = VALUE #( BASE lt_conditions_inx
                                    ( itm_number = ls_item-posnr
                                      cond_type  = 'ZR01'
                                      updateflag = 'I'
                                      cond_value = 'X'
                                       ) ).
        lv_mod_flag = 'X'.
      ENDIF.
    ENDIF.

 

 

 

 

 

 

 

Published 190 original articles · praised 133 · 970,000 views

Guess you like

Origin blog.csdn.net/wanglei880526/article/details/104728787