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

NEED LOGIC

Former Member
0 Likes
612

Hi,

I have Documnet field in my ztable. it contains the 50 char length.

I am entering the data like DA,Dl,DZ.......upto 50 chars. But in my report I have to compare the 2 chars from this field. How can i separate?

regards,

Ajay reddy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
594

HI,

if you have exactly 50 characters all the time.

data : begin of itab_value occurs 0,

str(2) type c,

end of itab_value.

data : lv_str type i.

loop at itab.

lv_strlen = strlen(itab-str).

do .

if lv_strlen > 0.

itab_value-str = itab-str+0(2).

append itab_value.

shift itab-str left by 3 places.

lv_strlen = strlen(itab-str).

else.

exit.

endif.

enddo.

here you have itab_value with all the values splint into two character string and you can compare here.

your comparision logic here.

referesh itab_value.

endloop.

thanks

mahesh

Message was edited by:

I Can Solve It

Hi,

I have Documnet field in my ztable. it contains the 50 char length.

I am entering the data like DA,Dl,DZ.......upto 50 chars. But in my report I have to compare the 2 chars from this field. How can i separate?

regards,

Ajay reddy

3 REPLIES 3
Read only

Former Member
0 Likes
595

HI,

if you have exactly 50 characters all the time.

data : begin of itab_value occurs 0,

str(2) type c,

end of itab_value.

data : lv_str type i.

loop at itab.

lv_strlen = strlen(itab-str).

do .

if lv_strlen > 0.

itab_value-str = itab-str+0(2).

append itab_value.

shift itab-str left by 3 places.

lv_strlen = strlen(itab-str).

else.

exit.

endif.

enddo.

here you have itab_value with all the values splint into two character string and you can compare here.

your comparision logic here.

referesh itab_value.

endloop.

thanks

mahesh

Message was edited by:

I Can Solve It

Read only

0 Likes
594

HI,

According to my logic i have to use RANGES with comma separater.

How can i do that.

regards,

Ajayreddy

Read only

Former Member
0 Likes
594

DATA:  BEGIN OF itab OCCURS 0,
         fld(2) TYPE c,
         END OF itab.

PARAMETERS:   str(50) TYPE c.   " to put ur values like DA,Dl,DZ.......upto 50 char

START-OF-SELECTION.

  CONDENSE str NO-GAPS.
  SPLIT str AT ',' INTO TABLE itab.

  LOOP AT itab.
    WRITE:/ itab-fld.
  ENDLOOP.

Reward if useful

Regards

Prax