cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical mapping issue

Former Member
0 Kudos

Hi Friends,

I ‘ve a mapping issue  in which “ Receipt  type field from Header segment of source  is being mapped to lineitem segment of target .  condition precisely is like this. Using graphical mapping I am able to map the first two condition but when I am taking third condition , I am not getting the result. Pleas help me out in designing a graphical mapping for the below conditions  .

CONDITIONS

Receipt Type from "H" Segment of Retail Pro sales file,

Condition -1


If Receipt type= Sales from "H" Segment of Retail Pro sales file,

And Serial No =blank from “I” segment ,  then RETAILTYPECODE: 2001

Condition -2

.If Receipt type= Sales from "H" Segment of Retail Pro sales file,

And .If Serial no=Home Delivery  from "I" segment, then RETAILTYPECODE:HOMD


Condition -3


If Receipt Type= Return from "H" Segment of Retail Pro sales file, then RETAILTYPECODE:2801

DATA from file

Sender

<ns:RetailProPOSDM101_PostTransactions_RETPRO_PI xmlns:ns="http://xxxxxxxxxxxxxx">

<Header>

<Flag>H</Flag>

<Receipt_No>102401</Receipt_No>

<Receipt_Type>Sale</Receipt_Type>

</Header>

<Item>

<Flag>I</Flag>

<Serial_no />

</Item>

<Item>

<Flag>I</Flag>

<Serial_no />

</Item>

<Item>

<Flag>I</Flag>

<Serial_no />

</Item>

<Item>

<Flag>I</Flag>

<Serial_no />

</Item>

<Tender>

<Flag>S</Flag>

<Tender_type>Cash</Tender_type>

<Tender_Amt>280.00</Tender_Amt>

</Tender>

</ns:RetailProPOSDM101_PostTransactions_RETPRO_PI>

Receiver

BAPI 

- <ns1:_-POSDW_-BAPI_POSTR_CREATE xmlns:ns1="urn:sap-com:document:sap:rfc:functions">

- <RETAILLINEITEM>

- <item>

……

<RETAILTYPECODE>2001</RETAILTYPECODE>

<SERIALNUMBER />

</item>

- <item>

<RETAILTYPECODE>2001</RETAILTYPECODE>

<SERIALNUMBER />

</item>

- <item>

<RETAILTYPECODE>2001</RETAILTYPECODE>

<SERIALNUMBER />

</item>

- <item>

<RETAILTYPECODE>2001</RETAILTYPECODE>

<SERIALNUMBER />

</item>

</RETAILLINEITEM>

</ns1:_-POSDW_-BAPI_POSTR_CREATE>

Thanks

mojib

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Mojib,

                  You said you have achieved the mapping with first two conditions. Could you post what you did? so that forum members might suggest extra steps to include the third condition.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam ,

I am attaching the mapping image for clarity .

Thanks

mojib

Answers (1)

Answers (1)

former_member201264
Active Contributor
0 Kudos

Hi Mojid,

There are so many "I" segments in your input file.

Which segment is to be used for evaluating the condition?

Please elaborate your conditions for more clarity.

Regards,

Sreeni.

Former Member
0 Kudos

Hi All,

Thanks for everybody effort

I went for a udf as there was two more conditions to be checked. The below code has worked .

and the mapping just looks like this:

public String calculate(String var1, String var2, String var3, Container container) throws StreamTransformationException{

float qtyval=Float.parseFloat(var2);

if

(var1.equals("Sale")&&qtyval>=0&& (var3.equals("Home Delivery")))

{

return("HOMD");

}else if

(var1.equals("Sale")&&qtyval>=0){

                              return("2001");

}

else if (var1.equals("Sale")&&qtyval<0){

                              return("2801");

} else if (var1.equals("Return")&&qtyval>=0){

                    return ("2801");

} else {

                    return ("2001");

}

}

anupam_ghosh2
Active Contributor
0 Kudos

Hi Mojib,

First of all congrats for successfully executing this complicated mapping.

                In the UDF you have written var3 must have multiple values where as var1 occurs only 1 time.

Thus I expect the var3 to be array of strings instead of a string. In the UDF you are using var3 as single string. Could you please post the final mapping which is giving you correct result. I would love to know the final solution. I tried this without UDF but was not able to come up with exact result hence deleted two of my previous posts.

Regards

Anupam