2010 Feb 03 9:02 AM
i want to 201 movement. i know gm_code 06. (MB11 movement type) when i run the code there is no error.
but gives me movement number. when i look at mb51 there is no data. so what could be the
reason. also i have manuely entered data to se37 with function BAPI_GOODSMVT_CREATE. same thing happen.
and of course at the continue of code there is commit and work bapi.
my code like:
data i_tab TYPE TABLE OF ZPM_FUEL_EXT WITH HEADER LINE.
DATA : goodsmvt_header TYPE bapi2017_gm_head_01,
goodsmvt_code TYPE bapi2017_gm_code,
goodsmvt_headret TYPE bapi2017_gm_head_ret,
materialdocument TYPE bapi2017_gm_head_ret-mat_doc,
matdocumentyear TYPE bapi2017_gm_head_ret-doc_year,
goodsmvt_item TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE ,
return TYPE TABLE OF bapiret2 WITH HEADER LINE .
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
gmcode-gm_code = '06'.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_header-doc_date = sy-datum.
goodsmvt_header-pr_uname = sy-uname.
SELECT * from ZPM_FUEL_EXT INTO i_tab where STATE = ''.
goodsmvt_item-material = i_tab-matnr.
goodsmvt_item-mvt_ind = ''.
goodsmvt_item-plant = i_tab-werks.
goodsmvt_item-stge_loc = i_tab-lgort.
goodsmvt_item-move_type = i_tab-bwart = " '201'.
goodsmvt_item-entry_qnt = i_tab-amount.
goodsmvt_item-entry_uom = i_tab-MEINS.
goodsmvt_item-COSTCENTER = i_tab-KOSTL.
goodsmvt_item-GL_ACCOUNT = i_tab-SAKNR. " '7300200001'.
goodsmvt_item-ORDERID = i_tab-AUFNR. " 'A27BC307'.
goodsmvt_item-PAR_COMPCO = i_tab-BUKRS.
APPEND goodsmvt_item.
ENDSELECT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = gmcode
IMPORTING
goodsmvt_headret = goodsmvt_headret" testrun = 'X'
TABLES
goodsmvt_item = goodsmvt_item
return = return.
thanks for your help.
2010 Feb 03 10:19 PM
Hi,
You need to commit the transacton using function module "BAPI_TRANSACTION_COMMIT".
If you want to check it via SE37 ,enter function module name & go to menu:
Function Module->Test-> Test Sequences
Enter function module names:
BAPI_GOODSMVT_CREATE
BAPI_TRANSACTION_COMMIT
AftereExecuting first function module, system displays output of the functon module.
when you click on back button the system allows to you execte second funtion module
Give WAIT = 'X". Execute it. The document will be saved.
Regards,
Sudhakar Rayala
i want to 201 movement. i know gm_code 06. (MB11 movement type) when i run the code there is no error.
but gives me movement number. when i look at mb51 there is no data. so what could be the
reason. also i have manuely entered data to se37 with function BAPI_GOODSMVT_CREATE. same thing happen.
and of course at the continue of code there is commit and work bapi.
my code like:
data i_tab TYPE TABLE OF ZPM_FUEL_EXT WITH HEADER LINE.
DATA : goodsmvt_header TYPE bapi2017_gm_head_01,
goodsmvt_code TYPE bapi2017_gm_code,
goodsmvt_headret TYPE bapi2017_gm_head_ret,
materialdocument TYPE bapi2017_gm_head_ret-mat_doc,
matdocumentyear TYPE bapi2017_gm_head_ret-doc_year,
goodsmvt_item TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE ,
return TYPE TABLE OF bapiret2 WITH HEADER LINE .
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
gmcode-gm_code = '06'.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_header-doc_date = sy-datum.
goodsmvt_header-pr_uname = sy-uname.
SELECT * from ZPM_FUEL_EXT INTO i_tab where STATE = ''.
goodsmvt_item-material = i_tab-matnr.
goodsmvt_item-mvt_ind = ''.
goodsmvt_item-plant = i_tab-werks.
goodsmvt_item-stge_loc = i_tab-lgort.
goodsmvt_item-move_type = i_tab-bwart = " '201'.
goodsmvt_item-entry_qnt = i_tab-amount.
goodsmvt_item-entry_uom = i_tab-MEINS.
goodsmvt_item-COSTCENTER = i_tab-KOSTL.
goodsmvt_item-GL_ACCOUNT = i_tab-SAKNR. " '7300200001'.
goodsmvt_item-ORDERID = i_tab-AUFNR. " 'A27BC307'.
goodsmvt_item-PAR_COMPCO = i_tab-BUKRS.
APPEND goodsmvt_item.
ENDSELECT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = gmcode
IMPORTING
goodsmvt_headret = goodsmvt_headret" testrun = 'X'
TABLES
goodsmvt_item = goodsmvt_item
return = return.
thanks for your help.
2010 Feb 03 10:19 PM
Hi,
You need to commit the transacton using function module "BAPI_TRANSACTION_COMMIT".
If you want to check it via SE37 ,enter function module name & go to menu:
Function Module->Test-> Test Sequences
Enter function module names:
BAPI_GOODSMVT_CREATE
BAPI_TRANSACTION_COMMIT
AftereExecuting first function module, system displays output of the functon module.
when you click on back button the system allows to you execte second funtion module
Give WAIT = 'X". Execute it. The document will be saved.
Regards,
Sudhakar Rayala
2010 Feb 04 6:45 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |