cancel
Showing results for 
Search instead for 
Did you mean: 

How to send one of the field value from .csv file to target field

former_member593220
Participant
0 Kudos

Hi All,

We got a change request for one our interface. The scenario is File to IDOC. PI is receiving .CSV file from FTP which may contains multiple line ITEMS.But PI is creating one IDOC with single Header segment and multiple line item segments. Here as per the new requirement changes am sending File name to one of the target field in IDOC by using UDF code.

Now we received another request from client, like each line item in the .CSV file may contain one Company_code. So we need to send the file name to target field (at line item level) at run time, which I have achieved already by using UDF.

But here the requirement is, I need to capture the Company_code from each line item in the Text file and need to send this to one of the target field at ITEM level.

For Example:

Below is my .CSV file contains 2 line Items

20120514;20120514; ;1000;1070001E0;;1070001E0;;;10;;COMPANY1

20120514;20120514; ;1000;1070001E0;;1070001E0;;;10;;COMPANY2

My file name is Orders*txt

So I need to capture the file name and should combined this with COMPANY1 like ----> OrdersCOMPANY1.txt which I need to transfer to one of the filed (Company_code) in the fisrt line item segment in the target IDOC

In the same for second line item ---> OrdersCOMPANY2.txt need to send to the Company_code field in to the second line ITEM.

So can any one please tell how I cam

Accepted Solutions (1)

Accepted Solutions (1)

former_member191435
Contributor
0 Kudos

Hi,

for this u can get the filename by using the dynamic configuration ...

then concat the dynamic configuration output and the last field in the csv file and assgn to the target field.

You can assign the udf to one variable in the mapping.

VARIABLE

                                        CONCAT ----------------> TARGET FIELD.....

                                       

CSV File last field

Thanks,

Sreenivas

former_member593220
Participant
0 Kudos

Hi Sreenivas and Hareesh,

Thanks a lot for your response.

It works with the Concatination function and also I have used Substring function to fulfill the requirement..

--

Regards

Raj

Answers (1)

Answers (1)

former_member184720
Active Contributor
0 Kudos

Hi Raj - in your content conversion for lineitem .. read the additional attribute as well.

Change your source strcture and additional field company_code

As you are already sending the filename for each line item using the UDF.. it's just you need to modify your UDF to take another input i.e. Company Code.

or

If your PI version is > 7.1 use the graphical variable to hold the filename..

and while sending the company code information for every item just use the concat function to append filename & company code..

http://scn.sap.com/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-gra...