2008 Feb 29 2:36 PM
How would I read any value from a table into a string?
Currently doing the following...
data ret_val type string.
select single (wa_map-qes_field) from z_qekko into ret_val
where
angnr = _angnr.
When the source field is a date it bombs though.
The result goes into a BDCDATA-fval.
regards
Dylan.
2008 Feb 29 2:43 PM
Not logged into a system at the moment, so can't check precisely, but you could do...
PARAMETERS: p_field TYPE fieldname.
DATA: lp_data TYPE REF TO DATA.
FIELD-SYMBOLS: <value>.
CREATE DATA lp_data LIKE (p_field).
ASSIGN lp_data->* TO <value>.
SELECT SINGLE (fieldname) FROM table INTO <value> WHERE... matt
How would I read any value from a table into a string?
Currently doing the following...
data ret_val type string.
select single (wa_map-qes_field) from z_qekko into ret_val
where
angnr = _angnr.
When the source field is a date it bombs though.
The result goes into a BDCDATA-fval.
regards
Dylan.
2008 Feb 29 2:40 PM
select single
field1 from table
into v_field
where field1 = p_field.
<REMOVED BY MODERATOR>
venkat.
Edited by: Alvaro Tejada Galindo on Feb 29, 2008 10:20 AM
2008 Feb 29 2:46 PM
May be I dont understand your solution but, that is even less generic.
Did you notice that the field is determined via select single (field_to_read) from into generic_type_of some sort
what data type did you use for v_field ?
Wouldnt the solution require some type of <fs>?
regards
Dylan.
2008 Feb 29 2:43 PM
Not logged into a system at the moment, so can't check precisely, but you could do...
PARAMETERS: p_field TYPE fieldname.
DATA: lp_data TYPE REF TO DATA.
FIELD-SYMBOLS: <value>.
CREATE DATA lp_data LIKE (p_field).
ASSIGN lp_data->* TO <value>.
SELECT SINGLE (fieldname) FROM table INTO <value> WHERE... matt
2008 Feb 29 2:47 PM
2008 Feb 29 2:52 PM
Tried...
1 DATA: lp_data TYPE REF TO DATA.
2 FIELD-SYMBOLS: <value> TYPE ANY.
3 CREATE DATA lp_data LIKE (wa_map-qes_field).
4 ASSIGN lp_data->* TO <value>.
5 SELECT SINGLE (wa_map-qes_field) FROM zquadrem_qekko INTO <value> WHERE angnr = _angnr.
Complains that (wa_map-qes_field) is not defined in line 3.
Think that the bracket thing is only available via SQL.
What about CREATE DATA lp_data type ref to object. ?
Would the above declaration work?
regards
2008 Feb 29 3:18 PM
REF TO OBJECT won't work.
Can you do CREATE DATA lp_data TYPE (wa_map-qes_field). ? Sorry - I like to check things before posting, but as I said, I've not got a system to log into today!
You can probably use RTTS - if your SAP version is high enough - to determine the correct type. Search on RTTS - there's some good documentation in SDN on it, with worked examples. [like this one.|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae]
matt
2008 Feb 29 3:23 PM
Hi,
I changed it to TYPE anyway and it worked.
Thanks, for your help!
Dylan.
2008 Feb 29 2:47 PM
tables:mara.
data:v_matnr like mara-matnr.
select-options: s_matnr for mara-matnr.
select single matnr
from mara
into v_matnr
where matnr in s_matnr.
write:/ v_matnr.
<REMOVED BY MODERATOR>
venkat .
Edited by: Alvaro Tejada Galindo on Feb 29, 2008 10:21 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |