cancel
Showing results for 
Search instead for 
Did you mean: 

RFC to ECC with list of items

former_member183909
Active Participant
0 Kudos

Hope this is a simple question.  I have a remote enabled ECC function module that has import parameters and a list of items.  But when I import this RFC into SAP PI repository the request/response part of the message are not what I expect.  The list of items in only appears as a list of unbounded items in the response part.

Z_PO_CREATE    
  CUSTOMER_ID
  CUSTOMER_ORDERNO

  ORDERITEMS
           item (unbounded)   
                 MATERIALID
                 QTY
                 MEINS

The message mapping will of course only allow me to select either the Request part of the RFC or the Response part of the RFC.  The Request part does not have ORDERITEMS.item as unbounded list.  The Response part only contains the ORDERITEMS.item unbounded list.

I need to pass into SAP ECC the Customer#, CustomerOrder# and a list of Items.  How do I do this with an RFC?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183909
Active Participant
0 Kudos

Hi

yes should have also said that I have done the mapping and can map the ORDERITEMS.items

But the problem I see is when the items are passed to the SAP ECC RFC they appear empty.

I have unit tested the message mapping and it prepares message correctly.

<?xml version="1.0" encoding="UTF-8"?>

<ns1:ZRH_TESTHARNESS_PO_CREATE xmlns:ns1="urn:sap-com:document:sap:rfc:functions">

   <CUSTOMER_ID>0004567890</CUSTOMER_ID>

   <CUSTOMER_ORDERNO>TEST412</CUSTOMER_ORDERNO>

   <VENDOR>Vendor1</VENDOR>

   <ORDERITEMS>

      <item>

         <MATERIALID>Bike</MATERIALID>

         <QTY>1</QTY>

         <MEINS>EA</MEINS>

      </item>

      <item>

         <MATERIALID>Bus</MATERIALID>

         <QTY>1</QTY>

         <MEINS>EA</MEINS>

      </item>

   </ORDERITEMS>

</ns1:ZRH_TESTHARNESS_PO_CREATE>

I have set a session debug in SAP ECC and when I use my SAP PI ICO scenario to actually call this I can see in SAP ECC debug mode and the items are empty !.  Why do you think is happening ?

former_member184720
Active Contributor
0 Kudos

Hi.. I'm not an ABAP expert but you are looping at ORDERITEMS segment which is always one.

I'm not sure if you should look for the item segment under ORDERITEMS.

Sorry if it doesn't make sense.

former_member183909
Active Participant
0 Kudos

Hi

the ABAP RFC only has ORDERITEMS.  The loop is correct.  In any case I can see that it is empty.

(The RFC adapter should look after moving the XML message ORDERITEMS.item into the appropriate ABAP function module "format"  - that is into the import table of ORDERITEMS.)

So why the ORDERITEMS in the called RFC is empty is a mystery that needs solving.

former_member184720
Active Contributor
0 Kudos

Hi Jonny - Did you map anything for the node ORDERITEMS in PI?

May be try mapping it with a blank constant and see if that way RFC reads the data.

former_member183909
Active Participant
0 Kudos

yes a constant.   I can see that the message is correctlyproduced by the message mapping (see my post @ 05/02/2014 3:20 AM).

However when this is passed into SAP ECC the orderitems are empty!.  Why so ?

iaki_vila
Active Contributor
0 Kudos

Hi Jonny,

I've noticed that you are using a ZRFC, have you included the tables metadata lately?, sometimes the PI caches the last metadata used, have you tried to clear the cpa cache? (http://host:50000/CPACache/refresh?mode=full with pidiruser)

Regards.

former_member183909
Active Participant
0 Kudos

thanks Inaki !.   Cache refresh was all that was required. 

Answers (2)

Answers (2)

former_member184720
Active Contributor
0 Kudos

Hi Jonny - The default view doesn't show the occurence field of the RFC.

However you can go to WSDL tab and search for the field "item", you'll able to find the below..

<xsd:element name="item" type="ZRH_TH_ORDERITEM" minOccurs="0" maxOccurs="unbounded" />

So you can use the request structure without any issues

iaki_vila
Active Contributor
0 Kudos

Hi Jonny,

I think it is only a visualization problem because in the request you are not showing the occurrences column. When you import a variable in Tables tab the PI always takes this variable tab like unbounded. Please, try now to use the Request RFC in a message mapping and you will see  OrdersItem will be unbounded. Also, the item tag in the RFC metadata is a clue, because PI create automatically the item tag to deal with tables (unbounded max occurrences).

Regards.