Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Bugs, Bugs, Bugs!


I ocassionally get the odd email regarding bugs, and development issues for SAP::Rfc for Perl (saprfc for Python, and SAP::Rfc for Ruby), and two days ago I got one that indicated that the handling of ABAP DEC type fields in a structure (for structured parameters or tables) was broken.




I thought this was strange, as this is a core kind of function that SAP::Rfc has handled for a number of years, but I wanted to look into it, as I have been known to introduce new features that break old ones before, :-).

The Test Case


My helpful tester (who will remain nameless, and does not fall into the category of "I have a friend who ...."), supplied me with a code sample, which I distilled down to:

use SAP::Rfc;

  1. connect to SAP

my $rfc = new SAP::Rfc( ... );

  1. lookup interface definition

my $if = $rfc->discover("RFC_READ_TABLE");

  1. populate interface for call

  2. - we are reading the Number Range Object definition table

$if->QUERY_TABLE('TNRO');

$if->OPTIONS( ["OBJECT LIKE 'ARCHIVELNK%'"] );

  1. get auxillary helper structure definition

my $str = $rfc->structure('TNRO');

  1. do the business

$rfc->callrfc($if);

  1. loop through each row and pass into

  2. helper structure to access field values

foreach my $row ($if->DATA()){

  $str->value($row);

 

  1. get the Number Range PERCENTAGE value

  warn "TNRO-PERCENTAGE: ".$str->OBJECT." ".$str->PERCENTAGE."\n";

}

</pre>

</p>

RFC_READ_TABLE


RFC_READ_TABLE (as you may have guessed) is a Remote call enabled Function Module, for reading rows (and optionally, specific columns) from any given table in R/3. You can supply the function a TEXT like table representing the WHERE clause to specify what filtering on the SQL query you want. This Function Module has been available since goodness knows when (I would think at least back to 3.0x - probably earlier).

Running the Test


The above code gave me a result like:


TNRO-PERCENTAGE: ARCHIVELNK 2a.2


What!

- 2a.2 - doesn't look like a percentage to me!


The actual PERCENTAGE value for the ARCHIVELNK number range object on my system (NW4 Test Drive 6.40 - 2004) is 10.0%, so there is something clearly wrong going on here.



Next stop was to fire up transaction SE37, and to debug the test directly. So start SE37, enter RFC_READ_TABLE, and then hit F8. Enter the parameters as follows:


QUERY_TABLE => TNRO

DELIMITER => "|"

OPTIONS table - enter one row as => OBJECT LIKE 'ARCHIVELNK%'

And then press ALTSHIFTF7 for debug.

.....

  •   copy all relevant fields into DATA (output) table

      LOOP AT FIELDS_INT.

        IF FIELDS_INT-TYPE = 'P'.

If all goes according to plan then you should get a situation like this (below).  Notice the field values that I have selected to display.

The Bug

What Now?


Well firstly - Phew - there isn't a bug in SAP::Rfc. Secondly, I think that this should be fixed, as I would hate to see an Iconic tool such as RFC_READ_TABLE languish into history - any takers?

8 Comments