Application Development 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: 

Spliting the line read from the application server

Former Member
0 Kudos

Hi All,

REPORT zu5 .

DATA: names(90) TYPE c,

*VALUE 'WW03/h/0000000501/h//h/200507/h//h//h//h/0/h/ 22.22',

rbukrs(30) TYPE c,

racct(10) TYPE n,

actyp(11) TYPE c,

prodcode(6) TYPE c,

vbund(6) TYPE c,

fdgrv(8) TYPE c,

land1(3) TYPE c,

arcod(2) TYPE c,

hsl(16) TYPE c,

delimiter(3) VALUE '/h/',

names2 TYPE string.

PARAMETERS: p_unix LIKE rlgrap-filename

DEFAULT

'/sony/sap/abapfiles/GT10A.XXXX.T400.XPHDO017.T200707100822290843968'.

OPEN DATASET p_unix FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.

WRITE:/ 'Unable to open file'.

ELSE.

DO.

CLEAR: names.

READ DATASET p_unix INTO names.

IF sy-subrc NE 0.

EXIT.

ENDIF.

SPLIT names AT delimiter INTO rbukrs racct actyp prodcode vbund fdgrv

land1 arcod hsl.

WRITE:/ rbukrs,

racct,

actyp,

prodcode,

vbund,

fdgrv,

land1,

arcod,

hsl.

ENDDO.

ENDIF.

CLOSE DATASET p_unix.

In the above code spliting is not happening when read from the application server and assign to a variable names.But when i directly assign within the programusing the value option to the variable names spliting at the delimiter is happening.

Why it is so?

I couldn't understand?

How to split the line read from the application using delimiter and put in the internal table?

Any can help me out.

Thanks

Shri

3 REPLIES 3

Former Member
0 Kudos

Hi

see the sample code

OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.

if sy-subrc ne 0.

write : / 'File could not be uploaded.. Check file name.'.

stop.

endif.

CLEAR : it_pricing[], it_pricing.

DO.

READ DATASET P_FNAME INTO V_STR.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

SPLIT V_STR AT ',' INTO it_pricing-key

it_pricing-F1 it_pricing-F2 it_pricing-F3

it_pricing-F4 it_pricing-F5 .

APPEND it_pricing.

CLEAR it_pricing.

ENDDO.

<b>Reward points for useful Answers</b>

Regards

Anji

0 Kudos

No it is not doing the splitting. I couldn't find out the problem.

Thanks

Shri.

0 Kudos

I am sorry Anji it is my mistake only,comma it is taking correctly but in the file if i use tab delimitation '09' here for spliting what operator i should use.

Thanks

Uma