2011 Jul 14 12:05 PM
Hi Experts,
I am working on one inbound interface to update shelf life expiry date into MCH1/MCHA/MCHB table with the help of standard bapi BAPI_BATCH_CHANGE
while debugging i cud see the values are passed to the bapi properly. but table are not getting updated.
kindly help me out.
following is the code that i have written.
FUNCTION Z_IDOC_INPUT_ZQMSLD.
Data: wa_expiry_date type BAPIBATCHATT,
wa_expiry1_date type BAPIBATCHATTX.
DATA: wa_z1sled type z1sled.
DATA : l_sled_doc TYPE TABLE OF z1sled,
it_return TYPE STANDARD TABLE OF bapiret2,
wa_return TYPE bapiret2.
LOOP AT idoc_contrl.
Verify the correct message was passed to the program
IF idoc_contrl-mestyp NE 'ZQMSLD'.
RAISE wrong_function_called.
Exit.
else.
" checking idoc_data for idoc details
LOOP AT idoc_data WHERE docnum EQ idoc_contrl-docnum.
"checking the correct segment details
CASE idoc_data-segnam.
WHEN 'Z1SLED'.
wa_z1sled = idoc_data-sdata.
append wa_z1sled to it_sled.
MOVE wa_z1sled-vfdat to wa_expiry_date-EXPIRYDATE.
"MOVE wa_z1sled-vfdat to wa_expiry1_date-EXPIRYDATE.
wa_expiry1_date-EXPIRYDATE = 'X'.
CALL FUNCTION 'BAPI_BATCH_CHANGE'
EXPORTING
MATERIAL = wa_z1sled-matnr
BATCH = wa_z1sled-charg
PLANT = wa_z1sled-werks
BATCHATTRIBUTES = wa_expiry_date
BATCHATTRIBUTESX = wa_expiry1_date
BATCHCONTROLFIELDS =
INTERNALNUMBERCOM =
EXTENSION1 =
MATERIAL_EVG =
IMPORTING
BATCHATTRIBUTES =
TABLES
RETURN = it_return.
IF wa_expiry_date IS INITIAL.
LOOP AT it_return INTO wa_return.
IF wa_return-type = 'E'.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '51'.
idoc_status-msgty = wa_return-type.
APPEND idoc_status.
ENDIF.
ENDLOOP.
ELSE.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc_status-msgty = 'S'.
APPEND idoc_status.
ENDIF.
ENDCASE.
Clear wa_z1sled.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFUNCTION.
Edited by: Anil_Sahni on Jul 14, 2011 1:05 PM
2011 Jul 14 1:08 PM
Hi
Only issue with is use update database . To update use bapi_transaction_commit.If return type is success use this bapi.
Regards,
Madhu.
Hi Experts,
I am working on one inbound interface to update shelf life expiry date into MCH1/MCHA/MCHB table with the help of standard bapi BAPI_BATCH_CHANGE
while debugging i cud see the values are passed to the bapi properly. but table are not getting updated.
kindly help me out.
following is the code that i have written.
FUNCTION Z_IDOC_INPUT_ZQMSLD.
Data: wa_expiry_date type BAPIBATCHATT,
wa_expiry1_date type BAPIBATCHATTX.
DATA: wa_z1sled type z1sled.
DATA : l_sled_doc TYPE TABLE OF z1sled,
it_return TYPE STANDARD TABLE OF bapiret2,
wa_return TYPE bapiret2.
LOOP AT idoc_contrl.
Verify the correct message was passed to the program
IF idoc_contrl-mestyp NE 'ZQMSLD'.
RAISE wrong_function_called.
Exit.
else.
" checking idoc_data for idoc details
LOOP AT idoc_data WHERE docnum EQ idoc_contrl-docnum.
"checking the correct segment details
CASE idoc_data-segnam.
WHEN 'Z1SLED'.
wa_z1sled = idoc_data-sdata.
append wa_z1sled to it_sled.
MOVE wa_z1sled-vfdat to wa_expiry_date-EXPIRYDATE.
"MOVE wa_z1sled-vfdat to wa_expiry1_date-EXPIRYDATE.
wa_expiry1_date-EXPIRYDATE = 'X'.
CALL FUNCTION 'BAPI_BATCH_CHANGE'
EXPORTING
MATERIAL = wa_z1sled-matnr
BATCH = wa_z1sled-charg
PLANT = wa_z1sled-werks
BATCHATTRIBUTES = wa_expiry_date
BATCHATTRIBUTESX = wa_expiry1_date
BATCHCONTROLFIELDS =
INTERNALNUMBERCOM =
EXTENSION1 =
MATERIAL_EVG =
IMPORTING
BATCHATTRIBUTES =
TABLES
RETURN = it_return.
IF wa_expiry_date IS INITIAL.
LOOP AT it_return INTO wa_return.
IF wa_return-type = 'E'.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '51'.
idoc_status-msgty = wa_return-type.
APPEND idoc_status.
ENDIF.
ENDLOOP.
ELSE.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc_status-msgty = 'S'.
APPEND idoc_status.
ENDIF.
ENDCASE.
Clear wa_z1sled.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFUNCTION.
Edited by: Anil_Sahni on Jul 14, 2011 1:05 PM
2011 Jul 14 1:08 PM
Hi
Only issue with is use update database . To update use bapi_transaction_commit.If return type is success use this bapi.
Regards,
Madhu.
2011 Jul 14 2:20 PM
Thanks Madhu for your input, But still the issue is same.
i have added call to the bapi like this
ELSE.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc_status-msgty = 'S'.
APPEND idoc_status.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
.
ENDIF.
one more point here althought i am getting messge after the execution that idoc got processed by FM Z_IDOC_INPUT_ZQMSLD...
still the transaction is running for a long time.....i had to stop it after a long time when there was no response.
Is something wrong with the code?
2011 Jul 16 10:57 AM
Thanks Madhu!
It's done, Test data was having some issues. Its working fine!
Thanks a lot for your input!
2011 Jul 16 11:08 AM