PDF to be downloaded to appln server in background
Hi
To be more precise I am using the FM
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
to convert the spool output to PDF and want this PDF to be downloaded to appln server in background.
any workaround?
IF KNOW PLS REPLY.
Thanks,
Deesanth
Hi Deshant,
Why can't???
Just now i tried this code. It is perfectly working fine.
Just copy paste below code and pass one abaplist spool number to the FM and execute in back ground. Infact it is working fine in both foreground and back ground. U have to change the file name also:-)
When i downloaded the file to local PC through transaction CG3Y, The pdf file is showing correct results.
Check this and get back.
DATA: it_pdf_output TYPE TABLE OF tline,
wa_pdf TYPE tline,
l_file(100) TYPE c VALUE '/usr/upi/out/test.pdf'.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = '29642'
*no_dialog = 'X'
*dst_device =
*IMPORTING
*pdf_bytecount = gd_bytecount
tables
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK NOT it_pdf_output[] IS INITIAL.
OPEN DATASET l_file IN TEXT MODE.
IF sy-subrc IS INITIAL.
LOOP AT it_pdf_output INTO wa_pdf.
TRANSFER wa_pdf TO l_file.
ENDLOOP.
CLOSE DATASET l_file.
WRITE: 'Data written to appl file', l_file.
ELSE.
WRITE: 'Not able to open file'.
ENDIF.
Thanks,
Vinod.
Similar Messages
-
File download to presentation server in BACKGROUND
Hello,
i'm trying to download a simple list to the presentation server, but in a background process (part of an update rule for an infopackage). I´ve tried WS_Download and CALL METHOD o->gui_download etc but the job cancels with them since they seem only to run in frontend. Does anyone know of a more suitable function module?
Thanks,
KevHi,
Tyr to download file to unix in background.
PARAMETERS: p_unix LIKE rlgrap-filename.
INITIALIZATION.
v_uzeit = sy-uzeit.
v_date = sy-datum.
v_client = sy-mandt.
v_sys = sy-sysid.
CONCATENATE c_str v_sys c_str4 v_client
c_str3 v_date c_str5 v_uzeit c_str6 INTO p_unix.
DATA: v_fnam LIKE rlgrap-filename,
v_filepht LIKE FILENAME-FILEINTERN, "File for p_unix
v_sys LIKE sy-sysid,
v_client LIKE sy-mandt,
v_date LIKE sy-datum,
v_uzeit LIKE sy-uzeit
FORM f3000_save_unix_file.
SORT i_output.
* Open the file in application server
OPEN DATASET p_unix FOR OUTPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE s900 WITH p_unix. " File opening error
LEAVE LIST-PROCESSING.
ENDIF.
LOOP AT i_output INTO w_output.
TRANSFER w_output TO p_unix.
CLEAR w_output.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ text-075, p_unix, text-076. " File successfully created
ELSE.
WRITE:/ text-074, p_unix. " Error creating file
ENDIF.
* Closing the file
CLOSE DATASET p_unix.
ENDFORM. " f3000_save_unix_file
Also refer this link
http://www.sapdevelopment.co.uk/file/file_updown.htm
Try this might help u. -
Problem with pdf display downloaded from application server
Hi all,
I have a problem with displaying pdf downloaded from application server (saved in BINARY MODE).
I am getting the pdf output of adobe form in FPFORMOUTPUT-PDF as rawstring back to my program and then converting that rawstring into binary form using the function module SCMS_BINARY_TO_STRING.
Now, when I export the data to presentation server directly using cl_gui_frontend_services=>gui_download, the pdf is downloaded properly.
However, when I save the data to application server file by looping at the internal table obtained from SCMS_XSTRING_TO_BINARY and using TRANSFER, and subsequently downloading the file in "unconverted format" from AL11 to my desktop, I am getting a "blank" pdf file (with the same number of pages as the one downloaded using gui_download).
I have tried different encodings during download but in those cases i get corrupted pdf message. only the default option of INTIAL value seems to work.
I am forced to believe that there is a problem in my code which saves the data to app server but I cant find any solution that is logical. Any solution to this would be greatly appreciated.
Regards,
Sasi
Edited by: Sasi Upadrasta on Sep 29, 2010 7:55 PMused a program to read the file from appl server and then downloading it to desktop.
-
Unable to print a PDF file using the BI Publishing server
Hi,
I have a BI publisher server version 10.1.3.4.2 on W2K3 43 bit.
I can access through the url that server.
From my desktop I access through an url my Oracle APEX application.
It has been configures with:
Report Printing:
Print Server Protocol: Advanced (requires Oracle BI Publisher)
Print Server Protocol: HTTP
Print Server Host Address: the IP address of my BI Publisher server
Print Server POrt: 9704 (from instllation of BI)
Print Server Script: /xmlpserver/convert
On the page I want to print, it is configured with:
Download:
PDF option is checked.
When I click on Action -> Download -> PDF for this page, I get the error:
<file>. pdf file can not be opened because the file type is not supported or because it is damaged (because, for example as an e-mail attachment is not sent and correctly decoded)
Does someone has an idea what the problem is and where I should investigate further?
Thanks by advance for tips.
Kind Regards.If you are trying to print to the Adobe PDF printer and that fails, try using print-to-file. Then open the file in Distiller. If the result is the desired PDF, then check for AcroTray running as a background application. Sometimes it has to be restarted, but should be in your startup (you can check msconfig from the start>run menu to see if AcroTray is there).
-
How to upload a pdf file and download/open it
hi experts,
i want to upload a pdf or word format files to server and let user download or open it when user click a button, how to do that, can you post some sample codes, hunger for your advices and thanks a lot !!Hi,
We have 3 types of uploads n downloads Function Modules.in ABAP.
1. UPLOAD
2.WS_UPLOAD
3.GUI_UPLOAD
1.DOWNLOAD
2.WS_DOWNLOAD
3.GUI_DOWNLOAD
Now we r making use of only GUI_UPLOAD n GUI_DOWNLOAD in our programs.
You can go through this code which will go u an idea about the GUI_Upload n gui_download. This may lead u to understand there function modules in more detail.
REPORT zjavacreate message-id zmsgnew.
************************Creation of Internal table******************
DATA: BEGIN OF ti_record OCCURS 200,
Line(250),
END OF ti_record.
DATA: BEGIN OF ti_rec OCCURS 200,
Line(250),
END OF ti_rec.
*****************************Selection screen************************
selection-screen begin of block b1 with frame .
Parameters create radiobutton group g1.
PARAMETERS: JavaName(30) lower case.
parameters modify radiobutton group g1.
selection-screen end of block b1.
******************Calling the java program creation page**************
at selection-screen.
if CREATE = 'X'.
if javaname is not initial.
refresh ti_record[].
concatenate 'public class' javaname into ti_record-line separated by space.
concatenate ti_record-line '{' into ti_record-line separated by space.
Append ti_record.
ti_record-line = 'public static void main(String []args){'.
Append ti_record.
ti_record-line ='//enter ur code here'.
append ti_record.
ti_record-line ='}'.
Append ti_record.
ti_record-line ='}'.
Append ti_record.
EDITOR-CALL FOR ti_record .
else.
Message e001.
endif.
**************************Saving the java program********************
data tfile type string.
concatenate 'D:\Programs\' javaname '.java' into tfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = tfile
FILETYPE = 'ASC'
TABLES
DATA_TAB = ti_record.
endif.
data new(15).
if MODIFY = 'X'.
new = 'ZJAVAMODIFY1'.
CALL TRANSACTION NEW.
endif.
ZJAVAMODIFY:
REPORT zjavamodify.
**********************selection screen.********************
selection-screen begin of block b1 with frame .
Parameters compile radiobutton group g1.
Parameters modify radiobutton group g1.
Parameters execute radiobutton group g1.
PARAMETER : FILE(100) lower case.
selection-screen end of block b1.
DATA: BEGIN OF TI_RECORD OCCURS 1,
LINE(200),
END OF TI_RECORD.
data: st1(30),st2(30).
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = '.'
MASK = ' '
MODE = ' '
TITLE = ' '
IMPORTING
FILENAME = FILE
RC =
End-of-selection.
****************************MODIFY********************************
if modify = 'X'.
data: TXT_FILE1 TYPE STRING .
txt_file1 = file.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = txt_file1
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
EDITOR-CALL FOR ti_record .
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = txt_file1
FILETYPE = 'ASC'
TABLES
DATA_TAB = ti_record.
**********End FM GUI_UPLOAD
endif.
*******************end of modify*******************
*******************BAT file for compilation n
execution.****************
if compile = 'X'.
DATA: begin of itab_bat_create occurs 0,
row(500) type c,
end of itab_bat_create.
data:comp_join1(250).
concatenate 'java' 'jCompiler' file into comp_join1
separated
by space.
itab_bat_create-row = 'c:'.
append itab_bat_create.
itab_bat_create-row = 'cd Documents and Settings\127740'.
append itab_bat_create.
itab_bat_create-row = comp_join1.
append itab_bat_create.
********FM GUI_DOWNLOAD
data: st type string.
st = 'C:\Documents and Settings\127740\compile_java.bat'.
call function 'GUI_DOWNLOAD'
EXPORTING
filename = st
filetype = 'ASC'
TABLES
data_tab = itab_bat_create[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
others = 3.
********end FM GUI_DOWNLOAD
*****FM dvsvas_doc_ws_execute_50
CALL FUNCTION 'DSVAS_DOC_WS_EXECUTE_50'
EXPORTING
PROGRAM = 'C:\Documents and Settings\127740\compile_java.bat'.
*****end FM dvsvas_doc_ws_execute_50
endif.
***********************end of compile*******************************
output***********************
if execute = 'X'.
data: TXT_FILE3 TYPE STRING .
split File AT '.java' into: st1 st2 .
concatenate st1 'error.txt' into TXT_FILE3.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = txt_file3
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
if not ti_record[] is initial.
loop at ti_record.
write:/ ti_record.
endloop.
else.
data: TXT_FILE4 TYPE STRING .
split File AT '.java' into: st1 st2 .
concatenate st1 'output.txt' into TXT_FILE4.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = TXT_FILE4
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
loop at ti_record.
write:/ ti_record.
endloop.
endif.
endif.
************************end of
output**************************************** -
Allow users to Download documents from server
Hello Everybody,
I am working on an Flex application where I have to allow the
users to Open/Save documents such as Word document, Excel sheet,
PDFs, Jpeg, Media files (any digital format document) when a user
clicks on a link present in a Flex application. To do this I am
using the navigateToURL() method and simply passing the URL string
as a URLRequest to the navigateToURL method. This works fine but
whenenver the link is invoked and the user selects to Save the
Excel sheet or any document it displays an unwanted browser window
behind the Open/Save/Cancel dialog box saying action cancelled.
I can not use "_self" as I require the Flex application to
run as is. I tried using the javascript:window.open() but this did
not work.
1) Is there a process to stop the browser window from
opening?
2) How can we invoke a javascript using navigateToURL(), I
tried to invoke javascript.alert('Ok') and also
javascript:window.open() both did not function.
3) Is there any other method or flex classes etc. to invoke
external applications (allow to download documents from server)?
Please help me.
Thanks and Regards,
ParomitaParomita,
You could use the file download functionality. This is from
the docs:
You can let users download files from a server using the
FileReference.download() method, which takes two parameters:
request and defaultFileName. The first parameter is the URLRequest
object that contains the URL of the file to download. The second
parameter is optional--it lets you specify a default filename that
appears in the download file dialog box. If you omit the second
parameter, defaultFileName, the filename from the specified URL is
used.
The following code downloads a file named index.xml from the
same directory as the SWF document:
var request:URLRequest = new URLRequest("index.xml");
var fileRef:FileReference = new FileReference();
fileRef.download(request);
To set the default name to currentnews.xml instead of
index.xml, specify the defaultFileName parameter, as the following
snippet shows:
var request:URLRequest = new URLRequest("index.xml");
var fileToDownload:FileReference = new FileReference();
fileToDownload.download(request, "currentnews.xml");
I think this will accomplish what you are trying to do.
Vygo -
Download Adobe License Server Tools? I want to manage the licenses using the in-house server
From this ticket https://forums.adobe.com/message/1329254#1329254, Am I able to download Adobe License Server Tools? I want to manage the licenses using the in-house server
Thanks.Hi Carol,
Please check the given guide for in-house licensing tool;
http://www.adobe.com/uk/elicensing/licensemanagement/alm/pdfs/server_tools_user_guide.pdf
Let us know in case you require more detail regarding your query.
Regards,
Sarika Behal -
Searched email showing "The message has not been downloading from the server."
I have Exchange email setup on my iPad. When I search for an email that has a large attachment (15mb PDF) the results show two identical emails. If I click on the first one it says "This message has not been downloaded from the server." The second email seems to open correctly. Closing the Mail app and opening back up doesn't fix the issue. Neither does rebooting iPad. Anyone have any idea why the search is showing multiple emails and why they won't download correctly?
--BrianI am the IT department. Seems to be an issue with the search showing the email locally and server side, so it shows up twice. If I open the email that is server side, it has an issue opening the email again unless I try several times. I'm working with Apple now so hopefully they can help.
-
Downloading to Application server
Hi gurus,
My requirement is to download a file to application server in background mode by DYNAMICALLY SELECTING THE DIRECTORIES AVAILABLE in application server.
i.e. i must display all the directories available in application server in the selection screen than the user will select which directory and folder he wants to download.
I used both F4_DXFILENAME_TOPRECURSION and SAPDMC/LSM_F4_SERVER_FILE but the problem is:-
F4_DXFILENAME_TOPRECURSION :-
When we use the above FM than by default it displays all the files in 'H:' directory only , we cannot access any other directory.
So we need to assign the I_PATH = J:(one of the other directory available) in the FM(I_PATH is one of the parameter in FM) and than we can easily store the output inside 'J:'
But this does not serve the purpose since we can see only 'J:' directory now but the user wants to see all the directories and depending on requirement they will choose the path..........
SAPDMC/LSM_F4_SERVER_FILE :-
even this FM has the same problem and we need to pass the particular directory path inside this.
Waiting for ur replies..its urgent
points will be definitely awardedHi janak dolia,
to download this the procedure:
you can use the FM 'EXCEL_OLE_STANDARD_DAT ' for this purpose.
this FM 'EXCEL_OLE_STANDARD_DAT' can be used to start Excel with a new sheet and transfer data from an internal table to the sheet.
Here are some of the parameters:
file_name: Name and path of the Excel worksheet file e.g. ?C:TEMPZTEST?
data_tab: Name of the internal table that should be uploaded to Exvcel
fieldnames: Internal tabel with column headers
How to build the field names table:
data: begin of i_fieldnames occurs 20,
field(60), end of i_fieldnames.
i_fieldnames-field = ?This is column 1?. append i_fieldnames-field.
i_fieldnames-field = ?This is column 2?. append i_fieldnames-field.
to upload follow this:
OPEN DATASET dsn FOR INPUT IN BINARY MODE.
DO.
READ DATASET dsn INTO itab-field.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
[/code]Rob
or Try this function module.
FILE_READ_AND_CONVERT_SAP_DATA
pass 'XLS' to I_FILEFORMAT..
Regards,
Sreenivasa sarma K.
Edited by: sharmashree kashi on Mar 27, 2008 9:08 AM -
Download to application server using job open/close
Hello people,
Currently I am using open/close dataset to download to the application server automatically. What I do here is submit a program execute in background when the report is done the report is automatically downloaded to the application server.
My problem now is that I want to use job open/close. With this, unfortunatley, my current method of open/close dataset will be unsuable to download to application server once the background job is done.
My question is, is there a way for me to automatically download a file to the application server using the job open/close method?
Thank you so much and take care.<b>Hi,
What you can do is to write a report program that downloads the data to the file on the app server.
Now, you can use the JOB_OPEN and JOB_CLOSE and submit this program in the background which will write the file.
Regards,
Ravi</b>
So what you are saying is that I create two programs, where the job open/close program is the one I will run?
Problem is that I plan to get the values of the selection-options from the original program using the program with the job open/close. How will that work.
Thanks -
We are having this issue across multiple IOS devices ranging from IOS version 5.x up to the latest 6.1.2. Many (not all) emails sent to the devices are unreadable and simply state: "This message has not been downloaded from the server". Microsoft believes this to be some sort of bug with the IOS devices in the way they are handling the SSL encryption.
Facts:
- Devices are connected to an Exchange 2010 SP1 Rollup 6 via Active Sync (No POP3, IMAP or SMTP)
- issue occurs on multiple IOS devices within the organization ranging from IOS 5.x up to the latest 6.1.2
- Issue occurs on both external cellular data and internal wireless networks
- Not all emails sent to the devices result in the error, but issue does tend to occur more frequently from certain senders/domains
- Using the same user account on an android phone does not result in an issue (even when receiving the exactly same email that has been sent to the IOS devices)
- Closing mail app / rebooting device does not resolve the issue
- Doesn't appear to matter what the mesage format is (can be html, plaintext, etc)
- Spent nearly 7 hours with Microsoft going through the Exchange server configuration and looking for possible causes. None have been found and all testing indicates things are setup correctly.
- This is not a case of Issue 2.3 listed here: http://support.microsoft.com/kb/2563324 (verified by Microsoft Support)
- If we disable SSL on the IOS device and connect via plain HTTP the messages are displayed correctly!
- If we use a different SSL certificate, the issue still occurs - so not a problem with the original cert.
Does anyone have any suggestions on what would cause this? Does the ISO devices have any sort of log that would indicate why it's reporting this error? The current error is pretty unhelpful.GFI Have a solution for this problem. It is to do with iOS implementation of reading the message headers when SPF compliance modifications are made by GFI.
http://kb.gfi.com/articles/SkyNet_Article/Error-This-message-has-not-been-downlo aded-from-the-server-when-downloading-messages-to-an-iOS-device?retURL=%2Fapex%2 FSupportHome&popup=true -
I updated my iphone 4S with iOS 6.1.3 and now I cannot retreive or send my e-mails. We have an Exchange server at work. I still receive the e-mails on all my devices just fine and I can see the subject headings & a small portion of the body of the e-mail, but when I open the e-mails there is no body and it reads, "This message has not been downloaded from the server". Very aggrevating and is not helping my business at ALL!! Same has happened with both iPads we own now.
Delete then add back the exchange acct on each device.
-
Upload and download of excel file in the application server in background
Hi all,
i want to download the excel file from application server into internal table and after processing i have to upload to excel file in the application server in the background mode..
i mean i'll schedule the program in background.
im using FM ALSM_EXCEL_TO_INTERNAL_TABLE its working fine in fore ground but not in back ground.
what method i have to follow ?Hi Ankit,
I think this is not possible to open a Excel-File from the application server because the Excel format before Office 2007 where a binary format (Suffix: .xls). The newer Office file format (Suffix: xlsx) is a zipped XML Format. To read the binary Excel-Format you need an OLE Connection between SAP GUI and Office. But at the application server in background you doesn't have this OLE Connection.
In my opinion you have two possibilities:
1. Convert all files in the CSV format. This file format can be read with open dataset.
2. Upload the files from the presentation server in forground. There are some funktion modules in the standard which can read the xls format. But they have some limits regarding the length of cells content.
My recommendation is solution no. 1. If you know an VBA expert, he can write an Excel-macro which converts all Excel Files in the CSV-Fomat.
Regards
Dirk -
How can i get a link to download windows storage server 2008 standard
how can i get a link to download windows storage server 2008 standard
Hi,
Please find the below link for storage server and its resources.
Windows storage server
Regards, Ravikumar P -
File download from application server to presentation server
Hi,
We have requirment to upload a file to application server in .dbf format and then download it to presentation server. while downloading the file to presentation server some of the fields getting junk values. we are downloading file to excel sheet. some of the fields values are Russian texts. Those fields only getting junk values, all other fields are getting correct values.
Please advice.
Regards,
chandra.hi
sample code below should help you......
<u>Download to presentation server</u>
This program can be used to download files from Application server to presentaion server.
1)Maximum length of each field is considered to be 40 characters.
2)Maximum length of the field can be changed by specifying the length in selection screen parameter
3)First line of the Application server file should contain the description of each field.
4)Each field should be delimited by #.
*& Report ZDOWNLOADFILE *
REPORT ZDOWNLOADFILE
MESSAGE-ID B1 .
INCLUDES *
INCLUDE ZDOWNLOADFILE_TOP.
INCLUDE ZDOWNLOADFILE_FORM.
EVENT-AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON pa_appl.
PERFORM check_file_exists USING pa_appl.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_appl.
PERFORM f4_dxfilename USING pa_appl.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_pres.
PERFORM f4_filename USING pa_pres.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_del.
PERFORM f4_dxfilename USING pa_del.
EVENT INITIALIZATION *
INITIALIZATION.
PERFORM initialization.
EVENT START-OF-SELECTION *
START-OF-SELECTION.
PERFORM determine_fields. "Determine number of columns
PERFORM build_itab. "Create internal table based on number
"of columns
PERFORM build_header. "To prepare header for the file
PERFORM download_data. "Download data to presentation server
PERFORM delete_files. "Delete files from application server
*& Include ZDOWNLOADFILE_TOP *
TYPES: BEGIN OF ty_header,
text(100) TYPE c,
END OF ty_header.
DATA: c_fnh_mask type dxfields-filemask value '.',
search_dir type dxfields-longpath value '/sapglobal/users'.
CLASS cl_abap_char_utilities DEFINITION LOAD.
Internal tables *
DATA: gt_header TYPE STANDARD TABLE OF ty_header,
gt_fieldcat TYPE lvc_t_fcat.
Work areas *
DATA: gs_header TYPE ty_header,
gs_fieldcat TYPE lvc_s_fcat.
DATA: wa_filename TYPE string.
DATA: wa_count(2) TYPE N,
wa_start(3) TYPE N,
wa_end(3) TYPE N,
wa_len(3) TYPE N.
DATA: wa_data(12000) TYPE c,
wa_off TYPE I,
itab_appl TYPE REF TO DATA,
itab_line TYPE REF TO DATA,
col(2) TYPE c.
DATA: wa_field(30) TYPE c.
DATA: lv_index TYPE sy-tabix.
DATA: gs_adrp type adrp,
gs_usr02 type usr02,
gs_usr21 type usr21,
gs_char50(50).
CONSTANTS: co_slash(1) value '/'.
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
<wa>,
<fs_line>,
<wa_line>.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-f01.
PARAMETERS: pa_appl LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-f02.
PARAMETERS: pa_pres LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE text-f03.
PARAMETERS: pa_del LIKE rlgrap-filename .
PARAMETERS: pa_deld AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE text-f04.
PARAMETERS: pa_len(3) TYPE c.
SELECTION-SCREEN END OF BLOCK B4.
*& Include ZDOWNLOADFILE_FORM *
*& Form f4_dxfilename
text
-->P_pa_appl text
form f4_dxfilename using p_file.
DATA: wa_file LIKE dxfields-longpath.
CLEAR: wa_file.
call function 'F4_DXFILENAME_TOPRECURSION'
exporting
i_location_flag = 'A'
i_server = ' '
i_path = search_dir
filemask = c_fnh_mask
fileoperation = 'R'
importing
o_path = wa_file
exceptions
rfc_error = 1
error_with_gui = 2
others = 3
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
p_file = wa_file.
endif.
endform. " f4_dxfilename
*& Form f4_filename
text
-->P_pa_pres text
form f4_filename using p_data.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = p_data
endform. " f4_filename
*& Form check_file_exists
text
-->P_pa_appl text
form check_file_exists using p_file.
DATA: wa_file LIKE rlgrap-filename.
wa_file = p_file.
OPEN DATASET wa_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 8.
MESSAGE E714
WITH text-m01 p_file text-m02.
ELSE.
CLOSE DATASET p_file.
ENDIF.
endform. " check_file_exists
*& Form build_header
text
--> p1 text
<-- p2 text
form build_header .
*Select user details
clear gs_usr21-persnumber.
select single persnumber
into (gs_usr21-persnumber)
from usr21
where bname = sy-uname.
concatenate sy-uname
co_slash
gs_adrp-name_text(36)
co_slash
into gs_char50.
condense gs_char50.
clear gs_usr02-class.
select single class
into (gs_usr02-class)
from usr02
where bname = sy-uname.
concatenate gs_char50
gs_usr02-class
into gs_char50.
condense gs_char50.
Write report technical name
write 'Name: ' TO gs_header+0(10).
gs_header+11(*) = sy-repid.
APPEND gs_header TO gt_header.
CLEAR: gs_header.
Write user data
write 'User: ' TO gs_header+0(10).
gs_header+11(*) = gs_char50.
CONCATENATE gs_header gs_char50 INTO
gs_header SEPARATED BY SPACE.
APPEND gs_header TO gt_header.
CLEAR: gs_header.
Write System data
write 'System: ' TO gs_header+0(10).
write: sy-sysid to gs_header+11(3).
write: co_slash to gs_header+14(1).
write: sy-mandt to gs_header+15(3).
APPEND gs_header TO gt_header.
CLEAR: gs_header.
Write System date and time
write 'System: ' TO gs_header+0(10).
write sy-datum to gs_header+11(10).
write sy-uzeit to gs_header+22(8).
APPEND gs_header TO gt_header.
CLEAR: gs_header.
Write Local date and time
write 'Local: ' TO gs_header+0(10).
write sy-datlo to gs_header+11(10).
write sy-timlo to gs_header+22(8).
APPEND gs_header TO gt_header.
CLEAR: gs_header.
APPEND gs_header TO gt_header.
endform. " build_header
*& Form determine_fields
text
--> p1 text
<-- p2 text
form determine_fields .
DATA: wa_data(600) TYPE c.
CLEAR: wa_count,wa_start,wa_end,wa_data.
wa_start = 0.
wa_end = 1.
OPEN DATASET pa_appl FOR INPUT IN TEXT MODE ENCODING DEFAULT.
READ DATASET pa_appl INTO wa_data.
wa_len = STRLEN( wa_data ).
DO wa_len TIMES.
IF wa_data+wa_start(wa_end) EQ
cl_abap_char_utilities=>horizontal_tab.
wa_count = wa_count + 1.
ENDIF.
wa_start = wa_start + 1.
ENDDO.
CLOSE DATASET pa_appl.
wa_count = wa_count + 1.
endform. " determine_fields
*& Form build_itab
text
--> p1 text
<-- p2 text
form build_itab .
DATA: wa_len(4) TYPE c.
CLEAR: wa_len.
IF pa_len IS INITIAL.
wa_len = 40.
ELSE.
wa_len = pa_len.
ENDIF.
col = 1.
DO wa_count TIMES.
CONCATENATE 'FIELD' col INTO wa_field.
gs_fieldcat-fieldname = wa_field.
gs_fieldcat-outputlen = wa_len.
gs_fieldcat-datatype = 'CHAR'.
gs_fieldcat-col_pos = col.
col = col + 1.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR: wa_field.
ENDDO.
*Create the internal table dynamically based on the file structure,
*this table will be used to download data through GUI_DOWNLOAD fm
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
EP_TABLE = itab_appl
*Assign the pointer to the field symbol
ASSIGN itab_appl->* TO <itab>.
CREATE DATA itab_line LIKE LINE OF <itab>.
*Create a work area for the dynamic internal table
ASSIGN itab_line->* TO <wa_line>.
col = 1.
OPEN DATASET pa_appl FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET pa_appl INTO wa_data.
IF sy-subrc <> 0.
CLOSE DATASET pa_appl.
RETURN.
ELSE.
wa_start = 0.
lv_index = 1.
DO wa_count TIMES.
ASSIGN COMPONENT lv_index OF STRUCTURE <wa_line> TO <fs_line>.
FIND cl_abap_char_utilities=>horizontal_tab
IN wa_data+wa_start(*) MATCH OFFSET wa_off.
IF sy-subrc = 0.
IF wa_off NE 0.
<fs_line> = wa_data+wa_start(wa_off).
ENDIF.
wa_start = wa_start + wa_off + 1.
lv_index = lv_index + 1.
ELSE.
<fs_line> = wa_data+wa_start(*).
ENDIF.
ENDDO.
APPEND <wa_line> TO <itab>.
CLEAR: <wa_line>,<fs_line>.
ENDIF.
ENDDO.
endform. " build_itab
*& Form download_data
text
--> p1 text
<-- p2 text
form download_data .
clear: wa_filename.
wa_filename = pa_pres.
call function 'GUI_DOWNLOAD'
exporting
filename = wa_filename
filetype = 'DAT'
tables
data_tab = gt_header
exceptions
access_denied = 15
call function 'GUI_DOWNLOAD'
exporting
filename = wa_filename
filetype = 'DAT'
append = 'X'
tables
data_tab = <itab>
exceptions
access_denied = 15
endform. " download_data
*& Form initialization
text
--> p1 text
<-- p2 text
form initialization .
REFRESH: gt_header,gt_fieldcat,gt_header.
endform. " initialization
*& Form delete_files
text
--> p1 text
<-- p2 text
form delete_files .
IF pa_deld EQ 'X'.
DELETE DATASET pa_appl.
ENDIF.
IF pa_del IS NOT INITIAL.
DELETE DATASET pa_del.
ENDIF.
endform. " delete_files
<b>reward points if helpful.</b>
thanks
vijay
Maybe you are looking for
-
Tried to set up shared memory more than once?
Hi all, Im getting a pop up error on 10.7.3.. It pops up very fast and is almost impossible to read. Having checked the console, this is the error.. 01/04/2012 13:59:12.457 com.apple.launchd.peruser.501: (com.facebook.videochat.'MyName'.updater[486])
-
The ATA only rings the first call
HelloI've just had instaled an ATA Linksys SPA2102 conecting it to a DSL modem CTC UNION model ATU-R130. The SIP is INPHONEX.COM My ISP had to redirect some ports to a fixed IP address in order to make the ATA RING. I make a call to the number assign
-
Suppose following stored procedure: PROCEDURE TEST_PRC IS BEGIN RAISE VALUE_ERROR; END; If I call this procedure in Sql*Plus, I get: BEGIN test_prc; END; ERROR in line 1: .ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SCH_PERSONEN.TEST_PRC
-
I have windows 8 on my laptop and love it so much. I like using word, but sometimes don't want to have to save random files to email them. I go to the save and send option in word, then click send as attachment. An error box appears: 'There is no pro
-
Dear All, I have configured direct GL posting in MIRO for some special requirements. But client want to have a control that, for a particular PO doc type only the GL account tab as to appear. How to achieve this? Regards