Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Item Quantity not getting updated 'BAPI_SALESORDER_CHANGE'

$
0
0

Hi,

 

Delivery quantity should be updated in the sales order item quantity, I have written the below shown code to achieve the functionality but it is not working, please check and let me know what else needs to be passed to the BAPI.

 

Include MV50AFZ1 exit : FORM userexit_save_document

 

data: w_vbelv     type vbfa-vbelv,      w_quan      type lfimg,      w_vbeln     type BAPIVBELN-VBELN,      wa_INX      type BAPISDH1X,      wa_item     type BAPISDITM,      wa_schdl    type bapischdl,      wa_schdlx   type bapischdlx,      wa_order    type U_16028,             " Modified      wa_itemx    type BAPISDITMX,      itab_inx    type table of BAPISDITMX,      itab_schdl  type table of bapischdl,      itab_schdlx type table of bapischdlx,      itab_item   type table of BAPISDITM,      itab_order  TYPE TABLE OF U_16028,      itab_return type table of BAPIRET2.

FIELD-SYMBOLS: <fs_lips>  type LIPSVB, "Data type of XLIPS               <fs_order> type U_16028.
clear w_VBELV.
case sy-tcode.  when 'VL02N'.
select VBELV up to 1 rows from vbfa into w_VBELV                          where vbeln = likp-VBELN                          and vbtyp_n = 'J'                          and vbtyp_v = 'C'.
ENDSELECT.
when 'VL01N'.
get PARAMETER ID 'AUF' FIELD w_VBELV.
endcase.

if w_VBELV is not initial.
  select * from U_16028 into table itab_order where vbeln = w_vbelv.  if sy-subrc = 0.    loop at itab_order assigning <fs_order>.      READ TABLE xlips assigning <fs_lips> with key vgbel = <fs_order>-VBELN                                                    posnr = <fs_order>-posnr.      if sy-subrc = 0.         wa_item-ITM_NUMBER   = <fs_lips>-posnr.         wa_item-MATERIAL     = <fs_lips>-matnr.         wa_item-TARGET_QTY   = <fs_lips>-LFIMG.                           " Modified         wa_itemx-updateflag  = 'U'.         wa_itemx-itm_number  = <fs_lips>-posnr.         wa_itemx-TARGET_QTY  = 'X'.                                       " Modified         wa_itemx-MATERIAL    = 'X'.         wa_schdl-itm_number  = <fs_lips>-posnr.         wa_schdl-sched_line  = <fs_order>-etenr.         wa_schdl-req_qty     = <fs_lips>-LFIMG."         wa_schdlx-updateflag = 'U'.         wa_schdlx-itm_number = <fs_lips>-posnr.         wa_schdlx-sched_line = <fs_order>-etenr.         wa_schdlx-req_qty    = 'X'.         APPEND: wa_item   to itab_item,                 wa_itemx  to itab_inx,                 wa_schdl  to itab_schdl,                 wa_schdlx to itab_schdlx.         clear: wa_item, wa_itemx, wa_schdl, wa_schdlx.      endif.    endloop.

if itab_item is not initial.
    w_vbeln = w_VBELV.    wa_INX-UPDATEFLAG = 'U'.    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'          EXPORTING            SALESDOCUMENT               = w_vbeln            ORDER_HEADER_INX            = wa_INX          TABLES            RETURN                      = itab_return            ORDER_ITEM_IN               = itab_item            ORDER_ITEM_INX              = itab_inx            SCHEDULE_LINES              = itab_schdl            SCHEDULE_LINESX             = itab_schdlx.   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'    EXPORTING      wait = 'X'.    endif.   endif.  endif.

 


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>