Skip to Content
0

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

Jun 13, 2017 at 03:59 PM

105

avatar image

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 !

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Mike Pokraka Jun 13, 2017 at 09:43 PM
1

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

append value #( sign = 'I' option = 'EQ' low = sel_row-matnr ) to o_matnr.
Show 7 Share
10 |10000 characters needed characters left characters exceeded

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 !

0

I gave you the code above.

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

0

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 ?

0

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

0

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.

0

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

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

0
Anand Sagar Sethi Jun 13, 2017 at 04:41 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Ganesh pandian Jun 14, 2017 at 02:06 PM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
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

0

I hope this is already answered ?

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

0
umayaraja b Jun 14, 2017 at 08:26 AM
-3

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

Share
10 |10000 characters needed characters left characters exceeded