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: 
Read only

reg :spaces

Former Member
0 Likes
719

Hi all ,

i have used concatenate command but the thing is that in output when i see after c_version value there shud be 20 spaces .but it is not happening now .whenevr i give blank spaces to add after all the variables then it is not taking .for ex ... i have below pasted the file output .after 2.0 there shud be 20 spaces but if we press right arrow key it shud not go to the next line after 20 spaces it shud go to the next line .any pointers plz thanx in advance ......

INVSYNSSD B70SAPAMS0000000005D0000002520200808130556352.0

data : l_spare TYPE string,

l_sp_size TYPE i VALUE '20'.

SHIFT l_spare RIGHT BY l_sp_size PLACES.

CONCATENATE c_msg_type c_msg_stype l_tr_type

zsource_site c_sou_appln l_seq_fno

l_envrn l_msg_flgth l_stamp

c_version l_spare INTO wa_final_header.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

Hi,

after concatenate use RESPECTING BLANKS addition.

Hi all ,

i have used concatenate command but the thing is that in output when i see after c_version value there shud be 20 spaces .but it is not happening now .whenevr i give blank spaces to add after all the variables then it is not taking .for ex ... i have below pasted the file output .after 2.0 there shud be 20 spaces but if we press right arrow key it shud not go to the next line after 20 spaces it shud go to the next line .any pointers plz thanx in advance ......

INVSYNSSD B70SAPAMS0000000005D0000002520200808130556352.0

data : l_spare TYPE string,

l_sp_size TYPE i VALUE '20'.

SHIFT l_spare RIGHT BY l_sp_size PLACES.

CONCATENATE c_msg_type c_msg_stype l_tr_type

zsource_site c_sou_appln l_seq_fno

l_envrn l_msg_flgth l_stamp

c_version l_spare INTO wa_final_header.

4 REPLIES 4
Read only

Former Member
0 Likes
666

Hi,

after concatenate use RESPECTING BLANKS addition.

Read only

Former Member
0 Likes
665

Hi,

you have to use RESPECTING BLANKS addition in concatenate statement.

For example,

concatenate 'name' ' ' into v_name separeted by ',' RESPECTING BLANKS.

Regards,

Boobalan S

Read only

0 Likes
665

HI ,ITS NOT WORKING FOR ME CAN YOU BRIEF ME AGAIN WITH A PIECE OF SAMPLE CODE .THANX IN ADVANCE ...

Read only

Former Member
0 Likes
665

Hi,

As of Web AS 2.0 we cannot use CONCATENATE statement as it ignores trailing spaces but from release 7.0 this statement can be used with new addition RESPECTING BLANKS to achieve the same. So to accomplish this task in 6.20 we can use the method UCCP of class CL_ABAP_CONV_IN_CE.

Check this sample code..may be it will help u..


REPORT  z_sn_space.


CONSTANTS: c_space TYPE syhex02 VALUE '00a0'. " Value for space

DATA: g_space TYPE string,
             l_pos type i.

TYPES: BEGIN OF ty_data,
        field1(8) TYPE c,
       END OF ty_data.

DATA: wa_data TYPE ty_data.
DATA: i_data TYPE STANDARD TABLE OF ty_data.

* Get the actual value for a space
g_space = cl_abap_conv_in_ce=>uccp( c_space ).

wa_data-field1 = 'Joy'.
L_pos = strlen( wa_data-field1 ).
Do 5 times.

wa_data-field1+l_pos(1) = g_space.
L_pos = l_pos + 1.
Enddo.

APPEND wa_data TO i_data.

CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename                  = 'C:\trailing_space_demo.txt'
  CHANGING
    data_tab                  = i_data
  EXCEPTIONS
    FILE_WRITE_ERROR          = 1
    NO_BATCH                  = 2
    GUI_REFUSE_FILETRANSFER   = 3
    INVALID_TYPE              = 4
    NO_AUTHORITY              = 5
    UNKNOWN_ERROR             = 6
    HEADER_NOT_ALLOWED        = 7
    SEPARATOR_NOT_ALLOWED     = 8
    FILESIZE_NOT_ALLOWED      = 9
    HEADER_TOO_LONG           = 10
    DP_ERROR_CREATE           = 11
    DP_ERROR_SEND             = 12
    DP_ERROR_WRITE            = 13
    UNKNOWN_DP_ERROR          = 14
    ACCESS_DENIED             = 15
    DP_OUT_OF_MEMORY          = 16
    DISK_FULL                 = 17
    DP_TIMEOUT                = 18
    FILE_NOT_FOUND            = 19
    DATAPROVIDER_EXCEPTION    = 20
    CONTROL_FLUSH_ERROR       = 21
    NOT_SUPPORTED_BY_GUI      = 22
    ERROR_NO_GUI              = 23
    others                    = 24
        .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Edited by: Joyjit Ghosh on Aug 13, 2008 2:22 PM