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

Splitting the single field data to multiple fields

Former Member
0 Likes
813

Hi,

I have the contents in fieldABC which i would like to copy based on the length of the value

Eg:

Field ABC has value 1

it need to be copied to Field1

FILEDABAC has 1234

it need to be copy in field 2

FILEDABC has 1234ABC

It need to be copy in Field 3

i means to say based on the lenght of the value i would like to copy the contents to multiple fields

Note: the data is for Heirachy...

Can anyone will help with code.

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
767

take this field ABC as string and then check the length of field ABC and put it into respective fields.

Hope this is helpful to you

Regards

Rajnesh

Read only

Former Member
0 Likes
767

Hi,

Can you be bit more clear with your requirment?

Read only

Former Member
0 Likes
767

Refer these sample codes. Instead of 'Test' pass ur value.

DATA: i TYPE i.
i = STRLEN('Test').
case i
  when 1.
  "pass to fld 1
  "and so on

Read only

Former Member
0 Likes
767

Hi,

You mean you want to copy contents of field ABC to Field1,Field2,Field3 based on there length??

if i have correctly understood you then do like:

data : g_strlen type i.

g_strlen = strlen ( ABC ).

if g_strlen = 1.

field1 = ABC.

elseif g_strlen > 1 and g_strlen <= 4.

field2 = ABC.

elseif g_strlen > 4 .

field3 = ABC.

endif.

Regards,

Neha

Read only

0 Likes
767

Hi,

Thanks for response...

ITs take the maximum length and copied only one text..

Can you advice how to put the whole string

Thanks

Read only

0 Likes
767

could you please explain clearly.....