Skip to Content

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

Add trailing space to text

Hi All,

I need to write a text file into application server values with spaces. I know this has been mentioned several times but I am unable to find a solution yet.

below is the coding;


DATA :  lv_rec(1) TYPE c,

         lv_source(4) TYPE c,

         lv_seq_number(4) TYPE c,

         lv_cutt(8) TYPE c,

         lv_res(779) TYPE c.

DATA : lv_file_name TYPE string,

          lv_space TYPE string,

          lv_raw TYPE string.

lv_rec = 'M'.

lv_reserved = ' ' .

lv_source = 'TEST'.

lv_cutt = sy-datum.

lv_reserved =  ' '.

lv_space = cl_abap_conv_in_ce=>uccp( '00a0' ).

OPEN DATASET lv_file_name FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

WRITE  lv_space TO lv_reserved+778(1).

CONCATENATE lv_rec lv_source  lv_cutt lv_res INTO lv_raw

TRANSFER:  lv_raw  TO lv_file_name.

CLOSE DATASET lv_file_name.

I dont see the file getting created as per the requirement . Variable LV_RES should have 779 SPACES.

Could anyone plz explain the satement "WRITE  lv_space TO lv_reserved+100(1)".... specially what specially "+100(1)"

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question