Skip to Content
author's profile photo Former Member
Former Member

Creating a UDF in SAP XI

Hi,

I have Idoc to File Mapping in SAP XI, where I need to populate "Spaces" in most of the Target fields Dynamically. I need to create a UDF for this mapping. Since I have n no.of Target fields where I need to populate Sapces and Target fileds has different lengths. As of now I have cretated a simple UDF which is usefull only for one field mapping. Below is the UDF:

String s;

char []c = new char[10];

for(int i=0; i<10; i++)

c<i> = 'S';

s = new String(c);

return s;

2. My source file will be having 1000 records where 999 records will be mapped to Traget sturucture and the end of the Record should be mapped to the other Traget structure(Traget sturcture is same in the both the cases).

Please let me know how can I go about on this.

Thanks in Advance.

Jose

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2008 at 04:11 PM

    Hi Jose,

    On the target side, do you want as many Spaces in the field as the field length ? Are you looking for a help for creating the UDF in IDOC to file case ?

    Thanks,

    Pooja

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Joseph,

      Give a try to use the below UDF for the fields where you want to have some hardcoded values :

      a : Field you would like to change

      b : New hardcoded value for the field.

      for( int i=0; i<a.length; i++)
      {
        if (i==(a.length-1))
            result.addValue(b[0]); 
        else
           result.addValue(a<i>); 
      }

      input_field_1   --------------------
                                             UDF  -------------------- target_field_1
      new_constant_EOD  ------------------

      Rest all mappings should remain as it is.

      Let me know if you face any issue.

      Thanks,

      Pooja

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.