Background job to download standard ALV reports
Hi,
Could anyone knows how to download an standard ALV report in a background job?
In a job I made, some ALV reports were precessed and made, and their spools were made,
but not downloaded.
Regerds,
Katsumi Makabe
hi,
I think you can have a network shared folder on application server.
you said that it is a comma separated file.
1) Using TCODE CG3Z, upload the flat file to application server , remember to copy the path (it contains file path aswellas name).
2) Using DATASET read the filepath along with the name and read each line into workarea and split at ',' into fields.
3) Then append those fields to internal table.
using the FMs job_open, job_submit and job_close you can go for background scheduling.
Please go through the following link for sample code on FTP.
http://abap4.tripod.com/FTP_Using_SAP_Functions.html
Reward points if helpful.
Thanks and regards
Similar Messages
-
Hi Guys,
Im facing a peculiar problem.
When I try to download an ALV report in excel format using (list ->export -> local file-> soread sheet )Im not able to download complete set of records.
Same is happening with ws_download, even though the internal table contains all the record; the number of downloaded records are not same.
Any one faced same problem. Pls. help me out.
Regards,
Sumitlooks strange!!!!!!!!!!!
change these in excel sheet and check out if it works
Change the macro settngs in your excel sheet and checkout if it works
Open empty excel sheet
In menu Tools>Macros>Security , change the radiobutton to medium
And also
In the Same popup , goto the second tab Trusted Publishers and check the checkbox Trust access to visual basic Project -
Add field in standard ALV report.
Hi friends,
In SAP standard ALV report, t.code- S_ALR_87012050, user wants the vendor to include information about source document - vendor number, vendor name, invoice number, original document number of the transaction in the case of payroll being capitalized.
I tell me weather this information is already present in the report or I have to create Z report for adding this information and how do I proceed to add new fields in the created Z program.
Please help me.
Thanks in advance,
SayaHI Saya,
Check in the ALV output whether these fields are already there and not displaying in the ALV output, if the fields are not at all printing in the ALV output,then copy the Program to Z program and change it.
write the Code to add the new fields to the internal table and change the Field catalaog to come your fields in the ALV output then print it
Regards
SUdheer -
Why the background job for downloading file failed?
I have a background job for downloading file with logical path.
with
'OPEN DATASET l_out_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT';
Now, the program can be run in foreground;but when it running on background, it shows 'open file error'.
I do not know what happen?
Please help ~~Hi,
The logical path you have provided might be incorrect or you might not have the necessary authorization to read/write on that folder.
Please check the folder in transaction AL11 & check whether you have the authorization to read/write. BASIS consultant would be able to tell you about it.
Best regards,
Prashant -
How to modify Standard ALV Report
Hello All,
I have a standard report which displays the data in ALV Grid. This data can also be exported to Excel sheet. I have got an FBI assignment where I have to add some new fields besides the existing ones. Could you please provide me with some documents oe explain me in brief how to modify any standard ALV report.
Thanks in Advance.
SarasCan't you just add the fields with the layout option in the tcode ?? with other words are all the fields selected in that particular layout the programm comes up with
if the fields can't be selected a quick sollution can be to make a query with SQ01
Message was edited by:
A. de Smidt -
How to filter standard ALV report with custom UI element?
Hello Expert,
I got a requirement to filter standard ALV report based on the custom UI element (which is created in the screen before displaying the ALV report). Upon entering the values in the Custom field, the ALV report is displayed accordingly.
Any ideas how to approach it?
Thanks,
MohammedHi,
Okay, let me explain the steps in detail
Let us say you have alv table with 10 records and alv table is shown first time with all 10 records
Create an internal table in component controller's attribute GT_ORIGINAL_DATA and save all 10 records into this table first time
Now, user enters value in FILTER_MATNR field 123 and press apply_filter button or press enter key
Read the value of field filter_matnr and get the only matching records from global internal table GT_ORIGINAL_DATA into local internal table as below
data lv_matnr type matnr.
data lt_data like wd_comp_controller->gt_original_data.
" read the value from context attribute of filter_matnr
lv_matnr = ???
" copy all data into local table
lt_data[] = wd_comp_controller->gt_original_data.
"delete the records which does not match
delete lt_data where matnr NP lv_matnr.
Now, bind the data lt_data to context node of alv table
Hope this helps you.
Regards,
Rama -
Hi while modifying one of the standard alv reports,
I had to include one more field..
for that I have made changes to the feild cat and i_tab structure. but the final report is not displaying that additional column
Can any one help me...
The report is IW29Hi Kalyan,
Though you have added a new column to the Field Catalog, it MIGHT not get displayed on the output. This is because, it would be in the hidden mode. Try this. Click on the Layout, add this new field and save the layout. You should be able to see your new column now.
But dont forget to do the same in Quality and Production systems.
Hope this clarifies your problem
Enjoy SAP.
Rajasekhar -
Error in background job of downloading data to PC
Hi Gurus,
I hv created a report for downloading data to PC using
GUI_DOWNLOAD FM when scheduling job in background
job is getting canceled...................
give me some solution....thnaks friend.i hv used DATASET as u said...............
But I M getting dump
FILE IS NOT OPEN
this is my code
TYPES:BEGIN OF T_MARD,
MATNR LIKE MARD-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
MAKTX LIKE MAKT-MAKTX,
END OF T_MARD.
***********WORK AREAS**********
DATA: WA_MARD TYPE T_MARD,
WA_MARD1 TYPE T_MARD.
DATA:BEGIN OF IT_MARD1 OCCURS 0,
MATNR(18),
WERKS(4),
LGORT(4),
LABST(13),
MAKTX(40),
END OF IT_MARD1.
TYPES : BEGIN OF TY_BAT,
LINE(100) TYPE C,
END OF TY_BAT.
*********INTERNAL TABLES*******
DATA:IT_MARD TYPE STANDARD TABLE OF T_MARD INITIAL SIZE 0 WITH HEADER LINE .
types: BEGIN OF ITAB1,
FIELD(100),
END OF ITAB1.
DATA : IT_BAT TYPE TABLE OF TY_BAT,
WA_BAT TYPE TY_BAT,
wa_itab1 type itab1.
data : it_tab type table of ALSMEX_TABLINE with header line.
*DATA: FILENAME1 TYPE STRING valu.
*DATA: FILENAME1(500).
DATA: FILENAME1 TYPE RLGRAP-FILENAME .
LOOP AT IT_MARD1.
CONCATENATE IT_MARD1-MATNR IT_MARD1-LABST IT_MARD1-MAKTX
INTO wa_ITAB1 SEPARATED BY ' '.
APPEND wa_itab1 to IT_tab.
CLEAR wa_ITAB1.
CLEAR WA_MARD.
ENDLOOP.
CONCATENATE 'D:\STOCKINH\' SY-DATUM '.TXT' INTO FILENAME1.
open dataset filename1 for output in binary mode." ENCODING DEFAULT.
IF sy-subrc = 0.
EXIT.
ENDIF.
LOOP AT it_tab into wa_itab1.
TRANSFER wa_itab1 TO filename1.
CLEAR wa_itab1.
ENDLOOP.
close dataset filename1.
MESSAGE S001(38) WITH 'Files Generated'.
WA_BAT = 'ftp -s:d:\ftp\ftp_upload.txt'.
APPEND WA_BAT TO IT_BAT.
CLEAR FILENAME1.
FILENAME1 = 'D:\STOCKINH\ftp_upload.BAT'.
open dataset filename1 for output in binary mode." ENCODING DEFAULT.
IF sy-subrc = 0.
EXIT.
ENDIF.
LOOP AT it_bat INTO wa_bat.
TRANSFER wa_bat TO filename1.
CLEAR wa_bat.
ENDLOOP.
close dataset filename1.
CLEAR: IT_BAT.
REFRESH IT_BAT.
WA_BAT-LINE = 'open 10.100.103.199'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'epossync'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'sync@1234'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'lcd D:\STOCKINH\20080201.TXT'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'cd /home/epossync/AMIT'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'binary'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'hash'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'put D:\STOCKINH\20080201.txt'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = ' '.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
WA_BAT-LINE = 'bye'.
APPEND WA_BAT TO IT_BAT.
CLEAR WA_BAT.
CLEAR FILENAME1.
FILENAME1 = 'D:\STOCKINH\ftp_upload.txt'.
open dataset filename1 for output in binary mode." ENCODING DEFAULT.
IF sy-subrc = 0.
EXIT.
ENDIF.
LOOP AT it_bat INTO wa_bat.
TRANSFER wa_bat TO filename1.
CLEAR wa_bat.
ENDLOOP.
close dataset filename1. -
Download the ALV Report output into excel sheet or notepad
Hi,
how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
Thanks in advance!!!!
Regards,
kranthi.Hi
Download a report to excel with format (border, color cell, etc)
Try this program...it may help you to change the font ..etc.
Code:
REPORT ZSIRI NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Please note that this example maybe slow at filling the excel table
(perhaps four fields per second on a 900 MHz machine - almost 30 seconds
for a short example).
To get the data on properties and methods - there is a bit of smoke and mirrors
going on here; they are EXCEL properties and methods, not sap ones - so you need
to look at excel help to determine how a particular function is structured. then
build the block in sap, as shown in the example.
If you only want to transfer the data to Excel like when you transfer the data from
ALV to Excel simply use the Function Modules:
XXL_SIMPLE_API
If you want more modifications when you transfer it to Excel use:
XXL_FULL_API -
How can i download dynamic alv report into excel ?
when i create dynamic alv report and try to download it
to my pc ( to excel file ) the data is not set in the
write position , also i get message in the excel
"Dynamic List Display " .
how can i set the data like the alv display ?ALV has standard download functionality to Excel. Aren't you able to use this functionality? Have you written your own custom code for DOWNLOAD?
-
Download a ALV report without repetitive headers and footers.
Hi,
I have an ALV report with header and footer. When I download the report into excel, after every 30 (approx) records there is a header and a footer. But I do not need it.
I need header only once and footer only once in the excel sheet. Please let me know how to achieve it.
Thanks
KrishnaHi Manish,
if sy-pagno EQ 1 or sy-batch = 'X'.
Call the top-of-page event code.
endif.
I don't think it can work as it calls the top-of-page at each page in batch mode. Better code should be something like :
if sy-pagno EQ 1.
Call the top-of-page event code.
endif.
Note : for a generic solution, I think the page number is not automatically page number 1 (for example, if we use a cover page or have printed something else before). So we'd should better use a global variable (first_time) set to 'X' just before CALL FUNCTION 'REUSE_ALV_LIST...' :
IF first_time = 'X'.
Call the top-of-page event code.
CLEAR first_time.
ENDIF.
To All,
I really made a big confusion in my previous answers, which were in fact about column headings (how to print them only once). Sorry about that.
Sandra -
Standard ALV Report default print parameters
Hi,
We recently upgraded to ECC6. In some of the ALV reports for example F.35 (Credit Master Sheet) default print parameter has wider column specifications (X_65_255) as against earlier version (X_65_132). It might be due to flexibility in increasing additional columns but for our purpose X_65_132 was sufficient.
Now when we print with the standard settings the fonts are small. Individual users can change that default settings but due to large user base we want to default it at a global level but only for transaction F.35.
Also we want to turn off ALV Statistics at this global level. We dont want to add a task for end users.
Can this be achieved just for a specific report ? If not then for all reports? Please advise.
Thanks,
VikramThe no shading as well as many "extended print parameter" are no part of the OLD structures used by the OLD reuse FM, they are stored in memory (MEMORY ID 'EXTPAR')
Check if 1703403 - Missing interface for extended print parameter can be applied in your system ?
Nevertheless, could you try a single call like
call function 'GET_PRINT_PARAMETERS'
exporting
mode = 'CURRENT'
suppress_shading = 'X'
no_dialog = 'X'
report = sy-repid
importing
out_parameters = w_params
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
Regards,
Raymond -
Problem while downloading a ALV report to excel
Hi experts,
I have an ALV report which took long time to extract records from various table. So while there is some restriction the report can be executed well in foreground. And the report can be extracted well to excel sheet. But while there is hudge records, i have to execute the report in backgroung. And then from spool i generally prefers to download the report to excel.
There is a field UOM where it contains value ' " ' for some records. And also there may be possiblity that other fields can also contain the same.
Now my problem is: while download to excel... When ever there is a value ' " ' from this point to the next value ' " '. It is treating as one record. and keep that in a same position in the excel sheet.
But i want to keep all the values in there respective fields. Can you please how can i do that? Please give me some solution...
regards,
charles.If anybody have any solution please send me....
-
Regarding excel download from ALV report tree
Hi Experts,
I have a ALV report tree program. In that i need the functionality to download report output in excel file.
Can any body suggest how can i achieve download to excel functionality in it.
Any useful suggestion will be appreciated.
Thanks in advance,
AkashThe data for the tree exist in the NODE table in a different format. So, even you download that table, it will not be downloaded in the TREE format. So, the user will not be able to understand the data unlike the case of a ALV GRID.
Whether it is a TREE / GRID, ultimately its the data of a internal table, that gets downloaded. But in case a TREE, we don't have the data in a straight forward way . i thnk it is not possible . i am not sure too for this . -
Download the alv report in excel
dear experts
I am creating ALV report and working fine, i want the report sould be viewed in excel format when i click the icon on AlV display
with regards.
Ajay Kumar.Hi Ajay,
SAP has provided the user interface for downloading the data into an excel file in the tool bar there is an option for downloading into excel.
Another way is to write a code using the function module alsm_excel and then downloading into the excel,
please tell me whether this reply was useful or for further clarification revert back
Thanks in advance
Srikanth
Maybe you are looking for
-
I can't click on a link in a web site opened in Firefox for Android
This is happening on a caches web app. I can not click on a link in my of my pages. However if I press long on it and select "Open in new tab" it opens successfully. what is the issue?!
-
IPad 2 won't Bluetooth link to BT-Q818XT GPS. Help?
I have been trying unsuccessfully to pair my recently acquired Qstarz Bluetooth GPS (BT-Q818XT) with my iPad2. However, no amount of tries following the directions has allowed the iPad2 to establish a Bluetooth connection. I am new to the world of
-
I have in stalled maverick on my iMac and now my contacts won't stay open..... any fixes?
-
App Store problem??
On both my iPad 3 and iPhone 5 the App Store is showing updates are available, yet when I go into the store nothing is showing up. I've tried restarting both devices and same thing. No connection issues, is there an issue with the App Store?
-
Problems with my laptop Windos 8.1 with 4K monitor
I've read about the new versions of After Effects CC resolve the problems with resolution in 4K monitors in Windows 8.1 OS but it isn't my case. It is supposed my After Effects is updated at the last version (2014.2), because the Aplication Manager d