cancel
Showing results for 
Search instead for 
Did you mean: 

Sender File Content conversion

Former Member
0 Kudos

Hi Experts,

    I do have a requirement to send Text file to SAP in the form of IDoc. I have Header,BatchHeader,InvoiceHeader & Trailer records in my Sender text file. I am using a Key field to identify the roots of each node. But i just need all of your help to read the below kind of file through FCC and populate the fields in SAP(IDoc).

The sender file looks like.......

     MT_Vendor Invoice

     Header --------------------------- Occurs 1-1

          ->Field 1

          ->Field 2

          ->Field 3

          ->Field 4

     Batch Header ----------------- Occurs 0-Unbound

           ->Field 1

           ->Field 2

           ->Field 3

           ->Field 4

           ->Invoice Header ------ Occurs 0-999 times

                 ->Field 1

                 ->Field 2

                 ->Field 3

                 ->Field 4

                 ->Field 5

     Trailer ----------------------------- Occurs 1-1

          ->Field 1

          ->Field 2

          ->Field 3

          |

          |

          ->Field 6.


Now in my file Header and Trailer will be Occurs only 1 time, and Batch Header will Occurs multiple times. Now my query is how to write content conversion for Batch Header along with the Invoice Header.


Please help me to get out from this issue... *Points will be rewarded*

Thanks in Advance... 🙂


Regards,

Dileep Kumar.

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Dileep,

As target XML is more than 4 level deep, FCC can not be used.

You can use custom module or XSLT (please check comments of blog).

Former Member
0 Kudos

Hey Raghu,

     The scenario would be Flat file to SAP through an IDoc, and the structure i have given above is not for the receiver one its for sender(File) one.

---> If Module configuration would works then please let me know which module do i need to use here. Thank you 🙂

Regards,

Dileep

sahithi_moparthi
Contributor
0 Kudos

Hi Dileep,

  In this case you can acheive using 2 mappings.

First mapping:

Consider the structure as  a plain structure.Take all the segments at the same level and read the FCC as normal structure and map the below structure with your req str.

MT_Vendor Invoice 

     Header --------------------------- Occurs 1-1

          ->Field 1

          ->Field 2

    Batctch Header ----------------- Occurs 0-Unbound

           ->Field 1

           ->Field 2

           ->Field 3

           ->Field 4

    Invoice Header ------ Occurs 0-999 times

                 ->Field 1

                 ->Field 2

     Trailer ----------------------------- Occurs 1-1

          ->Field 1

          ->Field 2

Source -> Segments at same levels

Target -> Actual str

Second mapping:

Actual str to the IDOC mapping.

Source -> Actual Str

Target -> IDOC

     


Former Member
0 Kudos

Hi Sahithi,

 

    Thanks for your valuable words. But i do have one small query here.


## First mapping:

Consider the structure as  a plain structure.Take all the segments at the same level and read the FCC as normal structure and map the below structure with your req str.

1. Please clarify, How does the mapping can understand the Sender (Fixed Lengths file) structure  to grab the values in to it?

FYI,

   My sample file will going to be like below..

HR01123456Header 20150701

BH20150701NOHRDCK     IH(Invoice Header)011709504015533

TR99Asntl0120150701

         


Thanks in advance. 🙂


Regards,

Dileep

sahithi_moparthi
Contributor
0 Kudos

Hi Dileep,

   Mention FCC parameters in the sender channel.If your file is fixedlength file,mention field.fieldFixedLength Parameter in your FCC.Sender channel will split the field according to the field length.

For more information please find below links:

http://wiki.scn.sap.com/wiki/display/XI/File+Content+Conversion

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

Former Member
0 Kudos

Sahithi, I am going to do the same as you mentioned above. Keep you posted if any thing needed. Thank you 🙂

Regards,

Dileep.

Former Member
0 Kudos

Hi Sahithi,

    I tried with the above approach, its works fine in the mapping level. But when i try to Post an IDoc in ECC it's toughing an error in the IDoc channel level and the message status showing as Waiting with (Receiver delivery).

