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: 

Force PAI with parameters

Former Member
0 Kudos

Hey gurus, I need your help.

I have a module pool with screen 100, see the following image:

And I need to fill the table name and simulate the button press with a parameter transaction.

I made the following parameter transaction.

which fill the table name, but I can't simulate the button press.

So I was thinking about another Default Value on the parameter transaction ZBRLIBAUTDIS and I would write in to the code an IF statement and trigger the PAI, but I can't because I can only set those fields which are on the screen. I tried to make a hidden field on the screen, but when I put the field active = 0 it's not possible to fill it, the only way to fill it is when the field is not hidden.

1. Is it possible somehow to make a not visible field on the screen which I can fill with the parameter transaction?

Another idea was to use the transaction name to decide which button force to press.

So in the PBO I got the last 3 characters from the transaction name with the following code:


DATA leng TYPE i.

   leng = strlen( sy-tcode ) - 3.

   SHIFT sy-tcode CIRCULAR BY leng PLACES.

   IF sy-tcode(3) EQ 'DIS' OR

     sy-tcode(3) EQ 'EDI' OR

     sy-tcode(3) EQ 'CRT'.

     scr_mode = sy-tcode(3).

I set the scr_mode, what normally do the button press, so the job is done, my only work here is to trigger the PAI now and the program do the rest of the job, but it's not working properly.

I forced the PAI with SUPPRESS DIALOG statement, what forced the PAI, but in this case the IF_TABLE_NAME wasn't fill. I think it is because the parameter transaction fill the field just on the end of the PBO and the SUPPRESS DIALOG is automatically jump to the PAI, so the parameter transaction can't fill the IF_TABLE_NAME.

So I tried to force the PAI with CALL METHOD cl_gui_cfw=>flush, which doesn't work with the above parameter transaction. It works only with this kind of parameter transaction.

Which I would not mind, but in this case the sy-tcode contains the ZBRLIB00S and not the ZBRLIBAUTDIS. So I failed again.

2. So why the FLUSH doesn't work when I'm setting the program and the screen number to the parameter transaction?

3. Is there some different way to trigger the PAI, which let the PBO finish and it's working if the first parameter transaction?

4. Is there somehow possible to write a code somewhere between the PBO and PAI?

5. Do you know some elegant solution to my problem?


P.S. I know it is possible to solve it when I rename the dialog transaction, but I want to do it for many various table names and for all buttons, so I should made 2 transactions (dialog and parameter) for every variant, and it is not really elegant solution.

If you need more information, just let me know.

Regards,

Robert

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I solved it.

I checked the SAPMSVMA (SM30) and it was working a little bit different or I just didn't understand you well. There was a check if it's called by a parameter transaction or dialog transaction. If it was call by param tcode the fields was not hide and else if dialog tcode the fields was hide.

Here is the source code:


CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD PARTCODE.          "HWR

   IF PARTCODE NE SY-TCODE.                                  "HWR

     MENU = 'X'.                                             "HWR

   ELSE.                                                     "HWR

     MENU = SPACE.                                           "HWR

     LOOP AT SCREEN.

       CHECK SCREEN-GROUP1 EQ 'FKT'.

       SCREEN-ACTIVE = 0.

       MODIFY SCREEN.

     ENDLOOP.

ENDIF.           

           

4 REPLIES 4

former_member197622
Participant
0 Kudos

hi Robert,

my english is not good enough, so im sorry if i didnt get it right.

Are you unable to change the transaction ZBRLIB00S ?? because if you can then you should use the model of SM30 when is used in parameter transaction, In your case this will be like this:

- 1: create a parameter CHANGE in screen 100 of transaction ZBRLIB00S

- 2: at pbo the set active = 0 so you cant see this parameters when using this program alone

- 3: at pai create a module action with code to execute and skip the first screen of this program/transaction(ZBRLIB00S) if the parameter CHANGE is used.

- 4: create the parameter transaction setting IF_TABLE_NAME = 'ZBR_T_AUTORI' CHANGE = 'X'

-try it

Regards

MC

0 Kudos

Hi Marco,

you probably meant the ZBRLIBAUTDIS transaction, but it nevermind. Well it's a good idea, just there is also little problem. When I set the CHANGE field to active = 0, then that field is not filled with 'X' because non active field is like non-existing field or I don't know, but I can't fill it with any value thru the parameter transaction. But I will probably analyse the SM30 more deeply and looking for solution there. Thanks.

0 Kudos

thats weird, because thats how its defined in SM30

Regards

MC

Former Member
0 Kudos

I solved it.

I checked the SAPMSVMA (SM30) and it was working a little bit different or I just didn't understand you well. There was a check if it's called by a parameter transaction or dialog transaction. If it was call by param tcode the fields was not hide and else if dialog tcode the fields was hide.

Here is the source code:


CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD PARTCODE.          "HWR

   IF PARTCODE NE SY-TCODE.                                  "HWR

     MENU = 'X'.                                             "HWR

   ELSE.                                                     "HWR

     MENU = SPACE.                                           "HWR

     LOOP AT SCREEN.

       CHECK SCREEN-GROUP1 EQ 'FKT'.

       SCREEN-ACTIVE = 0.

       MODIFY SCREEN.

     ENDLOOP.

ENDIF.