Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Pushbutton in reports

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member585060
Active Contributor
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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

former_member585060
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Push buttons in reports