cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping logic ...!!

Former Member
0 Kudos

Hi Experts ,

I am working on the below scenario where my Sender System is the Oracle Database system and Receiver System is SAP ECC

basically JDBC->PI->IDOC channels i am using . I need to create the below Mapping logic in order to satisfy the Interface Requirement

Based on the Interface_Transaction_ID each Idoc has to be Created and each Idoc should have corresponding Segments and line items . based on th value of GLAccount and Vendor Account

My sender Payload is

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<DOC_HEADER_TEXT>5251/0115/000000/0000</DOC_HEADER_TEXT>

<COMPANY_CODE>1610</COMPANY_CODE>

<DOCUMENT_DATE>20110707</DOCUMENT_DATE>

<POSTING_DATE>20110305</POSTING_DATE>

<PERIOD>3</PERIOD>

<DOCUMENT_TYPE>ZF</DOCUMENT_TYPE>

<REFERENCE>45720-T</REFERENCE>

<VENDOR_ACCOUNT></VENDOR_ACCOUNT>

<CF_MATERIAL_TYPE>MATTE</CF_MATERIAL_TYPE>

<CF_ENTRY_POINT>610 Tank</CF_ENTRY_POINT>

<CF_SOURCE>XNN</CF_SOURCE>

<PAYMENT_TERMS></PAYMENT_TERMS>

<BASELINE_DATE>20110305</BASELINE_DATE>

<ASSIGNMENT>5251/0115/000</ASSIGNMENT>

<TEXT>USD </TEXT>

<GL_ACCOUNT>111810</GL_ACCOUNT>

<SPECIAL_GL_IND></SPECIAL_GL_IND>

<PREV_DOC_NUMBER></PREV_DOC_NUMBER>

<PREV_POSTING_DATE></PREV_POSTING_DATE>

</row>

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<DOC_HEADER_TEXT>5251/0115/000000/0000</DOC_HEADER_TEXT>

<ASSIGNMENT>5251/0115/000</ASSIGNMENT>

<TEXT>USD </TEXT>

<GL_ACCOUNT>111821</GL_ACCOUNT>

<SPECIAL_GL_IND></SPECIAL_GL_IND>

<PREV_DOC_NUMBER></PREV_DOC_NUMBER>

<PREV_POSTING_DATE></PREV_POSTING_DATE>

</row>

Row having GL_Account Value E1BPACHE09,

E1BPACGL09, (GLvalue 111810)

E1BPACGL09, (GLvalue 111821)

E1BPACCR09,

E1BPACCR09,

E1PACEXTC .

Field value=CFCV00000627

Similary if Vendor_Account Value exist then only Vendor Segment (E1BPACAP09) must occur at target side

Row having Vendor_Aaccount Value

E1BPACHE09,

c (Vendor value 123)

E1BPACAP09, (Vendor Value 124)

E1BPACCR09,

E1BPACCR09,

E1PACEXTC .

Field value=CFCV00000628

I have mapped GL_ACCOUNT -


>E1BPACGL09 .

Vendor_Account---->E1BPACGL09.

if any one have gone through simiar mapping logic kindly share and do the needfull ...

Regards,

Aziz khan .

I

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Aziz,

By default when you import Idoc it creates only one in SAP even if you have multiple INTERFACE_TRANSACTION_ID . So first you need to change the idoc occurence to 1..unbounded. Use this blog for this:

/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

Then since you need to create an idoc for each change on INTERFACE_TRANSACTION_ID then map like this:

INTERFACE_TRANSACTION_ID ---> Split by value (value change) --> IDoc

Map GL_ACCOUNT from source to your E1BPACGL09 segment. It should automatically get in else you may need to use context fucntions for those to populate accordingly.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish,

I have already imported the Idoc with Occurence 1...Unbounded . and i am able to get the Idocs as per the Requirement .

but the Problem arises when i try to Map the GL_Account Filed (Sender) with the IDOC GL_Segment ie ( E1BPACGL09 ) and Vendor_Account -


>E1BPACAP09 )

I have mapped them using the below logic

GL_Account-->exists -


>if then Interface_Transaction_ID -
>SplitByValue(ValueChange)--->E1BPACGL09 .

Vendor_Account->Exists-->If then ->INTERFACE_TRANSACTION_ID->SplitByValue(ValueChange)--->E1BPACAP09)

when i test them i am able to get the Idoc Segment E1BPACGL09 for every occurence of GL_Account .

but the same logic is not working for the Vendor Account when Records are duplicated .

Regards,

Aziz khan .

Former Member
0 Kudos

Hi Aziz,

You dont need to SplitbyValuechange for this two fields. This already taken care with Idoc level itself. Map:

GL source --> SplitbyValue --> Target and see what you have.

Regards,

---Satish

baskar_gopalakrishnan2
Active Contributor
0 Kudos

> but the same logic is not working for the Vendor Account when Records are duplicated

Use splitByvalue (each value). Also you might want to use removecontext after the source field.

Former Member
0 Kudos

Hi Aziz,

Follow the below logic:

