cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical Mapping Query

Former Member
0 Kudos

Hi ,

I have query related to SAP XI graphical mapping. I have a requirement related to HR where in I need to make output as below

I am using three infotypes 0000, 0001 , 0002 , 0006 , 00007 , 0032 ,0041 , 0105 & 1001. Based on the begin date(BEGDA) of these 9 infotypes I want to create records in the ouput file.

For example:

Source structure

The infotype 0000 have 4 records in the input file.

10011742 0000 0 71063.28 20061217

10011742 0000 0 74360.00 20070101

10011742 0000 0 86419.86 20070401

10011742 0000 0 82149.75 20080401

and for infotype 0001 3 records with begda dates below:

10011742 0001 3 92 20061217 PG

10011742 0001 3 U5 20070101 PR

10011742 0001 3 U6 20081001 LL

and infotype 0002 have 3 records with begin date

10011742 20061217 0002

10011742 20070101 0002

10011742 20081001 0002

Note: Here I have to compare the 4 records of Infotype 0000 n pick up the records with latest BEGDA then use it the output. Samething has to be done for 0001 , 0002 , 0006 , 00007 , 0032 ,0041 , 0105 & 1001 infotypes.

The output structure should generate one records per employee

<Record>

<EMP_NUM> 10011742 </EMP_NUM>

<CHANGE_TYPE> X </CHANGE_TYPE>

<MONTHLY_ADJUST_AMT> 00000000.00 </MONTHLY_ADJUST_AMT>

<MONTHLY_SALARY> 00005921.94 </MONTHLY_SALARY>

<ANNUAL_SALARY> 00071063.28 </ANNUAL_SALARY>

<POSITION_CODE> 40003284 </POSITION_CODE>

<EEO_CODE> B04 </EEO_CODE>

<FLSA_CODE> EX </FLSA_CODE>

<UNION_CODE> 0000 </UNION_CODE>

<COMPANY_STATUS> R </COMPANY_STATUS>

<WORK_STATUS> FT </WORK_STATUS>

<EMPLOYEE_STATUS> A </EMPLOYEE_STATUS>

<ADJUST_TYPE />

<PAY_BASIS> M </PAY_BASIS>

<WORK_LOC_CODE> 9126 </WORK_LOC_CODE>

<RESP_CENTER> P01061 </RESP_CENTER>

</Record>

I am using graphical mapping and I need the logic for the above.

Currently I am doing like this

1) I created a UDF like as below :

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

{

result.addValue(E1P0000 [i|);

}

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

{

result.addValue(E1P0001 [i|);

}

........

2) The I mapped BEGDA with UDF --> split by value changed --> collapse context --> record

But my problem is the following

1)It will have multiple instance of record which I donu2019t want , I need only one instance of output record structure per employee.

2) Also I donu2019t know how to put the latest BEGDA date of each infotype as 9 INFOTYPES in my case into one record i.e. How to select the latest BEGDA from multiple records of each infotype for example in Infotype 0000 if there are 4 records how to select the records with latest BEGDA.

Your help on this will be appreciated

Thanks & Regards

Prabhat Ranjan

Accepted Solutions (0)

Answers (2)

Answers (2)

SudhirT
Active Contributor
0 Kudos

For latest date,and one output record you can try this

BEGDA(Context Set to 1 level up)->Sort(Node Func)>CollapseContext-->TargetDate

Thanks!

Former Member
0 Kudos

hi ,

can u explain it in details as how it will be done based on the source n target structure i have given..

your help will be appreciated.

thanks & regards

prabhat

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Could you please provide the source and target structure so that we can visualize what mapping logic to use?

Regards,

Former Member
0 Kudos

Hi ,

The source structure will be like as shown below

Source structure:

<?xml version="1.0" encoding="utf-8" ?>

<n0:MT_PAYROLL_DATA xmlns:n0="> (1..1)

<Z1MSGHDR> (0..1)

<INT_ID>100</INT_ID>

</Z1MSGHDR>

<Z1EMPHDR> (0..unbounded)

<PERNR>10011742</PERNR>

<PYBEGDA>20080518</PYBEGDA>

<PYENDDA>20080531</PYENDDA>

<E1P0000>(0..unbounded)

<PERNR>10011742</PERNR> (0..1)

<INFTY>0000</INFTY>

<STAT2>3</STAT2>

<MASSN>92</MASSN>

<BEGDA>20061217</BEGDA> (0..1)

<MASSG>PG</MASSG>

</E1P0000>

<E1P0000>

<PERNR>10011742</PERNR>

<INFTY>0000</INFTY>

<STAT2>3</STAT2>

<MASSN>U5</MASSN>

<BEGDA>20070101</BEGDA>

