cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Blank Column While Downloading Excel

jitendra_it
Active Contributor
0 Kudos

Hello ,

I am downloading excel file using  class~method

CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE

but I am getting a blank column at first position(A). All the data are correctly downloaded starting from Column B.

Steps I have done :

1. Get data from App server using Open dataset and populate internal table

2. Convert internal table into string

3. convert string into xstring

4. call the above method

Please let me know where I am doing wrong.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


Use the following dummy code.


" Header details.

CONCATENATE
<Header details..>

   cl_abap_char_utilities
=>newline
 
INTO lv_text2
   
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.


" Actual data..
 
LOOP AT lt_srvr_mstr INTO ls_srvr_mstr.
   <Main Data>

    cl_abap_char_utilities
=>newline
   
INTO lv_text1
   
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.


   
CONCATENATE  lv_text2 lv_text1 INTO lv_text.
   
CLEAR lv_text2.
   
CLEAR ls_srvr_mstr.


 
ENDLOOP.



DATA : lv_xstring TYPE xstring.
 
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
   
EXPORTING
     
text   = lv_text
   
IMPORTING
     
buffer = lv_xstring


............


.............

jitendra_it
Active Contributor
0 Kudos

Hello Chandra ,

Thanks for your input .

Just one correction :


LOOP AT lt_srvr_mstr INTO ls_srvr_mstr.
   <Main Data>

    cl_abap_char_utilities
=>newline
   
INTO lv_text1
   
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.


   
CONCATENATE  lv_text2 lv_text1 INTO lv_text.
   
CLEAR lv_text2.
   
CLEAR ls_srvr_mstr.


 
ENDLOOP.

here CLEAR lv_text1 should be in place of CLEAR lv_text2.

Former Member
0 Kudos

Actually there is no need of any clear statement, yeah for precaution purpose we can use clear lv_text1.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jitendra,

While converting Internal table records into String, you might be using the statement as below.

loop ....

concatenate lv_string

                  .....  (table fields)

                  .....(table fields )

                 cl_abap_char_utilities=>new_line

                  INTO lv_string

                   SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

endloop.

Remove lv_string immediately which is after concatenate, otherwise it introduces Blank Column.

loop ....

concatenate

                  .....  (table fields)

                  .....(table fields )

                 cl_abap_char_utilities=>new_line

                  INTO lv_string

                   SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

endloop.

Hope this is helpful.

Regards,

Ravikiran.k

ramakrishnappa
Active Contributor
0 Kudos

Hi Jitendra,

I suspect something is going wrong while converting data in step 2 & 3.

Please go through the below links

Exporting Internal Table contents to an Excel File

Download a file into excel sheet - Web Dynpro ABAP - SCN Wiki

If your issue is still not solved, please share the piece of code to convert data to excel.

Regards,

Rama