Is it possible not to show dialog boxes in download function - abap

I'm using "DOWNLOAD" function of abap to download something as txt file. But "DOWNLOAD" function shows some dialog boxes that shows where the file is being downloaded and asks if there is another file with the same name I want to replace.
There is silent parameter for that function to import but it doesn't change anything when I assign 'm' or 's' or 'x' to that.
Here is what I do;
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = fn
filetype = 'ASC'
silent = 'M'
TABLES
data_tab = itab.
GUI_DOWNLOAD (obsolete) is ok without dialog boxes but I can not silence 'DOWNLOAD' function. Anyone knows how to achieve that ?
Thanks.

Rather than the function modules you mention, you should use the methods of class cl_gui_frontend_services.
The following snippet shows you an example call to cl_gui_frontend_services=>gui_download.
types: t_line type c length 100.
data: lt_tab type table of t_line.
append 'test' to lt_tab.
call method cl_gui_frontend_services=>gui_download
exporting
filename = 'C:\temp\file.txt'
changing
data_tab = lt_tab[].
This downloads the file to the specified location without a dialog. For showing a file selection dialog if you choose, there is cl_gui_frontend_services=>file_open_dialog or cl_gui_frontend_services=>file_save_dialog.
Notes:
You should check the return codes from the method calls. I just omitted them here for brevity, but failure to include them may result in a short dump.

Related

How to convert the spectrum type ("Spectrum" -> "Convert Data to")

Is there a manner in which one can convert the spectrum type, for instance to EELS, by DM scripting? This screenshot represents what I'm referring to. I'd like to import a dataset using the GMS 3.4 Python interface, and then turn that into a EELS dataset for further processing (ideally without having to manually interface with the screenshotted menu bar).
Yes there is.
The "type" is simply a meta-data tag
which you can easily set with the TagGroup commands.
There is, however, one complication:
Data "registers" itself with DM when it first appears. Changing the meta-tags manually doesn't change this registration. (The menu command, however, does.)
Thus, you will only see effect of the type change when
either:
You save, close and reopen the data
You clone the data, throw away the original, and display the clone
The second option might cause issues with data-linkage though, as the unique image ID of the data is newly created.
Example using the first method (requires save & load):
image img:=GetFrontImage()
TagGroup tg = img.ImageGetTagGroup()
tg.TagGroupSetTagAsString("Meta Data:Signal","EELS")
imageDocument doc = img.ImageGetOrCreateImageDocument()
doc.ImageDocumentSave(0)
string path = doc.ImageDocumentGetCurrentFile()
doc.ImageDocumentClose(0)
doc = NewImageDocumentFromFile(path)
doc.ImageDocumentShow()
An alternative option is to rely on the menu command. If it is present, then you can simply use the ChoseMenuItem() command to invoke it.
However, the command will only be available with the UI when the data you want to change is front-most (i.e. not a script window!) You will need to ensure by script, that this is the case. A simple ShowWindow() will do.
image img:=GetFrontImage()
img.ShowImage()
if ( !ChooseMenuItem("Spectrum","Convert Data To","None") )
Throw( "Conversion to none failed.")
if ( !ChooseMenuItem("Spectrum","Convert Data To","EDS") )
Throw( "Conversion to none failed.")
Disadvantage of this solution: You will get the user-prompts.

Display PDF from application server in Webdyn Pro ABAP

