on 10-16-2007 1:04 PM
Hi,
I have a scenario where I'm generating a xml file to the receiver using file adaptor I need to write 100 records per file, if it's more than 100 then I need to write into a different file, to say I need to have 100 records per file.
ABAP Proxy > PI- >File
Any help is really appreciated.
Thanks,
Joe.P
Hi Joe,
Use a 1 to n mapping to split the message into messages of up to 100 records.
In your message mapping, open the Messages tab and change the occurence of your target message to 0... Unbounded.
Now you use a UDF to split according to number of records.
Eg. context function with parameter 'a':
for (int i=0; i<Math.ceil(a.length/100; i++)
result.addValue(" ");
You would map the records occurence to this function and map this function to the structure below the Message1 structure.
Message was edited by:
Yaghya Nana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yaghya,
When I test my message mapping I don't see any errors but the output message I don't see any results. this is what I see in the output screen.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"><ns0:Message1></ns0:Message1>
</ns0:Messages>
Here I don't see any values and also the subnodes are missing. any ideas what am I doing wrong here.
thanks,
Joe.P
Hi Joe,
What is your source structure and what is your destination structure?
You can go the ABAP proxy route but then your control is not in the integration layer but in the business system. But if you prefer it, here's some code outlined:
data:
index type i,
lcl_proxy type ref to ZCL_Proxy.
i = 0.
try.
loop at lt_recordset into ls_record.
append ls_record to lt_output.
index = index+1.
if index = 100.
create object lcl_proxy.
lcl_proxy->execute_asynchronous(output = lt_output).
index = 0.
clear lt_output.
endif.
end loop.
if index>0.
create object lcl_proxy.
lcl_proxy->execute_asynchronous(output = lt_output).
endif.
catch CX_ROOT.
endtry.
commit-work.
Hi Yaghya
I was able to achieve the split message using the UDF, if I'm using the file adaptor within the communication channel do I have to write some script to write it into multiple files. and if I have to increment the number the file name.
my file name is myfile_01_MMDDYYYY_HHMISS.xml when I'm writing to multiple files I have to increment the number . something like
myfile_01_MMDDYYYY_HHMISS.xml
myfile_02_MMDDYYYY_HHMISS.xml
I really appreciate your help on this.
Thanks,
Joe.P
Joe,
You can solve this problem by changing your Interface mapping from 0..Unbounded. Then in Integration Directory change your interface determination to Enhanced mode then select your Interface mapping.
I hope this will resolve your problem.
Regards,
Shridhar Pobbala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Joe,
You can solve this problem by changing your Interface mapping from 0..Unbounded. Then in Integration Directory change your interface determination to Enhanced mode then select your Interface mapping.
I hope this will resolve your problem.
Regards,
Shridhar Pobbala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when I do end-to-end testing I can't generate the files but I don't see any error in the moni.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joe,
Use Variable substituion for populating the file name dynamically.Refer the below links
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
And refer this thread where the same thing was discussed
Let me know your proceedings..
Cheers
Veera
>>> Reward Points, if it is needful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joe,
In ABAP proxy programing you can do this.For Sender Data type set the Occurence 0..Unbounded for the header node.
Suppose u r Data type to be look like
DT_File
Recordset 0..1
Records 0..Unbounded
-
Fields
When you are populating the data through strucutres which are genrated while proxy generation, before calling the Execute Asynchronous method put loop on the structure and assign variable to count. with in the loop you can check that variable equals 100 or not by putting IF conditon and if the records are less than 100 and no morerecords are there -- write the logic for this.With in If condition call your proxy and clear that variable which is used for counting the records.
So that you can able to populate the files for each 100 records. I have done the same where i need to generate the files based on one field value.
Cheers
Veera
>>> Reward points, if it is needful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
from the above mention steps in ABAP Proxy you are writing the condition so that 100 records are sent to XI at once....so that each file which is generted has only 100 records in it........
i had this stiuation where i created 2 interfcae
1st interface was noram sap->XI->File (file in append mode) , 2nd interface i was picking this file and in Sender file adter i used to set the limit as 100.....
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.