‎2008 Oct 17 7:42 AM
Hello everyone,
I have a scenario where i need to introduce a push button in my interactive reporting. Can anyone please help me with the code in step by step procedure.
Thanks & Regards,
Abhishek.
‎2008 Oct 17 7:58 AM
Hi,
If you want in Selection Screen use this syntax
SELECTION SCREEN PUSHBUTTON [/]pos(len) push
USER-COMMAND fcode [MODIF ID key].
and on Application Tool bar, create a Menu in SE41
Under AT USER-COMMAND you have to write code, for the function code you specified in Menu painter. Using CASE and ENDCASE.
-
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'MARC'.
SELECT * FROM marc WHERE matnr = itab-matnr.
WRITE 😕 sy-lsind.
WRITE: / marc-matnr,
25 marc-werks,
40 marc-pstat .
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'MAKT'.
SELECT * FROM makt WHERE matnr = itab-matnr.
WRITE 😕 sy-lsind.
WRITE: / makt-matnr,
25 makt-maktx,
70 makt-spras.
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'MARD'.
WRITE 😕 sy-lsind.
SELECT * FROM mard WHERE matnr = itab-matnr.
WRITE: / mard-matnr,
25 mard-lgort,
40 mard-werks,
55 mard-pstat .
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'MARM'.
WRITE: 'UNIT OF MEASURE DETAILS'.
ENDCASE.
-
Read the document for further help
http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/content.htm
Regards
Bala Krishna
Edited by: Bala Krishna on Oct 17, 2008 12:29 PM
Edited by: Bala Krishna on Oct 17, 2008 12:31 PM
‎2008 Oct 17 7:48 AM
Hi Abhishek,
You have posted the thread wrong place. You should have posted the same thread under 'ABAP General'.
Anyways where do you want the pushbutton? on the application toolbar?
Regards,
Saba
‎2008 Oct 17 7:55 AM
Hi Saba.
Oh am sorry about my wrong place of posting my question. Ya i want the push button in my application tool bar, and under which event should i write the code?
Thanks,
Abhishek
‎2008 Oct 17 8:06 AM
Hi,
set the pf-status after start-of-selectione event.
For ex.:
START-OF-SELECTION.
SET PF-STATUS 'XYZ'.
Double click on 'XYZ' and it will navigate you to GUI status for a screen. In this, under 'Application Toolbar' add the button name and set its function code and activate it.
Also set function code for BACK, EXIT and CANCEL under function keys.
Then AT-USER COMMAND event, on the basis of OK_CODE(SY-UCOMM) perform the action that you want for that pushbutton.
Also pls check this link:
Hope this is helpful.
Regards,
Saba
Edited by: Saba Sayed on Oct 17, 2008 9:08 AM
‎2008 Oct 17 7:58 AM
Hi,
If you want in Selection Screen use this syntax
SELECTION SCREEN PUSHBUTTON [/]pos(len) push
USER-COMMAND fcode [MODIF ID key].
and on Application Tool bar, create a Menu in SE41
Under AT USER-COMMAND you have to write code, for the function code you specified in Menu painter. Using CASE and ENDCASE.
-
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'MARC'.
SELECT * FROM marc WHERE matnr = itab-matnr.
WRITE 😕 sy-lsind.
WRITE: / marc-matnr,
25 marc-werks,
40 marc-pstat .
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'MAKT'.
SELECT * FROM makt WHERE matnr = itab-matnr.
WRITE 😕 sy-lsind.
WRITE: / makt-matnr,
25 makt-maktx,
70 makt-spras.
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'MARD'.
WRITE 😕 sy-lsind.
SELECT * FROM mard WHERE matnr = itab-matnr.
WRITE: / mard-matnr,
25 mard-lgort,
40 mard-werks,
55 mard-pstat .
ENDSELECT.
IF sy-subrc <> 0.
WRITE:/ 'NO RECORDS AVAILABLE'.
ENDIF.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'MARM'.
WRITE: 'UNIT OF MEASURE DETAILS'.
ENDCASE.
-
Read the document for further help
http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/content.htm
Regards
Bala Krishna
Edited by: Bala Krishna on Oct 17, 2008 12:29 PM
Edited by: Bala Krishna on Oct 17, 2008 12:31 PM
‎2008 Oct 17 10:56 AM
Hi abhishek,
Check this link.It also have a demo on how to use pushbuttons
http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba9a635c111d1829f0000e829fbfe/content.htm
-Goodluck,
Bhumika
‎2008 Oct 20 5:55 AM