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: 

Delete the 1st & last specific character in ITAB's fields

ekekakos
Participant
0 Kudos
493

In most of the fields of an ITAB the1st & last character is " and must be removed.

How can we say: Remove the 1st or the last character in all fields of the ITAB, if it is equal to ".

Thanks

5 REPLIES 5

FredericGirod
Active Contributor
0 Kudos
434

something with replace ?

replace all occurrences of '""' in itab-fieldname with ''.

ekekakos
Participant
0 Kudos
434

I finally found the following:

REPLACE ALL OCCURRENCES OF REGEX '^\"|\"$' IN TABLE it_file_header WITH ''

But I have another serious problem. 4 out of 5 ITABs have amount fields and I am getting the following error:

The table "A" expects a character-like field (in CHAR MODE) or a byte-like field (in BYTE MODE) as its row type.

And I want to avoid LOOPs

Sandra_Rossi
Active Contributor
434

You can't avoid loops. There are no languages where you can avoid loops (except maybe functional languages).

matt
Active Contributor
434

Exactly. REPLACE ALL OCCURRENCES is implemented in the ABAP language using loops.

Even functional languages have loops in their compiled form. Without loops, a language cannot be Turing Complete.

ekekakos
Participant
0 Kudos
434

Matthew, Sandra, you misunderstood me. I didn't say to not use LOOPs but to minimize the use especially if ITABs have a lot of records, like mine. I have 5 ITABs with this problem in all character fields and four of them have amount fields and these 4 have more than 100000 records. That's why I wanted to avoid LOOPs.

Thanks