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: 

How to call specific tab-screen of dynpro

Hello guys,

I am triying to send user to text tabs on VA01, to do this, I am go to text tab on VA01 and : System -> Status and see follow Dynpro:

Then I go to user-exit include: MV45AFZZ and I put this line code to when user click on SAVE Button:

CALL SCREEN 4002.

But its not working, when the user click on save, its showing to follow tab,

Can anyone please help me?

7 REPLIES 7

bruce_hartley
Active Participant
0 Kudos

I'm going to preface this in that I am pretty rusty on Dynpro and that it's been awhile that I've used it, but I found an example that does what I think you are trying to do, but I have a few questions.

Which exact user exit did you put the "Call Screen 4002" statement in? there are a lot of different user exits for various events in that include and it would help to know which one it was. Also, you didn't list what conditions cause you to go to the text screen, if you didn't put any conditions in and then you try to save it would never save because it would always go back to the text screen. I'm thinking that you were trying to set up a check to see if certain text(s) existed or not and if they didn't go back to the text screen.

If you were trying to do an audit like I stated, You will want to use the user exit "FORM userexit_save_document_prepare" to do this, any other user exit will not do what you think it will do. I also believe uou don't want to call the screen by the way, you want to have the Dynpro controller go to it by setting that screen - see below.

So let's say that you have a whole bunch of conditions and eventually you have a single char variable that if set to X causes you to want to require that text, then you would do the following:

IF ( your_condition_to_trap_on_was_hit = 'X' ).

SET SCREEN '4002'
LEAVE SCREEN.

ENDIF

Hope the above helps.

Hello,yes I am using userexit_save_document_prepare, I have this code but still not working.

DATA: respuesta TYPE string. "LFRANCO

CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
*   TITLEBAR                    = ' '
*   DIAGNOSE_OBJECT             = ' '
    text_question               = 'Do you need load text?'
   TEXT_BUTTON_1               = 'SI'(001)
*   ICON_BUTTON_1               = ' '
   TEXT_BUTTON_2               = 'NO'(002)
*   ICON_BUTTON_2               = ' '
*   DEFAULT_BUTTON              = '1'
*   DISPLAY_CANCEL_BUTTON       = 'X'
*   USERDEFINED_F1_HELP         = ' '
*   START_COLUMN                = 25
*   START_ROW                   = 6
*   POPUP_TYPE                  =
*   IV_QUICKINFO_BUTTON_1       = ' '
*   IV_QUICKINFO_BUTTON_2       = ' '
 IMPORTING
   ANSWER                      = respuesta
* TABLES
*   PARAMETER                   =
* EXCEPTIONS
*   TEXT_NOT_FOUND              = 1
*   OTHERS                      = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF respuesta = '1'.
  SET SCREEN '4002'.
    LEAVE  SCREEN.
*      MESSAGE 'ERROR' TYPE 'E'.
ENDIF.

0 Kudos

I'm going to assume you have debugged this and you know that field has an "X" in it so you know if it's getting to that point to call the SET SCREEN and LEAVE SCREEN code. I would think you would have an ELSE instead of an ENDIF so that you don't check respuesta if the pop-up didn't work correctly and returned an erorr.

Other than the minor points I just made, your code looks correct to me.

0 Kudos

I thought more about this and I remembered I went to the Dialogs class soI went into my BC-410 course book and on page 2-30 and 2-31 it describes exactly what I stated above and more. If you want to alter what screen comes next you use "SET SCREEN nnn" and then "LEAVE SCREEN".- that's page 2-30.

What is also interesting is that on page 2-31 they show what "CALL SCREEN nnn" does and that acts like going to a screen and eventually you end up back where you started when a LEAVE SCREEN is made - here's a potential problem with that - you would have to see what code is in the PAI module of screen 4002 to see what it does when it's done - if it's just a LEAVE SCREEN then you could use a CALL SCREEN to 4002. If not and it goes into it's own sequence and never gets back to your CALL SCREEN call then you would have to do the SET SCREEN/LEAVE SCREEN way. but if all the PAI module of screen 4002 does at the end is LEAVE SCREEN, then you could do the CALL.

I hope this additional information helps you to choose one way that works.

raymond_giuseppi
Active Contributor

The dynpro 4002 is the header dynpro that contains the tab control, calling this dynpro would not always display the text tab rather the current one?

In the transaction menu, the goto - header - text function is KTEX_SUB. Could you try to trigger this function code?

cl_gui_cfw=>set_new_ok_code( 'KTEX_SUB' ).

0 Kudos

Hello, thanks for yout adnware I tried that you say but not work, please see my code:

DATA: respuesta TYPE string. "LFRANCO

CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
*   TITLEBAR                    = ' '
*   DIAGNOSE_OBJECT             = ' '
    text_question               = 'ir a los textos'
   TEXT_BUTTON_1               = 'SI'(001)
*   ICON_BUTTON_1               = ' '
   TEXT_BUTTON_2               = 'NO'(002)
*   ICON_BUTTON_2               = ' '
*   DEFAULT_BUTTON              = '1'
*   DISPLAY_CANCEL_BUTTON       = 'X'
*   USERDEFINED_F1_HELP         = ' '
*   START_COLUMN                = 25
*   START_ROW                   = 6
*   POPUP_TYPE                  =
*   IV_QUICKINFO_BUTTON_1       = ' '
*   IV_QUICKINFO_BUTTON_2       = ' '
 IMPORTING
   ANSWER                      = respuesta
* TABLES
*   PARAMETER                   =
* EXCEPTIONS
*   TEXT_NOT_FOUND              = 1
*   OTHERS                      = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF respuesta = '1'.
  cl_gui_cfw=>set_new_ok_code( 'KTEX_SUB' ).
*  SET SCREEN '4002'.
*    LEAVE  SCREEN.
*      MESSAGE 'ERROR' TYPE 'E'.
ENDIF.

0 Kudos

In which user-customer exit or BAdI did you add your code?

Nb: In some case you could try to put the function code value 'KTEX_SUB' in field FCODE (or GL_FCODE) of the global area of main program SAPMV45A.