cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

drop down box

Former Member
0 Likes
934

Hi Everyone,

I have a drop down box in which i need to display the values from two diffrent fields from two different tables.Say i have 4 values for field x in ztable1 and 2 values for field y in ztable2.I want to display field x and field y values from ztable1 and ztable2 under a particular field in table cotrol as an input i.e it should show 6 values.

Any help would be greatly appreciated and rewarded.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi suchitra,

I guess the data type for both these fields are same..

Use a internal table with header line of type field1/field2...

populate the values from field1 of table1..

select field1 into table itab from table 1.

then

populate the values from field2 of table2..

select field2 into itab from table 2.

append itab.

endselect.

Use this internal table to poulate the dropdown box..

eg:

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = itab.

Regards,

Tanveer.

<b>Please mark helpful answers</b>

Former Member
0 Likes

try this:

1. populate itab with those 6 values.

2. LOOP AT itab .

value-key = itab-value.

APPEND value TO list.

ENDLOOP.

3. In the VALUE-request module for that parameter, call this.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = <parameter name>

values = list.

Former Member
0 Likes

Oops, Tanveer, we are on the same line

Former Member
0 Likes

Hi,

well i guess varun sonu did mention in the previous thread

<b>"Great minds think alike!!"</b>

Lets hope the solution helps Suchitra

Former Member
0 Likes

Hi ,

Iam sending the code .Please take a moment to go through it.

data : begin of I_test occurs 0,

Kostl like ztest-kostl,

aufnr like ztest-aufnr,

End of I_test.

"""I am confused how to read from zfix and zfix1 into internal table .I have kostl in table zfix and aufnr in table zfix1 i.e the select query.

select kostl from zfix into table i_kostl.

loop at i_test.

value-key = i_test-kostl."" Iam nost sure how to mention two values i.e i_test-kostl and i_test-aufnr""

*valUe-text = 'test'.

append value to list.

endloop.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'ztest-kostl'"" i am also not sure how to update date base table z test

VALUES = LIST

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

waiting for your replies

Former Member
0 Likes

Suchitra,

1. CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = <this is the parameter or screen field name e.g. p_field>

(why to update a databadse table?)

2. Declare your I_TEST with a fleid: field(80) type c.

3. Select from zfix,zfix1 etc wherever you want from.

2 separate selects.

4. Populate those values in I_TEST.

Former Member
0 Likes

Hi suchitra,

here is the code for reading all the records in to one internal table.

=================================================

data : begin of I_test occurs 0,

Kostl like ztest-kostl,

aufnr like ztest-aufnr,

End of I_test.

data: I_test1 like I_test occurs 0 with header line.

select kostl from zfix into table I_kostl.

select aufnr from zfix1 into table I_kostl1.

Loop at I_kostl1.

move I_kostl1-aufnr to i_kostl-aufnr.

append i_kostl.

clear i_kostl.

Endloop.

====================================================

I am not sure about the field passing in value-key but i think it should be OK if you pass just i_test-kostl.

Hope this helps..

Regards,

Vicky

Answers (0)