Error:- MP: exception caught with cause com.sap.aii.af.idoc.exception.IDOCAdapterException: Error during transform: java.lang.NullPointerException: while trying to invoke the method java.lang.String.length() of a null object loaded from local variable 'chars'

I enabled the check box of  "Apply control records from payload". But still getting the same error. I need your kind help on this to get out from here. Thank you 🙂

Regards,

Dileep

sahithi_moparthi
Contributor
0 Kudos

Hi Dileep,

Are you using external definition in your operation/message mappings?

Can you check below note -

1862655 - NullPointerExceptions during IDoc_AEE Receiver Adapter processing.

In Operation mapping you have to use your IDOC not external definition.

Former Member
0 Kudos

Yes Sahithi, I am using my Idoc through External Definition.

"My requirement is to post Multiple Idoc's When Batch header from Sender file repeats".

For this, I changed the occurrence of the Idoc from 1-1 to 1-unbounded. Post I created the Service interface for this and I am using the same in Operation Mapping too.

Dileep

sahithi_moparthi
Contributor
0 Kudos


Hi Dileep,

In Operation Mapping use your IDOC not extrenal defintion ,for IDOC receiver there is no need to create service interface.

Former Member
0 Kudos

Correct Sahithi, I agree with you. But in My scenario i do have to post more then 1 IDoc in a single soot. This is the reason i changed the Occurrence of the IDoc and use the same through External definition.

--> I am sure If i use the Stranded IDoc, it can generate IDoc only once per interval. Plz help 😞

Dileep

sahithi_moparthi
Contributor
0 Kudos


Hi Dileep,

I understood your requirement.Inorder to post multiple IDOC's you have to change the occurence of the IDOC and save it under external defintion and use it in Message mapping.

But you have to use this external defintion only in Message mapping but not in Operation mapping.

Please let me know still you have doubt.

Former Member
0 Kudos

Sahithi, Me also using the same as you said.. I am using external definition on Message mapping and service interface on Operation. Please find the snap shots and guide me if you find any thing wrong there. Thank you 🙂

Dileep

sahithi_moparthi
Contributor
0 Kudos

Hi Dileep,

As per the above screenshot i can see that you have created a service interface for IDOC which  is incorrect.As i said early for IDOC,there is no need to create Service Interafce.

Use IDOC  in Operation mapping at target side.Don't use extrenal defintion or service interface.

Hope you are clear.please let me know if you still face issue.

Former Member
0 Kudos

   Thanks Sahithi, Now i got relief from the above issue post change the Service interface to IDoc.

But Please clarify my below concerns...

1.Is this change can applicable for posting multiple IDoc's? Why because when i use the Standard Idoc type in Service interface i can see the Occurrence as 1.

2.As per my knowledge, if we Export any thing from External Definition. Then after we have to Create a Service interface for that. And the same SI we have to call in our Operation mapping. But in my case why did you said to use the Standard Idoc Type? and why i am getting error when using the Service interface of XSD?

3. When i am Activating the Operation Mapping it saying that "***** does not match request target message IDoc FIDCC2.FIDCCP02.ZFI_DCCP02 | urn:sap-com:document:sap:idoc:messages. Target message External Message ZFIDCCP02 | http://loves.com/SAPPI/Finance | ZFI_DCCP02 | of the message mapping is different.

Is the really works in real cases with out any Bugs?

Will be waiting for your response... Thank you so much 🙂

Regards,

Dileep Kumar

sahithi_moparthi
Contributor
0 Kudos

Hi,

Please find my comments below:

1.No,It doesnot change posting of multiple IDOC's.

2. IDoc it self act as service interface once we  import in to PI.

3.It is just a warning.Yes,It will work in the real case this is not a bug.

sahithi_moparthi
Contributor
0 Kudos

Hi Dileep,

     If  issue resolves,please close the thread.

Answers (2)

Answers (2)

Former Member
0 Kudos

  Issue got resolved post doing the changes suggested by Sahithi.M. Hence closing the thread.

Thank you 🙂

vinaymittal
Contributor
0 Kudos

Please don't mention points will be rewarded developers here are not helping each other for points. The statement is usually discouraged here on SCN, it makes a developer feel that he is working on your query for points...