<MASSG>PR</MASSG>

</E1P0000>

<E1P0000>

<PERNR>10011742</PERNR>

<INFTY>0000</INFTY>

<STAT2>3</STAT2>

<MASSN>U6</MASSN>

<BEGDA>20081001</BEGDA>

<MASSG>LL</MASSG>

</E1P0000>

<E1P0001>

<PERNR>10011742</PERNR>

<INFTY>0001</INFTY>

<BTRTL>0001</BTRTL>

<PERSK>03</PERSK>

<PERSG>1</PERSG>

<WERKS>9126</WERKS>

<KOSTL>P01061</KOSTL>

<PLANS>40000284</PLANS>

<EEO_CODE>B04</EEO_CODE>

<BUKRS>1001</BUKRS>

<EEOTX>Professionals</EEOTX>

<JOB_PSTN_NM>Analyst</JOB_PSTN_NM>

<STELL>30000714</STELL>

<BEGDA>20061217</BEGDA>

</E1P0001>

<E1P0001>

<PERNR>10011742</PERNR>

<INFTY>0001</INFTY>

<BTRTL>0001</BTRTL>

<PERSK>03</PERSK>

<PERSG>1</PERSG>

<WERKS>0201</WERKS>

<KOSTL>P01061</KOSTL>

<PLANS>40004438</PLANS>

<EEO_CODE>B03</EEO_CODE>

<BUKRS>1001</BUKRS>

<EEOTX>Professionals</EEOTX>

<JOB_PSTN_NM>Senior Analyst</JOB_PSTN_NM>

<STELL>30000879</STELL>

<BEGDA>20070101</BEGDA>

</E1P0001>

<E1P0001>

<PERNR>10011742</PERNR>

<INFTY>0001</INFTY>

<BTRTL>0001</BTRTL>

<PERSK>03</PERSK>

<PERSG>1</PERSG>

<WERKS>0201</WERKS>

<KOSTL>P01061</KOSTL>

<PLANS>40004438</PLANS>

<EEO_CODE>B03</EEO_CODE>

<BUKRS>1001</BUKRS>

<EEOTX>Professionals</EEOTX>

<JOB_PSTN_NM>Senior Analyst</JOB_PSTN_NM>

<STELL>30000879</STELL>

<BEGDA>20081001</BEGDA>

</E1P0001>

<E1P0002>

<PERNR>10011742</PERNR>

<PERID>160628891</PERID>

<INFTY>0002</INFTY>

<NACHN>Manyak</NACHN>

<VORNA>Kathleen</VORNA>

<GBDAT>19650331</GBDAT>

<GESCH>2</GESCH>

<MIDNM>N.</MIDNM>

</E1P0002>

<E1P0006>

<PERNR>10011742</PERNR>

<INFTY>0006</INFTY>

<SUBTY>1</SUBTY>

<STATE>PA</STATE>

<STRAS>526 Pizza Barn Rd.</STRAS>

<ORT01>Greensburg</ORT01>

<PSTLZ>15401</PSTLZ>

</E1P0006>

<E1P0006>

<PERNR>10011742</PERNR>

<INFTY>0006</INFTY>

<SUBTY>4</SUBTY>

<STATE>PA</STATE>

<STRAS>526 Pizza Barn Rd.</STRAS>

<ORT01>Greensburg</ORT01>

<PSTLZ>15401</PSTLZ>

</E1P0006>

<E1P0008>

<PERNR>10011742</PERNR>

<INFTY>0008</INFTY>

<SUBTY>0</SUBTY>

<ANSAL>71063.28</ANSAL>

<BEGDA>20061217</BEGDA>

<BASE_RATE>71063.28</BASE_RATE>

<TRFAR>02</TRFAR>

<TRFGB>06</TRFGB>

<TRFGR>EXEMPT</TRFGR>

<TRFST>01</TRFST>

</E1P0008>

<E1P0008>

<PERNR>10011742</PERNR>

<INFTY>0008</INFTY>

<SUBTY>0</SUBTY>

<ANSAL>74360.00</ANSAL>

<BEGDA>20070101</BEGDA>

<BASE_RATE>74360.00</BASE_RATE>

<TRFAR>02</TRFAR>

<TRFGB>06</TRFGB>

<TRFGR>EXEMPT</TRFGR>

<TRFST>01</TRFST>

</E1P0008>

<E1P0008>

<PERNR>10011742</PERNR>

<INFTY>0008</INFTY>

<SUBTY>0</SUBTY>

<ANSAL>86419.86</ANSAL>

<BEGDA>20070401</BEGDA>

<BASE_RATE>86419.86</BASE_RATE>

<TRFAR>02</TRFAR>

<TRFGB>06</TRFGB>

<TRFGR>EXEMPT</TRFGR>

<TRFST>01</TRFST>

</E1P0008>

<E1P0008>

<PERNR>10011742</PERNR>

<INFTY>0008</INFTY>

<SUBTY>0</SUBTY>

<ANSAL>82149.75</ANSAL>

<BEGDA>20080401</BEGDA>

<BASE_RATE>82149.75</BASE_RATE>

<TRFAR>02</TRFAR>

<TRFGB>06</TRFGB>

<TRFGR>EXEMPT</TRFGR>

<TRFST>01</TRFST>

</E1P0008>

<E1P0014>

<BETRG>30.00</BETRG>

<LGART>6020</LGART>

<ZUORD>U03</ZUORD>

<PERNR>10011742</PERNR>

<INFTY>0014</INFTY>

<SUBTY>6020</SUBTY>

</E1P0014>

<E1P0014>

<BETRG>9.07</BETRG>

<LGART>6023</LGART>

<PERNR>10011742</PERNR>

<INFTY>0014</INFTY>

<SUBTY>6023</SUBTY>

</E1P0014>

<E1P0041>

<PERNR>10011742</PERNR>

<INFTY>0041</INFTY>

---

---

---

---

---

</Z1EMPHDR>

Target Structure will be

<Record>

<EMP_NUM>10011742</EMP_NUM>

<CHANGE_TYPE>X</CHANGE_TYPE>

<MONTHLY_ADJUST_AMT>00000000.00</MONTHLY_ADJUST_AMT>

<MONTHLY_SALARY>00005921.94</MONTHLY_SALARY>

<ANNUAL_SALARY>00071063.28</ANNUAL_SALARY>

<POSITION_CODE>40003284</POSITION_CODE>

<EEO_CODE>B04</EEO_CODE>

<FLSA_CODE>EX</FLSA_CODE>

<UNION_CODE>0000</UNION_CODE>

<COMPANY_STATUS>R</COMPANY_STATUS>

<WORK_STATUS>FT</WORK_STATUS>

<EMPLOYEE_STATUS>A</EMPLOYEE_STATUS>

<ADJUST_TYPE />

<PAY_BASIS>M</PAY_BASIS>

<WORK_LOC_CODE>9126</WORK_LOC_CODE>

<RESP_CENTER>P01061</RESP_CENTER>

</Record>

Conditions to be applied

1) Select the latest Begda of an employee out of multiple records of any infotype say for 0000 i.e for example infotype 0000 has 4 records then select the latest Begda out of it. Same will happen for other infotypes also. so in my case IDOC will have 9 infotypes as mentioed in my query

2) after selection latest BEGDA from each of the infotype , then mapping should be done with the target structre in which only one employee records will be generated.

your help in this regard will be appreciated.

Thanks & Regards

Prabhat Ranjan

SudhirT
Active Contributor
0 Kudos

Hi Prabhat,

You will have to use this condition for all the Target fields to create the corresponding record for the latest BEGDA.

Mapping will look like

BEGDA----->Sort--->CollapseContext---->IfWithoutElse---->(SourceField Corresponding to TargetField)Then----->Target Field

Sort function will always take the latest date and accordingly pass the value from source to target.

Thanks!

Former Member
0 Kudos

hi,

as u might have seen in my query , the source & target structure , my requirement is that on the basis of Latest Begda record from each of the Infotype segment we have to map it with the target . In target we dont have any filed related to Begda , so my query to you is that, Is your solution will be correct in that case. Do I need to create any UDF for taking the Latest BEGDA from each of the infotype segment records?

I apreciate your effort for providing so much of information in order to resolve my query.

Thanks & Regards

Prabhat Ranjan

SudhirT
Active Contributor
0 Kudos

What I meant in my earlier reply is that you will have to apply this condition for every target field mapping taking the required source field in the "then" part of IfWithoutElse and passing to the relevant Output structure's field.

You dont have to pass BEGDA to all the output fields but just have to consider this condition(as provide) to create the output record based on the latest BEGDA field.

Whatever the mapping for source to target field is, just consider this additional consider and let me know the result.

Thanks!

Former Member
0 Kudos

hi sudhir,

thanks for your help. i will check the mapping as suggsted by u tommorow morning n will let you know.

thanks & regards

prabhat

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

The logic that Sudhir presented using BEGDA is correct. Adding to that, since you need to create only one record per employee, you need to take into consideration each unique occurrence of the node <PERNR>Insert Number Here</PERNR>. You can do this by using the following mapping:

PERNR --> removeContext --> sort:Numerical Ascending --> splitByValue:ValueChanged --> collapseContext --> EMP_NUM

Hope this helps