cancel
Showing results for 
Search instead for 
Did you mean: 

RE:idoc inbound scenario "mapping issue"

Former Member
0 Kudos

Hi experts,

we r facing the problem in idoc inbound scenario, while to generate multiple idoc's.

we need to generate the idoc's based on two fields, Location_code and Date. If any of the field is changing we need to generate the new idoc.

below is the sender payload :

<row>
      <Date>20100111</Date>
      <Sign>+</Sign>
      <Tender_Code>ZSHT</Tender_Code>
      <Tender_Amount>1890.30</Tender_Amount>  
      <Location_Code>0000001000</Location_Code>
   </row>
   <row>
      <Date>20100112</Date>
      <Sign>+</Sign>
      <Tender_Code>ZSHT</Tender_Code>
      <Tender_Amount>1890.30</Tender_Amount>
      <Location_Code>0000001000</Location_Code>
   </row>
   <row>
      <Date>20100112</Date>
      <Sign>+</Sign>
      <Tender_Code>ZSHT</Tender_Code>
      <Tender_Amount>1890.30</Tender_Amount>
      <Location_Code>0000001001</Location_Code>
   </row>
   <row>
      <Date>20100112</Date>
      <Sign>+</Sign>
      <Tender_Code>ZSHT</Tender_Code>
      <Tender_Amount>4532.32</Tender_Amount>
      <Location_Code>0000001001</Location_Code>
   </row>

for the above payload ,we need 3 idocs as below

idoc1:

Location_code>1000 Date->20100111

idoc2:

Location_code>1000 Date->20100112

idoc3:

Location_code>1001 Date->20100112

under the third idoc fourth row should get repeated.

at present we have the following mapping which is generating multiple idocs bsased on only location code, it's like

Location_code-->removecontext-->sort-->splitbyvalue(valuechange)-->collapsecontext--->idoc

rgds

selvam

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi Selvam,

Try this


date-------------->concat-->SplitByValue(Value change)-->Collapsecontext-->SplitbyValue---target
location_code-->

PS: If required you may use sortbyKey after concat.

Regards

Suraj

Former Member
0 Kudos

Hi,

Thanks Suraj , logic has worked but there is a simple issue , LOCATION_Code is mapped with SNDRPRN and RCVPRN of the EDI_DC40 segment when i m execuiting the payload it throws error for the second idoc generated , when the LOCATION_CODE changes this should also get updated to that field. Mapping for SDNPRN has been done like this.

LOCATION_CODE --->removecontext-->|
                                     formatbyexample--->SNDRPRN
idoc mapping logic---------------->|

pl suggest...

rgds

selvam

former_member187339
Active Contributor
0 Kudos

Hi Selvam,

I am little lost here.

Can you show me the display queue entries for both the input of formatbyexample?

Also just give a try like this:


LOCATION_CODE --->removecontext-->| formatbyexample--->splitbyvalue-->SNDRPRN
idoc mapping logic---------------->|

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

The display queue is like this :

FormatByExample:in0  FormatByExample:in1            FormatByExample:out

1000                            201001061000                       1000
1000                            201001071000                       1000
1001                            201001071001                       1001
1001                            201001071001                       1001(SUPPRESSED ROW)	

rgds

selvam

former_member187339
Active Contributor
0 Kudos

Hi Selvam,

Now try this:


LOCATION_CODE --->removecontext-------------------->| formatbyexample--->collapsecontext-->splitbyvalue-->SNDRPRN
idoc mapping logic------splitbyValue(valuchange)------>|

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

Thaks for u r effort....it's worked.

rgds

selvam

Answers (1)

Answers (1)

RKothari
Contributor
0 Kudos

Hello,

Try using below mentioned udf.

a = location

b = input

for( int i=0;i<a.length;i++)
{
	if(i== 0){
	 result.addValue(a<i>); 
	 result.addContextChange();

	}

	else
	{

		if(a<i>.equals(a[i-1]) || b<i>.equals(b[i-1])) {

		}
		else{
			result.addValue(a<i>);
			result.addContextChange();
		}

	}

}

BR,

Rahul