cancel
Showing results for 
Search instead for 
Did you mean: 

How to read two files with different structures at same location continously

Former Member
0 Kudos

Hello,

I have a SOAP to FILE scenario in which two different files are getting generated on the same location. The files could have any name depending on the counter but there are two structures i.e at any time any one file will get generated depending upon the data sent by user in the web service. Now I need to send this file to ECC side using RFC adapter.

But how can I declare two types of structures at the source side and if i do so, how the data will paas to different structure as the location is same and the file name can be any.

Here are the two types of files:

1) <?xml version="1.0" encoding="UTF-8"?>

<HEADER>

   <msg_id>308644</msg_id>

   <current_date>2012-07-18 16:00:14</current_date>

   <action>create</action>

   <order_number>P0103836</order_number>

   <order_type>PURCHASE</order_type>

   <issued>false</issued>

   <authorized>true</authorized>

   <code>02697</code>

   <ITEMS>

      <line_number>1</line_number>

      <line_description>112W1517-12 (FITTING-HOGOUT)</line_description>

      <part_number>112W1517-12</part_number>

      <order_quantity>1 EA</order_quantity>

      <unit_standard_price>10</unit_standard_price>

      <promised_by_dt>2012-07-18 16:00:14</promised_by_dt>

      <type>INVASSET</type>

      <t_code>1500002</t_code>

      <line_external_reference>800160</line_external_reference>

   </ITEMS>

</HEADER> 

2) <?xml version="1.0" encoding="UTF-8"?>

<HEADER>

   <msg_id>308644</msg_id>

   <current_date>2012-07-18 16:00:14</current_date>

   <invoice_number>1234567</invoice_number>

   <code>02697</code>

   <currency>USD</currency>

   <terms_conditions>NET30</terms_conditions>

   <ITEMS>

      <line_number>1</line_number>

      <line_description>112W1517-12 (FITTING-HOGOUT)</line_description>

      <part_number>112W1517-12</part_number>

      <invoice_quantity>1</invoice_quantity>

      <invoice_quantity_unit>EA</invoice_quantity_unit>

      <unit_price>12000</unit_price>

      <type>INVASSET</type>

      <t_code>1500002</t_code>

      <po_number>P0101156</po_number>

      <po_line_number>1</po_line_number>

   </ITEMS>

</HEADER>

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Monika badhwar,

your scenario is quite confusing me because you have written

            "I have a SOAP to FILE scenario in which two different files are getting generated on the same location. The files could have any name depending on the counter but there are two structures i.e at any time any one file will get generated depending upon the data sent by user in the web service. Now I need to send this file to ECC side using RFC adapter.'

in these scenario you never mentioned about using Idoc adapter, but receiver as a ECC how it is possible. could you please explain briefly your scenario. then may be i will provide the plausible answer.

by the way it is possible to read two files with different structures at same location with advanced options.  

Former Member
0 Kudos

Hi Monika,


What version of SAP PI are you using ?

The first line states its a SOAP to file scenario but following that you have written you need to send data to ECC using RFC. Little confused with the scenario you are describing.

However if your source is the same, you can always read different structures with same Sender interface and use a Java mapping to convert it to a standard structure. Java mapping wont throw xml validation errors, if the structures are different.

Hope this helps,
Regards,
Sathya

Former Member
0 Kudos

I dont't know the file names as the file names are dynamic depending upon the counter increment but out of these two files any file can come on location with any name. I do not have any key in file name to differentiate.

Please suggest...

former_member190624
Active Contributor
0 Kudos

Monika,

File name is not important here, you can read all  files from different source directories or same source directory using same communication channel.  How many type of files will be in FTP source directory ?

Your scenario is File to RFC correct? If yes, you can achieve your requirement using  advanced selection for source file. Let me know if get ur requirement wrong.


Regards

Hari

Former Member
0 Kudos

But i need to know that what to pass over here and how to do mapping in ESR.  Do i need to make two different structures according to the two different files. What steps needs to be done in ESR.

Regards

Monika

former_member190624
Active Contributor
0 Kudos

Well yes, you have to develop all ESR objects separately for both files types .i.e,

for 1 structure:

     2 Service interfaces one for each  inbound and outbound (2  Message types and 2 Data types  also )

     1 Message Mapping

     1 Operation Mapping

For both file structures u need 4 Service interfaces (along with 4message type's and 4Data type's) , 2 MessageMapping's and 2 Operation mapping's.

For Id objects :

1 File communication channel (use advanced selection for source file option to pick both files )

1 sender Agreement .

1 Receiver Determination

1 Interface determination

1 RFC communication channel

1 Receiver determination

Note: IF SENDER AND RECEIVER DATA TYPES ARE SAME , YOU CAN SKIP THE ESR OBJECTS. THE ONLY THING YOU HAVE TO DO IS IMPORT RFC TO YOUR SWCV.

IF SENDER AND RECEIVER DATA TYPES ARE NOT SAME, YOU CAN USE RFC AS INTERFACE AND ALSO AS MESSAGE TYPE.

Let me know, if u need any more information

Regards

Hari.

former_member190624
Active Contributor
0 Kudos

Hi Monika,

You can use advanced selection for file selection option which shown below.

If your file location having only 2 files(i.e, ur required file formates only , then no need to specify  ) Exclusion mask.

else you have to specify while files you don't want to pick from FTP location. Hope this will help you.

Regards

Hari.

gagandeep_batra
Active Contributor
0 Kudos

Hi monika,

how can I declare two types of structures at the source side

for that i think you have create two different scenario with common reciever

how the data will paas to different structure as the location is same and the file name can be any.

can you add some specific mask for output file in receiver CC of soap to file scenario. means file1*.xml like and for second structure file2*.xml.

then add these mask for ur sender channel.

Regards

Gagandeep