cancel
Showing results for 
Search instead for 
Did you mean: 

Data structures in RFC call

Former Member
0 Kudos

Hi,

still struggeling with the RFC calls from Ruby.

Unfortunately I could not get the new NWRFCSDK installed on my computer. So I am using the saprfc-0.34 version.

When calling the RFC BAPI_SALESORDER_GETLIST, I can not address the fields of the SALES_ORDERS return structure.

-


itab = rfc.discover("BAPI_SALESORDER_GETLIST")

itab.CUSTOMER_NUMBER.value = $Kunnr

itab.SALES_ORGANIZATION.value = $VKORG

rfc.call(itab)

orders = itab.SALES_ORDERS

-


I see the lines of an array "orders" containing a list of all the orders information, but addressing the fields with orders.nextHashrow results in a timeout.

It seems that the "orders" array contains the complete table line of the SALES_ORDERS return structure in one string field.

How can I address the individual fields like "SD_DOC" in the line ?

Any help is appreciated.

Regards

Marcus

Accepted Solutions (0)

Answers (3)

Answers (3)

marcus_schiffer
Active Participant
0 Kudos

Hi Piers,

thanks for the reply.

Yes I am on windows XP (SAP on AIX). The struggle with (not successful) installation of NWRFCSDK is shown below. Maybe there is stilll a chance to get setup.rb find the ".h" files ?

Otherwise the wrapper may be a (costly) solution. Then I would rather switch to the SAPWAS WebService connector which I dismissed originally due to the need for creating all that Service Stuff.

Regards

Marcus

Former Member
0 Kudos

OK - I remember - I think your compiling problems were to do with a broken build environment. With the mkmf.log file information you needed to figure out how to get the test compile program to build successfully in your environment. This will be largely dependent on what compiler you have installed, what libraries you have, and how you have set your environment up (including shell variables).

Once you've cracked that - setup.rb should work fine with what ever amendments you find that you need.

Cheers.

marcus_schiffer
Active Participant
0 Kudos

Thanks for the reply,

the array has a total of 20 lines each has 49 fields. Both of the hashRows methods do not work on the structure. I followed the conversion in debug mode and found, that the values are not correctly mapped to the fields. Also the Aptana IDE throws errors (without detail) Obviously a problem with offset is occuring.

I tried the example with RFC_READ_TABLE which worked fine. Maby a certain field type is not going through correctly ?

Regards

Marcus

Former Member
0 Kudos

That's entirely possible. RFC_READ_TABLE converts all fields to a display representation, so it would get around this.

The quickest solution for you would be to create a wrapper RFC function, and output only the fields that you want - converted to display, if you cannot find a way to get sapnwrfc working in your environment (I'm assuming your on windows?).

Cheers.

Former Member
0 Kudos

Pity about sapnwrfc - it really is better - eventually you'll have to deal with unicode, and it that will make the difference. Are you on windows? Perhaps we can get Ulrich Schmidt to help with this?

you should try:

itab.SALES_ORDERS.hashRows {|r|

...

}

If this is timing out, then I'd like to know how many rows you have in the table, as that would be the time related factor there.

When you do:

orders = itab.SALES_ORDERS.value

That is returning you an array of the un-structured rows.

you can work on each row by using the SAP::Struct helper class:

str = itab.SALES_ORDERS.structure

itab.SAPLES_ORDERS.value.each{|r|

rhash = str.toHash(r)

...

}

Cheers.