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

ABAP - Selection Screen With Push Buttons

REPORT ztest.

tables:mara,
marc,
mard,
sscrfields.

data: begin of it_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
pstat like mara-pstat,
ernam like mara-ernam,
end of it_mara.

selection-screen begin of screen 100 as subscreen.
selection-screen begin of block b1 with frame title text-001.
select-options:matno for mara-matnr.
selection-screen end of block b1.
selection-screen end of screen 100.

selection-screen begin of screen 200 as subscreen.
selection-screen begin of block b2 with frame title text-002.
select-options:industry for mara-meins.
selection-screen end of block b2.
selection-screen end of screen 200.

selection-screen begin of screen 300 as subscreen.
selection-screen begin of block b3 with frame title text-003.
select-options:mattype for mara-mtart.
selection-screen end of block b3.
selection-screen end of screen 300.

SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK SUB FOR 15 LINES,
END OF BLOCK SUB.


initialization.

SSCRFIELDS-FUNCTXT_01 = '@0D@'.
SSCRFIELDS-FUNCTXT_02 = '@0E@'.
SUB-PROG = SY-REPID.
SUB-DYNNR = 100.

AT SELECTION-SCREEN.
CASE SY-DYNNR.

WHEN 100.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 300.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 200.
ENDIF.

WHEN 200.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 100.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 300.
ENDIF.

WHEN 300.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 200.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 100.
ENDIF.
ENDCASE.

START-OF-SELECTION.

select matnr
meins
mtart
pstat
ernam
from mara
into table it_mara
up to 100 rows
where matnr in matno.

loop at it_mara.
write:/ it_mara-matnr,
it_mara-meins,
it_mara-mtart,
it_mara-pstat,
it_mara-ernam.
endloop.

end-of-selection.

No comments:

Post a Comment