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

Hiding fields in a screen-Module pool programming

Former Member
0 Likes
4,389

Hi,

I have a custom screen which has I/O fields, radio buttions and check boxes. The first three fields of the screen are mandatory fields. When the user enters the data in the first field and goes to the second field by using tab button or mouse click depending on the data entered in the first field the screen should change hiding some fields.

This is happening when the user presses enter after entering data in the first field but I want the fields to be hidden as soon the leaves the first field.

Thank You,

Juli

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,818

Hi,

In theory, a PAI is only triggered when the user presses enter or clicks on some button on the screen. Thus I'm not sure if your requirement can be fulfilled.

regards,

Advait

6 REPLIES 6
Read only

Former Member
0 Likes
1,819

Hi,

In theory, a PAI is only triggered when the user presses enter or clicks on some button on the screen. Thus I'm not sure if your requirement can be fulfilled.

regards,

Advait

Read only

Former Member
0 Likes
1,818

As Advait notes, this is not straightforward as a you are working with "block mode" screen processing not "character" mode when using SAPGui and dynpros - plus there is no concept of "onFocus" processing. One option that can work is if your input field can use a listbox for possible values instead - if so, you can trigger a function code when the value is changed by the user and this function code will trigger the PAI logic and allow you to return to the PBO to adjust the screen layout.

Jonathan

Read only

Former Member
0 Likes
1,818

Hi,

In PAI try the below code

IF <tablename-fieldname(i/o name)> NE ''. "not null

loop at screen.

if screen-name = 'first field name'.

*screen-invisible = 1. * "this makes your field invisible

screen-active = 1.

modify screen.

endif.

endloop.

endif.

Cheers!!

VEnk@

Read only

Former Member
0 Likes
1,818

Hi Juli,

I think you can meet this requirement with the help of Radio buttons.

You can put radio buttons next to these fields and on the click on that radio button you can make that particular field editable.

You can use this code for the this functionality, you will only have to add the code for making that field editable in this code.

Hope this code will help you.

********************************************************************

here's the sample code..

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-t01 .

PARAMETERS : r_abc RADIOBUTTON GROUP GRP1 USER-COMMAND za DEFAULT 'X',

r_def RADIOBUTTON GROUP GRP1.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-t02.

PARAMETERS :

p_1 like mara-matnr MODIF ID GR1 ,

p_2 like mara-matnr MODIF ID GR1 .

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-t03.

PARAMETERS :

p_3 like mara-matnr MODIF ID GR2 ,

p_4 like mara-matnr MODIF ID GR2 .

SELECTION-SCREEN END OF BLOCK b3.

AT SELECTION-SCREEN OUTPUT.

IF r_abc = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'GR2' .

screen-active = '0'.

ELSEIF screen-group1 = 'GR1'.

screen-active = '1'.

screen-input = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF r_def = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'GR1' .

screen-active = '0'.

ELSEIF screen-group1 = 'GR2'.

screen-active = '1'.

screen-input = '1' .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Amit.

Read only

Former Member
0 Likes
1,818

Presumably the 3 mandatory fields are always shown and it is a selection of the other fields that may not be required in certain circumstances. So, on first entering the screen, have only the three mandatory fields open for input. The other fields could be hidden or shown and protected. Once the data from the mandatory fields has been successfully evaluated, the mandatory fields could be protected from further input and the required additional fields could be opened for input.

Read only

Former Member
0 Likes
1,818

Juli,

The same kind of a requirement i had encounterd earlier.

What i did was i gave the functionality of 'TAB' to 'ENTER'.

Which means when ever the user presses enter based on the present cursor location next cursor position is obtained and automatically when ur PAI triggers the code u write for making the field imvisible would take effect.

Regards,

Ravi Kiran