2005 Oct 24 11:59 AM
Hi All,
I have written a code for posting multiple materials for goods issue for Movement type 201 (tcode MIGO_GI).
I am using FM
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = gmove_header
GOODSMVT_CODE = gmove_code
IMPORTING
GOODSMVT_HEADRET = headret
MATERIALDOCUMENT = matdoc
MATDOCUMENTYEAR = docyear
TABLES
GOODSMVT_ITEM = gmove_line
RETURN = return.
COMMIT WORK AND WAIT.
But if few materials have errors in details, other materials with correct data are not posted.
Please suggest what could be the reason.
Regards,
Pratibha
Hi All,
I have written a code for posting multiple materials for goods issue for Movement type 201 (tcode MIGO_GI).
I am using FM
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = gmove_header
GOODSMVT_CODE = gmove_code
IMPORTING
GOODSMVT_HEADRET = headret
MATERIALDOCUMENT = matdoc
MATDOCUMENTYEAR = docyear
TABLES
GOODSMVT_ITEM = gmove_line
RETURN = return.
COMMIT WORK AND WAIT.
But if few materials have errors in details, other materials with correct data are not posted.
Please suggest what could be the reason.
Regards,
Pratibha
2005 Oct 24 12:31 PM
Hi Pratibha,
Its not due to that reason.
Its better you use the BAPI BAPI_TRANSACTION_COMMIT.
Its better if you check the return code in the debug mode. And instead of commit work and wait use the above said FM. But it is due to some other problem. And could you please mention the exception that is throwing in the BAPI.
regards,
Sampath.
2005 Oct 25 5:32 AM
Dear Sanjay Sinha,
Do you have any suggestions for this query?
Please reply.
Thanks,
Pratibha.
2005 Oct 25 5:57 AM
hi,
what kind of error you got in gt_return. Is any material with batch manager/serial managed. In that case we need to populate those details also.
cheers,
sasi
2005 Oct 25 5:45 AM
Waht do you mean by "materials have errors in details, other materials with correct data are not posted". Is it that you are having multiple line items in gmove_line and some are incorrect and some correct and this BAPI call is failing . If this is the case then it is okay as you will see same behaviour in online mode. You cannot post a transaction with one incorrect item
Or is it that due to failure of one call of BAPI , subsequent BAPI calls are failing. Are you calling BAPI in a loop.
In you code can you use write statement to write the return parameters in table RETURN . It will help analyze the error .
Cheers.
2005 Oct 25 5:52 AM
Hi Sanjay,
Thanks for the reply.
Yes I have multiple line items in gmove_line. But I am calling FM only once for posting all materials. If few have wrong data other line items are not posted.
Shall I loop gmove_line and for every item call the FM and commit transaction. So which ever items have correct data, those will get posted one by one.
Regards,
Pratibha.
2005 Oct 25 5:56 AM
Yes loop is correct way if you expect to have faulty line items . As I said earlier also that it behaves similar to an online transaction. i.e. you cannot save with a faulty line items.
Better would be if you can analyze the errors and put the check before calling the BAPI itself.
What are the errors , can you check using write statement or in debugging by seeing the contents of table return.
Cheers.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |