on 08-19-2013 11:29 AM
Hi Experts,
I am working on a Idoc to JDBC mapping and meet some issue. Here is the source strcture. plant.
-<ZMARAM SEGMENT="1">
<MATNR>000000000001006960</MATNR>
<ERSDA>20100428</ERSDA>
<MTART>LG01</MTART>
<MATKL>003015</MATKL>
<ZMBEWM SEGMENT="1">
<MATNR>0000087H5944</MATNR>
<BWKEY>0154</BWKEY>
<VERPR>0987</VERPR> </ZMBEWM>
</ZMBEWM>
<ZMBEWM SEGMENT="1">
<MATNR>0000087H5944</MATNR>
<BWKEY>0112</BWKEY> <PEINH>1</PEINH>
<VERPR>0987</VERPR> </ZMBEWM>
<ZMARCM SEGMENT="1">
<MATNR>0000087H5944</MATNR>
<WERKS>0110</WERKS>
<PSTAT>DEAVQ</PSTAT>
<ZPLOC>CN01</ZPLOC>
</ZMARCM>
<ZMARCM SEGMENT="1">
<MATNR>0000087H5944</MATNR>
<WERKS>0112</WERKS>
<PSTAT>DEAVQ</PSTAT>
<ZPLOC>CN01</ZPLOC>
</ZMARCM>
first we need to filter one segment ZMARCM with WERKS = XXXX and convert corresponding lines to JDBC line one by one. So we mappe the ZMARCM to JDBC corresponding table. but now we have a new requirement for get the corresponing filelds of ZMBEWM add to the same JDBC table by ZMBEWM-BWKEY = ZMARCM-WERKS. How to do this. My question is if we can get the right content from ZMBEWM using starnd funtion. If not do we need to using UDF to do this? How to write this code for scan the ZMBEWM one by one?
Hello,
U can check this UDF (hope i understood ur req. correctly):
Input: 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(var2[j].equals(var1[i]))
{
result.addValue(var3[j]);
break;
}
}
}
Mapping:
WERKS--------\
BWKEY---------UDF -SplitByValue(Each Value) - Target Field
VPER-----------/
Do remember to change the context of all these fields and set it to "ZMARAM"
Thanks
Amit Srivastava
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
this is how you can do it with standard functions.
It seems you are using a custom IDoc for material master.
I assume ZMARCM and ZMBEWM are at the same level in the IDoc.
You are already applying a filter for ZMARCM-WERKS. I assume it is something like this
If ZMARCM-WERKS EQ 'X' -> create target row.
ZMBEWM segment has WERKS value in field BWKEY.
For the fields where you need information from ZMBEWM, simply map like below:
If ZMBEWM-BWKEY EQ 'X' map ZMBEWM-field---> ifWithoutElse -> MapWithDefault ->Target field
MapWithdefault is in case you want to populate a blank in target in case ZMBEWM-field value does not exist for the plant in play.
Hope it answers your question
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.