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

problem in Back button for a report

Former Member
0 Likes
3,154

Hi All,

I have a custom GUI status with an added refresh button in the application toolbar.

Now my problem is the back button.

I want it to go back to the programs selection-screen, not to the last program display.

What is happening now is let's say i click the refresh button 5 times, it took me another 5 click on the back button before it goes to the selection-screen.

How to do that?

Thanks.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,621

What is happening now is let's say i click the refresh button 5 times, it took me another 5 click on the back button before it goes to the selection-screen.

You problem may not relate with BACK function code but with REFRESH, how did you manage it, don't call another ALV but refresh the display using rs_selfield-refresh = 'X' in the ALV user_command, then the back button should work perfectly. (You may also get memory problem, try to refresh 100 times, and check memory usage...)

Regards,

Raymond

24 REPLIES 24
Read only

Former Member
0 Likes
2,621

Hi ..

Use

LEAVE LIST PROCESSING. " In the code of back button

Nag

Read only

0 Likes
2,621

There's no code for back button because it's a copy of the STANDARD_FULLSCREEN.

Only the refresh button is customized. When I tick the back button, the user command for the alv grid is not trigerred.

Take note that this is not dialog programming.

Read only

0 Likes
2,621

Hi Navi..

I got your problem..

Also implement the code for Back (&F03) and write the above logic..

Nag

Read only

0 Likes
2,621

how to implement the code for back?

Read only

0 Likes
2,621

you need to code sy-ucomm &F03, if you are using the standard.

leave list processing will work in that case.

like in my case frm selection screen execution i am calling the ALV FM, and it automatically controls the same..

regards

Yadesh

Read only

0 Likes
2,621

If its ALV LIST/GRID

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM ........................

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IT_FIELDCAT = FCAT[]

IT_EVENTS = IT_EVENTS[]

TABLES

T_OUTTAB = LT_TAB.

FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

IF F_UCOMM = '&F03'.

LEAVE LIST PROCESSING.

ENDIF.

ENDFORM.

If its report program

AT USER-COMMAND.

IF SY-UCOMM = '&F03'.

LEAVE LIST PROCESSING.

ENDIF.

Nag

Read only

0 Likes
2,621

if you are using the standard ALV FM..then it is not required to give the code in the call back routine...

standard program automatically controls the behaviour of back button.

Read only

0 Likes
2,621

i place a break-point on the user-command, but it wasn't trigerred whenever i click 'back' it's only trigerred when i click refresh.

once again, refresh is a custom button while back is not.

did i miss something?

do i need to change something in SE41 for the back attribute?

it seems that i'm not in control of the back button.

Read only

0 Likes
2,621

then how can i have control on the back button?

Read only

0 Likes
2,621

Trying changing Fcode of back and use the same in User_command.

Nag

Read only

0 Likes
2,621

if you have the Global trade active in your system ...you can refer to a program "RWB2_EXPENSE_WORKBENCH"

i think this is the same scenario...and its working for me..

Read only

0 Likes
2,621

can you tell me in which report event you are using the FM to display the ALV??

Read only

0 Likes
2,621

i changed the fcode and the breakpoint is now triggered. but the LEAVE LIST PROCESSING is not working, my code now won't exit from the main alv display.

Read only

0 Likes
2,621

i think raymond suggestion might be right..

when you are refreshing it...just change the data in the internal tables that you were passing in the FM...

Read only

0 Likes
2,621

I am using the global tables to pass the data to the ALV...

once i press the refresh button..i update the data in the global tables...

that is all is required...it automatically updates the data in the ALV...

i think that will solve you issue..

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,622

What is happening now is let's say i click the refresh button 5 times, it took me another 5 click on the back button before it goes to the selection-screen.

You problem may not relate with BACK function code but with REFRESH, how did you manage it, don't call another ALV but refresh the display using rs_selfield-refresh = 'X' in the ALV user_command, then the back button should work perfectly. (You may also get memory problem, try to refresh 100 times, and check memory usage...)

Regards,

Raymond

Read only

0 Likes
2,621

yup i call a new alv.

because in the refresh, i also need to capture the new created PO (in my case).

so in the refresh button, i call the subroutines that retrieves data and then call the alv back again.

Read only

0 Likes
2,621

case fcode = 'REFRESH'

  • - ALV refresh

p_rs_selfield-refresh = yes.

p_rs_selfield-col_stable = yes.

p_rs_selfield-row_stable = yes.

PERFORM select_data_from_db_expense "... "REFRESH

TABLES gt_wbrk_list "...

gt_selected_doc_key.

..here gt_wbrk_list ..gets updated...and will update the ALV.

and GT_WBRK_LIST is the global internal table that i used firstly to pass the data to the ALV

Read only

0 Likes
2,621

In the user_command, you may have some code like

  WHEN 'REFRESH'.
    PERFORM load_full_data.
    rs_selfield-refresh = 'X'.
  WHEN 'CREATE'.
    PERFORM create_new_record CHANGING record retcode.
    IF retcode = 0.
      ADD record TO itab.
      rs_selfield-refresh = 'X'.
    ENDIF.
  WHEN 'DELETE'.
    PERFORM delete_old_record USING p_index CHANGING retcode.
    IF retcode = 0.
      DELETE itab INDEX p_index.
      rs_selfield-refresh= 'X'.
      rs_selfield-col_stable= 'X'.
      rs_selfield-row_stable= 'X'.
    ENDIF.
  WHEN OTHERS...

Regards,

Raymond

Read only

0 Likes
2,621

hi raymond

you are right. i should not be calling another alv. it's enough that i update internal table for output.

thank you so much.

Read only

0 Likes
2,621

hi yadesh,

thanks also for your help.

Read only

0 Likes
2,621

you are welcome

Read only

Former Member
0 Likes
2,621

I think this is what you need to do, i had similar scenario.


FORM f_alv_user_comm USING i_ucomm TYPE syucomm            
                          i_rs TYPE slis_selfield."here you are catching the okcode from second creen to go to initial
 
*  Display ALV2 (This list shows the list blocked/unblocked customers)
    PERFORM f_display_alv2 CHANGING i_ucomm.
 
  IF i_ucomm EQ '&F03'.         " here you can use the back button code
* Return to seletion screen
    LEAVE TO SCREEN 0.
  ENDIF.
 
endform.
 

In f_display_alv2 do like this :


FORM f_display_alv2 CHANGING e_ucomm TYPE syucomm. "here you are sendin the okcode from second creen to go to initial
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_bypassing_buffer = c_mark
        i_callback_program = w_repid
        is_layout          = lws_layout
        it_fieldcat        = int_fieldcat2[]
        it_events          = int_events_alv2
      TABLES
        t_outtab           = int_alv2_out
      EXCEPTIONS
        program_error      = 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.
    ELSE.
      e_ucomm = '&F03'.                          " This will take the back button code
    ENDIF.
endform.

This is the right way to do it.

same reference :

Regards,

Salil Sonam

Read only

Former Member
0 Likes
2,621

Got posted twice by mistake.

Please ignore this one.