Application Development 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: 

help with Table declartion

Former Member
0 Kudos

Hi,

i declare table type char to move data to text format

the problem is that i have Field type Dec5.2 and i have erorr to send them how can i declare table that take all the fields types like (char,numc,dec)

TYPES : BEGIN OF itab,
        rec(500) TYPE c,
       END OF itab.

DATA: c_tab  TYPE TABLE OF itab WITH HEADER LINE ,


  LOOP AT it_d_2.
    CONCATENATE it_d_2-employee_number it_data_2-bow it_data_2-num
    it_d_2-text1 it_d_2-text2 it_d_2-text3 it_d_2-leihg

    INTO c_tab-rec SEPARATED BY ','..
    APPEND c_tab.

  ENDLOOP.

Regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi you cannot use conctenate with other than char data.

so you declare a character data type and assign value of field having type Dec5.2 and than concatinate it.

eg. if you have it_data_2-num type Dec5.2

data: char(10) type c.

LOOP AT it_d_2.

char = it_data_2-num.

CONCATENATE it_d_2-employee_number it_data_2-bow char

it_d_2-text1 it_d_2-text2 it_d_2-text3 it_d_2-leihg

INTO c_tab-rec SEPARATED BY ','..

APPEND c_tab.

ENDLOOP.

reward if useful.

3 REPLIES 3

Former Member
0 Kudos

hi you cannot use conctenate with other than char data.

so you declare a character data type and assign value of field having type Dec5.2 and than concatinate it.

eg. if you have it_data_2-num type Dec5.2

data: char(10) type c.

LOOP AT it_d_2.

char = it_data_2-num.

CONCATENATE it_d_2-employee_number it_data_2-bow char

it_d_2-text1 it_d_2-text2 it_d_2-text3 it_d_2-leihg

INTO c_tab-rec SEPARATED BY ','..

APPEND c_tab.

ENDLOOP.

reward if useful.

0 Kudos

if you move a decimal number to char field, the decimal format will not be stored instead...use the "WRITE - Formatting options ":

Write : <Field1> to <Field2>

Field 2 is a char type.. Field 1 can be of any data type...

Check the help on Write statement

Hope this helps you

Regards

Shiva

Former Member
0 Kudos

Hi Recardo,

As well as the MOVE statement, which converts the value of the source field into the data type of the target field, there is also a statement WRITE TO, which converts the contents of the source field into a field with type C.

WRITE <f1> TO <f2> .

This statement converts the contents of a data object <f1> to type C, and places the string in the variable <f2>.

So, u use the field of type dec5.2 to Char variable & then concatenate that variable in the required position to that record.

WRITE <FIELD> TO v_char.

This will surely works. Try it out & let me know in case of any concerns.

Dont forget to reward points if this is useful

Pavan.