Skip to Content
author's profile photo Former Member
Former Member

BAPI_PO_CHANGE message error

Hello Guys,

I have a problem when calling the BAPI_PO_CHANGE in loop to update the field EREKZ (Final Invoice) from ME22N.

Follows the logic...

Loop

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = vl_po_number

TABLES

Return = tl_return

poitem = tl_poitem

poitemx = tl_poitemx.

IF sy-subrc = 0 .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = c_x

ENDIF.

refresh (all structures and table)...

endloop

Today the program works nice, blocking all PO correctly (field EREKZ)...

But, if one PO return some error for internal table, all PO subsequent too will have some error.

I need so much of help,

Please, somebody knows what's happening?

Thank you,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2011 at 01:46 AM

    Fabrica,

    >> Be sure that you are CLEARing all work-areas&variables and REFRESHing all internal tables Properly in the loop.

    >> Don't use +IF sy-subrc = 0 + after BAPI call, instead check tl_return table for any error.

    Read table tl_return into wa_return with key type = 'E'.

    if sy-subrc = 0.

    Call 'BAPI_TRANSACTION_ROLLBACK'

    else.

    Call BAPI_TRANSACTION_COMMIT

    endif.

    IF you still get same problem, simple DEBUG and check that are all the variables, workares, int tables are cleared well.

    BR,

    Diwakar

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Diwakar, thank you so much,

      I did what you said and it worked.

      Follows what I did...

      The data of PO are allocated in MEMORY ID..

      Then I created a new report only with the BAPI_PO_CHANGE that import the data from MEMORY ID.

      This happens for each loop from the main program that calls the program thought of SUBMIT.

      The program now is working correctly.

      I'm really thankful

      vostan

  • author's profile photo Former Member
    Former Member
    Posted on Aug 23, 2011 at 08:21 PM

    Give the details of the error that one PO or all PO's have come up with.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.