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 field in screen in module pool programming

Former Member
0 Likes
11,285

Hi,

I have developed one screen.In that i have already hide one field,now i want to hide one more field.The same way i have followed for the second field also,but it is not working.Please help me.

Thanks

36 REPLIES 36
Read only

Former Member
0 Likes
7,269

Hi Ganesha,

Please follow the below procedure for hiding the multiple fields in the screen.

Parameters:

x type c modif id abc,

y type c modif id abc,

z type c modif id abc.

At selection-screen output.

Loop at screen.

    If Screen-group1 = 'abc'.

      Screen-active = 0.

      Modify Screen.

    Endif.

  Endloop.

Please let me know if still problem persist.

Warm Regards

Rock Start

Read only

ronaldo_aparecido
Contributor
0 Likes
7,269

OK use loop at screen ,but before the field must have a group and use loop at screen and inside the loop if scrren-gruop......

Read only

Former Member
0 Likes
7,269

could you share your code?

Read only

0 Likes
7,269

Hi Susmitha,

Here is my code for hiding Material Number only.

IF true EQ 'X'.
     LOOP AT SCREEN.
       IF screen-name = 'ARTICLE'.
         screen-required    = '0'.
         screen-intensified = '1'.
         screen-invisible = '0'.
         screen-active = '1'.
         MODIFY SCREEN.
       ENDIF.
       IF screen-name = 'MATNR'.
         screen-required    = '0'.
         screen-intensified = '1'.
         screen-invisible = '0'.
         screen-active = '1'.
         MODIFY SCREEN.
       ENDIF.
     ENDLOOP.
   ENDIF .


   IF true EQ ' '.
     LOOP AT SCREEN.
       IF screen-name = 'ARTICLE'.
         screen-required    = '0'.
         screen-intensified = '0'.
         screen-invisible = '1'.
         screen-active = '0'.
         MODIFY SCREEN.
       ENDIF.
       IF screen-name = 'MATNR'.
         screen-required    = '0'.
         screen-intensified = '0'.
         screen-invisible = '1'.
         screen-active = '0'.
         MODIFY SCREEN.
       ENDIF.
     ENDLOOP.
   ENDIF.

Thanks

Read only

0 Likes
7,269

Hi Sai,

To make a field invisible the attributes that you need to set are

screen-invisible = '1'.  " Field will be visible but Input will come as ****

screen-input = '0'.       " Field will be invisible.

modify screen.

Also make sure that the field names are correct.

Read only

0 Likes
7,269

which field is not hiding???

Read only

0 Likes
7,269

HSDAT field is not hiding,only MATNR is hiding.

Read only

0 Likes
7,269

One more clarification.

Is this your selection screen or screen created as module pool through SE51?

Read only

0 Likes
7,269

Screen created as module pool through SE51.

Read only

0 Likes
7,269

I dont find screen field  name HSDAT in the code you shared, I just saw 'ARTICLE'.

If its the same, do change the name to the correct screen field name.

Read only

0 Likes
7,269

where u hv used HSDAT in ur prog???

Read only

0 Likes
7,269

I have shared code for Only MATNR not HSDAT.

Read only

0 Likes
7,269

Hi Sai,

Try creating the group name for text fields and input fields , say  'G2' in group1 field in toolbar .

then IN PBO try using the code that i have given .

Read only

0 Likes
7,269

check screen field name carefully

Read only

0 Likes
7,269

Hi Farid,

Previously Only MATNR field is hiding,Now my requirement is i want to hide both MATNR and HSDAT fields.HSDAT field is in Table control.I have given same group name for both fields,and write code like this.But it is hiding only MATNR and not HSDAT.

Loop At Screen.

If screen-group1 = 'GR1'.

   Screen-active = 0.

   Modify Screen.

Endif.

Endloop.

Thanks

Read only

0 Likes
7,269

Hi Siva,

I have tried what you told,But only one field is hiding and other field is not hiding.

Thanks

Read only

0 Likes
7,269

for Table Control columns, you would have to code it a little differently.

please check out this previous post on SDN https://scn.sap.com/thread/1053227

hope it helps!

Read only

0 Likes
7,269

try wih giving the same group name for  MATNR & HSDAT (input ant text), and dont write separate code for MATNR & HSDT.

Loop At Screen.

If screen-group1 = 'GR1'.

   Screen-active = 0.

   Modify Screen.

Endif.

Endloop.

Read only

0 Likes
7,269

Hai Sai,

For table control , there is a little different way to code for field hiding.

DO like this,

Use table cols

data: x_bool like LINE OF tc-cols.   "Workarea for table control  tc-cols

  LOOP at  tc-cols INTO x_bool.      "TC is table control here

    if x_bool-index EQ 1.    "table control position

    x_bool-invisible = 1.

   endif.

    modify tc-cols FROM x_bool.

    ENDLOOP.

Hope this Helps,

regards,

Sivaganesh

Read only

0 Likes
7,269

Use :

1. IF true NE 'X' instead of ' '.

2. Check your field names. If part of a structure use complete name e.g 'MARA-MATNR'

regards,

Ashish Rawat

Read only

0 Likes
7,269

Hii Ganesha,

do the following,

put both MATNR and HSDT into same group in like G10r G2 or G3 or G4 ur choice screen layout design.

then in the screen PBO

PROCESS BEFORE OUTPUT.

LOOP AT t_trans INTO x_trans WITH CONTROL tcont"t_TRANS is internal table
    MODULE modify_screen.       "To Modify the Table Control Screen

  ENDLOOP.

   module modify_screen output.

     loop at screen.

          if screen-group1 eq 'G1'.

               screen-active = 0.

          endif.

          modify screen.

     endloop.

Note: if ur group name G1 then screen-group1 eq G1 like wise

hope this will resolve ur issue.

regards

Syed

Read only

Former Member
0 Likes
7,269

hi

wht u can do is go to the screen layout and click on all the fields that you want to hide and give a common group name in the properties.

in the program you can type

loop at screen.

if screen-group1 = groupname you have given the screen layout

screen-invisible = 1.

modify screen

endif.

with regards

suneesh

Read only

0 Likes
7,269

Hi suneesh,

To which i will make group name,i mean for text field and for input/output field.

Thanks

Read only

0 Likes
7,269

For both text and input field give the same group name

Read only

Former Member
0 Likes
7,269

Hi,

If i have got your question right then Please goto LAYOUT of your program and then group both your fields as suppose say G1. The screen provided by Ronaldo can be helpful.

Then use the below code.

Loop At Screen.

If screen-group1 = 'G1'.

   Screen-active = 0.

   Modify Screen.

Endif.

Endloop.

Regards

Read only

0 Likes
7,269

Hi Amaranatha,

I have already tried that one,But only one field is hiding and other field is not hiding.

Thanks

Read only

Former Member
0 Likes
7,269

Hi,

U can try like this (in PBO) but its better if u share ur code.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'FIELD1'.

SCREEN-INVISIBLE = 'X'.

WHEN 'FIELD2'.

SCREEN-INVISIBLE = 'X'.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

Read only

Former Member
0 Likes
7,269

Hi,

Have the same group name for both the fields.

by using the below code

loop at screen.

If screen-group1 = 'xyz'.

   screen-active = 0.

   Modify Screen.

Endif.

endloop.

Read only

sivaganesh_krishnan
Contributor
0 Likes
7,269

Hi Sai,

Create a group for fields by setting a name of the group on the right side tool bar , specify same group to both the fields,

IN PBO try to use LOOP AT SCREEN . with in that

write like if screen-group1 EQ 'groupname'.

               screen-active = 0.

             modify screen.

endif .

this will work .

regards,

Sivaganesh

Read only

Former Member
0 Likes
7,269

Dear Sai Ganesha,

No need to add the screen group to the field which want to make invisible in the screen layout .

Just add the following code

In the PBO (process before output) of the screen

Loop at screen.

if screen-name eq 'Field_name'.

screen-input =  0.

endif.

endloop.

Thanks and Regards,

Madhukumar

Read only

Former Member
0 Likes
7,269

Hi  Sai Ganesha,

In PBO use the below logic,

loop at screen.

      if screen-group1 eq <GROUP_NAME>.

          screen-active = 0.

          modify screen.

      endif.

end loop.

Read only

Former Member
0 Likes
7,269

Hi Sai Ganesha,

Please check the Name of the Table Control and if u have only one field in that table control u can use the below code , where u can hide the tab.

Loop at screen.

if <screen-name> eq 'Field_name'.

screen-input =  0.

endif.

endloop.

If u need to hide only the field. You may use

Example . cont_stc  is name of the table control (Structure)

                   cont_tab is refrence of structur con_stc.

code:-

loop at cont_tab into cont_stc.

if cont_stc-index = 2.  "your target hidden column

cont_stc-invisible = 1.

endif.

modify cont_tab from cont_stc.

endloop.


Please reply this above  doesnt help you.

Thanks,

S.Rajendranath

Read only

Former Member
0 Likes
7,269

Hello Sai,

please put below mentioned code in PBO module.

MODULE DISABLE_OUTPUT OUTPUT.
loop at screen.

   if screen-group1 = 'ABC'.
     screen-active = 0.
     modify screen.
     endif.
     endloop.
ENDMODULE.  

Regards,

Deepak kansal.

Read only

former_member220538
Active Participant
0 Likes
7,269

Hi,

First group the two fields 'MATNR' and 'HSDAT' using the field properties in the layout.

Loop at screen and change the screen attributes and modify the screen in PBO.

if screen-group1 = 'G1'

screen-invisible = '1'. 

screen-input = '0'.     

modify screen.

Still you are not able hide the field then Make sure that you are not modifying the screen attributes of the field HSDAT after the current loop at screen in the PBO.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
7,269

If one field is directly on dynpro and the second one in the records of a table control, they wont be managed in the same LOOP AT SCREEN.

PROCESS BEFORE OUTPUT.
* Fields on the dynpro
   MODULE mainscreen_attr.
   LOOP AT itab with control control cursor control-current_line.
*   Fields one one displayed record
     MODULE itab_attr.
   ENDLOOP.

So call your module(s) at both steps, you could use same module.

Regards,

Raymond

Read only

Former Member
0 Likes
7,269

Hi Sai,

As Raymond suggested you can create a module within the loop at block in PBO and inside this module you can check for the group and hide it like you have done for MATNR field.

This module will be called for each line of the internal table with which you are looping.

Thanks,

Ajay Bose