cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in standard RFCLookup using SALERT_CREATE

Former Member
0 Kudos


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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


Hi Eng,

My inbox is flooding with huge number of Alert emails with no vaues

Thanks,

Glory

engswee
Active Contributor
0 Kudos

Oh no!! Please stop your RFC receiver channel first and revert to your previous mapping. I will check on this further and get back to you.

Former Member
0 Kudos

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??

engswee
Active Contributor
0 Kudos

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

engswee
Active Contributor
0 Kudos

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

Former Member
0 Kudos


Hi Eng,

Can you show me the node "Item"?

I just wanted to see how you are passing five different ELEMENT and VALUES.

Are you sending it by replicating the node in test tab?

Thanks,

Glory.

engswee
Active Contributor
0 Kudos

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

Former Member
0 Kudos


Hi Eng,

Your suggesstion works perfectly.

But in my case i'm not mapping the fields from parent node instead all of them are constants and only the 'VALUE' is from source structure.

Do we need to have some intermediate mapping to achieve this?

Thanks,

Glory.

engswee
Active Contributor
0 Kudos

Hi Glory

If not all the values are coming from the source, can you please share the schema and the sample source payload here? I can then understand how it is and be able to assist further.

RGds

Eng Swee

Former Member
0 Kudos

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?

engswee
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hello Eng,

Sorry for the delay.

But your idea of writing an UDF before using RFCLookup helped me to fix this issue.

Thank you so much!!! you were of great help!!!

Thanks,

Glory.

engswee
Active Contributor
0 Kudos

Hi Glory

Glad to hear that your issue has been resolved

Rgds

Eng Swee

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello Eng,

Here you go:

Thanks,

Glory.

engswee
Active Contributor
0 Kudos

Hi Glory

Can you try adding the following two input parameters to the lookup?

IT_CONTAINER - map to any Constant

item - map to some source structure but make sure there are no context change between all the 5 values

Rgds

Eng Swee

engswee
Active Contributor
0 Kudos

Hi Glory

Try having context changes between your input values. You can use SplitByValue function before the inputs of the RFC.

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee,

When i use SplitByValue before the input values, 5 different alerts are getting created for each of the inputs.

Below are the queue values:

I want a single alert to be created with all the 5 values.

Any suggesstions?

Thanks,

Glory.

engswee
Active Contributor
0 Kudos

Hi Glory

You need to make sure that the input parameters to the RFCLookup function only generates 1 single RFC call.

Can you please share a screenshot of how you declare your input 0-5 of the RFCLookup (basically double click the function and share that screen)?

Rgds

Eng Swee

Former Member
0 Kudos

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);

}

Former Member
0 Kudos

Hi Indrajit,

Thanks for the sample code.

Actually our intention is to use standard RFCLookup instead of  UDF.

But let me try with the code u provided.

Thanks,

Glory.