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 Issue

Former Member
0 Likes
1,043

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

6 REPLIES 6
Read only

Former Member
0 Likes
956

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.

Read only

0 Likes
956

Dear Sanjay Sinha,

Do you have any suggestions for this query?

Please reply.

Thanks,

Pratibha.

Read only

0 Likes
956

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

Read only

Former Member
0 Likes
956

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.

Read only

0 Likes
956

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.

Read only

0 Likes
956

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.