‎2015 Sep 08 7:49 AM
Dear All,
I have scheduled a background job for IW37N in custom report to generate the spool.
And trying to download the spool data into excel file.
I am using following FM.
RSPO_RETURN_ABAP_SPOOLJOB
cl_gui_frontend_services=>gui_download
But the issues is excel file is not coming in proper format. Excel contains '|' after each data.
Could you please help?
Thanks,
Arpita
‎2015 Oct 01 5:35 AM
issue Solved..
read each line of spool data internal table and use below code
replace all occurrences of '|' in ls_data-line with cl_abap_char_utilities=>horizontal_tab.
modify spool itab.
and use GUI_DOWNLOAD to download..
BUt now I have one more issue..How to do this in background. I have scheduled this program
in background but GUI_DOWNLOAD function don't work in bg.
is there any alternative to download file on presentation server in bg..
‎2015 Sep 08 1:45 PM
Hi Arpita,
Paste the code that you are using for gui_download.
You may have issues only with that.
Rgds,
KS
‎2015 Sep 14 4:52 AM
Hi K S,
I am using Function module 'RSPO_RETURN_ABAP_SPOOLJOB' to convert spool to excel and then using GUI_DOWNLOAD to download it to excel.
But all data is coming in single column with separator "|".
Please help.
Thanks,
Arpita
‎2015 Sep 14 7:36 AM
Hi Arpita,
Did you use the WRITE_FIELD_SEPARATOR in the FM?
Regards,
KS
‎2015 Oct 01 5:35 AM
issue Solved..
read each line of spool data internal table and use below code
replace all occurrences of '|' in ls_data-line with cl_abap_char_utilities=>horizontal_tab.
modify spool itab.
and use GUI_DOWNLOAD to download..
BUt now I have one more issue..How to do this in background. I have scheduled this program
in background but GUI_DOWNLOAD function don't work in bg.
is there any alternative to download file on presentation server in bg..
‎2015 Oct 01 6:33 AM
Hi Arpita,
your presentation server is only available in dialogue thru SAP GUI. In dialog and batch you will both have access to your application server using OPEN DATASET - TRANSFER - CLOSE DATASET.
But if you have for example a MS Windows presentation server and a LINUX or UNIX application server, then you can mount a MS Windows net drive to your application server and create your file directly on it. (The mount must be done by the administration of your application server!)
Otherwise you can create the file on the application server in batch and write a program or use an existing tool to read it in dialogue and download it to presentation server in an additional dialogue step.
Regards,
Klaus
‎2015 Oct 01 8:03 AM
Thanks for your reply.
I am trying to do the same now. Reading application file into internal table and trying to
download it to presentation server.
I am facing issue in that also.
My excel file has dynamic data.. Columns keeps on changing. there is no fixed number of columns.
Following is code:
p_fname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
read DATASET p_fname into gs_app-line LENGTH len.
IF sy-subrc = 0.
append gs_app to t_app_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET fname.
ENDIF.
itab t_app_data has data but all columns are not coming. I have tried using MAXIMUM LENGTH , ACTUAL LENGTH and LENGTH but it is not working.
Please help.
Thanks,
Arpita
‎2015 Oct 01 8:56 AM
How did your solution for GUI_DOWNLOAD in dialogue work? Also there you had to solve the issue to separate the columns.
Next question: How did you create your file on application server? I think, the solution for column separation has to be done already when downloading your data to application server. Do you know the number of columns at this point? You can use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL TAB as an separator for field separation here.
Regards,
Klaus
‎2015 Oct 01 9:40 AM
Thanks..
I will use field separator but the issue is different.
My issue is in READ DATASET. It is taking only 600 chars in single line.
So if my internal table has more columns then some columns are not coming into
internal table t_app_data.
read DATASET p_fname into gs_app-line LENGTH len.
IF sy-subrc = 0.
append gs_app to t_app_data.
ELSE.
I tried using following:
len = 1000.
read DATASET p_fname into gs_app-line LENGTH len.
Still problem is there.
‎2015 Oct 01 9:42 AM
I don't know number of columns , as number of columns keep on changing based on variant selection.
‎2015 Oct 01 10:03 AM
Hi, please tell us the definition of gs_app-line. Is it of character type and length 600 ?
Please try to read it into a type string field. Do you get all data in this case?
‎2015 Oct 01 10:30 AM
‎2015 Oct 01 10:57 AM
Then please try it with a character filed of length 1000, 1024 or longer like
Regards,
Klaus.
‎2015 Oct 01 11:12 AM
‎2015 Oct 01 11:37 AM
Thanks..
I have solved issue.
Even though in internal tab it is showing few columns. I tried download to presentation server using GUI_DOWNLOAD fm, all columns are coming perfectly.
Thanks for helping..