Está en la página 1de 9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

GetStarted

Solutions

Partner

Community

Support

About

Training

Community

Developer

Blogs

Actions

BusinessRoleBased
authorizationsforyour
customBOs
July2,2014

| 125Views |
AlessandroIannacci
morebythisauthor

SAPCloudApplicationsStudio

share
0

share
0

tweet

share
0

0
like

Follow

Asyoumayknow,SAPCloud4Customeroffersastandardobject
calledUISwitchtoinfluencethestandardfieldpropertiesbasedonthe
userrole.
Howtouseit?

Standarduse
TheUISwitchisanobjectthatcanbeassignedtoanybusinessRole.
Anystandardscreenextensionisabletorecognizeiftheuserhas
someroleassociatedwiththeUISwitchandbasedonthis
https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

1/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

information,itcanchangethefieldpropertiesasdefinedbythe
developer.
Step1.
CreatetheUISwitchinthePDI

Step2.
Inanystandardscreenextension,youcanmodifyfieldproperties(via
extensibilityexplorer)andmakethesepropertiesdependantfromthe
UISwitch

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

2/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

Nonstandarduse:
ThelimitationtothisfactisthatthereisnostandardwaytouseUI
Switch(andsobusinessroleauthorization)foryourcustom
developments.
Hereasimpletricktomakeitworkingforallthekindsof
developments
Step1.
CreatetheUISwitchasshownbefore
Step2.
Addanindicator(orsomeotherkindoffieldifyouneed)andan
actiontoyourcustomBO

Step3.
Implementtheactionasshownbelow(highlightedpart).Notethat
Context.GetCurrentUserUISwitches()isastandardmethodalways
availableintheABSLlibrary.

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

3/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

Step4.
Inyourcustomscreenbindthefavouritedpropertyofyourfieldsto
the(inthisexample)indicatorfield

Step5.
Intheinitializationofyourscreencalltheactionthatrefreshthestatus
oftheindicatorfield,basedontheuserbusinessrole

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

4/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

TestingtheUISwitch
Step1.
CreateanewbusinessroleandassigntheUISwitchtoit

Step2.
AssigntheBusinessRoletotheuser

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

5/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

Step3.
Enjoy!

AlertModerator

9Comments

DhruvinMehta
July7,2014at9:04am

FantasticDocument!
AlessandroIhavesmalldoubtasthereisnooptionofAssigningUISwitch
againstacustomview(inmycaseQuickcreate).
Ordoihavetohandleeverythingbycode?
Regards,
Dhruvin

AlessandroIannacci Postauthor
July7,2014at9:26am

Yes,thereisnooptionofassigningUISwitchagainstacustom
view,youneedtohandletheUISwitchviacodeandsetyour
customproperties!

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

6/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

DhruvinMehta
July7,2014at9:34am

Oh!okayalessandrothanksfortheinfo!!!

AlessandroIannacci Postauthor
July7,2014at9:35am

Yourewelcome!

BradGorlicki
February22,2015at9:47pm

AgreathelpthanksAlessandro.
Ihaveoneproblem
IhaveusedthisideainaECtorestricteditaccesstocertainusers.
ItworksfineexceptnoweverytimeIopentheEC,thescreengoesintoedit
modewithoutclickingedit?
Anyideawhythiswouldoccur?

AlessandroIannacci Postauthor
February23,2015at9:12am

Uhmmmm
questions:
1)AreyouusingHTML5UI?(Iassumeyesbecauseyouare
speakingaboutaneditbutton)
2)Didyoubindyourcustomfieldswiththecustomindicator
drivenbytheuiswitch?
3)Beforethebindingatpoint2,thestandardsbehaviourwas
different?(ECeditableonlyafterclickingonedit?)
Ifallthe3pointsaretrue,Ithinkitsagoodthingtoraisean
incident.Ifyoubindacustomfieldwithareadonlyindicator,this

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

7/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

shouldnotoverwritethestandardbehaviour(IMHO:theycant
beenabledbeforeyouclickonedit).
Ifpoints1and2aretrue,butpoint3isfalse,thenyouneedto
takeinconsiderationtheeditablestandardflaginorderto
controlyourreadonlycustomflag.

BradGorlicki
February23,2015at6:42pm

1)Yes.
2)YesthecolumnsEnabledpropertyisdrivenby
thecustomindicator.
3)IfIremovetheactionfrommyinitializationofthe
ECthisunwantededitaccessnolongeroccurs.
IthoughtthiswasabugasthereisnowayIhave
toldthesystemtogointoeditmodeviamyscript,I
justwantedtobesureitwasntsomethingtodo
withtheEC.Thanksforyourhelp,Iwillraisean
incident.

GertKix
April30,2015at9:42am

Recentlyitwasbroughttomyattention
thatthistypeofbehaviourcanoccur
whenanembeddedcomponentis
addedtoacustomobjectandthe
WorkProtectedRelevantflagonthe
embeddedcomponentisnotset.You
havethisflagonfieldlevelbutalsoon
embeddedcomponentlevel

AdithyanRS
June30,2016at6:37am

HelloBrad,
https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

8/9

06/12/2016

BusinessRoleBasedauthorizationsforyourcustomBOsSAPBlogs

Wearetryingtoacheivesimilarkindof
requirement.Weneedtorestrict
accesstocreatebuttonanddelete
buttoninanCustomEC.
WhenitrytobindthatCreatebuttonto
theIndicatorfield,italwaysdisables
thebuttonforalluserseventhough
theUISwitchhasbeenassignedfor
theUsers.
Canyoupleaseletmeknowon
achievingthis?Itwouldbehelpfulfor
usifthereanyinformationshared!
ThanksinAdvance!
Regards
AdithyanRS

AddComment

Share & Follow

Privacy

TermsofUse

LegalDisclosure

https://blogs.sap.com/2014/07/02/businessrolebasedauthorizationsforyoucustombos/

Copyright

Trademark

Sitemap

Newsletter

9/9

También podría gustarte