Tuesday, 13 October 2015

Spliting TDLINE and KTEXT fields to create multiple segment of E1EDKT2 under segment E1EDKT1

We face normal issue when TDLINE under E1EDKT2 segment comes more than 70 characters. As SAP ECC can hold max 70 characters in one TDLINE hence we need to replicate multiple E1EDKT2 segment with 70 characters each.
We can handle this splitting by writing UDF for creating multiple TDLINE.
Please follow below steps:
Step1: Create a user defined function splitTDLINE/ splitKTEXT and Execution type as All values of a context.




Step2: Write the below Code:

for(int j=0;j<str.length;j++) {
result.addValue("");
String[] splited = str[j].split("(?<=\\G.{70})");
for(int i=0;i<splited.length;i++) {
result.addValue(splited[i]);
 }
}

Step3: Map the TDLINE segment using above UDF.

Step4: Map the E1EDKT2 segment also"


This will create multiple E1eDKT2 segment and hence multiple TDLINE or KTEXT node.
Now you can easily handle length issue with this simple UDF.

No comments:

Post a Comment