Vendor_Account>SplitBYValue>Target (GL_ACCOUNT).

This should take care of the issue.

Try and let me know if you have any issues.

Thanks,

Former Member
0 Kudos

Hi ,

Here the requirement which i am looking for :

Sender Side has below value

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<PERIOD>3</PERIOD>

<DOCUMENT_TYPE>ZF</DOCUMENT_TYPE>

<REFERENCE>45720-T</REFERENCE>

<CF_MATERIAL_TYPE>MATTE</CF_MATERIAL_TYPE>

<VENDOR_ACCOUNT>600046</VENDOR_ACCOUNT>

<CF_ENTRY_POINT>610 Tank</CF_ENTRY_POINT>

<CF_SOURCE>XNN</CF_SOURCE>

<PAYMENT_TERMS></PAYMENT_TERMS>

<BASELINE_DATE>20110305</BASELINE_DATE>

<ASSIGNMENT>5251/0115/000</ASSIGNMENT>

<GL_ACCOUNT>111810</GL_ACCOUNT>

<USER_STATUS>TOHD</USER_STATUS>

<PREV_POSTING_DATE></PREV_POSTING_DATE>

</row>

as you can see in the above Payload has values where Row is the Root element and under that the rest of fields occur (its a jdbc to idoc Scenario ) and here based on the Interface Trasaction ID the Idoc is generated . where each Idoc should have either GL Segment if GL Account Value has values and respectively Vendor idoc Segment has to be generated if Vendor Account details are present . the Sender Data will have either GL Account or Vendor Account value in a row not both.

below is the IDOC Strcuture how it looks for GL Account at Target side

IDOC

--->E1BPACHE09

E1BPACGL09 (This is the GL Segment will have GL Account Line item)

E1BPACAR09

E1BPACAR09.

E1BPACEXTC

Filed1

below out put should come when Vendor Account have Value

IDOC

E1BPACHE09

E1BPACAP09 (This is the Vendor Segment will have Vendor Account Line item)

E1BPACAR09

E1BPACAR09.

E1BPACEXT09

Filed1

Now when i duplicate the above Row

Like

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<VENDOR_ACCOUNT></VENDOR_ACCOUNT>

<GL_ACCOUNT>111810</GL_ACCOUNT>

</row>

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<VENDOR_ACCOUNT></VENDOR_ACCOUNT>

<GL_ACCOUNT>111811</GL_ACCOUNT>

</row>

<row>

<INTERFACE_TRANSACTION_ID>CFCV00000627</INTERFACE_TRANSACTION_ID>

<VENDOR_ACCOUNT></VENDOR_ACCOUNT>

<GL_ACCOUNT>111812</GL_ACCOUNT>

</row>

I have Mapped the below fileds

Interface_Transaction_ID-->SplitByValue(EachValue)>CollapseContext>IDOC

Interface_Transaction_ID -->Filed1 (IDOC/E1BPACEXTC/Filed1)

all the above 3 Row have been duplicated the 3 Rows will have 3 interface Transaction id Value=CFCV00000627 (which is same as per the above Sender Payload ) and 3 GLAccount fields with values 111810,111811,111812 each

If i test the data i should get the below output 1

if GL account exists

IDOC 1

E1BPACHE09

E1BPACGL09 (This is the GL Segment with value 111810)

E1BPACGL09 (This is the GL Segment with value 111811)

E1BPACGL09 (This is the GL Segment with value 111812)

E1BPACAR09

E1BPACAR0/

E1BPACEXTC

Filed1 (CFCV00000627)

If Vendor account Exists then output 2 as follows

IDOC

E1BPACHE09

E1BPACAP09 (This is the Vendor Segment will have Vendor Account Line item)

E1BPACAP09

E1BPACAP09

E1BPACAR09

E1BPACAR09.

E1BPACEXT09

Filed1 (CFCV00000627)

How can i achive the above logic .

Regards,

Aziz

Former Member
0 Kudos

Hi ,

Need help to resolve above logic ...Pls ...Any suggestions ...!!!

Former Member
0 Kudos

chk this:

1)



INTERFACE_TRANSACTION_ID -> RemoveContext -> sort - splitbyValue (value change) - >collapseContext -> IDOC

2)



INTERFACE_TRANSACTION_ID ->removeContext ->sort(numerical)-> splitbyvalue (valuechange) -> collapsecontext- >

  INTERFACE_TRANSACTION_ID->RemoveContext->.                                                               --------------------UDF--E1BPACGL09

GL_ACCOUNT-->mapwith default----> remove context

3) In the same way do the mapping for VENDOR_ACCOUNT (follow the same mapping steps as shown above for GL_ACCOUNT) .

UDF:

this will have 3 inputs

var1, var2, var3

Execution type all values of a context


for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
if(var1<i>.equals(var2[j]))
{
if(!var3[j].equals(""))
{
result.addValue(var3[j]);
}
}
}
result.addContextChange();
}

Note: This UDF will take care of the context changes if there are more than one (i.e different) INTERFACE_TRANSACTION_ID.