cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for Line item number

Former Member
0 Kudos

Hi All,

Currently i'm working on a EDI2JDBC scenario. we have a field called LINE_ITEM_NUMBER at the target side. The incoming EDI signal doesn't contain the line item number and at the target side for every line item we need a create line item number. Lets suppose the incoming signals contains 3 line item number then at target side the value for LINE_ITEM_NUMBER should be 1,2 and 3. Can i achieve this functionality with any standard function or do i need to write an UDF? Can anyone provide the code for UDF?

Your hekp is highly appreciated.

Regards

Faisal.

Accepted Solutions (1)

Accepted Solutions (1)

former_member200962
Active Contributor
0 Kudos
Lets suppose the incoming signals contains 3 line item number then at target side the value for LINE_ITEM_NUMBER should 
be 1,2 and 3.

Do you mean that in the source message you will have 3 Line_item nodes and on target side you want to put the value 1,2,3 in LINE_ITEM_NUMBER nodes? If yes then you can make use of the Index Function.

Former Member
0 Kudos

Hi ,

Yeah for every line item the value for LINE_ITEM_NUMBER should be 1,2,3...... Will index function provide the said functionality.

Rgds

Faisal.

jyothi_anagani
Active Contributor
0 Kudos

Hi,

Yes You can use Index Function.

Source(LineItemNumber)----> Index(Initial Value = 1, Increment = 1 ) -


> Target(LineItemNumber)

Regards

Jyothi A

Edited by: Jyothi Anagani on Jul 14, 2010 1:34 PM

Former Member
0 Kudos

Hi,

LINE_ITEM_NUMBER at source side is optional. when i use the index function i didn't got any value for LINE_ITEM_NUMBER at target side.

Regards

Faisal

jyothi_anagani
Active Contributor
0 Kudos

Hi Faisal ,

Do you mean to say If Source side Line_Item_Number doesnt exisists also you want to create Target element.

If Yes,

Do like this..


                       Source(LineItemNumber)   -------\
                                                     then
Source(LineItemNumber)  ---->  Exisists   ----->  If     ------>Target(LineItemNumber) 
                                                       else
                              Constant[0] ------------/

Map Some Constant value If Source Line Item Number is not coming...(As shown Above)..

Regards

Jyothi A.

Former Member
0 Kudos

Hi Jyothi,

Thanks for the response. My requirement is like this at the source side there is one field called D_I12 (which is line item number)and we mapped it to LINE_ITEM_NUMBER at target side. D_I12 may not contain any value. if suppose the customer is sending 3 line item in a PO then the value for LINE_ITEM_NUMBER should be 1,2 and 3 for every context change. As per this requirement pls provide some UDF or std. fucntion.

Rgds

Faisal.

Former Member
0 Kudos

Hi,

Thanks for all your responses. the issue got solved and i used counter (std. function) and its working fine now.

Rgds

Faisal.

jyothi_anagani
Active Contributor
0 Kudos

Hi Faisal,

The Below mapping will work for your requirement..



Source(LineItemNumber)--->Index(Initial Value = 1, Increment = 1 )------\
                                                                         then
Source(LineItemNumber)  ---->  Exisists      ----->  If                     ------>Target(LineItemNumber) 
                                                                         else
                                                  Constant[0] ------------/

If Input is

<Source>
   <Line>aaaa</Line>
   <Line>bbbb</Line>
   <Line>cccc</Line>
</Source>

Your Target will be Like This

<Target>
   <Line>1</Line>
   <Line>2</Line>
   <Line>3</Line>
</Target>

I have Tested That Mapping.. Working as shown below.

Let me know For any clarifications..

Regards

Jyothi A.

Former Member
0 Kudos

Hi Faisal,

I am a little confused, but with what I understood Try this:

As field D_l12 is optional and may not contain any value, that means you dont want to use this field. then why don't you map the target Line_Item_Number with the field that will be repeating as many times as the number of Line Items in PO.

You can use following mapping;

Source Field(repeating with line items)--->Remove Context-->Index (Starting at 1, increasing by 1)--->SplitbyValie-->Line_Item_Number

Try this if it helps.

Regards,

Rahul.

Answers (0)