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

dynamic data type and conversion

Former Member
0 Likes
954

How to stock result in dynamic var ?

i don't know in advance the data type it can be char or string or datum ?

select single (fieldname) from (t_name) into field where pernr = pernr and endda <= '99991231'

fieldname, t_name are variable but i have a dump because i can have every data type in field ?

I use field assign but it does'nt work ?

Edited by: kraiem adel on May 15, 2008 5:55 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
758

I declared as and I got the result ..

data : fieldname(20) ,

t_name(10) ,

field(20).

fieldname = 'PERNR'.

t_name = 'PA0001'.

select single (fieldname) from (t_name)

into field where pernr = pernr and endda <= '99991231'.

if sy-subrc = 0.

*....

endif.

5 REPLIES 5
Read only

Former Member
0 Likes
759

I declared as and I got the result ..

data : fieldname(20) ,

t_name(10) ,

field(20).

fieldname = 'PERNR'.

t_name = 'PA0001'.

select single (fieldname) from (t_name)

into field where pernr = pernr and endda <= '99991231'.

if sy-subrc = 0.

*....

endif.

Read only

0 Likes
758

fieldname, table name are dynamic ?With field type char it does'nt work

Edited by: kraiem adel on May 15, 2008 6:08 PM

Read only

0 Likes
758

Hello.

Look at this example.


DATA: fieldname TYPE char20,
           t_name TYPE char20,
           field TYPE char20.

field-symbols: <fs1> TYPE any.
fieldname = 'VBELN'.
field = 'FIELDNAME'.
t_name = 'VBAP'.
ASSIGN (field) TO <fs1>.

SELECT SINGLE (fieldname) FROM (t_name) INTO <FS1> WHERE vbeln EQ '0000000001'.

Best regards.

Valter Oliveira.

Read only

0 Likes
758

I have a dump with this ?

field can be any type of data : char integer datum ...

Read only

Former Member
0 Likes
758

Thanks to all experts