Skip to Content
avatar image
Former Member

novice in PI

Hi Everyone,

I am learning PI and currently working on UDF.

I am interface Z RFC to update the data from external system.

When the data is staged at XI i need to concatenate two fields and store into third in message mapping.

I am writing an UDF for this.

For example :

source structure.

emp_id

emp_name

emp_sal

date_time

first_name

last_name

gender

dept_id

target strucutre( strucutre in sap)

ZEMPID

ZEMPNAME

ZEMPSAL

ZDEPTID

ZDATE

ZTIME

I need the steps (including execution type ) to concatenate fields first_name and last_name into zempname in UDF only.

Can you pls give me the steps and code.

Regards,

Vinay

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jan 05, 2011 at 03:46 PM

    Hello Vinay,

    I believe this is for your understanding purpose as to how UDF works.

    1. Create UDF with two input parameters of type string.

    2. Type of the UDF be single value function.

    3. Inside the UDF, you can use Java function concat with the input parameters and place the resultant into a String variable

    4. Using the return statement return the resultant String variable.

    After creating the UDF. The UDF appears along with the standard functions in the graphical editor.

    Coming to the graphical mapping:

    Use the source nodes first_name and last_name as input parameters for your UDF and the output of the UDF into the target field ZEMPNAME.

    Prerequisite: You should know Java coding.

    Hope it is clear.

    Regards,

    Anand Patil

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2011 at 01:23 PM

    Hi,

    why an UDF ? use concat function from standard functions (text)

    Regards,

    Michal Krawczyk

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 05, 2011 at 02:23 PM

    >>> need the steps (including execution type ) to concatenate fields first_name and last_name into zempname in UDF only.

    This is pretty simple. Don't need UDF. Just use concat standard function

    use first_name and last_name as input of concat and map the output to the zempname

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 06, 2011 at 05:53 AM

    Go through this u will fulfill ur requirement easily.

    (Graphical mapping all functions)==>

    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

    Some more helpful links are....

    Like where u can use UDF

    User Defined Function==>

    http://help.sap.com/saphelp_nwpi71/helpdata/EN/22/e127f28b572243b4324879c6bf05a0/content.htm

    Add comment
    10|10000 characters needed characters exceeded