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 using BADI

Former Member
0 Likes
2,389

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
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,998

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

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,998

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.

Read only

0 Likes
1,998

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

Read only

0 Likes
1,998

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.

Read only

0 Likes
1,998

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...

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,999

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

Read only

Former Member
0 Likes
1,998

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.

Read only

Former Member
0 Likes
1,998

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

Read only

Former Member
0 Likes
1,998

Thanks all..All the answers were very useful.

Thanks & Regards

Pravithanambiar