cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping error in PI

Former Member
0 Kudos

Hi All,

I have a requirement where i am picking a text file which will have multiple records and each record will create a new Idoc in SAP system. I am fine with that approach, using FCC convert that file into XML and then using multimapping generate multiple idocs.

The main requirement is to do the some validations at mapping level (like if value start with X i have to fail that record etc) and if something goes wrong then i have to generate the same CSV file on error folder and if transformation at PI level happens sucessfully then will need to place that CSV file on sucess folder.

1) Mapping sucessful -> create source CSV file on Sucess FTP folder

2) Mappiung failed -> create source CSV file on error FTP folder

Please help.

Thanks!!

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Vasant,

                    In the same message mapping where you are performing the validation there you can use an UDF to read the source file as shown in this thread

http://scn.sap.com/thread/1569382

and write the contents of the file either in  Success FTP folder or Error FTP folder depending on outcome of validation  as shown in this thread

http://scn.sap.com/thread/316570

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

How can i make sure that this UDF will only be called once the execution of messge mapping is completed. Means this UDF should only be triggered after my mapping throws an error or if my mapping is sucesfully completed?

Thanks!!

anupam_ghosh2
Active Contributor
0 Kudos

Hi Vasant,

               As per your initial post you defined success of mapping by validation check. If a validation of a particular field is ok then create sucess file else create error file. Now there is another case of exceptions raised in mapping. There also java allows catching of runtime exceptions. In the catch block you write the code of creating error file, at the end of try statement put the code for creating the success file. Thus if there is no exception thrown success file will be there in respective folder. This requireemnt is best met if you would use java mapping instead of message mapping. In case of message mapping for each validation you need to write separete UDF, where as in java mapping all validation can be combined in one code. Since all statememts will be in try block in case anything goes wrong you can raise an exception and error file gets written as explained above. This approach avoids the use of BPM and also takes care of mapping failure due to exceptions raised.

Regards

Anupam 

Answers (3)

Answers (3)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Vasant,

I would recommend to below options

Develop interface ith two receivers

1)File

2)ECC

Step1:

Develop two operation mappings and write a condition in receiver determination to call FTP when there are records with X but dont write any condition for SAP ECC receiver.

Step2:

Operation mapping 2(File to ECC) you need to write a mapping logic to create IDoc for the records which doesnot have X and supress X records.

or

1)Interface1:

Wiate a validation logic and filter the records and create XML file or CSV file in FTP,the records starts with X will be in different file with different name and valid records in different file.

Interface2:

Then create one more interface to read the valid file and process to SAP.

try exploring this options.. with small changes you can achive this requirement.

PS: I dont recommend thrwoing manual mapping exception.

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

My client wants that if any error occurs during mapping i need to cancel the entire file and move it to some folder and if mapping executes then move the original file to some other folder and create the idoc in ECC??

Above appraoch wont able to handle all kind of validations??

Thanks!!

rajasekhar_reddy14
Active Contributor
0 Kudos

You need to use BPM for this requirement and you can catch exceptions . Very much possible.

Former Member
0 Kudos

Hi Raj,

Indeed but i cant use it because my PI version is PI7.31 JAVA only

Thanks!!

rajasekhar_reddy14
Active Contributor
0 Kudos

You dont have SAP PI+BPM licence model?

without BPM also you can achieve your requirement 90% but except mapping failure one

gagandeep_batra
Active Contributor
0 Kudos

i think you can handle this also at receiver determination also , if value of that field is X then you can fail at that level also and only send that message to error field . and if message is success then send  to other two options.

for that you need two more Receiver CC with FCC.

Regards

Gagandeep

Former Member
0 Kudos

Hi Gagandeep,

There can be multiple validations on which the transformation can failed at mapping. Suppose, if mandatory value is missing, integer value is expected and alphanumeric comes into PI and many more.

So idea behind this if transformation i.e. mapping is sucessful then in addition to creating message to ECC create a same source CSV file on folder1 and if mapping is failed then create the soucrce csv file on folder2.

Thanks!!

gagandeep_batra
Active Contributor
0 Kudos

Can you create one more field which is filled at mapping time if there is any error means when it  is not satisfy your condition and then we can check that field at Receiver Determination. then take a decision where to pass that message.

Regards

Gagan

Former Member
0 Kudos

Hi,

Can you please be bit more descriptive.

You mean to say i need to create intermediate structure and then do my validations in that step and if it it sucessful then have my mapping for idoc?

But RD step only checks the source message structure? How this will help me?

Please clarify.

Thanks!!

former_member190624
Active Contributor
0 Kudos

Hi Vasant ,

Instead of creating multiple mapping , try Michal blog. It will easy way to create multiple Idocs.http://scn.sap.com/community/pi-and-soa-middleware/blog/2009/05/21/xipi-collecting-idocs--possible-w...

Regards

Hari.

Former Member
0 Kudos

Hi Hari

That's fine. I am more concerned about sending the source CSV file to two different FTP folders depending upon the outcome of mapping?

1) Mapping sucessful -> create source CSV file on Sucess FTP folder

2) Mapping failed -> create source CSV file on error FTP folder

Thanks!!

former_member190624
Active Contributor
0 Kudos

Hi,

We can do this through dynamic configuration. The simplest way of doing is creating 2 different channels based on X path of your file value. If you want to achieve this using only one Channel then go for dynamic configuration.

Regards

Hari.