Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Goods Reciept BAPI that updates Document Flow

Former Member
0 Likes
543

Hello,

We are looking for a BAPI or FM that posts a goods reciept against a PO and updates document flow. Does anyone know if this exists?

We have been using BAPI_GOODSMVT_CREATE, which will post the GR against the PO but it does not update the Doc Flow. It is essential for Doc Flow to be updated because it posts the event in our SAP SCM EM instance.

Any help would be much appreciated... will award as many points possible.

Hello,

We are looking for a BAPI or FM that posts a goods reciept against a PO and updates document flow. Does anyone know if this exists?

We have been using BAPI_GOODSMVT_CREATE, which will post the GR against the PO but it does not update the Doc Flow. It is essential for Doc Flow to be updated because it posts the event in our SAP SCM EM instance.

Any help would be much appreciated... will award as many points possible.

2 REPLIES 2
Read only

Former Member
0 Likes
492

Hi,

Check the below code:

*********Work areas***********

DATA : wa_mseg type ty_mseg,

wa_mseg1 TYPE ty_gds,

wa_mkpf LIKE mkpf,

wa_lgort_sum TYPE ty_lgort_sum,

wa_loss_data LIKE zpesloss,

wa_zpesloss LIKE zpesloss.

DATA : v_header LIKE bapi2017_gm_head_01,

v_gm_code LIKE bapi2017_gm_code.

DATA: wa_headret LIKE bapi2017_gm_head_ret,

wa_matdoc TYPE bapi2017_gm_head_ret-mat_doc,

wa_matdocyr TYPE bapi2017_gm_head_ret-doc_year.

DATA: i_items TYPE STANDARD TABLE OF t_items,

i_return_goods TYPE STANDARD TABLE OF t_return with header line,

i_message TYPE TABLE OF bapiret2 WITH HEADER LINE.

wa_mseg1-bwart = '551'.

wa_mseg1-matnr = ws_matnr.

wa_mseg1-umlgo = i_mseg1-umlgo.

wa_mseg1-lgort = i_mseg1-lgort.

wa_mseg1-werks = 'SP01'.

  • Header Data

v_header-pstng_date = sy-datum.

v_header-doc_date = sy-datum.

  • Code Group

v_gm_code-gm_code = '03'.

******Mandatory fields passed into BAPI***

CLEAR i_items[].

wa_items-material = wa_mseg1-matnr.

wa_items-plant = wa_mseg1-werks.

wa_items-stge_loc = wa_mseg1-lgort.

wa_items-move_type = wa_mseg1-bwart.

wa_items-entry_qnt = wa_mseg1-lossquantity.

wa_items-costcenter = '0000012000'.

APPEND wa_items TO i_items.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = v_header

goodsmvt_code = v_gm_code

  • TESTRUN = ' '

IMPORTING

goodsmvt_headret = wa_headret

materialdocument = wa_matdoc

matdocumentyear = wa_matdocyr

TABLES

goodsmvt_item = i_items

  • GOODSMVT_SERIALNUMBER =

return = i_return_goods .

if i_return_goods[] is not initial.

message i001(zespur) with i_return_goods-message.

stop.

endif.

IF i_return_goods[] IS INITIAL .

lws_wait = 3.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = lws_wait.

WAIT UP TO 1 SECONDS.

endif.

Regards,

Prakash.

Read only

Former Member
0 Likes
492

You have to use RV_DOCUMENT_FLOW_UPDATE.