Code: Alles auswählen.
REPORT ztest3 .
DATA: d1(100),
d2(10) TYPE n,
d3(30),
tabname(20),
xres1 like D021S_RES1,
landx TYPE landx,
nummer(2) TYPE n,
tabix TYPE sytabix.
DATA:
h TYPE d020s,
f LIKE d021s OCCURS 0 WITH HEADER LINE,
e LIKE d022s OCCURS 0 WITH HEADER LINE,
m LIKE d023s OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_anz(2) TYPE n DEFAULT 7.
START-OF-SELECTION.
IMPORT DYNPRO h f e m
ID 'SAPMZTESTTAB1 9000'.
READ TABLE f WITH KEY fnam = 'DYNA1_SCA'.
IF sy-subrc = 0.
f-line = p_anz.
f-coln = '99'.
MODIFY f INDEX sy-tabix.
ENDIF.
******** Alte Reiter löschen ************
LOOP AT f WHERE fnam(4) = 'TAB_' AND coln > 1.
DELETE f.
ENDLOOP.
**** Referenz-Reiter lesen
READ TABLE f WITH KEY fnam = 'DYNA1_TAB1'.
IF sy-subrc = 0.
CLEAR nummer.
SELECT landx FROM t005t INTO landx UP TO p_anz ROWS
WHERE spras = 'D'.
nummer = sy-dbcnt.
CONCATENATE 'DYNA1_TAB' nummer INTO tabname.
READ TABLE f WITH KEY fnam = tabname.
IF sy-subrc > 0.
tabix = sy-tabix + 1.
f-coln = f-coln + 1.
f-auth = '100'.
f-leng = 12.
SET BIT 6 OF f-fmb1 TO 0.
CONCATENATE 'TAB_' nummer INTO f-fnam.
xres1 = f-res1.
xres1-funccode = f-fnam.
f-res1 = xres1.
f-stxt = landx.
INSERT f INTO f INDEX tabix.
ENDIF.
ENDSELECT.
EXPORT DYNPRO h f e m
ID 'SAPMZTESTTAB1 9000'.
GENERATE DYNPRO h f e m
ID 'SAPMZTESTTAB1 9000'
MESSAGE d1 LINE d2 WORD d3.
ENDIF.
CALL TRANSACTION 'ZTESTTAB'.