cancel
Showing results for 
Search instead for 
Did you mean: 

UDF

Former Member
0 Kudos

Hi Forum,

<b>My source file looks as follows:</b>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>* What kind of longtext appears for the service notification line item</TDLINE>

</E1NTITM_TASK_LTXT>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>* as we need to see what is transitioned to Siebel.</TDLINE>

</E1NTITM_TASK_LTXT>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>COMMENTS - ITEM OF REQUEST</TDLINE>

</E1NTITM_TASK_LTXT>

I need to concatenate all the TDLINE fields and send it to target field. For that i am using the following UDF:

String Tdline=new String();

for(int j=0; j<a.length; j++)

{

Tdline += a[j];

}

result.addValue(Tdline);

and it's working alright for a header field, where as for an item field, it is collecting all the values of tdline (irrespective of item1, 2 and so on) and concatinating to the target field.

Your inputs to resolve the issue is highly solicited.

thanks & regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member214364
Active Contributor
0 Kudos

Hi Lakshmi,

i did your scenario in the following way.

1.i created sample taget structure as follows

Taget_data

Header(child node of Target_data)1....1

txt(i.e Element under <b>Header</b> node)1.......1

Item(node under <b>Header</b> node)1......Unbounded

it_txt(Element under <b>Item</b> node)1.....1

2. mapped /INOTIF01/IDOC/E1NTHDR/E1ORHDR_LTXT/TDLINE element as follows

/ns0:Target_MT/Header/txt=MergerTxt(/INOTIF01/IDOC/E1NTHDR/E1ORHDR_LTXT/TDLINE=)

3.mapped ns0:Target_MT/Header/ITEM/it_txt=MergerTxt(/INOTIF01/IDOC/E1NTHDR/E1NTITM/E1NTITM_TASK/E1NTITM_TASK_LTXT/TDLINE=)

<b>Note:</b>: Right Click on TDLINE node in Data flow editor and select <b>Context</b> to <b>E1NTITM</b>

i.e TDLIN(after Context change)->UDF(i.e MergeTxt)->it_txt

4. <b>MergerTxt </b> UDF code as below

<b>Note:</b> In <b>Cache </b> select <b>Context</b> radio button

String str = "";

for(int k = 0;k<a.length;k++)

str += a[k];

result.addValue(str);

i guess now you will be clear.this process worked for me.

cheers,

Jag

Former Member
0 Kudos

Hi Jagadish,

Gud work... thanks, it solved my problem.

regards

Answers (11)

Answers (11)

former_member214364
Active Contributor
0 Kudos

Hi Lakshmi,

if you change TDLINE context to ITEM's parent segment then you need to get context as follows

Queue contains the individual values like:

TDLine1

TDLine2

TDLine3

CC...........

TDLine1

TDLine2

you mean,you receive this queue when item repeated twice?

in first iteration

Queue contains the individual values like:

TDLine1

TDLine2

TDLine3

and 2nd iteration

Queue contains the individual values like:

TDLine1

TDLine2

Cheers,

Jag

former_member214364
Active Contributor
0 Kudos

Hi,

is it possible to send TDLINE(right click on it and select Queue) Queue data,i just want to see how queue looking like.

and also send target field with occurrence.

Cheers,

Jag

Former Member
0 Kudos

Hi Jagdish,

Queue contains the individual values like:

TDLine1

TDLine2

TDLine3

TDLine1

TDLine2

regards

former_member214364
Active Contributor
0 Kudos

Hi,

if you want to use Queue function try with the following code,but dont forget to change the context of TDLINE field.

String str = "";

for(int k = 0;k<a.length;k++)

{

if(a[k] == (ResultList.CC))

{

result.addValue(str);

str = "";

result.addValue(ResultList.CC);

}

else

str += a[k];

}

Cheers,

Jag

Former Member
0 Kudos

Hi Jagadish,

FYKI, I have tried all the options before approaching the FORUM. If I use the Que function, the field is not generating for the subsequent items and it is reading all the segments and concatinating and generating to the first item.

If I use Context function, almost the same thing but it is not considering the subsequent segment fields.

Any other inputs?

regards

former_member214364
Active Contributor
0 Kudos

Hi,

Sorry in the previous code just add this line

result.addValue(ResultList.CC);

at end of the code.

Cheers,

Jag

former_member214364
Active Contributor
0 Kudos

