cancel
Showing results for 
Search instead for 
Did you mean: 

Table parameter is not returning values to JAVA UDF RFC LookUp.

Former Member
0 Kudos

Hi All,

In my mapping, in the java UDF i do the RFC lookup and send values. The RFC in ABAP side has

the table parameter.(There is not import or export parameter)
When i execute in se37 the RFC gives the values. But when I do the RFC lookup from my

message mapping it gives only the name of the table parameter.

Additional information:

Earlier the RFC had import and export parameters and from message mapping it was giving

result. But now the requirment changed so i asked my abaper to use Table parameter(NO import or

export parameter) and the abap expert did the code accordingly.
And after this change on the ABAP side,  i reimported the RFC in ESR and activated it and did the "Display queue" on my RFClookup

JAVA UDF. It was giving zeros values in all the return fields.  I don't have any idea so,  I just simply activated

(again) the RFC comm. channel and  did the "Display Queue" on my RFclookup java UDF this

time onwards the RFC response is always giving the table(variable) 'container_dtls' name which has been used

in the table parameter in the RFC on SAP abap.

Below is the abap code in the RFC:

FUNCTION z_uom_orders_shipment_gtn .
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      CONTAINER_DTLS STRUCTURE  ZXSD_ORDRS_GNEX
*"  EXCEPTIONS
*"      NO_ENTRY_FOUND
*"      NO_VALUE_FOUND
*"----------------------------------------------------------------------
  DATA: it_container  TYPE STANDARD TABLE OF zxsd_ordrs_gnex.

  IF NOT container_dtls[] IS INITIAL.
    SELECT * FROM zxsd_ordrs_gnex
             INTO TABLE it_container
             FOR ALL ENTRIES IN container_dtls
             WHERE zcontainertyp = container_dtls-zcontainertyp.
    IF sy-subrc NE 0.
      RAISE no_entry_found.
    ELSE.
      container_dtls[] = it_container[].
    ENDIF.
  ENDIF.
ENDFUNCTION.

Can you please help me to resolve this issue?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184681
Active Contributor
0 Kudos

Hi,

Have a look at this blog by , it describes exactly your requirement:

Regards,

Greg

Former Member
0 Kudos

Hi Greg, Earlier I referred that blog. Now i've problem in looping.

I've corrected the issue and below is the clip of the RFC response:
______________________________________________________________________________________________________
<?xml version="1.0" encoding="UTF-8"?>
<rfc:Z_UOM_ORDERS_SHIPMENT_GTN.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<CONTAINER_DTLS>
<item>
<ZCONTAINERTYP>BIGVAN</ZCONTAINERTYP>
<ZTYPE>L5GP</ZTYPE>
<ZVOLUME>2.4500</ZVOLUME>
<ZLENGTH>105.0000</ZLENGTH>
</item>
<item>
<ZCONTAINERTYP>ISOTNK</ZCONTAINERTYP>
<ZTYPE>L5GP</ZTYPE>
<ZVOLUME>3.1415</ZVOLUME>
<ZLENGTH>123.1100</ZLENGTH>
</item>
</CONTAINER_DTLS>
</rfc:Z_UOM_ORDERS_SHIPMENT_GTN.Response>
______________________________________________________________________________________________________


Below is the JAVA UDF code earlier, when my RFC had Import and 'Export' parameter where the RFC sent back only one value for "ZVOLUME" field. Now the RFC has only table parameter. So I'm having difficulties in looping all the iteration of 'ZVOLUME' field.  The below code snippet right now it stores only the first(2.4500) value of ZVOLUME and get out of the loop.

So, down in the map again when I loop, I'm able to retreive only the first(2.4500) value either through HashMap global variable or Global Container.

*********************************************************************************************************************
  String Lookup_Value_Tag8 = "ZVOLUME";
 
  String Lookup_Value_StartTag8 = "<" + Lookup_Value_Tag8 + ">";
  String Lookup_Value_EndTag8 = "</" +Lookup_Value_Tag8 + ">";
  importantTrace.addWarning("RFC Response::" + content7);
  //Parsing RFC output
    j = 0;
    while ( content7.indexOf(Lookup_Value_StartTag8) != -1 )
             {
     Lookup_Value = content7.substring( content7.indexOf(Lookup_Value_StartTag8) + Lookup_Value_StartTag8.length()  , content7.indexOf(Lookup_Value_EndTag8) ) ;
     VOLUME_Hashmap.put(contType[j], Lookup_Value );   
                   //VOLUME.setParameter(contType[j], Lookup_Value );
        j++;    
     content7 = content7.substring(content7.indexOf(Lookup_Value_EndTag8) + Lookup_Value_EndTag8.length() );
     }  

*********************************************************************************************************************

It would be very helpful, if i get the code snippet on how to loop all the return values of a particular field and store in either in HasMap global variable or GlobalContainer.

Thanks,

raj

Former Member
0 Kudos

I resolved the issue by using the RFCLookUP function instead of Java UDF for RFCLookup.

Thanks,

raj