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

Fm to pass string to data base table

Former Member
0 Likes
487

Hi all,

Is there any fm to split string as per data base filed length and pass in to table.

FM should contain input fields table name and string .for example

if i give input table name : mara

string: 200123456789123456789

it should give output in an internal table like this

t_mara-mandt : 200

t_mara-matnr :12345678912345689

is there any fm ?

3 REPLIES 3
Read only

Former Member
0 Likes
461

Try:


REPORT ztest MESSAGE-ID 00.

DATA: data(100) VALUE '200123456789123456789'.

DATA: BEGIN OF table,
        mandt TYPE mandt,
        matnr TYPE matnr,
      END   OF table.

MOVE data TO table.

WRITE: /001 table-mandt,
            table-matnr.

Rob

Read only

0 Likes
461

Rob,

I agree: this will work for this particular example, but as soon as there are some specific non-character fields (i.e packed etc.) as part of the internal table, this might crash (dependent on whether the string takes the field content into account or not).

Guenther

Read only

0 Likes
461

Correct - it only works for some special cases.

rob