Page 1 of 1

RFC_READ_TABLE / DUMP / REPARATUR

PostPosted: Tue Aug 25, 2009 11:00 pm
by Tron
Moin,
Der Remotefähige Funktionsbaustein RFC_READ_TABLE bricht ab, wenn die Tabelle Felder vom Typ Floating Point besitzt, z.B. SAPLANE.
Grund ist ein CASTING - Problem (siehe ST22 :wink: ).

:!: mögliche Abhilfe:
1.) Funktionsgruppe anlegen z.B.ZSDTX

2.) Funktionsbaustein RFC_READ_TABLE auf Z_RFC_READ_TABLE kopieren und der Funktionsgruppe zu 1. zuweisen.

3.) Codingstelle aufsuchen und durch folgendes Coding ersetzen und aktivieren.

4.) freuen, da SAP bekundet, diesen Baustein nicht auszubessern.
(unter 3.1 hat er ja auch noch funktioniert !)

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. * ----------------------------------------------------------------------
  2. *  read data from the database and copy relevant portions into DATA
  3. * ----------------------------------------------------------------------
  4. * output data only if NO_DATA equals space (otherwise the structure
  5. * information in FIELDS is the only result of the module)
  6. IF NO_DATA EQ SPACE.
  7.  
  8. DATA: DREF TYPE REF TO DATA, BEGIN OF WORK, BUFFER(30000), END OF WORK.
  9.  
  10. FIELD-SYMBOLS: <WA> TYPE ANY, <COMP> TYPE ANY.
  11. CREATE DATA DREF TYPE &#40;QUERY_TABLE&#41;.ASSIGN DREF->* TO <WA>.
  12.  
  13. IF ROWCOUNT > 0.
  14.   ROWCOUNT = ROWCOUNT + ROWSKIPS.
  15.  
GeSHi ©

gruß Tron

Daten über RFC und XKL mittels Transformation lesen

PostPosted: Thu Mar 04, 2010 12:19 pm
by Mayla2583
Die Bausteine RFC_READ_TABLE und Co sind fehlerhaft, warum nicht im XML
Zeitalter dieses Format benutzen. SAP bietet hier für ein neuen ABAP Befehl
CALL TRANSFORMATION
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. function z_rfc_readtable_as_xml.
  2. *"----------------------------------------------------------------------
  3. *"*"Lokale Schnittstelle:
  4. *"  IMPORTING
  5. *"     VALUE&#40;TABNAME&#41; TYPE  TABNAME
  6. *"     VALUE&#40;TRANSID&#41; TYPE  CXSLTDESC DEFAULT 'ID'
  7. *"     VALUE&#40;SELPARA&#41; TYPE  STRING OPTIONAL
  8. *"  EXPORTING
  9. *"     VALUE&#40;XML&#41; TYPE  STRING
  10. *"----------------------------------------------------------------------
  11. *Für den Datentransport beliebiger Tabellen über XML Serializierung
  12. data itab type ref to data.
  13. field-symbols <itab> type table.
  14.  
  15. create data itab type table of &#40;tabname&#41;.
  16. assign itab->* to <itab>.
  17.  
  18. select * from &#40;tabname&#41; into table <itab> where &#40;selpara&#41;.
  19.  
  20. call transformation &#40;transid&#41;
  21. source table = <itab>
  22. result xml xml.
  23.  
  24.  
GeSHi ©

Nun kann selbst im SAP auch wieder deserializiert werden
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1.   itab type table of zmytable,
  2.  xml type string,
  3.  wsel type string.
  4.  
  5. wsel = 'FIELD1 = ??? and FIELD2 = ???'.
  6.  
  7. call function 'Z_RFC_READTABLE_AS_XML' destination 'XYZ'
  8.   exporting
  9.     tabname       = 'ZMYTABLE'
  10.    TRANSID       = 'ID'
  11.     selpara       = wsel
  12.   importing
  13.     xml           = xml.
  14.  
  15. call transformation id
  16.       source xml xml
  17.       result table = itab[].
  18.  
GeSHi ©