01-07-2006 7:07 AM
Hai Friends again,
in my alv report..if the user at top-level pressses either green horizontal arrow or the yellow vertical arrow button will generate a popup prompt with message...2buttons with yes and no.
yes to exit the report
no ..display the current screen.
plz give me code for this.??
01-07-2006 7:25 AM
Hi Hari,
1. Things won't work if we do normal things.
2. The important things are :
a) New PF-STATUS is required , say 'ABCD'.
b) Handle user_commmand
3. First of all, from Function group SALV,
copy the STANDARD gui status to your program,
from SE80, by right clicking.
4. come to your program.
start-of-selection.
SET PF-STATUS 'ABCD'.
5. Double click ABCD and activate the gui status.
6. In gui status,
in those green buttons and yellow buton,
write BACK1 in both.
ie. buttons with fcode BACK1.
Save and activate.
6. AT USER-COMMAND.
IF sy-ucomm = 'BACK1'.
DATA : answer TYPE c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Do You Want To Exit ?'
text_question = 'Do You Want To Exit ?'
IMPORTING
answer = answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF answer = '1'.
SET USER-COMMAND 'BACK'.
ENDIF.
ENDIF.
This will solve your problem.
I tried at my end, it works fantastic.
regards,
amit m.
01-07-2006 7:25 AM
Hi Hari,
1. Things won't work if we do normal things.
2. The important things are :
a) New PF-STATUS is required , say 'ABCD'.
b) Handle user_commmand
3. First of all, from Function group SALV,
copy the STANDARD gui status to your program,
from SE80, by right clicking.
4. come to your program.
start-of-selection.
SET PF-STATUS 'ABCD'.
5. Double click ABCD and activate the gui status.
6. In gui status,
in those green buttons and yellow buton,
write BACK1 in both.
ie. buttons with fcode BACK1.
Save and activate.
6. AT USER-COMMAND.
IF sy-ucomm = 'BACK1'.
DATA : answer TYPE c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Do You Want To Exit ?'
text_question = 'Do You Want To Exit ?'
IMPORTING
answer = answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF answer = '1'.
SET USER-COMMAND 'BACK'.
ENDIF.
ENDIF.
This will solve your problem.
I tried at my end, it works fantastic.
regards,
amit m.
01-07-2006 7:32 AM
Hi Hari,
Change the Function code of BACK and CANCEL to some thing to override the existing one.
when the user presses the button handle them in User command .
FORM USER_COMMAND1 USING UCOMM LIKE SY-UCOMM SELFIELD TYPE
SLIS_SELFIELD.
DATA: L_ANS.
CASE UCOMM.
**When User Press Back
WHEN 'BACK1'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Confirm'
TEXT_QUESTION = 'Do you wish to leave'
TEXT_BUTTON_1 = 'Yes'
ICON_BUTTON_1 = 'ICON_OKAY'
TEXT_BUTTON_2 = 'No'
ICON_BUTTON_2 = 'ICON_CANCEL'
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
START_COLUMN = 25
START_ROW = 6
IMPORTING
ANSWER = L_ANS
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF L_ANS = '1'.
"do some thing...
ELSEIF L_ANS = '2'.
LEAVE TO SCREEN 0.
ENDIF.
similarly other one also...
ENDFORM.
FORM PF_STATUS_SET USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM. "PF_STATUS_SET