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 field name and numeric conversion from FLTP

Former Member
0 Kudos
588

Hi dear experts,

I'm working on a SELECT from a system generated table that contains a field (the last one from a total of 10) with a dynamic name (and defined as a FLOAT data type, 16/16).

How can I retrieve (within a subsequent loop against the internal table after the SELECT INTO TABLE) the dynamic name of this field and, in the meantime, convert it in NUMC (with 0 decimal)?

Thanks in advance !

Bye,

Roberto

4 REPLIES 4
Read only

Former Member
0 Kudos
351

Hi

I believe your last field has to be of the same type so a float type and so you can read it by field-symbol into the loop:

LOOP AT ITAB.

ASSIGN COMPONENT 10 OF STRUCTURE ITAB TO <FS_FLOAT>.

IF SY-SUBRC = 0.

MOVE <FS_FLOAT> TO <NUMC>.

ENDIF.

ENDLOOP.

U can try to use the FM GET_COMPONENT_LIST in order to get the component of an internal table.

Max

Read only

0 Kudos
351

Grazie Max...

Now I have the value I want to analyze in <FS_FLOAT> thanks to the statement

ASSIGN COMPONENT 10 OF STRUCTURE ITAB TO <FS_FLOAT>.

you suggested before...

But now, how can I convert the value I have in <FS_FLOAT> in a NUMC (or even in a CHAR) data type field ?

I see on my system a FM "FLTP_CHAR_CONVERSION", but I'm not so sure about its output (I see the same thing...)

Do you have some tip about my requirement ?

Again,

Roberto

Read only

Clemenss
Active Contributor
0 Kudos
351

Hi Roberto,

is this something new, a database field with dynamic name? Where can I check this?

Regards,

Clemens

Read only

Former Member
0 Kudos
351

Hi all,

this FM seems working...

CALL FUNCTION 'FLTP_CHAR_CONVERSION'

EXPORTING

DECIM = 0

INPUT = <FS_FLOAT>

IMPORTING

FLSTR = char.

Thanks...

Bye,

Roberto