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: 

Hiding fields in a screen using BADI

Former Member
0 Kudos

Hi Experts

I want to invisible certain fields in the screen for certain users and it should be made visible for certain users,the requirement is to do with badi.Can anyone help me regarding this issue.

Thanks & Regards

Pravitha

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

First you will have to [find a BAdI|http://www.sdn.sap.com/irj/scn/advancedsearch?query=findaBAdI] that is executed during the [PBO process before output|http://help.sap.com/abapdocu_70/en/DYNPPROCESS.htm#&ABAP_ALTERNATIVE_1@1@], in this BAdI you will be able to [LOOP AT SCREEN|http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_SCREEN.htm] on displayable fields and [MODIFY|http://help.sap.com/abapdocu_70/en/ABAPMODIFY_SCREEN.htm] their attributes.

Regards,

Raymond

8 REPLIES 8

Former Member
0 Kudos

Hi,

We generally use modify screen structure for enabling disabling screen fields.

loop at screen

if screen-name = field1

screen-activ = 0.

endif.

modify screen

endloop.

But you need to make sure, if the badi is triggered at the right place.in the module pool of screen.

0 Kudos

Sorry Expert

Please suggest me to hide the fields for certain users and should be made to visible for certain users.Don't want to enable or disable.

Thanks & Regards

Pravitha

0 Kudos

Hi,

you can create an authorization object and assign it to users whom you want the fields to be visible for.

Now in your badi, before the screen code, check teh authorization object.

If satisfied then show fields else hide.

If you have limited set of users, you can also check username and then modify accordingly.

0 Kudos

Use (or Create) authorization [field|http://help.sap.com/saphelp_nw04/helpdata/en/52/67168c439b11d1896f0000e8322d00/frameset.htm] and [object|http://help.sap.com/saphelp_nw04/helpdata/en/52/6716a6439b11d1896f0000e8322d00/frameset.htm], in the BAdI [check this authorization|http://help.sap.com/abapdocu_70/en/ABAPAUTHORITY-CHECK.htm] and change the INVISIBLE field and not the ACTIVE field in SCREEN structure.

- [Programming Authorization Checks|http://help.sap.com/saphelp_nw04/helpdata/en/52/6712ac439b11d1896f0000e8322d00/frameset.htm]

Inform system admin to manage those new object and field in the user roles. ([SAP Authorization Concept Modules|http://help.sap.com/saphelp_banking463/helpdata/en/5c/deaa74d3d411d3970a0000e82de14a/frameset.htm])

Regards,

Raymond

NB: The "d" of BAdI should always been in lowercase, except in statement GET BADI...

raymond_giuseppi
Active Contributor
0 Kudos

First you will have to [find a BAdI|http://www.sdn.sap.com/irj/scn/advancedsearch?query=findaBAdI] that is executed during the [PBO process before output|http://help.sap.com/abapdocu_70/en/DYNPPROCESS.htm#&ABAP_ALTERNATIVE_1@1@], in this BAdI you will be able to [LOOP AT SCREEN|http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_SCREEN.htm] on displayable fields and [MODIFY|http://help.sap.com/abapdocu_70/en/ABAPMODIFY_SCREEN.htm] their attributes.

Regards,

Raymond

former_member182485
Active Contributor
0 Kudos

Hi,

You can create a Z table in this maintain all the user who will get authorisation to change the field.

In the BADI compare the user with the Z table and modify the screen accordingly.

Former Member
0 Kudos

Hi Pravithanambiar,

Try to figure out the badi which has the structure SFAUSWTAB.

In this structure there is one field KZINV, which is to make field invisible.

Follow the below code then,

IF sy-uname EQ 'Pravithanambiar'.

IF ( fauswtab-fname = 'MARA-MEINS' ).

fauswtab-kzinV = '0'.

ENDIF.

endif.

U can add as many user names as u want by 'and' logical condition. This above written logic is to suppress the meins field for you

and displayed for others.

If u don't have any BADI with the structure SFAUSWTAB.

Then try with this code.

IF sy-uname EQ 'Pravithanambiar'.

loop at screen.

IF ( screen-name = 'MARA-MEINS' ).

screen-invisible = 1'.

ENDIF.

endloop.

endif.

The above two can solve ur problem but the second method is trail and error one. Try with each and every method of all badi.

Best wishes,

Rudhir Bhaskar

Former Member
0 Kudos

Thanks all..All the answers were very useful.

Thanks & Regards

Pravithanambiar