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

Split Command

Former Member
0 Likes
636

Data in the internal table ITAB.

001######

15,444.17

143,334.61

*002######

37,231.88

2,267,526.04-

003#########

**004######

52,676.05

2,124,191.43-

***005######

52.05

2,191.43-


  LOOP AT ITAB.
    CONDENSE ITAB-LINE  NO-GAPS.
    SPLIT ITAB-LINE AT '|' INTO ZITAB-F1 ZITAB-F2
        			  ZITAB-F3 ZITAB-F4 ZITAB-F5.
    ZITAB-F1 = ZITAB-F2(3).
    APPEND ZITAB.
  ENDLOOP.

The final output in ZITAB-F1 is,

001, *00, 003, **0, ***.

I don’t want this as my output. I want to ignore the leading * and want output as in ZITAB-F1

001, 002, 003, 004, 005

Any suggestions.

Ster.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
609

You can use replace statement.

REPLACE ALL OCCURRENCES OF '*' IN ZITAB-F2 WITH space.

ZITAB-F1 = ZITAB-F2(3).

Message was edited by:

Darshil Shah

4 REPLIES 4
Read only

Former Member
0 Likes
610

You can use replace statement.

REPLACE ALL OCCURRENCES OF '*' IN ZITAB-F2 WITH space.

ZITAB-F1 = ZITAB-F2(3).

Message was edited by:

Darshil Shah

Read only

suresh_datti
Active Contributor
0 Likes
609

make the following change..

LOOP AT ITAB.
    CONDENSE ITAB-LINE  NO-GAPS.
    SPLIT ITAB-LINE AT '|' INTO ZITAB-F1 ZITAB-F2
        			  ZITAB-F3 ZITAB-F4 ZITAB-F5.
    replace all occurrences of '*' in ZITAB-F2 with '0'.
    ZITAB-F1 = ZITAB-F2(3).
    APPEND ZITAB.
  ENDLOOP.

~Suresh

Read only

Former Member
0 Likes
609

LOOP AT ITAB.
  TRANSLATE ITAB-LINE USING '* '. <b><-- Add this line</b>
  CONDENSE ITAB-LINE  NO-GAPS.
  SPLIT ITAB-LINE AT '|' INTO ZITAB-F1 ZITAB-F2
      			  ZITAB-F3 ZITAB-F4 ZITAB-F5.
  ZITAB-F1 = ZITAB-F2(3).
  APPEND ZITAB.
ENDLOOP.
Read only

0 Likes
609

Thanks All.

Ster