cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc Context issue

Former Member
0 Kudos

Hi all,

I am facing problem with IDoc contexts... IDoc(CLFMAS01) has 3 fields ATNAM,ATWRT and ATFVL in same segment.

if no value found during the IDoc creation, the fields creating in Segments, hence PI is not receiving the fields within the IDoc.

Ex:if there is no value for ATWRT, the field is not present in the IDoc segment.

sample IDoc segment values:

-


ATNAM -


ATWRT -


ATFVL

-


NAMVal1 -


WRTVal1 -


FVLVal1

NAMVal2 -


WRTVal2 -


FVLVal2

NAMVal3 -


-


FVLVal3

NAMVal4 -


WRTVal4 -


NAMVal5 -


WRTVal5 -


FVLVal5

NAMVal6 -


-


FVLVal6

-


When I use context at Segment level, the values are showing like these:

-


ATNAM -


ATWRT -


ATFVL

-


NAMVal1 -


WRTVal1 -


FVLVal1

NAMVal2 -


WRTVal2 -


FVLVal2

NAMVal3 -


WRTVal4 -


FVLVal3

NAMVal4 -


WRTVal5 -


FVLVal5

NAMVal5 -


-


FVLVal6

NAMVal6

-


in the above case, If the loop is in 5 iteration, I am getting the ATFVL value as "FVLVal6". But I am supposed to get the values "WRTVal5" and "FVLVal5"

While I am looping the values with in the UDF, I am not getting in proper order.

How can I get the proper order using the context? I tried RemContext and CollapseContext functions.

Any inputs? Thanks for your time...

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

You need to use the mapWithDefault node function before you do any context manipulation so that the number of contexts will be the same.

You can try this mapping

ATNAM --> mapWithDefault --> removeContext --> UDF

ATWRT --> mapWithDefault --> removeContext --> /

ATFVL --> mapWithDefault --> removeContext -->/

Hope this helps,

Former Member
0 Kudos

Thanks mark,

My problem is:

If the values are not maintained in Classification master, then IDoc fields are not filling. The empty fields are not passing to PI. Means, I can not have the Fields in IDoc segments.

Comming to technical fields...

The IDoc (CLFMAS) segment (E1AUSPM) has 3 fields:

1) ATNAM

2) AWTRT

3) ATFLV

Some times the AWTRT will not be maintained in SAP ECC. When IDoc is created, the field AWTRT is not present in segment E1AUSPM.

Example:

ATNAMAWTRTATFLV

-a1


w1--


f1

-a2


novaluef2

-a3


w3--


f3

-a4


novaluef4

-a5


novaluef5

-a6


w6--


f6

    • Note: "novalue" means the field AWTRT is not present in segment.

In my PI Mapping, I am using context at segment level E1AUSPM.

Now I am getting the context as like this:

ATNAMAWTRTATFLV

-a1


w1--


f1

-a2


w3--


f2

-a3


w6--


f3

-a4--


f4

-a5--


f5

-a6--


f6

I want the context to be keep as it is, eventhough the field is not present in IDoc-Segment.

If its possible in PI, can you suggest the code change in SAP ECC? I don't know how to sent empty fields to PI from SAP.

Thanks in Adv...

Former Member
0 Kudos

Hi

For 2 elements Use this UDF (UDF type as context)

public void TDLineCounter(String[] tdlne,String[] tdno,ResultList result,Container container){

int j , cc = 0,cc_count = 0;

for(int i =0;i<tdno.length;i++)

{

if(tdno<i>.equals("ZI03")) // if you have any condition else you can remove this if

{

cc_count = 0;

for (j = 0; j < tdlne.length ; j++)

{

if ( tdlne[j].equals(ResultList.CC) )

cc_count = cc_count + 1;

if ( cc_count == cc)

result.addValue(tdlne[j]);

}

}

if (tdno<i>.equals(ResultList.CC) )

result.addValue(ResultList.CC);

else

cc = cc + 1;

}

}

Regards

Ramesh

Former Member
0 Kudos

Hi Ramesh,

If possible, please elaborate me the solution. already I have a udf for remaining header fields. Now the problem is with the dependent level IDoc fields. can I pass the new UDF (suggested by you) to my existing UDF?

The existing UDF has 11 input fields. the last 3 fields are ATNAM, ATWRT and ATFLV. I need to set context for ATWRT only.

Thanks...

Former Member
0 Kudos

Solved