Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SELECT from a remote dictionary table

matteo_montalto
Contributor
0 Likes
2,030

Hi all mates,

I'm trying to make a simple record that, assuming a logical system "target" is specified with a parameter, tries to retrieve all the entries in a dictionary, std table (i.e, the EKPO one, to retrieve Order Requisition numbers of that system) of a remote system.

Example: the parameter I specify is the target logical system: a select option then declared as follows:

SELECT-OPTIONS s_po_id FOR wa_po-object_id.

has a related search help that I would like to do as follows:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_po_id-low.

DATA: it_help_item TYPE TABLE OF my_alv_type,

it_return TYPE TABLE OF ddshretval.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE it_help_item

FROM remoteEKPO (that is to say, EKPO in log_sys specified)

WHERE ....

Is something like this possible in an "easy" way? Or the only way to do it is to implement a function in each backend to retrieve the local EKPO via RFC?

Thanks a lot for your help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,222

Hi Matteo

There's the std fm module RFC_READ_TABLE to read a SAP table

Max

6 REPLIES 6
Read only

Former Member
0 Likes
1,223

Hi Matteo

There's the std fm module RFC_READ_TABLE to read a SAP table

Max

Read only

0 Likes
1,222

Max,

I think this fm will not work with qty & unit fields in ECC 6.

a®

Read only

0 Likes
1,222

Hi

Yes I know

there's a oss note about this problem, i don't remember the number, but this is its concept:

There's no solution, if the available std fm for RFC can't work for a certain table: it can only create an own fm for that table.

Max

Read only

0 Likes
1,222

Thanks all mates,

better explain my current need... I JUST need to extract Purchase Order numbers, and not details, in order to put them in a subsequent ALV mask for selection. Do you think that method can do what I'm looking for?

Read only

0 Likes
1,222

Hi

In this case u can use the fm RFC_READ_TABLE: here u need to indicate which table has to be read and which fields has to be extracted.

If you need to get only "CHAR" field that fm is ok:

DATA: T_WHERE  TYPE TABLE OF RFC_DB_OPT,
      T_FIELDS TYPE TABLE OF RFC_DB_FLD,
      T_DATA   TYPE TABLE OF TAB512.

CALL FUNCTION 'RFC_READ_TABLE' DESTINATION <DEST>
  EXPORTING
    query_table                = 'EKPO'
*   DELIMITER                  = ' '
*   NO_DATA                    = ' '
*   ROWSKIPS                   = 0
*   ROWCOUNT                   = 0
  tables
    OPTIONS                    = T_WHERE    "<---- Where conditions
    fields                     = T_FIELDS   "<---- Field to be extracted
    data                       = T_DATA     "<---- Results
* EXCEPTIONS
*   TABLE_NOT_AVAILABLE        = 1
*   TABLE_WITHOUT_DATA         = 2
*   OPTION_NOT_VALID           = 3
*   FIELD_NOT_VALID            = 4
*   NOT_AUTHORIZED             = 5
*   DATA_BUFFER_EXCEEDED       = 6
*   OTHERS                     = 7
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Max

Read only

0 Likes
1,222

Thx to ya all mates