Skip to Content
0
Former Member
Aug 25, 2009 at 08:02 AM

Data set Writing Problem

18 Views

Dear all,

I have created a program to which read data from application server, which is seprated by tab. But anable to append the data into internal table itab and write it.

I have include to code for your reference.

With Regards,

Baskaran

DATA: X_INPUT_REC,

REC_TYPE(4) TYPE C.

DATA: BEGIN OF ITAB OCCURS 0,

LEN(2),

WED(2),

hei(2),

END OF ITAB.

DATA: BEGIN OF ITAB1 OCCURS 0,

STR(200),

END OF ITAB1.

DATA: G_INREC(80) .

data str(255).

*data: FILEN TYPE i default ' '.

DATA: L_EOF(50) VALUE 'C_FALSE'.

*DATA: L_EOF1(50) VALUE 'C_TRUE'.

PARAMETERS: FILENAME(80) DEFAUlt '
192.168.100.33\sapmnt\ids\sys\global\sample.txt' .

*CONCATENATE FILEN INTO FILENAME NO-GAP.

OPEN DATASET FILENAME FOR INPUT IN TEXT MODE ENCODING DEFAULT." MESSAGE L_MSG.

WHILE L_EOF NE 'C_TRUE'.

READ DATASET FILENAME INTO G_INREC.

  • CONCATENATE G_INREC INTO g_inrec NO-GAP.

IF SY-SUBRC = 0.

MOVE G_INREC TO ITAB1.

  • ENDCASE.

*append itab.

LOOP AT ITAB1.

SPLIT ITAB1-STR AT 'X' INTO ITab-len ITab-wed ITab-hei.

APPEND ITab.

ENDLOOP.

ELSE.

L_EOF = 'C_TRUE'.

CONTINUE.

ENDIF.

ENDWHILE.

loop at itab.

write: itab-len.

endloop.