Hi,

i have no idea about <item>field in your IDOC,but i assumed that <item> field is PSTER(which under E1NTITM_TASK segment).

you right click on TDLINE field in data flow editor and put context as E1NTITM_TASK

Create UDF by selecting an option "Context" and inputs

1.TDLINE element

copy your code there

String Tdline = "";

for(int j=0; j<a.length; j++)

{

Tdline += a[j];

}

result.addValue(Tdline);

This one is tested in my system,it worked

Cheers,

Jag

Former Member
0 Kudos

HI,

tdline -- remove context -- UDF -- target node.

Try

regards

Chilla

prabhu_s2
Active Contributor
0 Kudos

try to set the context of E1NTITM_TASK_LTXT to the root node and map E1NTITM_TASK_LTXT to a UDF. this udf will use a loop stmt to concatenate and then pass the value to the target. will this help?

Former Member
0 Kudos

Hi,

>>this udf will use a loop stmt to concatenate and then pass the value to the target. will this help?

can you plz elaborate on this?

regards

prabhu_s2
Active Contributor
former_member214364
Active Contributor
0 Kudos

Hi,

Could you please send us parent segments for <E1NTITM_TASK_LTXT> segment,i mean structure from <item> segment to <E1NTITM_TASK_LTXT>.

Cheers,

Former Member
0 Kudos

Hi,

This is my source XML file.

<INOTIF01>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<TABNAM>EDI_DC40</TABNAM>

<MANDT>120</MANDT>

<DOCNUM>0000000000049092</DOCNUM>

<DOCREL>640</DOCREL>

<STATUS>30</STATUS>

<DIRECT>1</DIRECT>

<OUTMOD>2</OUTMOD>

<IDOCTYP>INOTIF01</IDOCTYP>

<MESTYP>INOTIF</MESTYP>

<STDMES>INOTIF</STDMES>

<SNDPOR>SAPR3D</SNDPOR>

<SNDPRT>LS</SNDPRT>

<SNDPRN>R3DCLNT120</SNDPRN>

<RCVPOR>XI500</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPFC>LS</RCVPFC>

<RCVPRN>DXICLNT500</RCVPRN>

<CREDAT>20070417</CREDAT>

<CRETIM>070228</CRETIM>

<SERIAL>20070417070228</SERIAL>

</EDI_DC40>

<E1NTHDR SEGMENT="1">

<QMNUM>000500000811</QMNUM>

<QMART>Z1</QMART>

<QMTXT>COMMENTS - HEADER OF REQUEST</QMTXT>

<PRIOK>2</PRIOK>

<STORT>OPEN</STORT>

<MSGRP>ZACCNTS</MSGRP>

<QMDAT>16042007</QMDAT>

<MZEIT>134029</MZEIT>

<E1ORNOT_ADR SEGMENT="1">

<HOUSE_NUM1>0010000294</HOUSE_NUM1>

<SORT2>1-2L1E5</SORT2>

</E1ORNOT_ADR>

<E1ORHDR_LTXT SEGMENT="1">

<TDLINE>Header text of service notifcation, making sure that all text is sent</TDLINE>

</E1ORHDR_LTXT>

<E1ORHDR_LTXT SEGMENT="1">

<TDLINE>from SAP and received into Siebel.</TDLINE>

</E1ORHDR_LTXT>

<E1ORHDR_LTXT SEGMENT="1">

<TDLINE>This is issue number 263 and sent from Kasturi on Thursday 12/04 stating</TDLINE>

</E1ORHDR_LTXT>

<E1ORHDR_LTXT SEGMENT="1">

<TDLINE>that this had been completed. First chance to check was Monday 16/04</TDLINE>

</E1ORHDR_LTXT>

<E1ORTOB SEGMENT="1">

<BAUJJ>0290</BAUJJ>

</E1ORTOB>

<E1ORPAR SEGMENT="1">

<VTEXT>00000001</VTEXT>

</E1ORPAR>

<E1ORPAR SEGMENT="1">

<VTEXT>00000001</VTEXT>

</E1ORPAR>

<E1NTTSK SEGMENT="1">

<MANUM>0001</MANUM>

<STTXT>Z0000001A040</STTXT>

<PSTER>16042007</PSTER>

<PSTUR>134124</PSTUR>

<PETER>00000000</PETER>

<PETUR>000000</PETUR>

</E1NTTSK>

