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: 

Creation of Pf-status at selection screen

Former Member
0 Kudos

Hi,

I created a pf-status for selection screen for three buttons at tool bar.But now the problem is the back/exit/cancel buttons are not working.Can anyone tell me what could be the problem.

Or can anyone tell me the function module used to create the buttons at selection screen toolbar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

U can set pf-status by using the below code

SET PF-STATUS 'GUI'.

double click on GUI and define all the functions n keys u need.

below is the example code .

TABLES: spfli, sbook.

DATA: num TYPE i,

dat TYPE d.

START-OF-SELECTION.

num = 0.

SET PF-STATUS 'FLIGHT'.

GET spfli.

num = num + 1.

WRITE: / spfli-carrid, spfli-connid,

spfli-cityfrom, spfli-cityto.

HIDE: spfli-carrid, spfli-connid, num.

END-OF-SELECTION.

CLEAR num.

TOP-OF-PAGE.

WRITE 'List of Flights'.

ULINE.

WRITE 'CA CONN FROM TO'.

ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.

CASE sy-pfkey.

WHEN 'BOOKING'.

WRITE sy-lisel.

ULINE.

WHEN 'WIND'.

WRITE: 'Booking', sbook-bookid,

/ 'Date ', sbook-fldate.

ULINE.

ENDCASE.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'SELE'.

IF num NE 0.

SET PF-STATUS 'BOOKING'.

CLEAR dat.

SELECT * FROM sbook WHERE carrid = spfli-carrid

AND connid = spfli-connid.

IF sbook-fldate NE dat.

dat = sbook-fldate.

SKIP.

WRITE / sbook-fldate.

POSITION 16.

ELSE.

NEW-LINE.

POSITION 16.

ENDIF.

WRITE sbook-bookid.

HIDE: sbook-bookid, sbook-fldate, sbook-custtype,

sbook-smoker, sbook-luggweight, sbook-class.

ENDSELECT.

IF sy-subrc NE 0.

WRITE / 'No bookings for this flight'.

ENDIF.

num = 0.

CLEAR sbook-bookid.

ENDIF.

WHEN 'INFO'.

IF NOT sbook-bookid IS INITIAL.

SET PF-STATUS 'WIND'.

SET TITLEBAR 'BKI'.

WINDOW STARTING AT 30 5 ENDING AT 60 10.

WRITE: 'Customer type :', sbook-custtype,

/ 'Smoker :', sbook-smoker,

/ 'Luggage weight :', sbook-luggweight UNIT 'KG',

/ 'Class :', sbook-class.

ENDIF.

ENDCASE.

Regards

Sumana

5 REPLIES 5

kesavadas_thekkillath
Active Contributor
0 Kudos

Might be usefull.

link: [Example|http://abap-gallery.blogspot.com/2007/07/add-toolbar-on-selection-screen.html]

Former Member
0 Kudos

Hi,

In PBO, write

set pf-status '<PF-STATUS NAME>'.

In PAI write,

case sy-ucomm.

when 'EXIT'.

leave program.

when 'CANCEL'.

call function 'POPUP_TO_CONFIRM'

exporting

text_question = 'Do you want to save the changes?'

text_button_1 = 'Yes'(001)

text_button_2 = 'No'(002)

display_cancel_button = ''

importing

answer = ans

exceptions

text_not_found = 1

others = 2

.

if sy-subrc <> 0.

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

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

endif.

if ans = 002.

leave program.

else.

<code to update>

endif.

when 'BACK'.

Leave to screen <screen_no>.

endcase.

Hope it will help you. In case of doubt, revert back

Regards

Natasha Garg

Former Member
0 Kudos

hi,

just activate the buttons for back/exit/cancle if you are not using ALV otherwise you have to copy the standared pf-status and add you required buttons.

Atul

Former Member
0 Kudos

Hi,

U can set pf-status by using the below code

SET PF-STATUS 'GUI'.

double click on GUI and define all the functions n keys u need.

below is the example code .

TABLES: spfli, sbook.

DATA: num TYPE i,

dat TYPE d.

START-OF-SELECTION.

num = 0.

SET PF-STATUS 'FLIGHT'.

GET spfli.

num = num + 1.

WRITE: / spfli-carrid, spfli-connid,

spfli-cityfrom, spfli-cityto.

HIDE: spfli-carrid, spfli-connid, num.

END-OF-SELECTION.

CLEAR num.

TOP-OF-PAGE.

WRITE 'List of Flights'.

ULINE.

WRITE 'CA CONN FROM TO'.

ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.

CASE sy-pfkey.

WHEN 'BOOKING'.

WRITE sy-lisel.

ULINE.

WHEN 'WIND'.

WRITE: 'Booking', sbook-bookid,

/ 'Date ', sbook-fldate.

ULINE.

ENDCASE.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'SELE'.

IF num NE 0.

SET PF-STATUS 'BOOKING'.

CLEAR dat.

SELECT * FROM sbook WHERE carrid = spfli-carrid

AND connid = spfli-connid.

IF sbook-fldate NE dat.

dat = sbook-fldate.

SKIP.

WRITE / sbook-fldate.

POSITION 16.

ELSE.

NEW-LINE.

POSITION 16.

ENDIF.

WRITE sbook-bookid.

HIDE: sbook-bookid, sbook-fldate, sbook-custtype,

sbook-smoker, sbook-luggweight, sbook-class.

ENDSELECT.

IF sy-subrc NE 0.

WRITE / 'No bookings for this flight'.

ENDIF.

num = 0.

CLEAR sbook-bookid.

ENDIF.

WHEN 'INFO'.

IF NOT sbook-bookid IS INITIAL.

SET PF-STATUS 'WIND'.

SET TITLEBAR 'BKI'.

WINDOW STARTING AT 30 5 ENDING AT 60 10.

WRITE: 'Customer type :', sbook-custtype,

/ 'Smoker :', sbook-smoker,

/ 'Luggage weight :', sbook-luggweight UNIT 'KG',

/ 'Class :', sbook-class.

ENDIF.

ENDCASE.

Regards

Sumana

Former Member
0 Kudos

hi try this

you need to write code for that

at user command

case sy-ucomm

if 'BACK'

then some code to leave to screen

if 'exit'

then exit command

Likewise