Google Search - Blog...........

Dynamic Internal Table With A Single Field

DATA:
o_ref TYPE REF TO data.
FIELD-SYMBOLS:
TYPE STANDARD TABLE,
TYPE ANY,
TYPE ANY,
TYPE ANY.
PARAMETERS:
p_tab TYPE tabname default 'MARA', " Table name (eg: MARA)
p_field(20) TYPE c default 'MATNR'. " Field name (eg: MATNR)

START-OF-SELECTION.
CREATE DATA o_ref TYPE TABLE OF (p_tab).

ASSIGN p_field TO .
ASSIGN o_ref->* TO .

SELECT *
INTO TABLE
FROM (p_tab).

LOOP AT ASSIGNING .
ASSIGN COMPONENT OF STRUCTURE
TO .
IF sy-subrc = 0.
WRITE:/ .
ENDIF.
ENDLOOP.

No comments:

Post a Comment