cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.3 development File to File and File to Idoc

Former Member
0 Kudos

Hi,

I working on scenario where PI picks a Flat File through the sFTP adapter and split the records in the file and sends to ECC system. Here there are four different ECC systems where PI has to send the file. For Two SAP Systems it has to send as Idoc and another it has to send as Flat File. how do i need to proceed with this. We need to split the flat file and based on the record we need to SAP system.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

As per my scenario mentioned above PI picks the file from the (Carrier 3PL) sFTP server and split the file based on the delivery number.

I have to send the sender system (Carrier name) with the field in the idoc 'TEXT2'. I have created 15 sender business component as there are 15 carriers which send file. I little confused how do i need to give the Value mapping for the sending the carrier name with IDoc.

Note: There is no carrier name in the inbound file. We just have to send it whenever PI picks from a server.

Harish
Active Contributor
0 Kudos

Hi Vijay,

If you want to send sender business component name to IDOC 'TEXT2' field,then you can use the function Sender under Constant function.

Regards,

Harish

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In my scenario PI has to split the file based on the delivery number ranges and send it to respective systems. Currently I have a requirement where I need to send the file to all the four receiver SAP systems if the delivery number ranges fall outside or if there is no delivery number previously it sends based on the delivery number.

what would be the best way to send based on the above condition.

Below is my message Mapping:

UDF used in Message Mapping for enhanced receivers:

