on 06-29-2009 2:22 PM
hi
I need help for the following scenario :
PI will be receivng text files where the number of line items will be of the order say 2800 line items per file.
Each file is a document posting(IDOC) , but the condition is that in SAP FI the number of records that can be posted are only 999 , so the fix is that after every 998 records read by SAP PI a dummy record is to be inserted and an IDOC is posted and for the next IDOC(next 998 records) the first line item is again a dummy record which is the reversal of the last line item inserted to balance the credit and debits.
a) How can PI read the file in such a way that the first 998 line items can be posted as one idoc and the remaining line items in the next idoc etc
b)Also the file to be read, has to be first sorted on date ,ie each line item with the same date field have to be clubbed and then the 998 split has to be applied.
Kindly help in suggesting the approach , if it requires a UDF ,,can some body please provide the code for the same ?
thanks
Rohan
Hi Rohan,
I think you will need to use multimapping:
source -> temp (sort by date)
temp -> target (split)
You can use similar code to split the line items:
for(int j = 0; j< a.length; j++)
{
counter = counter + 1;
counter1 = counter1+ 1;
result.addValue(a[j]);
if (counter == 998)
{ if (a.length - counter1==0)
{ counter = 0; }
else
{ result.addContextChange();
counter = 0;
}
}
}
Hope this helps..let us know if you come up with a better method!!
Regards,
Lasya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has this never been done before
a) sorting the records of the incoming file on the basis of a field for eg. ascending date ?
b) splitting the file on the numer of records ie 999 records for one idoc and the next 999 for the second and so on ?
Can anyone please suggest something ?+
Thanks
Rohan
Edited by: RohanS on Jun 29, 2009 4:37 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had a similar scenario at a customer, finally had to revert to mapping class.
On the face of it, a UDF or a class mapping will work.
However, as the requirements get more elaborate, only viable (& technically reusable option) is to use mapping in a class (either an ABAP class or a Java class) will work.
If volume of data is a consideration and some data elements need verification (company code, GL accounts etc), then you may lean towards an ABAP class.
Let me know if you need more help.
Anupam
Hi RohanS,
I think that one possible solution is use multimapping. You can generate more than one IDOC document from one input message.
Pls, see the following reference:
[Multimapping without BPM|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3115] [original link is broken] [original link is broken] [original link is broken];
I hope It helps you.
Ivan
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.