‎2014 Jan 05 1:54 PM
I need to post a financial document in SAP from PI. I need to split that document after the 999 Th line. Can anyone help me with the splitting logic?
‎2014 Jan 05 3:46 PM
‎2014 Jan 05 5:46 PM
Yes i am using BAPI. It is a custom BAPI which is doing the posting.
‎2014 Jan 05 3:47 PM
Where is the problem?
Just use a counter and after the 999 line set your pointer to the next internal table.
And this isn't a question right now. What document do you got. is it an XML or already in another table stored or or or.
Please share more about the details you are into and I think you will get some useful answers in case my answer didn't help you out
Regards
Florian
‎2014 Jan 06 8:11 AM
Hi - What type of financial document is it ( like GL Posting) ?
‎2014 Jan 06 6:27 PM
yes its GL posting. I am done with the splitting part. I wanted to know how to add the debit credit adjustment (GL account)in the 998th line and keep the final result in the 999th line. The final internal table is it_out. I am using BAPI_ACC_DOCUMENT_POST.
‎2014 Jan 06 6:42 PM
Hi Tina
In such scenario we normally have a dummy GL account GL1. Lets say till 998 lines the total is 50 Credit we add 999 line for GL1 account with 50 Debit and post the document. The next document has first line as GL1 credit 50 and then other lines. So effectively dummy GL account balances out
Nabheet
‎2014 Jan 06 7:14 PM
Hi Nabheet
I get the concept but I am nnot sure in which field to append it.? and how do I know for sure it will be the 998th line item?
‎2014 Jan 06 8:58 PM
‎2014 Jan 07 7:36 AM
Hi Tina -
Say if you have 1200 Lines to be posted then you will create two account documents. The First Accounting document will have 998 Lines + 1 Line for Dummy GL and 2nd document will have 222 Lines + 1 Dummy GL.
1. Now loop over the 1200 lines. Put a counter and another variable for sum of the amounts.
2. When the counter reaches 998 then check the sum of amounts.
(a)If its credit (negative) then post a debit to the dummy GL as the line 999. So the balance will be zero.
(b) If its debit (positive then post a credit to the dummy GL as the line 999.). So the balance will be zero.
(c) then you call BAPI_ACC_DOCUMENT_POST to create first accounting document
3. Now you need create 2nd account document. If you posted the dummy GL as negative in step 2 above then create the 1st line as positive for dummy GL else create the 1st line as negative for dummy GL.
4. Proceed for the rest of line items and create till 1200 lines. ( the 2nd document should have 221 lines )
5. Then you call BAPI_ACC_DOCUMENT_POST to create 2nd accounting document .
Let us know if it helps.
Regards,
Atul Mohanty