public void Iterator(String[] Lower, String[] Higher, String[] VBELN, ResultList result, Container container) throws StreamTransformationException{

int i=0;

int j=0;

int k=0;

for ( i=0; i<VBELN.length;i++)

{

  if ( Long.parseLong(VBELN[i]) >= Long.parseLong(Lower [j] )  &&

  Long.parseLong(VBELN[i]) <=  Long.parseLong(Higher [k]) )

  {

    result.addValue("true");

  break;

  }

}

if( VBELN.length == i)

{

  result.addValue("false");

}

return;

UDF used in Message mapping for File to IDoc:

public void Item_Iterator(String[] VBELN, String[] Input, ResultList result, Container container) throws StreamTransformationException{

for (int i=0; i<VBELN.length;i++)

{

  if (Long.parseLong(VBELN[i]) >= 80000000 &&

  Long.parseLong(VBELN[i]) <= 83999999 )

  {

  result.addValue(Input[i]);

  }

}

return;

Harish
Active Contributor
0 Kudos

Hi Vijay,

where are you sending the output of UDF?

you need to add more condition to route the message if the delivery number is not in range or not present. Please provide the full logic of map to help you with the issue.

Regards,

Harish

Former Member
0 Kudos

Hi

The above which mentioned is the code I am using in the mapping.

Five Mappings:

MM_POD_File_to_Csys_Idoc

MM_POD_File_to_Bsys_IDoc

MM_POD_File_to_Asys_File

MM_POD_File_to_Dsys_File

MM_POD_File_to_Receivers

Also How can we increase the size of an integer number since for one receiver system the delivery number ranges is as below.

Source text of object Message Mapping: MM_POD_File_to_Asys_File | http://XXXXX has syntax errors:
Harish
Active Contributor
0 Kudos

Hi Vijay,

you can use double data type, but the Long data type can store the value in the below range

Minimum value

-9223372036854775808
(java.lang.Long.MIN_VALUE)

Maximum value

9223372036854775807
(java.lang.Long.MAX_VALUE)

regards,

Harish

Former Member
0 Kudos

Hi Harish,

Below is the UDF i am using for routing it to the receivers.

__________________________________

public void Iterator(String[] Lower, String[] Higher, String[] VBELN, ResultList result, Container container) throws StreamTransformationException{

int i=0;

int j=0;

int k=0;

for ( i=0; i<VBELN.length;i++)

{

  if ( Long.parseLong(VBELN[i]) >= Long.parseLong(Lower [j] )  &&

  Long.parseLong(VBELN[i]) <=  Long.parseLong(Higher [k]) )

  {

    result.addValue("true");

  break;

  }

}

if( VBELN.length == i)

{

  result.addValue("false");

}

return;

Harish
Active Contributor
0 Kudos

Hi Vijay,

The given code is not giving any syntax error. but i am bit confuse with the logic you want to implement with the code. If the delivery number is in the range you are passing true and comming out of the loop with the break statment.

So it mean you can not have more then one delivery no is the input file?

Please provide the full logic so we can try to help you.

regards,

Harish

Former Member
0 Kudos

Hi Harish,

The scenario is where PI picks a Flat File through the sFTP adapter and split the records in the file and sends to ECC system. Here there are four different ECC systems where PI has to send the file. For Two SAP Systems it has to send as Idoc and another it has to send as Flat File.


The Condition here is we need to split the file based on the delivery number ranges(a file can have multiple delivery numbers) and in case if the delivery number ranges falls outside the required range or if there is no delivery number on the file then we need to send the file to all the four SAP Systems.

Harish
Active Contributor
0 Kudos

Hi Vijay,

I understood your scenario, but bit confuse about your splitting logic. Why you have break statement in the code? do you only get one file per delivery no or you might get more then one delivery no in one file?

regards,

Harish

Former Member
0 Kudos

Hi Harish,

Below is the format of the file and the delivery number comes in the first column. One file will have different delivery numbers and based on that we need to send to the respective receiver systems.

98350000|20111213|6330|  SU|20111213|2058||000063365|         6336598350000009|          |                             |

80678826|20111213|6330|  SU|20111213|2058||000063365|         6336580678826002|          |                              |

80678824|20111213|6330|  SU|20111213|2058||000063365|         6336580678824008|          |                              |

80678775|20111213|6330|  SU|20111213|1957||000063365|         6336580678775003|          |                              |

Harish
Active Contributor
0 Kudos

Hi Vijay,

As per your file one line will have one message. If you want to split it in mapping then remove the break statment from your code and test.

Other wise you can read the file record by record (use the option in sender channel) and you receive one message XML per delivery number, then you need to take care only the routing logic in receiver determination.

regards,

Harish

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You can use enhanced Interface determination to decide the targets based on data coming out during mapping .  Here you have to create 4 service interfaces for different target systems.  Please use this link as a starting point... This is feasible even without bpm.  Because your target systems (both idoc and file are async based  -   all are same mode)   .

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...

Former Member
0 Kudos

Hi,

Actually there are thirteen send carriers which send file to PI with same Flat file format. What condition/modules should i use sender channel put for splitting the file.

The delivery document number ranges to be used for splitting records in the inbound files are:

BPP Delivery Doc Number Ranges

Internal

Range S

Range E

23

95550000

109999999

Z3

2000000000

2000999999

IPP Doc Number Ranges

Internal

Range S

Range E

17

10000000

82999999

External

Range S

Range E

18

85000000

88999999

Former Member
0 Kudos

Hi,

I am getting an error in Moni as below. not sure where exactly the error in mapping.

My scenario is like picking a flat file and splitting it into four based on delivery number ranges and sending it to different SAP systems. In the message mapping i used UDF_iterator. Can anyone suggest is there any other I can work on this scenario.

Note: I have to send as Idoc for two systems and as flat file for another two systems.

Error when determining the receiver: Problem while determining receivers using interface mapping: Runtime exception occurred during application mapping com/sap/xi/tf/_MM_POD_File_to_Receivers_; com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping /ns1:Receivers/Receiver; root message: Ex~ Problem while determining receivers using interface mapping: Runtime exception occurred during application mapping com/sap/xi/tf/_MM_POD_File_to_Receivers_; com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping /ns1:Receivers/Receiver; root message: Ex~ Runtime exception occurred during application mapping com/sap/xi/tf/_MM_POD_File_to_Receivers_; com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping /ns1:Receivers/Receiver; root message: Ex~

Former Member
0 Kudos

Hi Vijay,

As error says it at node Receiver, copy paste your payload in test tab of mapping.

Do Display queue on the fields, you will know the exact error.

Regards,

Pranav

Harish
Active Contributor
0 Kudos

Hi Vijay,

you got the error in MM_POD_File_to_Receivers mapping in receiver determination step.

Please run the payload in the mapping to troubleshoot the issue.from the error message it seems that "/ns1:Receivers/Receiver" is not genrated. Please insure that you have all the rules at receiver node and not at the service field.

Regards,

Harish