Export an Internal Table to Excel - in ABAP [english]
ฝัง
- เผยแพร่เมื่อ 23 ต.ค. 2021
- In this video I show how to export data from an internal table to Excel (*.xslx) in ABAP.
For this I use the class: cl_fdt_xl_spreadsheet
The program is divided into the following sections:
1: Reading the data to an internal table
2: Creating the headers
3: Transform header and itab data to an XSTRING
4: Create file dialog for saving
5: Transforming the XSTRING to SOLIX (Raw)
6: Download the data
#export #table #sap
▬▬ Literature 📚 ▬▬▬▬▬▬▬▬▬▬▬▬▬
▶ ABAP: An Introduction 2020 amzn.to/45CLTqk
▶ Complete ABAP 2023 amzn.to/45D5UNM
▶ ABAP to the Future 2022 amzn.to/42cgWGs
▶ Clean ABAP 2022 amzn.to/3KAqmow
▬▬ My Hardware 💻 ▬▬▬▬▬▬▬▬▬▬▬▬▬
▶ Microphone: amzn.to/3zj2UIz
▶ Headphone: amzn.to/3GUBRFg
▬▬ My Software (free) 💾 ▬▬▬▬▬▬▬▬▬▬▬
▶ Video Recorder: bit.ly/678fgh6
▶ Video Editor: bit.ly/38Rj9lb
▶ Thumbnail: bit.ly/CustAndCodeThumbnail
▶ Gamma AI: bit.ly/3nsdvgr
▬▬ Further Links 🔗 ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
⭐Become my subscriber: bit.ly/CustAndCodeSub
🎬All videos in English: bit.ly/CustAndCodeENG
☕Buy me a Coffee 😀: bit.ly/3dih2cl
*The links are affiliate links. There are no additional costs.
Nice video. You saved my day.
Thank you! Glad to hear that! 🤗👏
Really Great Video,, Thanks
Thank you for your comment! 🤗😀
Me resulte realmente útil, muchas gracias!!!
Gracias por su opinión y su comentario. 🤗
thank you so much!
Thank you 🤗
You're a life saver
I don't know if i would go that far 😉 Thank you for your feedback, i am very glad to hear it 😀🤗
@@CustAndCode I was using the FM GUI download and it was downloading in XLS format, not xlsx. Then I used FM "SAP_CONVERT_TO_XLS_FORMAT" and it was working but it was not overwriting the Excel file if I ran the program again.
Your code finally worked
Just today is was doing this !
I hope it worked 🤗
excellent brother ..
Thank you! You are wery welcome! 🤗
I only want the header information can you plese tell me how can I achieve this
is it possible to import multiple tables in the excel file in different sheets? thanks for the video
I haven't tried it yet, but unfortunately I think it is not possible. 🙄
I have this error
el metodo "if_fdt_doc_spreadsheet-create_document" es desconocido o protected o private
I think you have a problem with the syntax here:
you have to call the method with "~" not with "-"
hope that helps! 🤗
How to set column width based on the values? Can you please help me on this?.
I have not found a solution for this. But is that really necessary? Have you found a solution? 🤔
Is it possible to generate this file without those tabs "Input Help", "Possible Entries" and "Column Alias Mapping"? Thanks!
Yes, I know what you mean. I've looked at this before and haven't found a solution yet. I'll have to look at it again. 🤔
Inside the method create blank document struct , it is assigning the tabs.. we can remove 2 tabs by providing input iv_call_type as blank.. But then also input help tab will come along with our output tab. There is no way to remove that
@@ranjitghosh3097did you find a way to remove input help also?
Thank you so much!! I got a question. I am doing internal table to excel and I need to send this excel to SFTP server. so i think i dont use to guid download and file save dialog. But i dunno how can i send it. If you make another video like this you will be my hero !
Okay, I've never had that requirement myself. I'll put it on my to-do list. But I'm not sure if it's that easy to do. Let's see. 😀🤗
@@CustAndCode thank you!! You are so kind 🙏 glad to find your channel
@@Pekinceler Thanks a lot! 😀🤗
Could you please explain,
How to download alv header and footer data into Excel sheet.
I am not sure if this works 🙄 I have to check this.
I have this error field is unknown
Object an field symbol is defined by this two lines of code:
DATA(o_desc) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( lv_header ) ).
LOOP AT o_desc->get_components( ) ASSIGNING FIELD-SYMBOL().
Is it possible to insert carriage return into cells, for example for strings?
Try to add: cl_abap_char_utilities=>cr_lf 🤗
@@CustAndCode not working, al already tried
@@tenhtam Then (I think, I am not sure) it is not possible with this solution. 🤔
I want to download 3 internal table with multiple sheets in single xcel file, i want show some information at the top of table & wanted to highlight the table header with format & border. OLE function is not working for me could you please help me with this 🙏.
This is a very special requirement. I have not used that myself in this way yet. 🤔
Hii. Thanks for this video. It helped a lot. After downloading into an excel, it's not opening . I have to manually select from the folder to open the file. Can u pls help on this
Glad to hear that! 🤗 The Excel does not open automatically. I also open it manually. Unfortunately you can't see that on the video. I must have opened it on my second monitor.
@@CustAndCode Download from alv report is opening directly. Do u have any idea about that?
@@jerlinthomas8025 unfortunately not 😐
Excelente! :D... It is possible to remove the other sheets?
With this class I haven't found a solution yet, to remove the other sheets. 🤔🙄
@@CustAndCode Don't worry, you help me so much! you rock!!! if you can remove it, please, tell me how!
@@thecisco24 Thanks! Ok, I will do my best! If you du more with excel an SAP, import, export, create reports in Excel then you should have a look at abap2xlsx. 🤗
@@CustAndCode Hello my friend. I found a solution for the sheets. if you want to share with me an email and I'll tell you how i did it. You could make a video afterward.
@@thecisco24 That would be great! Thanks! 🤗 You will find my contact on my channel tab: About --> Details: For business inquiries: 😀
How to download data from alv list viewer to xlsx file with layout choosen by user (selected fields only ) from adding separate functionality in applications menu bar (xlsx download) through sy-ucomm
You can work with report variants or predefined layout settings. 🤔
@@CustAndCode I have created one function to download alv output to Xlsx file . In alv output screen I chose some field now I have to download only this fields in xlsx file but it will take all the fields
@@akshaykumarkadam3117 Unfortunately I don't know how this works with this code dynamically without changing or adapting the transfer structure of the internal table. 🤔
Hi. Can we remove the header line and download?
I don't think that's possible. Why do you need it without a header? without you don't know the column name?
I used this but for large data like 1 lakhs or more records its not working. Its get terminating.
With many lines, it is unfortunately very memory-intensive and relatively slow! Large amounts of data should therefore not be processed. I also only use it for lookup or maintenance. There is also ABAP2XLSX for such processing. 🤗
I WANT TOP OF PAGE INFORMATIN DISPLAYING ON EXEL SHEET
Have you found a solution?
Hi, How to change the 'sheet 1' name to new name?
Unfortunately I have not found a solution for this problem so far. 🙄
While converting table to XML, provide Sheet name iv_sheet_name = ' Your name'.
There are so many tabs created. How to create sheet1 alone.
Thanks for the question. Currently, I do not have a solution for this yet. I am trying to find out if this would be possible. 🤔
do abap code is available to download
Unfortunately I can not copy the code into the description because some characters are not allowed. 😔
Hi!
I tried this code, but the header is only displaying in Excel and the internal table data is missing. Can you please suggest me some solution.
Are you sure that the internal table is filled with data? Check this in the debugger on line 35 --> it_sflight. 🤔
@@CustAndCode Yes, it contains data.
@@sairanjans522 This is strange, because after this point in the code there is only the save dialog and the download. I fear you have to check line by line if there is a missing assignment. 🤔🙄
And o_desc is unknown
The object "o_desc" is defined on line nr. 18. Did you do that?
DATA(o_desc) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( lv_header ) ).