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: 

Button Event

Former Member
0 Kudos

hi all,

im new to abap .

im developing a report which shows some records,

so now i want to add a button aat toolbar and after clicking that button the report should display sap script for that report and again should go back from that script page....

i need to do this as early as possible so..PLZ

thanx in advance...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

well this sounds quite easy, tho it isnt too easy.

at first: for displaying something in SAP-SCRIPT you need a form first. useSE71 to create.

then you need a driver program. Ok thats your normal program, but for displaying your output in sap script you need a second logic branch in your program, triggering all the write_form methods.

to get that button in your screen you need to modify the PF status of that screen.

10 REPLIES 10

Former Member
0 Kudos

well this sounds quite easy, tho it isnt too easy.

at first: for displaying something in SAP-SCRIPT you need a form first. useSE71 to create.

then you need a driver program. Ok thats your normal program, but for displaying your output in sap script you need a second logic branch in your program, triggering all the write_form methods.

to get that button in your screen you need to modify the PF status of that screen.

Former Member
0 Kudos

Hi nilesh,

chk with this link

u will get entire knowledge on it.

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/content.htm

thanks

nagendra.

Former Member
0 Kudos

1. You need to creat a button in the GUI Status.

2. SET PF-STATUS in your program

3. In the USER-COMMAND, you need to call the SAP Script using open_form and write_form functiona modules.

Former Member
0 Kudos

i have created a disply button but now i need to give the click event fot that so that it will go to sap script output page (i.e. deatail o/p) & im writing the code for script too. thats ok. but plz tell me in details to write code to disply sap script page and to go back again to output page .. like below..

1. normal (classical ) reports output page

2. click on disp button.

3 script displayed.

4 go back like normally we go by pressing F3.

thankxx for earlier reply...

Edited by: NILESH SHELKE on Sep 16, 2008 2:21 PM

Edited by: NILESH SHELKE on Sep 16, 2008 2:22 PM

0 Kudos

Hi,

You can call your form as given below inside the PF-STATUS.

  • CALL FUNCTION 'OPEN_FORM'

  • EXPORTING

    • APPLICATION = 'TX'

    • ARCHIVE_INDEX =

    • ARCHIVE_PARAMS =

    • DEVICE = 'PRINTER'

    • DIALOG = 'X'

  • FORM = 'ZSCRIPTFORM' (SAP SCRIPT form name)

  • LANGUAGE = SY-LANGU

    • OPTIONS =

    • MAIL_SENDER =

    • MAIL_RECIPIENT =

    • MAIL_APPL_OBJECT =

    • RAW_DATA_INTERFACE = '*'

    • SPONUMIV =

    • IMPORTING

    • LANGUAGE =

    • NEW_ARCHIVE_PARAMS =

    • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • CODEPAGE = 11

  • OTHERS = 12

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

Regards,

P.S.Chitra

Former Member
0 Kudos

hi,

Use "SET PF STATUS" .

Consider the eg given below:-

&----


*& Form SUB_PFSTATUS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SUB_PFSTATUS USING EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS xxx.

ENDFORM. " SUB_PFSTATUS

*----


Inside the form endform , you need to call your script form.

Regards,

P.S.Chitra

0 Kudos

can u plz clearify the set pf-status code..in more details plzzzzzz.....& can we go back by F3 as we go normally from script to o/p screen ?

thanku...

Edited by: NILESH SHELKE on Sep 16, 2008 2:37 PM

Edited by: NILESH SHELKE on Sep 16, 2008 2:39 PM

0 Kudos

Hi Nilesh,

Yes you can go back by pressing F3 button. Just mention the function code as BACK in pf-status.

Regards,

Swapna.

0 Kudos

Hi,

Please check the below example. Hope this might help you.

&----


*& Form SUB_USERCMD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SUB_USERCMD USING P_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

IF SY-SUBRC = 0.

CASE P_UCOMM.

WHEN 'BACK'.

CALL SCREEN 0.

ENDCASE.

ENDIF.

ENDFORM. " SUB_USERCMD

----


Regards,

P.S.Chitra

Former Member
0 Kudos

ok