2010 Apr 12 7:19 AM
Where is application sever file.?I need download a file to pc at background. I use the OPEN DATASET ... FOR OUTPUT.
the system is shortdump when i use the satement. I dont know where the file. HOW CAN I FIND IT?
2010 Apr 12 10:46 AM
hi,
you can go to AL11 to see the path of application server.
Please find below my code.it will help you.
DATA:
z_logical_filename TYPE filename-fileintern VALUE 'Z_OUTPUT_IOMIP',
l_filename TYPE string,
p_file(255) TYPE c,
program_name(35) TYPE c,
program_name_error(35) TYPE c,
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
CONCATENATE: 'Open Zor' sy-datum sy-uzeit
into program_name
SEPARATED BY '_',
'Open Zor Error' sy-datum sy-uzeit
into program_name_error
SEPARATED BY '_'.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = z_logical_filename
operating_system = sy-opsys
file_name = program_name
eleminate_blanks = c_x
IMPORTING
file_name_with_path = p_file
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
CLEAR l_filename.
MOVE p_file TO l_filename.
* transfer the file to the app server.
CLEAR p_file.
* open dataset to transfer file.
OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE text-e01 TYPE c_e. "File could not be opened
exit.
ELSE.
*----HEADER INFORMATION------------------------------------------------*
CONCATENATE text-t01 "Sales Document
text-t02 "Item
text-t03 "Reason for Rejection
text-t04 "Message type
INTO wa_output1
SEPARATED BY con_tab.
TRANSFER wa_output1 TO l_filename.
CLEAR : wa_output1,
wa_output.
LOOP AT i_output INTO wa_output.
CONCATENATE wa_output-vbeln
wa_output-posnr
wa_output-abgru
wa_output-msgtype
INTO
wa_output1 SEPARATED BY con_tab.
* Transfer the content to app server.
TRANSFER wa_output1 TO l_filename.
CLEAR :wa_output1,
wa_output.
ENDLOOP.
ENDIF.
* close the dataset.
CLOSE DATASET l_filename.
thanks and regards ,
tanmaya Gupta
Edited by: Tanmaya Gupta on Apr 12, 2010 11:46 AM
Edited by: Tanmaya Gupta on Apr 12, 2010 11:46 AM
Edited by: Tanmaya Gupta on Apr 12, 2010 11:47 AM
2010 Apr 12 10:31 AM
goto AL11 this is the tcode to find paths in a application server.
usinf open datasetstatement u can upload ur data in App servr
OPEN DATASET gv_fname FOR OUTPUT IN BINARY MODE.
BR,
giridhar
2010 Apr 12 10:46 AM
hi,
you can go to AL11 to see the path of application server.
Please find below my code.it will help you.
DATA:
z_logical_filename TYPE filename-fileintern VALUE 'Z_OUTPUT_IOMIP',
l_filename TYPE string,
p_file(255) TYPE c,
program_name(35) TYPE c,
program_name_error(35) TYPE c,
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
CONCATENATE: 'Open Zor' sy-datum sy-uzeit
into program_name
SEPARATED BY '_',
'Open Zor Error' sy-datum sy-uzeit
into program_name_error
SEPARATED BY '_'.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = z_logical_filename
operating_system = sy-opsys
file_name = program_name
eleminate_blanks = c_x
IMPORTING
file_name_with_path = p_file
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
CLEAR l_filename.
MOVE p_file TO l_filename.
* transfer the file to the app server.
CLEAR p_file.
* open dataset to transfer file.
OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE text-e01 TYPE c_e. "File could not be opened
exit.
ELSE.
*----HEADER INFORMATION------------------------------------------------*
CONCATENATE text-t01 "Sales Document
text-t02 "Item
text-t03 "Reason for Rejection
text-t04 "Message type
INTO wa_output1
SEPARATED BY con_tab.
TRANSFER wa_output1 TO l_filename.
CLEAR : wa_output1,
wa_output.
LOOP AT i_output INTO wa_output.
CONCATENATE wa_output-vbeln
wa_output-posnr
wa_output-abgru
wa_output-msgtype
INTO
wa_output1 SEPARATED BY con_tab.
* Transfer the content to app server.
TRANSFER wa_output1 TO l_filename.
CLEAR :wa_output1,
wa_output.
ENDLOOP.
ENDIF.
* close the dataset.
CLOSE DATASET l_filename.
thanks and regards ,
tanmaya Gupta
Edited by: Tanmaya Gupta on Apr 12, 2010 11:46 AM
Edited by: Tanmaya Gupta on Apr 12, 2010 11:46 AM
Edited by: Tanmaya Gupta on Apr 12, 2010 11:47 AM
2010 Apr 13 8:50 PM
AL11 to check Application server ...
gv_app_ser --Path of application server
OPEN DATASET gv_app_ser FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH SMART LINEFEED.
READ DATASET gv_app_ser INTO 'Internal Table'.
CLOSE DATASET gv_app_ser.
2010 Apr 13 9:19 PM
All questions around PC, application server, background, foreground, open dataset, gui_download etc. have been asked and answered before, please search before posting.
Thread locked.
Thomas