on 04-15-2014 8:04 AM
Hello Experts,
I'm trying to call FM salert_create using standard RFCLookup but my problem is:
Though i pass all the input values, Alert is getting created only with one value.
Below are my Queue values
but the alert is getting created only with the first value "Dummy Message".
so this means that the FM is called only with the first value.
could you please help?
Hi Eng,
My inbox is flooding with huge number of Alert emails with no vaues
Thanks,
Glory
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Eng for checking!
I tried to do this the other way: In my case almost all the values are constanst so instead of passing them dynamically i'm trying to hardcode them in RFC.
And i need only one value dynamically which has been highlighted below.
First two inputs are mapped to a constant.
But in this case I'm getting the following error:
"The argument with index 1 was not bound to a node in rfc request structure. This indicates a bug, which may cause infinite loop in transformation. Contact development support for assistance. See error logs for details"
Any idea on this or is this a right way??
Hi Glory
OSS note 1674730 describes the error you are getting.
Symptom
Infinite number of calls are being triggered to an RFC from a standard RFC
lookup function used in message mapping. This can cause memory issues and
increased CPU utilization.
The number of values in item node cannot be less than the number of contexts in element VALUE. If you map constant to item (means only 1 value), and VALUE has 5 entries, it will hit the condition mentioned in the OSS note.
Can you try removing item from the input parameter?
Rgds
Eng Swee
Hi Glory
I've tried this on my system and managed to get it to work in the following way.
Define only three input parameters for the RFCLookup function. You can hardcode IP_CAT, ELEMLENGTH (suggest the maximum value that you expect from the different ELEMENT coming in) and TYPE.
Here is the mapping and how the queues look like. Please make sure for Item you have the same number of values as the different context that will appear in ELEMENT and VALUE. Easiest way to achieve this is to map it from the parent segment of ELEMENT or VALUE.
This is a sample of the alert generated from the above test.
NOTE: I tried having ELEMLENGTH as an input for the function but somehow it did not work. I think sometimes this RFCLookup function is a bit buggy!
Please try this out and let me know how it goes.
Rgds
Eng Swee
Hi Glory
Yes, I did "Duplicate Subtree" in test tab to generate the additional elements
The structure should be like this
<Item>
<ELEMENT>SXMS_RULE_NAME</ELEMENT>
<VALUE>MY_RULE_NAME</VALUE>
</Item>
<Item>
<ELEMENT>SXMS_ERROR_CAT</ELEMENT>
<VALUE>MY_ERROR_CAT</VALUE>
</Item>
<Item>
<ELEMENT>SXMS_ERROR_CODE</ELEMENT>
<VALUE>MY_ERROR_CODE</VALUE>
</Item>
<Item>
<ELEMENT>SXMS_FROM_PARTY</ELEMENT>
<VALUE>MY_FROM_PARTY</VALUE>
</Item>
<Item>
<ELEMENT>SXMS_FROM_SERVICE</ELEMENT>
<VALUE>MY_SERVICE</VALUE>
</Item>
Rgds
Eng Swee
Hi Eng,
Here is the source payload:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:QualityResults_GV xmlns:ns0="XXXXXXXXXXX">
<Recordset>
<Indicator>C</Indicator>
<InspPoint> </InspPoint>
<UsageDecision> </UsageDecision>
<InspectionLot/>
<TestNo>XXXX</TestNo>
<AnalyteNo>XXXX</AnalyteNo>
<TestCode>XXX </TestCode>
<QuanResult>XXX </QuanResult>
<CodeGroup> </CodeGroup>
<Code> </Code>
<InspectionDesc> </InspectionDesc>
</Recordset>
</ns0:QualityResults_GV>
And as i told you earlier, i'll be passing five sets of ELEMENT and VALUE to RFCLookUP among which four sets are constants and in the fifth set, below three values has to be concatenated and passed to field 'VALUE'.
<TestNo>XXXX</TestNo>
<AnalyteNo>XXXX</AnalyteNo>
<TestCode>XXX </TestCode>
Can you please check?
Hi Glory
My suggestion is that you have a UDF before the RFCLookup function to generate the appropriate queues into the RFC input parameters.
I don't have access to a system right now, but you can try something like this below - I hope there is no syntax problem there. Please change the hardcoded values according to your requirement.
UDF type - Queue
Input:
TestNo - String[]
AnalyteNo - String[]
TestCode - String[]
Output:
item - ResultList
element - ResultList
value - ResultList
//Element 1
item.addValue(“”);
element.addValue(“ELEMENT1”);
element.addContextChange();
value.addValue(“Value1”);
value.addContextChange();
//Element 2
item.addValue(“”);
element.addValue(“ELEMENT2”);
element.addContextChange();
value.addValue(“Value2”);
value.addContextChange();
//Element 3
item.addValue(“”);
element.addValue(“ELEMENT3”);
element.addContextChange();
value.addValue(“Value3”);
value.addContextChange();
//Element 4
item.addValue(“”);
element.addValue(“ELEMENT4”);
element.addContextChange();
value.addValue(“Value4”);
value.addContextChange();
//Element 5
item.addValue(“”);
element.addValue(“ELEMENT5”);
value.addValue(TestNo[0] + AnalyteNo[0] + TestCode[0]);
The other alternative is to actually hardcode all the details into the message text that you have configured in ALRTCATDEF. This way, you just need to pass in 1 line into the RFC which is the concatenation of the values you want.
It's up to you which approach you prefer to go for.
Rgds
Eng Swee
Hi Glory,
From your above posts I see that for the FM used in RFC lookup, there are 5 input fields being used for input parameters and only 1 field being used for export parameter. That is the reason why it is giving single value as output.
Note: there should be 5 corresponding fields used for export parameters, one each for input fields.
It should work then.
Thanks and Best Regards
Souvik Bhattacharjee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Glory
Try having context changes between your input values. You can use SplitByValue function before the inputs of the RFC.
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Glory
Write an UDF and pass all the input values in a single queue. Then inside the UDF write the code for RFC look up.
Use a for loop to populate the item node. I think that will work.
Sample code
java.util.Map map;
try {
String msgid;
map = container.getTransformationParameters();
msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
Channel channel = LookupService.getChannel("XXXCLNT100","CC_RFC_R_PI");
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
String rfcXML= "<ns0:SALERT_CREATE xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">"+
"<IP_ALIAS/>"+
"<IP_APPLICATION_GUID/>"+
"<IP_CAT>ALERT_TEST_UDF</IP_CAT>"+
"<IP_XML_CONTAINER/>"+
"<IT_CONTAINER>"+
"<item>"+
"<ELEMENT>ZCUSTOMER</ELEMENT>"+
"<TAB_INDEX>0</TAB_INDEX>"+
"<ELEMLENGTH>20</ELEMLENGTH>"+
"<TYPE>C</TYPE>"+
"<VALUE>"+pnum+"</VALUE>"+
"</item>"+
"<item>"+
"<ELEMENT>ZMSGID</ELEMENT>"+
"<TAB_INDEX>1</TAB_INDEX>"+
"<ELEMLENGTH>70</ELEMLENGTH>"+
"<TYPE>C</TYPE>"+
"<VALUE>"+msgid+"</VALUE>"+
"</item>"+
"</IT_CONTAINER>"+
"</ns0:SALERT_CREATE>";
InputStream inputStream =new ByteArrayInputStream(rfcXML.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload rfcOutPayload = accessor.call(payload);
throw new StreamTransformationException ( " Message Mapping Failed because of invalid Customer number");
}
catch(Exception e)
{
throw new RuntimeException("Exception while checking for Distribution channel : "+e);
}
User | Count |
---|---|
84 | |
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.