Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Pass variable From ALV to Select Screen / Just parameter to select screen works

Former Member
0 Likes
3,264

So i did an ALV where my matnr should be passed to my Select Screen into the Select-Options.


I can pass the value from the alv with this Code to my selection screen.

ELSEIF pv_ucomm EQ gc_history.
READ TABLE gt_list INTO sel_row
INDEX ps_selfield-tabindex.
o_matnr = sel_row-matnr.


But my problem is, if i change O_matnr to Select-Options e.g. Select-Options: matnr for ...
and the above code to
o_matnr-low = sel_row-matnr
the value is not passed anymore.


MY selection-screen:

SELECTION-SCREEN BEGIN OF SCREEN 0200 AS SUBSCREEN.
*SELECT-OPTIONS: o_matnr FOR zpplock-matnr.
PARAMETERS: o_matnr TYPE zpplock-matnr.
SELECT-OPTIONS: o_sernr FOR risa0-sernr.
SELECT-OPTIONS: o_user FOR zpplock-uname..
SELECT-OPTIONS: o_date FOR zpplock-datum.
PARAMETERS: o_zlock TYPE zpplock-zlock.
SELECT-OPTIONS: o_zreas FOR zpplock-zlock_reason.
SELECT-OPTIONS: o_time FOR zpplock-uzeit.
SELECTION-SCREEN END OF SCREEN 0200.

I let the debugger go over it and my matnr gets written in the o_matnr-low field but its never getting displayed
So i Hope you can help me thanks for your time and help !

1 ACCEPTED SOLUTION
Read only

pokrakam
Active Contributor
2,598

Are you also setting "I" and "EQ" in your select options?

append value #( sign = 'I' option = 'EQ' low = sel_row-matnr ) to o_matnr.
13 REPLIES 13
Read only

anand_sagarsethi
Contributor
2,598

AT Selection screen output, event is only place that let you show the field. Make sure its been called & when its called fields are updated.

Thanks

Anand

Read only

pokrakam
Active Contributor
2,599

Are you also setting "I" and "EQ" in your select options?

append value #( sign = 'I' option = 'EQ' low = sel_row-matnr ) to o_matnr.
Read only

Former Member
0 Likes
2,598

no im not setting in my select option 'I' and 'EQ' can u tell me maybe what i need to do
thanks

EDIT: okay thanks a lot mike really helped me with that now its working perfect !

Read only

pokrakam
Active Contributor
0 Likes
2,598

I gave you the code above.

Please see Select Options in the online help for more detailed info.

Read only

Former Member
0 Likes
2,598

okay i read it and its working for the first selection, but i go back and select another matnr it keeps giving me the first i selected.
1. time i select matnr = 1315.811.711 -> displays 1315.811.711

than i go back
2. time i select matnr = 1315.811.712 -> displays 1315.811.711
and in the debugger at sel_row.matnr-low gets passed the right value, but on the 2nd time the wrong value gets displayed ...

thank you or did i just miss something ?

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,598

Seems that you miss that select options are internal tables with header lines.

Read only

Former Member
0 Likes
2,598

Yes i did i figured it out now 🙂
but i dont know how to delete the previous entry i tried Modify, Update value # (.....)
but it doesnt work like that.
Do i need to put a loop over the code and than delete it ?

ELSEIF pv_ucomm EQ gc_history.
READ TABLE gt_list INTO sel_row
INDEX ps_selfield-tabindex.
APPEND VALUE #( sign = 'I' option = 'EQ' low = sel_row-matnr ) TO o_matnr.


* LOCK Tabelle aufrufen
PERFORM add_history.

Read only

pokrakam
Active Contributor
0 Likes
2,598

To clear a table, use:

REFRESH o_matnr. 

or alternatively you can assign the entire table instead of appending, this will overwrite existing contents:

o_matnr = VALUE #( ( sign = 'I' option = 'EQ' low = sel_row-matnr ) ).
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,598

You really should start with some ABAP basics first ...

Read only

Former Member
0 Likes
2,598

hi kevin,

"o_matnr-low = sel_row-matnr" is wrong statement for while use select option ,just " o_matnr-low IN sel_row-matnr " type like that it will fetch record based on select option ( low an high).

regards,

Umayaraja.B

Read only

Ganesh_Pandian
Explorer
2,598

What is actually your requirement??

If you need the same select option like function you can opt for RANGES.

So that you can assign the values to the ranges and get the same functionality like the select-option

but you have to write code to fill the RANGES.

Else try playing with the memory to achieve your work.

Read only

0 Likes
2,598
I'm new to abap ....

what do u mean by playing with the memory ?

With mikes code it works but as soon as i go back and select another row it keeps displaying me the previous selected matnr from the previous selected row. So i just want the matnr to be copied to the selection screen and if i go back that the previous matnr gets overwritten with the new one .
i hope i explained it correctly

Read only

0 Likes
2,598

I hope this is already answered ?

https://archive.sap.com/discussions/thread/2083266