cancel
Showing results for 
Search instead for 
Did you mean: 

dropdown by key condition

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

Thanks for reply.

No i am not using any FM for this. I want to read the table PA0001 field BUKRS where Company code is maintained.

Can you suggest on this,

Regards

arjun_thakur
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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 = ' ' ).

Former Member
0 Kudos

Hi,

Thanks both of you .. I am getting error on Loop statement while reading the internal table.

can you help on the loop statement

thanks

arjun_thakur
Active Contributor
0 Kudos

Kiran,

Show the code which you have written.

Regards

Arjun

Former Member
0 Kudos

Hi,

The loop I used is

Loop at it_p0001 into wa.

if it_p0001-bukrs = '1000' .

endif.

endloop.

Thanks

arjun_thakur
Active Contributor
0 Kudos

Kiran,

Use this:


Loop at it_p0001 into wa.

if wa-bukrs = '1000' .

endif.

endloop.

Regards

Arjun

Former Member
0 Kudos

I am getting error for wa

"WA cannot be converted to the lint type of "it_p0001"

could you let me know

thanks

arjun_thakur
Active Contributor
0 Kudos

Declare wa as given below

   DATA:  wa type p0001. 

Regards

Arjun

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

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

Former Member
0 Kudos

Hi Thomas,

yes I declared in same way.

Data: it_p0001 TYPE STANDARD TABLE OF p0001,

wa like line of it_p0001,

lc_infty1 TYPE char4 VALUE '0001'.

I am getting now different error on calling the onselectaction "Type conflict when calling a function module"

can you highlight

thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

As the error message suggests, you have a data type conflict between the variables you are passing into the function module and what the function interface expects. Check your data types against those of the function module to determine where the inconsistency lies.

Former Member
0 Kudos

Hi,

Thanks thomas error got resolved

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Could any one let me know whats wrong in the code.

thanks

arjun_thakur
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thanks Arjun issue resolved

Answers (1)

Answers (1)

Former Member
0 Kudos

any replies ??