‎2013 Jan 23 5:52 AM
hai all,
thai is raju i new from the abap, i develop one report but it's not executing, can any helpm me,
this is my code..........
DATA FLAG.
TABLES : mara ,
t001 ,
t001w .
TABLES SSCRFIELDS.
CONSTANTS : c_yes TYPE c VALUE '1' ,
c_no TYPE c VALUE '0' .
TYPES : BEGIN OF ty_mara,
matnr TYPE MATNR,
ersda type ERSDA,
ernam type ERNAM,
mtart type MTART,
matkl type MATKL,
END OF ty_mara.
data : it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara.
*Define three option button with USER-COMMAND clause
*Note the in option button group you can specify USER-COMMAND only once
PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1 , "Material
p_opt2 TYPE c RADIOBUTTON GROUP radi , "Company Code
p_opt3 TYPE c RADIOBUTTON GROUP radi . "Plant
*PUSHBUTTON 4(10) BUT1 USER-COMMAND CLI1.
*Define user inputs for respective option button, uset MODIF ID
*to identify the control as run time
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID op1 , "Material
s_bukrs FOR t001-bukrs MODIF ID op2 , "Company Code
s_werks FOR t001w-werks MODIF ID op3 . "Plant
SELECTION-SCREEN SKIP.
*SELECTION-SCREEN FUNCTION KEY 1. "Adds button to application toolbar
* Declaration of sel screen buttons
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN PUSHBUTTON 5(10) but1 USER-COMMAND usr1 MODIF ID op1.
SELECTION-SCREEN PUSHBUTTON 18(10) but2 USER-COMMAND usr2 MODIF ID op2.
SELECTION-SCREEN PUSHBUTTON 32(10) but3 USER-COMMAND usr3 MODIF ID op3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
INITIALIZATION.
but1 = 'material'.
but2 = 'co.code'.
but3 = 'Plant'.
*At selecttion screen output act as PBO where we can change the screen
*attributes, inside LOOP AT SCREEN
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF screen-group1 = 'OP1' .
IF p_opt1 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP2' .
IF p_opt2 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP3' .
IF p_opt3 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
START-OF-SELECTION.
*AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'USR1'.
FLAG = '1'.
WHEN 'USR2'.
FLAG = '2'.
WHEN 'USR3'.
FLAG = '3'.
ENDCASE.
CASE FLAG.
WHEN '1'.
PERFORM display_output.
exit.
* WRITE / 'Button 1 was clicked'.
WHEN '2'.
WRITE / 'Button 2 was clicked'.
WHEN '3'.
WRITE / 'Button 3 was clicked'.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form DISPLAY_OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form DISPLAY_OUTPUT .
select matnr
ersda
ernam
mtart
matkl
into CORRESPONDING FIELDS OF TABLE it_mara from mara UP TO 15 ROWS
WHERE matnr in s_matnr.
if sy-subrc = 0.
NEW-LINE.
WRITE : /5 'Material No',
15 'Created On',
25 'Person name',
35 'Material Type',
45 'Material Group'.
loop at it_mara into wa_mara.
WRITE : /5 wa_mara-matnr,
15 wa_mara-ersda,
25 wa_mara-ernam,
35 wa_mara-mtart,
45 wa_mara-matkl.
ENDLOOP.
endif.
endform.
‎2013 Jan 23 7:16 AM
Hi buddy, the problem in your code is you missed the most important part of the code.
SELECTION-SCREEN BEGIN OF SCREEN <screen no>.
.....
...
....
SELECTION-SCREEN END OF SCREEN <screen no>.
And then you have to call the screen under START-OF-SELECTION using
CALL SELECTION-SCREEN <screen no>.
‎2013 Jan 23 10:26 AM
‎2013 Jan 23 11:50 AM
Sure. I've corrected the code but didn't check the output, if you encounter any further errors just let me know.
DATA flag.
TABLES : mara ,
t001 ,
t001w .
TABLES sscrfields.
CONSTANTS : c_yes TYPE c VALUE '1' ,
c_no TYPE c VALUE '0' .
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
mtart TYPE mtart,
matkl TYPE matkl,
END OF ty_mara.
DATA : it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara.
*Define three option button with USER-COMMAND clause
*Note the in option button group you can specify USER-COMMAND only once
PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1 , "Material
p_opt2 TYPE c RADIOBUTTON GROUP radi , "Company Code
p_opt3 TYPE c RADIOBUTTON GROUP radi . "Plant
*PUSHBUTTON 4(10) BUT1 USER-COMMAND CLI1.
*Define user inputs for respective option button, uset MODIF ID
*to identify the control as run time
SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID op1 , "Material
s_bukrs FOR t001-bukrs MODIF ID op2 , "Company Code
s_werks FOR t001w-werks MODIF ID op3 . "Plant
SELECTION-SCREEN SKIP.
*SELECTION-SCREEN FUNCTION KEY 1. "Adds button to application toolbar
* Declaration of sel screen buttons
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN PUSHBUTTON 5(10) but1 USER-COMMAND usr1 MODIF ID op1.
SELECTION-SCREEN PUSHBUTTON 18(10) but2 USER-COMMAND usr2 MODIF ID op2.
SELECTION-SCREEN PUSHBUTTON 32(10) but3 USER-COMMAND usr3 MODIF ID op3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN END OF SCREEN 1100.
INITIALIZATION.
but1 = 'material'.
but2 = 'co.code'.
but3 = 'Plant'.
*At selecttion screen output act as PBO where we can change the screen
*attributes, inside LOOP AT SCREEN
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF screen-group1 = 'OP1' .
IF p_opt1 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP2' .
IF p_opt2 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP3' .
IF p_opt3 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
START-OF-SELECTION.
*AT SELECTION-SCREEN.
CALL SELECTION-SCREEN 1100.
CASE sscrfields-ucomm.
WHEN 'USR1'.
flag = '1'.
WHEN 'USR2'.
flag = '2'.
WHEN 'USR3'.
flag = '3'.
ENDCASE.
CASE flag.
WHEN '1'.
PERFORM display_output.
EXIT.
* WRITE / 'Button 1 was clicked'.
WHEN '2'.
WRITE / 'Button 2 was clicked'.
WHEN '3'.
WRITE / 'Button 3 was clicked'.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form DISPLAY_OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_output .
SELECT matnr
ersda
ernam
mtart
matkl
INTO CORRESPONDING FIELDS OF TABLE it_mara FROM mara UP TO 15 ROWS
WHERE matnr IN s_matnr.
IF sy-subrc = 0.
NEW-LINE.
WRITE : /5 'Material No',
15 'Created On',
25 'Person name',
35 'Material Type',
45 'Material Group'.
LOOP AT it_mara INTO wa_mara.
WRITE : /5 wa_mara-matnr,
15 wa_mara-ersda,
25 wa_mara-ernam,
35 wa_mara-mtart,
45 wa_mara-matkl.
ENDLOOP.
ENDIF.
ENDFORM. "DISPLAY_OUTPUT
‎2013 Jan 23 12:15 PM
hai
in out put screen radio buttons ra coming but the
select-option and push button s are not coming............
‎2013 Jan 24 11:39 AM
Well what happens when you select one of the radio buttons & execute ?
‎2013 Jan 23 7:56 AM
Hello,
Always remember the 7 basic reporting events as following, which is extended to 9:
<< Copy pasted from http://sap-abap-programming.blogspot.de/2009/11/abap-report-event-in-abap-report.html >
Moderator message: Please do not do this again, it is highly discouraged.
Regards,
Akg
Message was edited by: Kesavadas Thekkillath
‎2013 Jan 26 8:05 AM
Hi Gompa,
Please try the below code for pushbuttons. You don't need to define a new screen for your requirement. You can do it on the same screen(1000).
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr MODIF ID op1 , "Material
s_bukrs FOR t001-bukrs MODIF ID op2 , "Company Code
s_werks FOR t001w-werks MODIF ID op3 . "Plant
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN PUSHBUTTON 5(10) but1 USER-COMMAND usr1 MODIF ID op1.
SELECTION-SCREEN PUSHBUTTON 18(10) but2 USER-COMMAND usr2 MODIF ID op2.
SELECTION-SCREEN PUSHBUTTON 32(10) but3 USER-COMMAND usr3 MODIF ID op3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
AT SELECTION SCREEN.
CASE SSCRFIELDS.
WHEN 'USR1'.
FLAG = '1'.
WHEN 'USR2'.
FLAG = '2'.
WHEN 'USR3'.
FLAG = '3'.
ENDCASE.
START-OF SELECTION.
CASE FLAG.
WHEN '1'.
PERFORM display_output.
exit.
* WRITE / 'Button 1 was clicked'.
WHEN '2'.
WRITE / 'Button 2 was clicked'.
WHEN '3'.
WRITE / 'Button 3 was clicked'.
ENDCASE.
Hope this helps