Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table line data from flat file

hi folks,

I am reading the data from the flat file(.CSV) into a single line and then splitting the data at the ',' and reading them into the fields of internal table like:

DATA: tb_line(125) type c.

data: begin of rec occurs 1,

businessunit(3) type c,

tablename(30) type c,

oldlegcode(30) type c,

description(30) type c,

newlawsoncode(30) type c,

records(8) type c,

message(50) type c,

end of rec.

READ DATASET filein INTO tb_line.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

split tb_line at ',' into REC-businessunit

REC-tablename REC-oldlegcode REC-description

REC-newlawsoncode.

the data read into the tb_line is

tb_line = BPF,PAYCODES,OVERTIME,Overtime,OTP#

and therefore the final field takes the value 'OTP#'

To get rid of this '#' I have read the final field value into a variable and then remove the ''#" using shift.

<b>My question is can we avoid the appearence of '#' while reading the data into the tb_line.</b>

Because on three separate occasions I have encountered this scenario and everytime I will have to declare the varuable for the last field and remove the '#" sign with some additional code.

Is there a better way to solve this?

Thanks

Vinu.

Tags:
Former Member
replied

If you are shifting it one place to the right and then back to remove it, I believe that this is the best way to handle it. This is the line return in the file. You don't really have any control of the file so this is the best way, to handle yourself.

Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question