cancel
Showing results for 
Search instead for 
Did you mean: 

how to Populate Languages into DropwonByKey

former_member188831
Contributor
0 Kudos

Hi Friendz,

plese let me know in detail how shall i populate the languges list in dropdownbykey.

Thanks in advance.

Mahesh.Gattu

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

LOOP at tab_languaga into line_language.

ls_value_set-key = key.

ls_value_set-value = line_language_tab-text.

INSERT ls_value_set INTO TABLE lt_value_set.

add 1 to key.

ENDLOOP.

Here you are passing the Key information as integer because when you do the statement add 1 to key then the value can converted to integer. so if you pass the intefer value to KEY field it will display the list but when you select that it throus dump.

First time you are passing '00' as string so that when you select the first you are not getting the dump, after that you passing integer value so that you are getting the dump. Please change your logic.

For example: in my scenario i am doing like this:

  • fill Dropdown Help for posting Key

bschl_key_item-key = '40'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBIT_GL_ACCOUNT' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '50'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDIT_GL_ACCOUNT' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '21'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBITVENDOR' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '31'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDITVENDOR' ).

insert bschl_key_item into table lt_bschl_set.

lv_node_info = lv_node_it->get_node_info( ).

lv_node_info->set_attribute_value_set( name = 'BSCHL' value_set = lt_bschl_set

Former Member
0 Kudos

1. Do you need F4 help instead of Dropdown?

2. Where you linked the action Onaction_lanagues?

former_member188831
Contributor
0 Kudos

it is some thing linke this what ever the values we get for F4 help for language field, pick up that vlaues append to internal table pass that table into dropdown list.

i have not linked onaction_getlanguges please ignore it.

Thanks,

Mahesh

Former Member
0 Kudos

Hi Mahesh,

If that is the case, then search the "Search help" for Language and search for the BAPI or FM to return the values for the given serach help. Depending on that you can add those values to your input field.

Warm Regards,

Vijay.

former_member188831
Contributor
0 Kudos

yah i am really looking for that...

if you can tell me that indetail it will be great help...

whic fm or bapi has to be used and how should i get the values into itab.

thanks,

mahesh

Former Member
0 Kudos

Hi Maheshkumar,

get the list of languages (tab_languages)

and then populate the dorpdown :

contexte node = LANGAUGES

element = LANG (type WDY_UIE_LIBRARY_ENUM_TYPE )

lr_node = wd_context->get_child_node('LANGUAGES').

lr_node_info = lr_node->get_node_info( ).

key = 00.

LOOP at tab_languaga into line_language.

ls_value_set-key = key.

ls_value_set-value = line_language_tab-text.

INSERT ls_value_set INTO TABLE lt_value_set.

add 1 to key.

ENDLOOP.

lr_node_info->set_attribute_value_set(

name = 'LANG'

value_set = lt_value_set ).

I hope this helps

Regards

former_member188831
Contributor
0 Kudos

Hi Maya,

Thanks for your reply, but can you plese give me indetail like

what is the type declarion for lr_node and lr_node_info.

and how shall i populate the values into Internal Table. (dont mind).

i am littile confused with this Loop Endloop.

Former Member
0 Kudos

Hi,

Suppose you've got a table tab_language which contains all the languages you want to put int the dropdownByKey.

Suppose you've got in your contexte a node 'LANGUAGES' and in this node you've got an attribute 'LANG' which type is WDY_UIE_LIBRARY_ENUM_TYPE.

Data :

lr_node TYPE REF TO if_wd_context_node,

lr_node_info TYPE REF TO if_wd_context_node_info,

ls_value_set TYPE wdy_key_value,

lt_value_set TYPE wdy_key_value_table.

lr_node = wd_context->get_child_node( 'LANGUAGES').

lr_node_info = lr_node->get_node_info( ).

key = '00'.

LOOP AT tab_languages INTO line_languages.

ls_value_set-key = key.

ls_value_set-value = line_languages-txt.

INSERT ls_value_set INTO TABLE lt_value_set.

ADD 1 TO key.

ENDLOOP.

lr_node_info->set_attribute_value_set(

name = 'LANG'

value_set = lt_value_set ).

and then you have to assign the attribute to your DropdownByKey.

Regards

former_member188831
Contributor
0 Kudos

what is the type of lt_value_set

former_member188831
Contributor
0 Kudos

sorry ignore my previuos reply

former_member188831
Contributor
0 Kudos

Hi Mayaa,

Thansks for your reply, but i am not getting the values in dropdownbox.

i have the following code please analyse and let me know what is the problem.

method ONACTIONGET_LANGUAGE .

data:

Node_Languages type ref to If_Wd_Context_Node,

Node_Languages_info TYPE REF TO if_wd_context_node_info,

Elem_Languages type ref to If_Wd_Context_Element,

Stru_Languages type Wd_This->Element_Languages ,

Item_LANGU like Stru_Languages-LANGU.

DATA: TAB_LANGUAGES TYPE ZGT_LANGU1.

DATA: LINE_LANGUAGES TYPE ZGS_LANGU1.

DATA: ls_value_set TYPE wdy_key_value,

KEY type I,

lt_value_set TYPE wdy_key_value_table.

LINE_LANGUAGES-TEXT = 'EN'.

APPEND LINE_LANGUAGES to TAB_LANGUAGES.

LINE_LANGUAGES-TEXT = 'DE'.

APPEND LINE_LANGUAGES to TAB_LANGUAGES.

  • navigate from <CONTEXT> to <LANGUAGES> via lead selection

  • Node_Languages = wd_Context->get_Child_Node( Name = wd_This->wdctx_Languages ).

Node_Languages = wd_Context->get_Child_Node('Languages').

Node_Languages_info = Node_Languages->get_node_info( ).

    • get element via lead selection

  • Elem_Languages = Node_Languages->get_Element( ).

*

    • get single attribute

  • Elem_Languages->get_Attribute(

  • exporting

  • Name = `LANGU`

  • importing

  • Value = Item_Langu ).

**

key = '00'.

LOOP AT tab_languages INTO line_languages.

ls_value_set-key = key.

ls_value_set-value = line_languages-text.

INSERT ls_value_set INTO TABLE lt_value_set.

ADD 1 TO key.

ENDLOOP.

Node_Languages_info->set_attribute_value_set(

name = 'LANGU'

value_set = lt_value_set ).

endmethod.

Former Member
0 Kudos

Hi,

I tried your example and it worked perfectly.

what is the type of ZGT_LANGU1 and ZGS_LANGU1 and LANGU.

Did you assign the attribute LANGU to your dropdownbox ?

Regards

former_member188831
Contributor
0 Kudos

I have created a structure i.e ZGS_LANGU1 with the following parameters:

TEXT CHAR 20 0

KEY CHAR 20 0

and the ZGT_LANGU1 is the table type of ZGS_LANGU1.

earlier i have written the code on on action of the dropdown box, now i moved the code to WDDOINIT now my program is working.

But when i select first value like 'EN' it is not copied to lis.

when i select the second value 'DE' i am getting the following dump:

The following error text was processed in the system E6S : The value selectedKey = "01" in DropDownByKey "DB_LANGUAGE" does not exist in the value list and is not initial either

can plese do the needful.

Thanks,

Mahesh.

Former Member
0 Kudos

Hi Mahesh,

The problem in the following code:

<b>key = 00.

LOOP at tab_languaga into line_language.

ls_value_set-key = key.

ls_value_set-value = line_language_tab-text.

INSERT ls_value_set INTO TABLE lt_value_set.

add 1 to key.

ENDLOOP.</b>

Here you are passing the Key information as integer because when you do the statement add 1 to key then the value can converted to integer. so if you pass the intefer value to KEY field it will display the list but when you select that it throus dump.

First time you are passing '00' as string so that when you select the first you are not getting the dump, after that you passing integer value so that you are getting the dump. Please change your logic.

For example: in my scenario i am doing like this:

  • fill Dropdown Help for posting Key

bschl_key_item-key = '40'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBIT_GL_ACCOUNT' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '50'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDIT_GL_ACCOUNT' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '21'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBITVENDOR' ).

insert bschl_key_item into table lt_bschl_set.

bschl_key_item-key = '31'.

bschl_key_item-value = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDITVENDOR' ).

insert bschl_key_item into table lt_bschl_set.

lv_node_info = lv_node_it->get_node_info( ).

lv_node_info->set_attribute_value_set( name = 'BSCHL' value_set = lt_bschl_set ).

This definetly will solve your problem.

Warm Regards,

Vijay

former_member188831
Contributor
0 Kudos

Thanks vijay it is working fine.

in addition to this i have littile more functionality like, now i am passing the values manually where as i have get it the values from F4 Help of the languages, is there any way to get the values from F4 Help and pass to the internal table.

another is now i have written all my code in wddoinit where as i want to add this code onaction_language method, but i don't know how to call this.

now the values are getting populate by default it is loaded with value 1.

plese help me.

Thanks,

Maheshkumar.Gattu

Former Member
0 Kudos

Hi Mahesh,

Before giving the answer to your question, Please give me the answers to my question so that i can give the exact solution.

1. Do you need F4 help instead of Dropdown?

2. Where you linked the action Onaction_lanagues?

3. Why you want to write this information in the action instead of WDDOINIT?

You can't make a call to Action. It will be traigger by WD controller Depending on your action. For example, Button has the action, so when you click on the button then only the action will be traigarred. in the same way like tabchange for the Tabstrip also.

So first give me the answers to my question then i can provide the solution to you.

Warm Regards,

Vijay.