<E1NTTSK SEGMENT="1">

<MANUM>0002</MANUM>

<STTXT>Z0000001A040</STTXT>

<PSTER>17042007</PSTER>

<PSTUR>050505</PSTUR>

<PETER>00000000</PETER>

<PETUR>000000</PETUR>

</E1NTTSK>

<E1NTITM SEGMENT="1">

<BAUTL_VERSION>OPEN</BAUTL_VERSION>

<E1NTITM_TASK SEGMENT="1">

<PSTER>00000000</PSTER>

<PSTUR>000000</PSTUR>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>* What kind of longtext appears for the service notification line item</TDLINE>

</E1NTITM_TASK_LTXT>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>* as we need to see what is transitioned to Siebel.</TDLINE>

</E1NTITM_TASK_LTXT>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>COMMENTS - ITEM OF REQUEST</TDLINE>

</E1NTITM_TASK_LTXT>

</E1NTITM_TASK>

</E1NTITM>

<E1NTITM SEGMENT="1">

<BAUTL_VERSION>OPEN</BAUTL_VERSION>

<E1NTITM_TASK SEGMENT="1">

<PSTER>00000000</PSTER>

<PSTUR>000000</PSTUR>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>* What kind of longtext appears for the service notification line item</TDLINE>

</E1NTITM_TASK_LTXT>

<E1NTITM_TASK_LTXT SEGMENT="1">

<TDLINE>COMMENTS - ITEM OF REQUEST</TDLINE>

</E1NTITM_TASK_LTXT>

</E1NTITM_TASK>

</E1NTITM>

</E1NTHDR>

</IDOC>

</INOTIF01>

regards

former_member214364
Active Contributor
0 Kudos

hi,

you tried context function or context change?

you need to try both,i mean create context change function instead of Queue and also change context of the TDLINE element.

cheers,

Jag

Former Member
0 Kudos

Hi,

I tried all the options.

thanks & regards

former_member214364
Active Contributor
0 Kudos

Hi,

Right click on TDLINE element in source message and change context to <item> node.

make this function as context UDF.

cheers,

Jag

Former Member
0 Kudos

Hi Jagadish,

I tried to option of Context... but no luck.

regards

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

What is the option for the Advanced UDF? Is it Queue or Cache?

Try with a Queue and check.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

It's Queue.

regards

bhavesh_kantilal
Active Contributor
0 Kudos

Hi

Can you give us more details on the target side and what the issue is as well.

On first glance i thought this was an issue of Queue / Cache , now that it is not, we would need more details

regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Source side the standard IDOC INOTIF is being used under the segment <E1NTITM_TASK_LTXT> the field TDLINE is getting repeated, as this field has been mapped with target siebel field 'x', which expects a string value max of 1500 chars and since TDLine accepts max char of 70, i need to concatenate and send it to target field.

If it is only for a single item, it's working absolutely alright, whereas for multiple items, the UDF is reading all the tdline fields and concatenating to target field and to the subsequent item fields.

EX:-

source: target

1)ABC 1)ABCDEFGHIJKLMNOPQRSTUVWXYZ

2)DEF 2)ABCDEFGHIJKLMNOPQRSTUVWXYZ

3)GHI 3)ABCDEFGHIJKLMNOPQRSTUVWXYZ

1)JKL

2)MNO

1)PQR

2)STU

3)VWX

4)YZ

Hope, you will get a better idea this time.

regards

Message was edited by:

Vijaya Lakshmi

Former Member
0 Kudos

Hi Vijaya,

Just want to know how will you differentaite each line item.

In your example you have mentioned that all those 1)ABC 2) DEF... will be in <TDLINE> tag . but how you can say first 3 are one set and next 2 one set.

Can you explain how to differentaite them ...

EX:-

source: target

1)ABC 1)ABCDEFGHIJKLMNOPQRSTUVWXYZ

2)DEF 2)ABCDEFGHIJKLMNOPQRSTUVWXYZ

3)GHI 3)ABCDEFGHIJKLMNOPQRSTUVWXYZ

1)JKL

2)MNO

1)PQR

2)STU

3)VWX

4)YZ

Nanda

Former Member
0 Kudos

Hi ,

In XML source how will you differentiate each line item . If you can set your context at line item level in the mapping . Please try that.

Provide XML source with header and item details with explanation( how differentiate each line item ).

Nanda