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

BAPI_ACC_GL_POSTING_POST understanding BAPIRET2

Former Member
0 Likes
806

I prepare a document(filling DOCUMENTHEADER structure), add a few lines to it(filling ACCOUNTGL + CURRENCYAMOUNT tables).

Now let's assume I have some errors. After executing BAPI_ACC_GL_POSTING_POST the RETURN table contains all the information generated by the BAPI. Analyzing BAPIRET2 structure i came across 'ROW' field which according to help.sap.com goes as follows:

ROW INT 4

Line number of the data record containing the invalid value

The problem is, the ROW field is ALWAYS ZERO for every generated message, regardless of which line has an error. I'd like to know in which line given error occurred. Is it possible ?

Right now I'm forced to try to post a document with eg. 100 lines.

Then if error occurs, I split the document into multiple documents, each having only 2 lines and then I am able to find out which lines caused the error. But that doesn't seem to go in pair with performance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

Hi Bart,

I could not even get this solution but I would recommend some you instead of using post bapi use CHECK BAPI and pass only two lines [Item] and that too the second line should be a dummy record not the real one this is because this BAPI can be used only when you have amount to be zero.

Why I am telling this to you is this way you can get the Error Message for any field in one record and then check the next line and soon.Once you get that all line items in a document are okay then use POST BAPI this can be achieved using any FLAG variable.

Thanks

Sudharshan

I prepare a document(filling DOCUMENTHEADER structure), add a few lines to it(filling ACCOUNTGL + CURRENCYAMOUNT tables).

Now let's assume I have some errors. After executing BAPI_ACC_GL_POSTING_POST the RETURN table contains all the information generated by the BAPI. Analyzing BAPIRET2 structure i came across 'ROW' field which according to help.sap.com goes as follows:

ROW INT 4

Line number of the data record containing the invalid value

The problem is, the ROW field is ALWAYS ZERO for every generated message, regardless of which line has an error. I'd like to know in which line given error occurred. Is it possible ?

Right now I'm forced to try to post a document with eg. 100 lines.

Then if error occurs, I split the document into multiple documents, each having only 2 lines and then I am able to find out which lines caused the error. But that doesn't seem to go in pair with performance.

3 REPLIES 3
Read only

Former Member
0 Likes
694

Hi Bart,

I could not even get this solution but I would recommend some you instead of using post bapi use CHECK BAPI and pass only two lines [Item] and that too the second line should be a dummy record not the real one this is because this BAPI can be used only when you have amount to be zero.

Why I am telling this to you is this way you can get the Error Message for any field in one record and then check the next line and soon.Once you get that all line items in a document are okay then use POST BAPI this can be achieved using any FLAG variable.

Thanks

Sudharshan

Read only

Former Member
0 Likes
693

Hi,

Thanks for reply. Meanwhile I've came across the CHECK BAPI myself, I'll use it for verifying single entries instead of POST + ROLLBACK. Why I mentioned checking 2 lines at the same time and not one and dummy, well I'm developing an interface to move data from an external system to SAP. 1 line of data from external system is expanded into 2 lines for the SAP posting document. Therefore it is sufficient and convenient for me to check the lines in pairs.

Anyways, I still leave the question open, is it possible to obtain true line numbers in BAPIRET2-ROW ?

Read only

0 Likes
693

Hi ,

I too had the same requirement in my last project where we had data[GL] coming from XI into SAP and I had used the same BAPI,if you want only line number then you can use the TAB-IX of the internal table which will be giving data to BAPi.

Thanks

Sudharshan