cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Buttons

Former Member
0 Kudos

Hi,

I m having a button say 'lock', when i press lock it should trigger some action as well in place of lock there should be another button with the test 'unlock'. when u press unlock it should call another action and in place of unlock it should replace with previous button 'lock'.

how to do this.

Accepted Solutions (1)

Accepted Solutions (1)

mohammed_anzys
Contributor
0 Kudos

Hi renushree,

You need to handle this using meta data.I will write teh steps that you need to follow.

1.Create a node lock in your context.

1.a Add attribute VISIBLE of type WDY_BOOLEAN.

put the default value as 'X' .so that it will be visible in your first load

2.Create a node unlock in your context

2.a Add an attribute VISIBLE of type WDY_BOOLEAN.

Give deafult value space.

3. Create two buttons with LOCK and UNLOCK and bind their visible properties bound to teh attributes from node LOCK and UNLOCk respectively.

4. Add your code in your LOCK and UNLOCK actions .

In LOCK action , set VISIBLE attribute of the node LOCK to space and set VISIBLE attribute of the UNLOCK node to 'X'

This will enable your UNLOCK button and hide LOCK button.

In UNLOCK action , set VISIBLE attribute of the node UNLOCK to space and set VISIBLE attribute of the LOCK node to 'X'

This will enable your LOCK button and hide UNLOCK button.

Thanks

Anzy

Award points for useful answers

Former Member
0 Kudos

could you please provide me the code how to write this in action button. please

thanks in advance.

mohammed_anzys
Contributor
0 Kudos

Hi

On click of LOCK action.

Data: lo_lock type ref to if_wd_context_node,

lo_unlock type ref to if_wd_context_node.

lo_lock = wd_context->get_child_node( 'LOCK' ).

lo_unlock = wd_context->get_child_node( 'UNLOCK' ).

CALL METHOD lo_unlock ->SET_ATTRIBUTE

EXPORTING

VALUE = 'VISIBLE'

NAME = 'X'

.

CALL METHOD lo_lock ->SET_ATTRIBUTE

EXPORTING

VALUE = 'VISIBLE'

NAME = ' '

.

On click of UNLOCK action.

Data: lo_lock type ref to if_wd_context_node,

lo_unlock type ref to if_wd_context_node.

lo_lock = wd_context->get_child_node( 'LOCK' ).

lo_unlock = wd_context->get_child_node( 'UNLOCK' ).

CALL METHOD lo_unlock ->SET_ATTRIBUTE

EXPORTING

VALUE = 'VISIBLE'

NAME = ' '

.

CALL METHOD lo_lock ->SET_ATTRIBUTE

EXPORTING

VALUE = 'VISIBLE'

NAME = ' X'

.

This will work for you.Put teh code in the respective button actions.

Thanks

Anzy

<B>Award points for useful posts.

Former Member
0 Kudos

Hey anzy,

its throughing an error like method "lo_unlock" is unkonwn or protected or private.

how to rectify this

mohammed_anzys
Contributor
0 Kudos

Hi

Actually it should not give the error .While making the set attribute call..Try this way

lo_unlock ->if_wd_context_node~SET_ATTRIBUTE

Thanks

Anzy

former_member1193316
Participant
0 Kudos

hi,

i hav used like this

lo_lock->if_wd_context_node~SET_ATTRIBUTE EXPORTING VALUE = 'VISIBLE' NAME = 'X' .

still its throughing error like its not defined, check ur spelling...........

mohammed_anzys
Contributor
0 Kudos

Hi

There was unwanted space after lo_unlock ...Please correct like below...

Data: lo_lock type ref to if_wd_context_node,

lo_unlock type ref to if_wd_context_node.

lo_lock = wd_context->get_child_node( 'LOCK' ).

lo_unlock = wd_context->get_child_node( 'UNLOCK' ).

CALL METHOD lo_unlock->SET_ATTRIBUTE

EXPORTING VALUE = 'VISIBLE'

NAME = 'X' .

CALL METHOD lo_lock->SET_ATTRIBUTE

EXPORTING VALUE = 'VISIBLE'

NAME = ' ' .

Its working in my editor.

Thanks

Anzy

Award points if this solves your issue

former_member1193316
Participant
0 Kudos

Hi Anzy

I m really very thankfull for ur replies, but still my problem not got resolved.

i hav done the same thing which u mentioned.

its executing also. but when i pressed 'lock' button its throughing an error "could not find attribute 'x' ". i commented the line

CALL METHOD lo_unlock->SET_ATTRIBUTE EXPORTING VALUE = 'VISIBLE'

NAME = 'X' .

now also getting te smae error "could not find the attribute ' ' "

what does it mean

why i m getting this problem

mohammed_anzys
Contributor
0 Kudos

Hi

There is a correction.The parameters got interchanged.Please correct the code

and try it...

CALL METHOD lo_unlock->SET_ATTRIBUTE

EXPORTING VALUE = 'X'

NAME = 'VISIBLE' .

Thanks

Anzy

former_member1193316
Participant
0 Kudos

even i tried like this also, i got an error like "Unable to interpret x as a number".

whats wrong with me..............

mohammed_anzys
Contributor
0 Kudos

hi

Remove all the unneccasery space and format the code like this...

CALL METHOD lo_unlock->SET_ATTRIBUTE

EXPORTING

VALUE = 'X'

NAME = 'VISIBLE' .

This has to work , you have created a node in the context with name UNLOCK and with attribute VISIBLE , right ? The code is syntactically correct now .

Please check again

Anzy

former_member1193316
Participant
0 Kudos

Yes,

Superb da, its working.

I m really very thankful to u. i m very very very happy for this. ThankQ very much buddy...

mohammed_anzys
Contributor
0 Kudos

hi Venkat,

Great to hear that your problem got solved...good work.....now i can go and sleep..:-).....its 2.30 AM in india....

Thanks..

Anzy

Former Member
0 Kudos

gr8 anzy, i m also frm india. i m frm chennai.

anywayz thanks for ur cooperation. Gud Nyte....

Answers (0)