Application Development and Automation 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: 
Read only

Using Back Button after Display Report

Former Member
0 Likes
4,054

Hi,

Need an advice, i need to customize the standard BACK button after report had been displayed, trying to use AT USER-COMMAND, but still not avail..

anyone can come with example will help me a lot.

Thanks

1 ACCEPTED SOLUTION
Read only

vattekrishna
Participant
0 Likes
2,673

Hi badz lee,

Just change the function code 'BACK' to 'ZBACK' in your custom GUI staus.

Then write your own logic for the custmer needs.

Hope this code helps.


*&---------------------------------------------------------------------*
*& Report  ZVK_TEST
*&
*&---------------------------------------------------------------------*
REPORT  zvk_test.
TABLES:ekko."for select option only
SELECT-OPTIONS:s_ebeln FOR ekko-ebeln.
DATA:lt_ekko TYPE TABLE OF ekko,
     lw_ekko TYPE ekko.
START-OF-SELECTION.
  SET PF-STATUS 'STLI'."copy status STLI of program SAPMSSY0.
  SET TITLEBAR 'TITLE'.
*
  SELECT * INTO TABLE lt_ekko
    FROM ekko
    WHERE ebeln IN s_ebeln.

  LOOP AT lt_ekko INTO lw_ekko.
    WRITE:/ lw_ekko-ebeln,
            lw_ekko-bukrs,
            lw_ekko-bstyp,
            lw_ekko-bsart.
  ENDLOOP.

END-OF-SELECTION.
*
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'ZBACK'.
      PERFORM back_function."Your logic
    WHEN OTHERS.
  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  BACK_FUNCTION
*&---------------------------------------------------------------------*
FORM back_function .
  LEAVE PROGRAM.
ENDFORM.                    " BACK_FUNCTION

12 REPLIES 12
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,673

Is this a classical report or an ALV ?

Read only

Former Member
0 Likes
2,673

Suhas i try this in Classical Report.

Edited by: badz lee on Jul 5, 2010 10:24 AM

Read only

vattekrishna
Participant
0 Likes
2,673

Hi,

Create your own GUI status to make it work.

Read only

0 Likes
2,673

Krishna, I already create the GUI status. but its skip the back button code.

Below is my code snippet.



end-of-selection.
*-----------------------------------------------------------------------
* User Command
*-----------------------------------------------------------------------
at user-command.
  perform user_command using sy-ucomm. 



--------------------------------------------
form user_command  using  in_ucomm.
  case in_ucomm. 
    when 'CETAK'.
      perform print_sapscript. 
    when 'BACK'.
      perform print_sapscript. 
  endcase.
endform. 

Read only

0 Likes
2,673

Hi badz lee ,

please read docu for event AT USER-COMMAND - Function Code BACK doesnt trigger AT USER-COMMAND.

Regards

REA

Read only

0 Likes
2,673

Thanks, i read the abap docu , yes i cant used At-User Command, any suggestion how can i use BACK button in the classic report program

Read only

0 Likes
2,673

Hi badz_lee,

event

AT SELECTION-SCREEN ON EXIT-COMMAND.

could meet your requirements.

regards

rea

Read only

0 Likes
2,673

Hi, i had try the code, but seems not working, as the report already displayed, when i pressed back button , its not going to to the exit command

below is my code snippet


SELECTION-SCREEN: BEGIN OF BLOCK upd WITH FRAME TITLE txt2.
SELECT-OPTIONS: s_carrid FOR SFLIGHT-carrid OBLIGATORY MODIF ID r2.
SELECTION-SCREEN: END OF BLOCK upd.

INITIALIZATION.

AT SELECTION-SCREEN.

AT SELECTION-SCREEN ON EXIT-COMMAND.
  LEAVE PROGRAM.

START-OF-SELECTION.

SELECT *
INTO CORRESPONDING
FIELDS OF TABLE itab1
FROM
sflight
  WHERE carrid IN s_carrid .

LOOP AT itab1.

WRITE: / itab1-carrid,
itab1-connid,
itab1-fldate,
itab1-price,
itab1-seatsmax,
itab1-seatsocc.
ENDLOOP.

Read only

0 Likes
2,673

hi badz_lee,

now i got your point, as the report already displayed = after report has been executed and list is displayed.

you should define your own status for addtional functionality instead of using the back button, nobody expects that something happens by pressing back except going one screen backwards...

regards

rea

Edited by: Ramy El-Arnaouty on Jul 5, 2010 5:55 PM

besides i think there is no way to react on the back button in a list

Read only

0 Likes
2,673

Ramy, we should wait others point of view to decide if we can customized the BACK button using GUI Status at report list

There is purpose i would like to this , but i'll ask this in another thread, its about call transaction.

Thanks.

Read only

vattekrishna
Participant
0 Likes
2,674

Hi badz lee,

Just change the function code 'BACK' to 'ZBACK' in your custom GUI staus.

Then write your own logic for the custmer needs.

Hope this code helps.


*&---------------------------------------------------------------------*
*& Report  ZVK_TEST
*&
*&---------------------------------------------------------------------*
REPORT  zvk_test.
TABLES:ekko."for select option only
SELECT-OPTIONS:s_ebeln FOR ekko-ebeln.
DATA:lt_ekko TYPE TABLE OF ekko,
     lw_ekko TYPE ekko.
START-OF-SELECTION.
  SET PF-STATUS 'STLI'."copy status STLI of program SAPMSSY0.
  SET TITLEBAR 'TITLE'.
*
  SELECT * INTO TABLE lt_ekko
    FROM ekko
    WHERE ebeln IN s_ebeln.

  LOOP AT lt_ekko INTO lw_ekko.
    WRITE:/ lw_ekko-ebeln,
            lw_ekko-bukrs,
            lw_ekko-bstyp,
            lw_ekko-bsart.
  ENDLOOP.

END-OF-SELECTION.
*
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'ZBACK'.
      PERFORM back_function."Your logic
    WHEN OTHERS.
  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  BACK_FUNCTION
*&---------------------------------------------------------------------*
FORM back_function .
  LEAVE PROGRAM.
ENDFORM.                    " BACK_FUNCTION

Read only

0 Likes
2,673

Yes it solved my current problem thanks Krishna Vatte, when creating GUI Status we need to ensure to activate the Function Code, by clicking Function Code button or F7 at the specific icon.

Thanks all for helping me on this.