on 12-08-2008 2:44 PM
Hi,
I have Idoc to File Mapping in SAP XI, where I need to populate "Spaces" in most of the Target fields Dynamically. I need to create a UDF for this mapping. Since I have n no.of Target fields where I need to populate Sapces and Target fileds has different lengths. As of now I have cretated a simple UDF which is usefull only for one field mapping. Below is the UDF:
String s;
char []c = new char[10];
for(int i=0; i<10; i++)
c<i> = 'S';
s = new String(c);
return s;
2. My source file will be having 1000 records where 999 records will be mapped to Traget sturucture and the end of the Record should be mapped to the other Traget structure(Traget sturcture is same in the both the cases).
Please let me know how can I go about on this.
Thanks in Advance.
Jose
Hi Jose,
On the target side, do you want as many Spaces in the field as the field length ? Are you looking for a help for creating the UDF in IDOC to file case ?
Thanks,
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jose,
If you have two message type at the target end.
You can divide them into 999 and 1 piece using two simple UDFs. One to create 999 nodes, which should be used only once at the node level of the first message type :
for(int i =0; i<node1.length; i++)
if(i!=0) result.addValue(node1(i));
//Use the square brackets around i
and
another UDF is needed to fetch the last ( 1000th) record. You have to use the UDF for each and every field (field1 --> UDF ---> field1. .... same for all fields of the second structure
result.addValue(a (a.length-1) );
//Use the square brackets around a.length-1
Let me know if you face any issue in resolving your problem
Thanks,
Pooja
Messages
Messages1
<MT_Insite_Req>-> UDF1->MT_Insite_Req
DataConversionArea
DataElement
Messages
Messages1
<constant>--->MT_Insite_Req
<constant> --->DataConversionArea
<Field1> ---> UDF2 --->Field1
<Field2> ---> UDF2 --->Field2
<constant> ---> UDF2 --->DataElement
<Field1> ---> UDF2 --->Field1
<Field2> ---> UDF2 --->Field2
I have assumed that DataConversionArea and DataElement come only ones under the MT_Insite_Req.
Fields in the angle brackets are the input fields.
UDF1 :
for(int i =0; i<node1.length; i++)
if(i!=0) result.addValue(node1(i));
UDF2:
result.addValue(a (a.length-1) );
Let me know if I have confused you. :)Pooja
Messages
.......Messages1
.........MT_Insite_Req
...........DataConversionArea
.................Field1
.................Field2
.............DataElement
.................Field1
.................Field2
.................Field3
.......Messages2
..........MT_Insite_Req
.............DataConversionArea
.................Field1
.................Field2
.............DataElement
.................Field1
.................Field2
.................Field3
Pooja, It will be great if you can give the UDF related to the above structure and explain me in detail.
Once again Thanks for ur help.
Joseph
HI Joseph
Pooja has given UDF to apply like this
Messages
.......Messages1
.......UDF1..MT_Insite_Req (work for 999)
.................DataConversionArea
.................Field1
.................Field2
.............DataElement
.................Field1
.................Field2
.................Field3
.......Messages2
.......Constant...MT_Insite_Req
.......................DataConversionArea
............UDF2...Field1
...........UDF2....Field2
.......Constant...DataElement
........UDF2.......Field1
......UDF2.........Field2
........UDF2.......Field3
Thanks
Gaurav
Hi Pooja,
Continution to the issue.....
E1BP2017_GM_ITEM_CREATE is the SAP segment of the IDoc YWMS_MBGMCR03. The above segment is repeting 0 to unbounded.
Requirment:I need to create a UDF where I need to find the End of data coming from the segment.Once we reach the end of data then I should map the end record(Hardcoded Values). Before we were using 2 message types of sametype at the traget, now we should use only one.
Thanks in Advance.
Best Regards,
Joseph
I think , I misconstrued your question.
DO you want to create only one target structure with the last occurence of the segment to be replaced by some constants or rest occurence as it is
or
do you only need the last occurence or the segment in your target?
You can achieve that by writign a small UDF at the segment level.
thanks,
pooja
Edited by: Pooja Pandey on Dec 19, 2008 12:11 PM
Hi Pooja,
I need to send all the item records of the Segment E1BP2017_GM_ITEM_CREATE like we should use the segment counter. And the last record we will be hardcodeing.
We have taken out the concept of using the second Message type, because we have to mapp all the 140 fields again for the end record. What we want to do is, if we have reached the end of the data which is comming from source, we just want have if condition and Hardcord a value LIKE EOD which means end of data.
hope you have got the point.
Jose.
Hi Joseph,
Give a try to use the below UDF for the fields where you want to have some hardcoded values :
a : Field you would like to change
b : New hardcoded value for the field.
for( int i=0; i<a.length; i++)
{
if (i==(a.length-1))
result.addValue(b[0]);
else
result.addValue(a<i>);
}
input_field_1 --------------------
UDF -------------------- target_field_1
new_constant_EOD ------------------
Rest all mappings should remain as it is.
Let me know if you face any issue.
Thanks,
Pooja
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.