on 04-08-2011 2:30 PM
Hi XI experts ,
This is SOAP TO RFC scenario .
THe Source is an dtd (create PO ) schema provided by external partners .
The Target is : BAPI : BAPI_PO_CREATE1 , a standard BAPI used to craete PO in SAP .
I need to map the below source fields to the BAPI Fields:
1. ReferenceTypeCodedOther>ACC_STR</ReferenceTypeCodedOther> then <RefNum>1000</RefNum> ->
2. <ReferenceTypeCodedOther>G_L_ACCT</ReferenceTypeCodedOther> then RefNum>5423100</RefNum>
3. <ReferenceTypeCodedOther>COST_CTR</ReferenceTypeCodedOther> then <RefNum>313</RefNum>
4. ReferenceTypeCoded>AccountCategory</ReferenceTypeCoded> then <RefNum>ZNCC</RefNum>
-I have changed the context of the "Ref NUm" to -ReferenceTypeCoded ( Main Node)
2. Lets take an example of 2 :"
iF <ReferenceTypeCodedOther> = G_L_ACCT , Then RefNum (5423100<) -> Leading zero function (to make it 10 digits) =GL_ACCOUNT field of BAPI
here i have used , if ReferenceTypeCodedOther <> SUBSTRING (0-7) <Equals text> G_L_ACCT then <RefNum> LeadingZero Function with constant 10 -> GL_ACCOUNT (Field of BAPI)
Similarly this logic should get applied for all the other 3 conditions
But when i used the substring , it throws an error : Error:
Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 1] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[,
I tried creating this Java function: to extract the string, but this throws an error of Java container
Does anyone hve a simple solution . Appreciate your input.
Thanks,
Vara
-
public String Extract_String(String a,Container container){
//write your code here
// u201Cau201D is your input that is reference field
boolean flag=false;
if ((a.contains("ACC_STR"))|| (a.contains("G_L_ACCT "))||( a.contains("COST_CTR"))||(a.contains("AccountCategory")))
{
flag = true;
}
return flag;
}
with Java.lang.* --- > imported , but this throws an error
>>But when i used the substring , it throws an error : Error:
Exception:java.lang.StringIndexOutOfBoundsException: String index out of range: 1 in class com.sap.aii.mappingtool.flib3.TextFunctions method substring
I believe you code as substring(0,7) not substring(0-7)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Baskar ,
The Issue got solved , I used a java function : To exatrct the string comparing the : String value which I provide as Input .
This function inturn consolidate the value and will pass it one context (PO_ACCOUNT ) of BAPI .
I used this code by changing the CONSTANT :(VALUE ) for other 3 conditions mentioned in my query.
Java function:
For Cost Centre(COST_CTR) field of BAPI:
public void Value(String[] a,String[] b,ResultList result,Container container){
Java IMport :java.lang.String;java.lang.*;
//write your code here
int m= a.length;
int n= b.length;
String s="COST_CTR";
for (int i=0; i<m ;i++)
{
if(a<i>.equals(s))
{
result.addValue(b<i>);
}
}
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.