With the help of this video i cleared my bug, Thank you Rahul 🙂
@sapabapbyrahulmehta4 ай бұрын
Great.
@hongphilongtu665 Жыл бұрын
thank bro
@anmolnarula453911 ай бұрын
Hey Rahul , I have gone through all you videos on file handling they are very informative and amazing..i have a requirement…we have placed an excel file (xls /xlsx) format file in all11 directory..bt when in my program i am opening and reading it via open and read data set,its reading the garbage values (*#) in the internal table… instead of the normal values…please suggest how do i correct this issue asap
@AnaghaSridhar9 ай бұрын
I followed the exact same steps as mentioned in the video, for my example. but when i am trying to write into the file i am getting this issue: Write access to file file:///home/user/training sap/output1.txt' is denied' even though i have write permission for my file. please help me to fix this issue. thank you
@sapabapbyrahulmehta9 ай бұрын
I will suggest to check with Basis person/system administrator or try with different path, as based upon the error, it is a authorization related issue.
@BiboyrobloxmobilegamingPH2 ай бұрын
is it possible to save the value directly to a notepad and then the note pad is saved into a folder directly?
@sapabapbyrahulmehta2 ай бұрын
Sorry for the late reply. Yes you can. Pass the full path and it will save in to that folder with that name.
@AnkitKumar-bg1ft5 ай бұрын
Hi Rahul, If I want to use some other separator(like comma or pipe) rather than Tab then how will I achieve it.
@sapabapbyrahulmehta5 ай бұрын
Firstly you can use the FM : SAP_CONVERT_TO_TEX_FORMAT and pass the separator which you want use. Then use the method - GUI_DOWNLOAD of CL_GUI_FRONTEND_SERVICES class to download that data. Below is the code for the same. CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT' EXPORTING I_FIELD_SEPERATOR = ',' TABLES I_TAB_SAP_DATA = IT_ITAB[] CHANGING I_TAB_CONVERTED_DATA = DO_ITAB[]. * CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD EXPORTING FILENAME = 'C:\KNA1.TXT' FILETYPE = 'ASC' CHANGING DATA_TAB = DO_ITAB[].
@AnkitKumar-rr8te5 ай бұрын
Thanks for the response. It is working.
@KANNANKANNAN-vu9rq5 ай бұрын
How to save the file in csv file format in desktop sir
@sapabapbyrahulmehta5 ай бұрын
There is a FM : SAP_CONVERT_TO_CSV_FORMAT , You can convert it to CSV format and then download.
@anujkumar11648 ай бұрын
hi sir is it mandatory to use notepad file,can we use excel file,?
@sapabapbyrahulmehta8 ай бұрын
You can use excel also. In that case we need to use different FM : TEXT_CONVERT_XLS_TO_SAP
@anujkumar11648 ай бұрын
thanku sir🙂
@rupamacharya45813 ай бұрын
Sir whenever we are using the gui_download function module then the data are downloaded to the file. What if i execute the code 2 times Will the data also be downloaded 2 times or not?? And if we are downloading the data in a file which is not empty then what will happen please explain sir?
@sapabapbyrahulmehta3 ай бұрын
Below is the answer. If we download again with the same name, it will update the existing file. It covers the answer of your second point as well.
@masoolabdulrahim423310 ай бұрын
Hi Rahul, I have gone through video it is very nice and easily understandable, I have few question on writing Data to a file on presentation server, 1.How to show the field names or short description on the file(here on the downloaded file). 2.Can we use .xls as file format. Please clarify this , appreciate for your time. thanks in advance.
@sapabapbyrahulmehta10 ай бұрын
Hello Masool - Thank you for connecting. Below are the answers. 1) For the first point - We need to use the parameter FIELDNAMES which is the part of TABLES Tab. You can fill this internal table, pass the column text and it will display at the top of the data. 2) You can pass the file extension at .XLS and pass the value of WRITE_FIELD_SEPARATOR = 'X'. Sending the sample code, which I tried. TYPES : BEGIN OF lty_data, ono TYPE zdeono_28, odate TYPE zdeodate_28, pm TYPE zdepm_28, ta TYPE zdeta_28, END OF lty_data. TYPES : BEGIN OF lty_header, Text(40) TYPE c, END OF lty_header. DATA : lt_data TYPE TABLE OF lty_data. DATA : lt_header TYPE TABLE OF lty_header. DATA : ls_header TYPE lty_header. SELECT ono odate pm ta FROM zordh_28 INTO TABLE lt_data. ls_header-text = 'Order Number'. APPEND ls_header to lt_header. ls_header-text = 'Order Date'. APPEND ls_header to lt_header. ls_header-text = 'Payment Mode'. APPEND ls_header to lt_header. ls_header-text = 'Total Amount'. APPEND ls_header to lt_header. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING * BIN_FILESIZE = filename = 'C:\Users ahul\OneDrive\Desktop\2.xls' * FILETYPE = 'ASC' * APPEND = ' ' WRITE_FIELD_SEPARATOR = 'X' * HEADER = '00' * TRUNC_TRAILING_BLANKS = ' ' * WRITE_LF = 'X' * COL_SELECT = ' ' * COL_SELECT_MASK = ' ' * DAT_MODE = ' ' * CONFIRM_OVERWRITE = ' ' * NO_AUTH_CHECK = ' ' * CODEPAGE = ' ' * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * WRITE_BOM = ' ' * TRUNC_TRAILING_BLANKS_EOL = 'X' * WK1_N_FORMAT = ' ' * WK1_N_SIZE = ' ' * WK1_T_FORMAT = ' ' * WK1_T_SIZE = ' ' * WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE * SHOW_TRANSFER_STATUS = ABAP_TRUE * VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD' * IMPORTING * FILELENGTH = TABLES data_tab = lt_data FIELDNAMES = lt_header * EXCEPTIONS * FILE_WRITE_ERROR = 1 * NO_BATCH = 2 * GUI_REFUSE_FILETRANSFER = 3 * INVALID_TYPE = 4 * NO_AUTHORITY = 5 * UNKNOWN_ERROR = 6 * HEADER_NOT_ALLOWED = 7 * SEPARATOR_NOT_ALLOWED = 8 * FILESIZE_NOT_ALLOWED = 9 * HEADER_TOO_LONG = 10 * DP_ERROR_CREATE = 11 * DP_ERROR_SEND = 12 * DP_ERROR_WRITE = 13 * UNKNOWN_DP_ERROR = 14 * ACCESS_DENIED = 15 * DP_OUT_OF_MEMORY = 16 * DISK_FULL = 17 * DP_TIMEOUT = 18 * FILE_NOT_FOUND = 19 * DATAPROVIDER_EXCEPTION = 20 * CONTROL_FLUSH_ERROR = 21 * OTHERS = 22 . IF sy-subrc 0. * Implement suitable error handling here ENDIF.
@masoolabdulrahim423310 ай бұрын
@@sapabapbyrahulmehta Thank you very much Rahul.
@VijayaLaxmi-xk3ds8 ай бұрын
how can get data with field name (headings) to local
@sapabapbyrahulmehta8 ай бұрын
We need to use the parameter FIELDNAMES which is the part of TABLES Tab. You can fill this internal table, pass the column text and it will display at the top of the data. Below is the sample code which I tried. TYPES : BEGIN OF lty_data, ono TYPE zdeono_28, odate TYPE zdeodate_28, pm TYPE zdepm_28, ta TYPE zdeta_28, END OF lty_data. TYPES : BEGIN OF lty_header, Text(40) TYPE c, END OF lty_header. DATA : lt_data TYPE TABLE OF lty_data. DATA : lt_header TYPE TABLE OF lty_header. DATA : ls_header TYPE lty_header. SELECT ono odate pm ta FROM zordh_28 INTO TABLE lt_data. ls_header-text = 'Order Number'. APPEND ls_header to lt_header. ls_header-text = 'Order Date'. APPEND ls_header to lt_header. ls_header-text = 'Payment Mode'. APPEND ls_header to lt_header. ls_header-text = 'Total Amount'. APPEND ls_header to lt_header. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING * BIN_FILESIZE = filename = 'C:\Users ahul\OneDrive\Desktop\2.xls' * FILETYPE = 'ASC' * APPEND = ' ' WRITE_FIELD_SEPARATOR = 'X' * HEADER = '00' * TRUNC_TRAILING_BLANKS = ' ' * WRITE_LF = 'X' * COL_SELECT = ' ' * COL_SELECT_MASK = ' ' * DAT_MODE = ' ' * CONFIRM_OVERWRITE = ' ' * NO_AUTH_CHECK = ' ' * CODEPAGE = ' ' * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * WRITE_BOM = ' ' * TRUNC_TRAILING_BLANKS_EOL = 'X' * WK1_N_FORMAT = ' ' * WK1_N_SIZE = ' ' * WK1_T_FORMAT = ' ' * WK1_T_SIZE = ' ' * WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE * SHOW_TRANSFER_STATUS = ABAP_TRUE * VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD' * IMPORTING * FILELENGTH = TABLES data_tab = lt_data FIELDNAMES = lt_header * EXCEPTIONS * FILE_WRITE_ERROR = 1 * NO_BATCH = 2 * GUI_REFUSE_FILETRANSFER = 3 * INVALID_TYPE = 4 * NO_AUTHORITY = 5 * UNKNOWN_ERROR = 6 * HEADER_NOT_ALLOWED = 7 * SEPARATOR_NOT_ALLOWED = 8 * FILESIZE_NOT_ALLOWED = 9 * HEADER_TOO_LONG = 10 * DP_ERROR_CREATE = 11 * DP_ERROR_SEND = 12 * DP_ERROR_WRITE = 13 * UNKNOWN_DP_ERROR = 14 * ACCESS_DENIED = 15 * DP_OUT_OF_MEMORY = 16 * DISK_FULL = 17 * DP_TIMEOUT = 18 * FILE_NOT_FOUND = 19 * DATAPROVIDER_EXCEPTION = 20 * CONTROL_FLUSH_ERROR = 21 * OTHERS = 22 . IF sy-subrc 0. * Implement suitable error handling here ENDIF.
@devindersingh45324 ай бұрын
Sir i want to read the data from the pdf file and this method is not working
@sapabapbyrahulmehta4 ай бұрын
Hello - Please refer to this link. community.sap.com/t5/technology-q-a/how-to-read-a-pdf-file-from-desktop-to-internal-table-in-sap-abap/qaq-p/13640498
@devindersingh45324 ай бұрын
@@sapabapbyrahulmehta as the link suggest 1st we have to upload the file to al11 only then we can extract data from the pdf . There is no other alternative to directly get the pdf data from the local system
@Balaji-g5t2 ай бұрын
Hi Sir.. zero byte transmitted and record not fetch on presentation layer DATA : lv_ono TYPE ZDEONO_107. TYPES : BEGIN OF lty_data, ONO TYPE ZDEONO_107, ODATE TYPE ZDEODATE_107, PM TYPE ZDEPM_107, TA TYPE ZDETC_107, END OF lty_data. DATA : lt_data TYPE TABLE OF lty_data. DATA : lwa_data TYPE lty_data. SELECT-OPTIONS : s_ono FOR lv_ono. SELECT ONO ODATE PM TA FROM ZORDH_107 INTO TABLE lt_data WHERE ono IN s_ono. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING * BIN_FILESIZE = BIN_FILESIZE filename = 'C:\Users\HP\Desktop\Order.txt' * FILETYPE = 'ASC' * APPEND = ' ' WRITE_FIELD_SEPARATOR = 'X' * HEADER = '00' * TRUNC_TRAILING_BLANKS = ' ' * WRITE_LF = 'X' * COL_SELECT = ' ' * COL_SELECT_MASK = ' ' * DAT_MODE = ' ' * CONFIRM_OVERWRITE = ' ' * NO_AUTH_CHECK = ' ' * CODEPAGE = ' ' * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * WRITE_BOM = ' ' * TRUNC_TRAILING_BLANKS_EOL = 'X' * WK1_N_FORMAT = ' ' * WK1_N_SIZE = ' ' * WK1_T_FORMAT = ' ' * WK1_T_SIZE = ' ' * WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE * SHOW_TRANSFER_STATUS = ABAP_TRUE * VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD' * IMPORTING * FILELENGTH = FILELENGTH TABLES data_tab = lt_data * FIELDNAMES = FIELDNAMES EXCEPTIONS FILE_WRITE_ERROR = 1 NO_BATCH = 2 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6 HEADER_NOT_ALLOWED = 7 SEPARATOR_NOT_ALLOWED = 8 FILESIZE_NOT_ALLOWED = 9 HEADER_TOO_LONG = 10 DP_ERROR_CREATE = 11 DP_ERROR_SEND = 12 DP_ERROR_WRITE = 13 UNKNOWN_DP_ERROR = 14 ACCESS_DENIED = 15 DP_OUT_OF_MEMORY = 16 DISK_FULL = 17 DP_TIMEOUT = 18 FILE_NOT_FOUND = 19 DATAPROVIDER_EXCEPTION = 20 CONTROL_FLUSH_ERROR = 21 . IF SY-SUBRC 0. ENDIF.
@sapabapbyrahulmehta2 ай бұрын
Based upon my perception, you are passing wrong input to the program. Check the data in the internal table - LT_DATA in the debugging mode. As I used your code and it is working fine for me.