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: 

Call transaction, on pressing BACK displaying initial select screen

Former Member
0 Kudos

Hi,

I have an ALV report from which I want to call transaction 'FBE3'. I set parameter ids and did call transaction and skip first screen. The problem is that after the FBE3 screen is displayed correctly, if you press BACK, the initial FBE3 screen is displyed which shows the input parameters instead of the ALV report. I have to press back from the input screen to go back to the ALV report, which is not what I want. I want to be able to go back to the ALV report without stopping at the FBE3 initial screen. Is there anyway to avoid this or could anybody let me know why this happens. I have done numerous call transactions for FB03, VA03 and have never had problems like this before.

Would really appreciate it if somebody could help.

Regards and thanks in advance,

Nanditha

1 ACCEPTED SOLUTION

Former Member

Hi Nanditha,

I think I have your answer. Take a look at this code snippet from the customer master display transaction (XD03, the source program is MF02DFO0):


IF SY-CALLD = 'X'.
  LEAVE.
ELSE.
  ...
ENDIF.

So, there is explicit code in this transaction to leave the transaction when called via CALL TRANSACTION (sy-calld = 'X') and user hits back. This means that instead of displaying the selection screen when the user clicks on back, the transaction is terminated and control is returned to the calling program.

It looks like the SAP application programmers need to build in the logic into the transaction to prevent the initial selection screen to be displayed again.

Thus, I am not sure that you can do much about this from your program. You will just have to train your users to click on EXIT, rather than BACK.

Hope that helps.

Cheers,

Brad

9 REPLIES 9

Former Member

Hi Nanditha,

I think I have your answer. Take a look at this code snippet from the customer master display transaction (XD03, the source program is MF02DFO0):


IF SY-CALLD = 'X'.
  LEAVE.
ELSE.
  ...
ENDIF.

So, there is explicit code in this transaction to leave the transaction when called via CALL TRANSACTION (sy-calld = 'X') and user hits back. This means that instead of displaying the selection screen when the user clicks on back, the transaction is terminated and control is returned to the calling program.

It looks like the SAP application programmers need to build in the logic into the transaction to prevent the initial selection screen to be displayed again.

Thus, I am not sure that you can do much about this from your program. You will just have to train your users to click on EXIT, rather than BACK.

Hope that helps.

Cheers,

Brad

Former Member
0 Kudos

Hi,

Try this out

MODULE user_command_9001 INPUT.

DATA: i_return_code TYPE i .

CALL METHOD cl_gui_cfw=>dispatch

IMPORTING return_code = i_return_code.

ws_save_ok = ok_code.

CASE ws_save_ok.

<b> WHEN 'BACK' OR 'EXIT' OR 'CANC'.</b>

PERFORM exit_program.

<b>WHEN 'MATNR'.</b>

SET PARAMETER ID 'MAT' FIELD w_block-matnr.

CALL TRANSACTION fbe3 AND SKIP FIRST SCREEN .

ENDCASE.

CLEAR ws_save_ok.

ENDMODULE. " USER_COMMAND_0100 INPUT

<b>FORM exit_program</b>.

<b> CALL METHOD o_grid_container->free.

CALL METHOD cl_gui_cfw=>flush.</b>

IF sy-subrc NE 0.

  • Error in FLush

ENDIF.

<b>LEAVE TO SCREEN 0.</b>

ENDFORM. " EXIT_PROGRAM

Check this whether u have done all clear while u press back.

Even i had the same problem and i did a small mistake without clearing. So check it once.

Thanks & Regards,

Judith.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If you use SUBMIT instead of call transaction ,then you can use RETURN with the SUBMIT statement.

This is taken from the F1 Help of SUBMIT.

Addition 6

... AND RETURN

Effect

Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal session.

... USING SELECTION-SETS OF PROGRAM prog

Effect

Uses variants of the program prog when executing the program rep.

Note

Important

The programs prog and rep must have the same SELECT-OPTIONS and PARAMETERs. Otherwise, variants of the program prog may be destroyed.

Note

When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari. On the other hand, all variant-related actions on the selection screen of rep (Get, Save as variant, Display, Delete) refer to the variants of prog.

Example

SUBMIT REPORT01

VIA SELECTION-SCREEN

USING SELECTION-SET 'VARIANT1'

USING SELECTION-SETS OF PROGRAM 'REPORT00'

AND RETURN.

Effect

Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00.

Former Member
0 Kudos

Hi,

See if you have used the return stmnt.

submit FB3 <b>and return</b>.

Also, in user-command check with this:

WHEN 'BACK'.

SET SCREEN '0'.

LEAVE SCREEN.

Regards,

Anjali.

0 Kudos

The original poster has clearly stated that transaction FBE3 is called from the report !.

And Brad has given a clear explanation. Its because of the way the underlying porgram of FBE3 is written.

There is nothing you can do about it unless modify the source code.

Where does the question of submit comes in this case?

(the underlying program is a module pool program)

Regards

Raja

0 Kudos

Thank you everybody for your answers. I think what Brad says is absolutely right. Thanks again.

Hey Guys, well there is a very simple workaround for the problem, when creating your bdc table to be passed to the call transaction, you can add the "back" command yourself and this should make the deal, something like this

append initial line to (lt_bdc) assigning field-symbol(<ls_bdc>)

<ls_bdc>-program = 'SHDB Program of your called tcode'

<ls_bdc>-dynpro = '.....

........

and at the end of all the things you do, when the user clicks back, "which will call the initial screen in your case", record the name of that screen/program and sett is as well in the lt_bdc table with an ok code back

so, at the end

append initial line to lt_bdc assigning <ls_bdc>

<ls_bdc>-program = 'SHDB program of screen you want to scape' e.g ZMY_ALV 
<ls_bdc>-dynpro  = 'screen number you wanna scape'            e.g 1000
<ls_bdc>-fnam    = BDC_OKCODE'
<ls_bdc>-fval    = /EBACK

and this tricks the system that when it sees this screen "the one you want to scape" it will simply click back by itself, going back to the caller in your case!

cheers

0 Kudos

This worked for me.

0 Kudos

This works perfectly well, and is obvious when you think about it.

Thank-you Martin!