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.

ความคิดเห็น • 80

  • @ranjitghosh3097
    @ranjitghosh3097 ปีที่แล้ว +1

    Nice video. You saved my day.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Thank you! Glad to hear that! 🤗👏

  • @yuvaraj9975
    @yuvaraj9975 ปีที่แล้ว

    Really Great Video,, Thanks

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Thank you for your comment! 🤗😀

  • @funeralord
    @funeralord 6 หลายเดือนก่อน

    Me resulte realmente útil, muchas gracias!!!

    • @CustAndCode
      @CustAndCode  6 หลายเดือนก่อน

      Gracias por su opinión y su comentario. 🤗

  • @ben11ur
    @ben11ur 2 ปีที่แล้ว

    thank you so much!

  • @migl_98
    @migl_98 11 หลายเดือนก่อน

    You're a life saver

    • @CustAndCode
      @CustAndCode  11 หลายเดือนก่อน +1

      I don't know if i would go that far 😉 Thank you for your feedback, i am very glad to hear it 😀🤗

    • @migl_98
      @migl_98 11 หลายเดือนก่อน

      @@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

  • @nhanha4
    @nhanha4 2 ปีที่แล้ว

    Just today is was doing this !

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      I hope it worked 🤗

  • @afrozshaik9894
    @afrozshaik9894 3 หลายเดือนก่อน

    excellent brother ..

    • @CustAndCode
      @CustAndCode  2 หลายเดือนก่อน

      Thank you! You are wery welcome! 🤗

  • @akshayakumar823
    @akshayakumar823 14 วันที่ผ่านมา

    I only want the header information can you plese tell me how can I achieve this

  • @redouankanaa8439
    @redouankanaa8439 2 ปีที่แล้ว +2

    is it possible to import multiple tables in the excel file in different sheets? thanks for the video

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      I haven't tried it yet, but unfortunately I think it is not possible. 🙄

  • @juliansabogal1370
    @juliansabogal1370 2 ปีที่แล้ว +2

    I have this error
    el metodo "if_fdt_doc_spreadsheet-create_document" es desconocido o protected o private

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +3

      I think you have a problem with the syntax here:
      you have to call the method with "~" not with "-"
      hope that helps! 🤗

  • @sk16034
    @sk16034 2 หลายเดือนก่อน

    How to set column width based on the values? Can you please help me on this?.

    • @CustAndCode
      @CustAndCode  หลายเดือนก่อน

      I have not found a solution for this. But is that really necessary? Have you found a solution? 🤔

  • @marlonbalves
    @marlonbalves ปีที่แล้ว +1

    Is it possible to generate this file without those tabs "Input Help", "Possible Entries" and "Column Alias Mapping"? Thanks!

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      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. 🤔

    • @ranjitghosh3097
      @ranjitghosh3097 ปีที่แล้ว

      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

    • @RITICKSOBTI-jp1yg
      @RITICKSOBTI-jp1yg 11 หลายเดือนก่อน

      ​@@ranjitghosh3097did you find a way to remove input help also?

  • @Pekinceler
    @Pekinceler ปีที่แล้ว +1

    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 !

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      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. 😀🤗

    • @Pekinceler
      @Pekinceler ปีที่แล้ว

      @@CustAndCode thank you!! You are so kind 🙏 glad to find your channel

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@Pekinceler Thanks a lot! 😀🤗

  • @srraj2656
    @srraj2656 ปีที่แล้ว

    Could you please explain,
    How to download alv header and footer data into Excel sheet.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      I am not sure if this works 🙄 I have to check this.

  • @someshkulakarni9535
    @someshkulakarni9535 2 ปีที่แล้ว

    I have this error field is unknown

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      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().

  • @tenhtam
    @tenhtam 4 หลายเดือนก่อน

    Is it possible to insert carriage return into cells, for example for strings?

    • @CustAndCode
      @CustAndCode  3 หลายเดือนก่อน

      Try to add: cl_abap_char_utilities=>cr_lf 🤗

    • @tenhtam
      @tenhtam 3 หลายเดือนก่อน

      @@CustAndCode not working, al already tried

    • @CustAndCode
      @CustAndCode  3 หลายเดือนก่อน

      @@tenhtam Then (I think, I am not sure) it is not possible with this solution. 🤔

  • @vasumegh
    @vasumegh ปีที่แล้ว

    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 🙏.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      This is a very special requirement. I have not used that myself in this way yet. 🤔

  • @jerlinthomas8025
    @jerlinthomas8025 2 ปีที่แล้ว

    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

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      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.

    • @jerlinthomas8025
      @jerlinthomas8025 2 ปีที่แล้ว

      @@CustAndCode Download from alv report is opening directly. Do u have any idea about that?

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      @@jerlinthomas8025 unfortunately not 😐

  • @thecisco24
    @thecisco24 ปีที่แล้ว +1

    Excelente! :D... It is possible to remove the other sheets?

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      With this class I haven't found a solution yet, to remove the other sheets. 🤔🙄

    • @thecisco24
      @thecisco24 ปีที่แล้ว

      @@CustAndCode Don't worry, you help me so much! you rock!!! if you can remove it, please, tell me how!

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@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. 🤗

    • @thecisco24
      @thecisco24 11 หลายเดือนก่อน

      @@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.

    • @CustAndCode
      @CustAndCode  11 หลายเดือนก่อน

      @@thecisco24 That would be great! Thanks! 🤗 You will find my contact on my channel tab: About --> Details: For business inquiries: 😀

  • @akshaykumarkadam3117
    @akshaykumarkadam3117 ปีที่แล้ว

    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

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      You can work with report variants or predefined layout settings. 🤔

    • @akshaykumarkadam3117
      @akshaykumarkadam3117 ปีที่แล้ว

      @@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

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@akshaykumarkadam3117 Unfortunately I don't know how this works with this code dynamically without changing or adapting the transfer structure of the internal table. 🤔

  • @jerlinthomas8025
    @jerlinthomas8025 2 ปีที่แล้ว

    Hi. Can we remove the header line and download?

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      I don't think that's possible. Why do you need it without a header? without you don't know the column name?

  • @manikantareddy64207
    @manikantareddy64207 5 หลายเดือนก่อน

    I used this but for large data like 1 lakhs or more records its not working. Its get terminating.

    • @CustAndCode
      @CustAndCode  5 หลายเดือนก่อน

      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. 🤗

  • @AshokKumar-zf4gl
    @AshokKumar-zf4gl 2 หลายเดือนก่อน

    I WANT TOP OF PAGE INFORMATIN DISPLAYING ON EXEL SHEET

    • @CustAndCode
      @CustAndCode  หลายเดือนก่อน

      Have you found a solution?

  • @srinathpulloori3865
    @srinathpulloori3865 ปีที่แล้ว +1

    Hi, How to change the 'sheet 1' name to new name?

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Unfortunately I have not found a solution for this problem so far. 🙄

    • @sapraju
      @sapraju ปีที่แล้ว +2

      While converting table to XML, provide Sheet name iv_sheet_name = ' Your name'.

  • @beingme.630
    @beingme.630 2 ปีที่แล้ว

    There are so many tabs created. How to create sheet1 alone.

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว

      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. 🤔

  • @dharmandrayadav2858
    @dharmandrayadav2858 2 ปีที่แล้ว

    do abap code is available to download

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +1

      Unfortunately I can not copy the code into the description because some characters are not allowed. 😔

  • @sairanjans522
    @sairanjans522 ปีที่แล้ว

    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.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Are you sure that the internal table is filled with data? Check this in the debugger on line 35 --> it_sflight. 🤔

    • @sairanjans522
      @sairanjans522 ปีที่แล้ว

      @@CustAndCode Yes, it contains data.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@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. 🤔🙄

  • @someshkulakarni9535
    @someshkulakarni9535 2 ปีที่แล้ว

    And o_desc is unknown

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +1

      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 ) ).