I'm working on a report which contains actions allowing the user to reach a a new page. In this new page pdf stored on the application server has to be displayed.
On the PDF view I created an interactive form linked with my context (PDF_DATA-PDF : xstring)
gv_filepath = '/tmp/test.pdf'.
" Open the file in binary mode
OPEN DATASET gv_filepath FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
READ DATASET gv_filepath INTO gv_filedata.
IF sy-subrc = 0.
CLOSE DATASET gv_filepath. "Close the file
" Convert the file from hex-string to Binary format
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = gv_filedata
IMPORTING
output_length = gv_filesize
TABLES
binary_tab = gt_bin_data.
Here, I don't know what to do ....
lo_node = wd_context->get_child_node( 'PDF_DATA' ).
lo_node->set_attribute( name = 'PDF' value = ?).
wd_comp_controller->gestion_affichage( ).
ENDIF.
ENDIF.
Please suggest how do I handle this?
There are a couple of ways to implement this:
Use a FileDownload element and perform the operations you described above in the Supply method of the context element. That's probably the easiest way to implement this, but it might have the drawback that the file is not displayed, but offered for download instead. It's worth giving it a try though since it's very easy to implement.
Create a new ICF service (not a WebDynpro application!) that will return the PDF file with an appropriate MIME type when requested. Then, open a new browser window with the URL of that service.
As before, but use an IFrame element to display the PDF file in-place. Be aware that the usage of this element is discouraged (although probably only to push customers towards EP...?).
To display a PDF file in Web Dynpro ABAP page,
Add the InteractiveForm control to the View
Bind the pdfSource property to the Context node containing the PDF content
Load the PDF file to the context node
Here is an example with screen shots
Well i solved my problem with my colleague, thank you
I just have to add the following code after the OPEN DATASET
CLEAR l_len.
CLEAR l_data_tab.
DO.
READ DATASET gv_filepath INTO l_data actual LENGTH l_len.
IF sy-subrc <> 0.
IF l_len > 0.
file_size = file_size + l_len.
APPEND l_data to l_data_tab.
ENDIF.
EXIT.
ENDIF.
file_size = file_size + l_len.
APPEND l_data to l_data_tab.
ENDDO.

chronoforms v5 multi file upload...cannot choose multiple files

I am trying to configure this in v5 and cannot find any documentation. This is what I have so far...
followed the V4 documentation as close as possible, but cannot get the form to allow me to choose multiple files!
Under HTML Render I have Form Tag Attachment = enctype="multipart/form-data"
Under the designer tab I have file field element on the form. Under this I have
Field Name = file1[]
Field ID = file1
Multiple=Yes
Under the settings tab I have the files upload action in the on submit event. In the files upload action I have
Enabled=Yes
Files config = file1:jpg-png-gif-txt
Array fields = file1
is there anything else I need to do?
Turns out this is a bug and will be fixed in the next update. Workaround by creating a custom file upload element with the word multiple as a parameter.

Fixed text when scrolling

My program displays an ABAP list, I'm trying to show a header (some lines of text, nothing fancy) fixed when scrolling down in a report.
Is there some kind of tag or declaration that I have to use?
In SE38 you can define list heading with 'GOTO -> Text Elements -> List Headings`.
You can define a list header, and titles for your list (Columns heading).
One advantage: With GOTO -> Translations you can define different texts in different languages.
Another way to get this maintenance screen:
From your list, you can choose: System -> List -> List Header.
Another way:
You can use top-of-page to define your header text inside your report code.
top-of-page.
write 'My header'.
You can use the TOP OF PAGE event to write something that will stick at the top of the page while scrolling. You can find more info here.
You can also use the list headers from Text Elements menu. More info here.
Best regards,
Sergiu
One way is directly using top-of-page in your code.
Other way is calling reuse_alv_grid_display or reuse_alv_list_display (depending on your output type) and declaring "top-of-page" in the I_CALLBACK_TOP_OF_PAGE line. Then create a sub-routine with the same name as your "top-of-page". In that you can write
wa_list-typ = 'H'.
wa_list-info = ''.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'A'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'S'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
depending on what you want (header, action or selection).
Finally you can use REUSE_ALV_COMMENTARY_WRITE function and call the table(in this example it_list).
Hope it helped.

In SAP SCRIPT, how to add a page break or print the records in a new page

I would like to print the records in a new page every time the contract number changes. What is the syntax for new page in the SAP SCRIPT.
Kindly let me know if you know how to achieve this.
Inside of SAPSCRIPT (Transaction SE71) use the control command NEW-PAGE. (Control Commands are identified by typing /: in the format column).
Inside the Print Program (Transaction SE38) use Function Module CONTROL_FORM to call the command NEW-PAGE:
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'NEW-PAGE'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3.
You only need to use one of these options, depending on where you will determine if a page-break is needed.