CALL SCREEN USING RADIO CONTROL BUTTONS.
Simple program to understand how call screen can be used within action of radio buttons.we have 2 radio buttons , if you select header , you will have dialog screen with 10,100, 10, 10. with an select-option i have not made it OBLIGATORY,but you can make it.
then you enter the values you could see the header table data.
same in case of line item .
&---------------------------------------------------------------------*
*& Report ZSCREENCREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSCREENCREATE.
******************HEADER DATA
TYPES: BEGIN OF ty_vbak,
VBELN TYPE VBELN ,
ERDAT TYPE ERDAT,
ERNAM TYPE ERNAM,
NETWR TYPE NETWR,
END OF TY_VBAK.
**************NOW LINE ITEM DATA******************
TYPES: BEGIN OF TY_VBAP,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
MATNR TYPE MATNR,
MATKL TYPE MATKL,
END OF TY_VBAP.
*************************************************
DATA: IT_VBAP TYPE TABLE OF TY_VBAP,
WA_VBAP TYPE TY_VBAP.
DATA: IT_VBAK TYPE TABLE OF TY_VBAK,
WA_VBAK TYPE TY_VBAK.
**************************************************
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECT-OPTIONS : S_VBELN FOR WA_VBAK-VBELN.
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 101.
SELECT-OPTIONS: K_VBELN FOR WA_VBAP-VBELN.
SELECTION-SCREEN END OF SCREEN 101.
PARAMETERS: HEADER RADIOBUTTON GROUP RG1 ,
ITEM RADIOBUTTON GROUP RG1.
IF HEADER = 'X'.
CALL SELECTION-SCREEN 100 STARTING AT 10 10 ENDING AT 100 10.
PERFORM GET_VBAK.
PERFORM DC_DISPLAY.
ELSE.
CALL SELECTION-SCREEN 101 STARTING AT 10 10 ENDING AT 100 10.
PERFORM GET_VBELN.
PERFORM ITEM_DISPLAY.
ENDIF.
*&---------------------------------------------------------------------*
*& Form GET_VBAK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_VBAK .
SELECT VBELN
ERDAT
ERNAM
NETWR
FROM VBAK INTO TABLE IT_VBAK WHERE VBELN IN S_VBELN.
ENDFORM. " GET_VBAK
*&---------------------------------------------------------------------*
*& Form DC_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DC_DISPLAY .
LOOP AT IT_VBAK INTO WA_VBAK.
AT FIRST.
WRITE:10 'SALES DOC NO',
15 'DATE OF PURS',
25 'EMPL NAME ',
35 ' TOTAL'.
ENDAT.
WRITE: 10 WA_VBAK-VBELN,
15 WA_VBAK-ERDAT,
25 WA_VBAK-ERNAM,
35 WA_VBAK-NETWR.
AT LAST.
WRITE:'header table display'.
ENDAT.
ENDLOOP.
ENDFORM. " DC_DISPLAY
*&---------------------------------------------------------------------*
*& Form GET_VBELN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_VBELN .
SELECT VBELN
POSNR
MATNR
MATKL
FROM VBAP INTO TABLE IT_VBAP where vblen in k_vbeln.
ENDFORM. " GET_VBELN
*&---------------------------------------------------------------------*
*& Form ITEM_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ITEM_DISPLAY .
LOOP AT IT_VBAP INTO WA_VBAP.
AT FIRST .
WRITE: 10 'SALE DOC NO',
25 'ITEM NUM',
35 'MATERIAL ',
45 'TEST'.
ENDAT.
WRITE: 10 WA_VBAP-VBELN,
25 WA_VBAP-POSNR,
35 WA_VBAP-MATNR,
45 WA_VBAP-MATKL.
ENDLOOP.
ENDFORM. " ITEM_DISPLAY
if you select any radio button , you will see a dialog screen like this prompting on your screen , just simply enter the values.
if you enter the value then will get the values like this .
if you are selecting item then you can see the ouput as following