05-10-2008 4:40 AM
Hi Experts
We are doing shipment from one plant to another plant.
Now my requirement is,
when i do PGI(Post Goods Issue) activity from one plant to other plant using VL02N, i need to do automatic GR for other plant.
The PO number will be maintained in the sales order itself, so how to do this.
Can we use BADIs, if so, whats the right one, and how to do it, pls advise me on this.
Thanks in advance.
Regards
Rajaram
05-10-2008 5:11 AM
Hello,
A custom program may be created and scheduled to run to receive Goods In-Transit using BAPI BAPI_GOODSMVT_CREATE.
Thanks,
Venu
05-10-2008 5:25 AM
Hi Venu
Thank you very much for your instant replay, Can you explain me briefly that,
how to do this, bcoz, i will be getting Purchase Order Number from the sales order, the quantity which am doing sales has to be inwarded into the Goods Receipt of that Purcahse Order in other Plant.
Pls tell me the badi's name, and how to do this with step by step pls.
Thank you very much
Regards
Rajaram
05-10-2008 6:43 AM
Hi Raja,
data: bapi_head LIKE bapi2017_gm_head_01,"OCCURS 10 WITH HEADER LINE,
bapi_move LIKE bapi2017_gm_code,
bapi_move LIKE bapi2017_gm_code,
bapi_headret LIKE bapi2017_gm_head_ret,
bapi_out LIKE bapi2017_gm_head_ret-mat_doc,
bapi_year LIKE bapi2017_gm_head_ret-doc_year,
bapi_item LIKE bapi2017_gm_item_create OCCURS 10
WITH HEADER LINE,
wa1 LIKE bapi2017_gm_item_create,
bapi_serial LIKE bapi2017_gm_serialnumber OCCURS 10
WITH HEADER LINE,
bapi_return LIKE bapiret2 OCCURS 10 WITH HEADER LINE.
bapi_move = '01'.
MOVE t_sd-bldat TO bapi_head-doc_date.
MOVE t_sd-budat TO bapi_head-pstng_date.
MOVE t_sd-xblnr TO bapi_head-ref_doc_no.
MOVE t_sd-bktxt TO bapi_head-header_txt.
loop at t_sd.
MOVE t_sd-werks TO wa1-plant.
MOVE t_sd-lgort_r TO wa1-stge_loc.
wa1-move_type = '101'.
MOVE t_sd-ebeln_s TO wa1-po_number.
MOVE t_sd-ebelp_s TO wa1-po_item.
MOVE t_sd-VBELN TO wa1-DELIV_NUMB_TO_SEARCH.
MOVE t_sd-POSNR TO wa1-DELIV_ITEM_TO_SEARCH.
MOVE t_sd-menge TO wa1-entry_qnt.
MOVE t_sd-base_uom TO wa1-entry_uom.
MOVE t_sd-matnr TO wa1-material.
MOVE t_sd-reswk TO wa1-plant.
MOVE t_sd-lgort_s TO wa1-stge_loc.
APPEND wa1 TO bapi_item.
endloop.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = bapi_head
goodsmvt_code = bapi_move
TESTRUN = ' '
IMPORTING
goodsmvt_headret = bapi_headret
materialdocument = bapi_out
matdocumentyear = bapi_year
TABLES
goodsmvt_item = bapi_item
goodsmvt_serialnumber = bapi_serial
return = bapi_return
.
IF sy-subrc = 0.
headr_ret = bapi_headret.
mat_doc = bapi_out.
doc_year = bapi_year.
ret_tab[] = bapi_return[].
ENDIF.
IF ( bapi_return-type = ' ' ) AND ( NOT bapi_out IS INITIAL ).
if the material document created this function is used to make the
permanent changes to the database
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = space.
IMPORTING
RETURN = MESSTAB_COMMIT.
ENDIF.
if it is helpfull pls reward pts.
Regards
Srimanta
05-10-2008 7:09 AM
Hi Srimanta
Thanks for your replay, but can you tell me where we need to process these codes.
Whether i have to use, in badi or user exit, can u tell me pls.
Regards
Rajaram