cancel
Showing results for 
Search instead for 
Did you mean: 

header data in xml tags and line items in fixed length but both in same fil

Former Member
0 Kudos

Hi,

In my scenario target side in header level i am passing all the values are fixed values and line item vaues are getting from the source data.how to write udf for this scenario.It should be graphical mapping.

Please help to me

please reply fast

Thanks&Regards

Swathi

Edited by: SWATHIP on Feb 4, 2011 7:16 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Swathip,

You can use graphical mappping.

You map constant values to the header fields at target side. After that map item level fields one to one as per your mapping logic from source field to target field.

Regards,

Nayan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The Heading of your post and the Content in the post are confusing..

Shall we know what is your exact requirement?

Are you looking for in the target file, Header will be in XML format and Details in Fixed lenght?

or something else?

Babu

Former Member
0 Kudos

Hi Babu,

I am looking for in the target file, Header will be in XML format and Details in Fixed lenght.

Edited by: SWATHIP on Feb 7, 2011 6:52 AM

Former Member
0 Kudos

Hi,

1) If your values are numerical you can use the "FormatNum" function under Arithmetic Functions.

This will help you fix the length of the number and even the decimal part.

2) If you want to fix the length of field which is of type string, you can try the following code:

 

public String setLength(String var1, String var2,  Container container) throws StreamTransformationException 
{ 

     /*   var1 will have the String Value, in var2 pass a constant integer of fixed length you want  */ 

     int len = Integer.parseInt(var2); 
     String rslt = var1; 

     if( var1.length() < len) 
     { 
         for(int i = var1.length(); i < len; i++) 
         { 
             rslt = rslt + " "; // appending space 
         } 
     } 
     else 
     { 
           rslt = rslt.substring(0,var1.length - 1)l 
     } 
   
     return rslt; 
} 


regards,

Aravind

Edited by: ajnayak on Feb 7, 2011 7:25 AM

Former Member
0 Kudos

Hi ,

in the target file, Header will be in XML format and Details in Fixed lenght.

This is not possible with simple FILE Receiver Adapter.

Since the target file has both XML and also FCC, its difficult to achieve.

You should write a adapter module for this. Please check in SDN you will get lot of materials for the same..

Babu

Former Member
0 Kudos

Hi Aravind,

thanks for ur response

My Requirement is what ever the data in header it will be in xml as a target side and what ever the data in detail that is in fixed length file both in same file

My scenario idoc-jms

<REMOVED AS REQUESTED>

Edited by: Prateek Raj Srivastava on Feb 17, 2011 12:49 AM

Former Member
0 Kudos

Hi,

your requirement was not clear for me before.

1) For you requirement as said by Babu You need to develop Adapter module.

2) The file structure as mentioned by you wont be a valid xml structure.

For developing adapter module refer:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e674...

regards,

Aravind

Former Member
0 Kudos

Hi Swathip,

You write: "...My scenario idoc-jms..."

The file you give in the post looks like IDOC xml (very strange though that you have XML and flatfile in one file combined).

Can you not get a proper idoc definition from the sender and iimport it into the PI system?

kr

Robert

Former Member
0 Kudos

Thanks to every one.

I passed xml tags as a constants. now it is working fine.

Thanks

Swathi

Former Member
0 Kudos

Hi Swathi,

For your requirement, there is no need of UDF.

Map the header fields with Constants.

Map the line item fields with the source.

Thanks,