on 03-10-2009 9:53 AM
Hi All,
I want to get the logged in user company code and depending on the country selected in drop down and company code I want to enable the button.
thanks
K
Hi Kiran,
I guess you must be using some FM to get the company code of the employee and the user is selecting some country from the drop down, then based on those values you want to enable a button. If this is your requirement then it can be done easily.
You'll get the componay code in some variable and in the onselect method of the drop down , just read the attribute that is binded to the drop down. This will give you the key the country selected selected. Now just write the logic is the if statement and enable the button if the condition satisfies.
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kiran,
Use of select query in wd component is not recommended. So if you have fetch data from any infotype (0001 in your case), you should FM HR_READ_INFOTYPE. Just pass the pernr and the infotype type no. (0001 in you case) and you'll get data in an internal table corressponding to that pernr, then you can simply apply a read statement on the internal table to get the value of burks field.
Data: it_p0001 TYPE STANDARD TABLE OF p0001,
lc_infty1 TYPE char4 VALUE '0001'.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = zpernr
infty = lc_infty1
bypass_buffer = 'X'
TABLES
infty_tab = it_p0001" this internal table will contain the data corressponding to the pernr passed.
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
I hope it helps.
Regards
Arjun
Edited by: Arjun Thakur on Mar 10, 2009 4:31 PM
Hi Kiran,
Use FM RH_READ_INFOTYPE , to this pass info type '0001'. You will get the values of login pernr.
Now on action of country drop down check the bukrs and country key if they are satisfied with your required values then disable the button.
To disable the button take one context attribute of type WDY_BOOLEAN and bind this attribute to the button property enabled .When your condition is meet then set the attribute with value space.
get element via lead selection
lo_el_context = wd_context->get_element( ).
Set attribute
Disable addrow,deleterow and Ok buttons
lo_el_context->set_attribute(
exporting
name = `A_DISABLE_BUTTONS`
value = ' ' ).
>
> I am getting error for wa
>
> "WA cannot be converted to the lint type of "it_p0001"
>
> could you let me know
>
> thanks
Somehow this thread has gotten off track from Web Dynpro ABAP and is instead discussing very basic ABAP concepts. If you have basic ABAP questions - like how to declare a work area and loop through a table, these questions really belong in the ABAP general forum.
You haven't even posted how you declared WA. From the error we have to assume it is declared incorrectly. Declare it with a like reference to the internal table to avoid such errors.
data wa like line of it_p0001.
I tried keeping a break point at loop statement but the condition is not getting checked
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = v_pernr
infty = lc_infty1
bypass_buffer = 'X'
TCLAS = ZTCLAS
BEGDA = ZBEGDA
ENDDA = ZENDDA
LEGACY_MODE = ZA
TABLES
infty_tab = it_p0001
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
Loop at it_p0001 into wa.
if wa-bukrs = '1000' and lv_country_and_region eq 'IN'
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_ca_enable TYPE wd_this->element_context-ca_enable.
lo_el_context = wd_context->get_element( ).
lo_el_context->set_attribute(
name = `CA_ENABLE`
value = ' ' ).
ENDIF.
Endloop.
I am cheking on company code and selected country and disabling the button
any points
Regards
Hi Kiran,
In your earlier post you said that you have to get logged in user's company code, for that you have to pass logged in user's pernr to 'HR_READ_INFOTYPE'. I hope you are passing the pernr value in the FM.
If yes, then put a break point on the if statement and see if the conditions are getting checked.
Regards
Arjun
any replies ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.