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

Dialog programming: issue with BACK after COMMIT.

Former Member
0 Likes
1,209

Hello,

I have a selection screen 1000, and a result screen 200 with ALV (but the issue is there even if I don't render it).

I do some processing in screen 1000, and then CALL SCREEN 200. then display results in the ALV.

I coded the PAI with LEAVE TO SCREEN 0 on BACK.

Everything works when I do not use COMMIT WORK Statement in end-of-selection of screen 1000.

But when I do use COMMIT WORK, then I have to click twice to go back from screen 200 to selection screen. After the first click on BACK the selection screen 200 is displayed again, though the Title of the screen changes from mine to SAP, that'd mean that PBO modules of screen 200 are not called the second time (as I can see in debug), but the screen is still there until I click the back button again.

Any help appreciated,

Michal

10 REPLIES 10
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,159

Any specific reason of using end-of-selection ?

Read only

0 Likes
1,159

Not really, but the issue remains even if I leave the whole logic in start-of-selection.

Read only

0 Likes
1,159

Can you paste your code here for PAI (200) and th epoint where you call 200 and Commit work .

Read only

0 Likes
1,159

Commit is in a loop

FORM commit CHANGING cs_data TYPE ty_data.

  DATA: lt_return TYPE TABLE OF bapiret2.

  CALL FUNCTION 'BAPI_CPROJECTS_COMMIT_WORK'
    TABLES
      return = lt_return.

  PERFORM check_results USING    lt_return
                        CHANGING cs_data-error.

ENDFORM.

after that I do the call:

CALL SCREEN 200.

THE PAI:

MODULE user_command_0200 INPUT.

  DATA: lv_okcode TYPE sy-ucomm.

  lv_okcode = okcode.
  CLEAR okcode.

  CASE lv_okcode.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'CANCEL'.
      LEAVE TO SCREEN 0.
    WHEN OTHERS.
      LEAVE TO SCREEN 0.
  ENDCASE.


ENDMODULE.

Read only

0 Likes
1,159

Well this looks ok to me ... another tyr will be to check if you had set a default screen number for screen 200.

Read only

0 Likes
1,159

If you mean Next Screen attribute in the Attributes tab of the screen, then it doesn't matter what's in there, 1000, 200 or nothing. Issue remains.

Read only

Former Member
0 Likes
1,159

From the F1 help for LEAVE TO SCREEN:

This statement must not be used when handling events of the Control Framework.

Rob

Read only

0 Likes
1,159

The same thing happens if I use SET SCREEN 0. LEAVE SCREEN.

Any other way to navigate back to selection screen?

Read only

0 Likes
1,159

What I have done is :

call method cl_gui_cfw=>dispatch.
CALL METHOD grid1->free.
LEAVE TO SCREEN 0.

Rob

Read only

0 Likes
1,159

After applying your correction the ALV grid disappeared - the screen is blank, and it still is screen 200, and the title is 'SAP' instead of my own.