Import Excel *.xlsx to Internal Table - with ABAP [english]

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ส.ค. 2024

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

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

    Excellent work! Thanks a lot , it is working at background as well.

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

      Thank you! Yes should work, read the file from a share on the application server 🤗

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

    Thanks for the excellent video. I am having a requirement to wrap an alv field content when it is more than 128 length. Could you please suggest me a way to display the field (wrap the data when the length is more than 128) in alv report?

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

      I think thats not possible because of the limitation of the ALV grid. 🤔 You can split it? I don't know an other solution. yet. 🤔

  • @user-qq6qt7ye6y
    @user-qq6qt7ye6y 7 หลายเดือนก่อน

    Hi, can you make a video where you show how to upload excel data to use it in a transaction like MIRO or posting acconting documents.

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

      With an Excel Upload you can only maintain the records in ABAP but not record for record in a transaction like MIRO. What is your usecase? or what would you like to achive? 🤗

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

    Thank you great tutorial

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

      Thank you and sorry for the bad audio 🙄, my microphone filters are much better now 😀

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

    Great job...it will helpful.

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

    Excellent. Nicely explained. Although I am able to copy your code and import data from excel into internal table, I am not able to understand your coding. Expressions like =>, ->, NEW, ->* etc. I am unable to comprehend. Please tell me where I can learn all these steps in detail? Thank you

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

      Thank you for your feedback! 🤗 To your questions:
      => you call a Method of a class
      -> Method chaining, means the result of method 1 is the input of method 2
      NEW a new operator released with Release 7.40 the same as Create Object
      ->* This operator is used for dereferencing while using dynamic types.
      You can practise examples with the new operators and syntax after Release 7.40 I have created some videos with, in my opinion, useful functions and operators.
      Hope that helps! 🤗

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

      Thank you for your detailed response. May you be rewarded for that.

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

      @@muhammadfahim2627 Thank you! 🤗🤗🤗🤩

  • @NeerajKumar-du4rm
    @NeerajKumar-du4rm 2 ปีที่แล้ว

    Great work, very clean code, please keep it up also, please improve sound quality and increase font size

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

      Hi and thank you for your feedback! 🤗
      Sound quality should be better now. I have improved some microphone filters, have a look to my newer videos!
      Regarding the font size: It is for me current a mixture of size and overview. With this option you see more code at once. It is easier to read if you use methodchaining for exmple.
      The videos are good viewable with 720p. I have to balance overview and font size, but I will test some different settings. 😀

  • @rakeshpatil4457
    @rakeshpatil4457 3 หลายเดือนก่อน +1

    I am processing the internal table using loop statement as shown below -
    LOOP AT ASSIGNING FIELD-SYMBOL(). -A = lwa_mgo-consumer.
    But this statement giving me error showing "The data object "" does not have a structure and therefore does not have a component "A".
    I want to copy this internal table to user define internal table. Can you please help me with this.

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

      Try it like in this video: th-cam.com/video/RGYoJRP2Nqc/w-d-xo.html 🤗 Here I had to declare the explicit: FIELD-SYMBOLS: TYPE ANY TABLE.

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

      @@CustAndCode Thank You for your response. Really appreciated.

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

      @@rakeshpatil4457 🤗🤗🤗

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

    Great video, thanks for the upload.
    I have a couple of questions!!
    Q: What to do if we want to limit the input of the .xlsx file?
    -> Let's say the file has 30K line items and I want to process 20K first then the remaining once i.e. 10K.
    -> How to split? and then how to process the remaining line items?
    [I know manually we can split the files and then process but I want to automate this process]

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

      I would have to try that myself. I would start here from line 60. In the field-symbol are all entries of the file. Here you have to split them and process them as you like. 🤗

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

    thank you very much!

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

    Amazing! Thnks a lot!

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

    Excellent code I helped me so much. Thanks.

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

      Thank you very much! Great feedback! 😀🤗

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

      @@CustAndCode How can I move data from to itab??

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

      @@christianarmandorivasroble604 You can use as an internal table. Do you have a special requirement?

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

      @@CustAndCode yes you right, but the type of is generic, I-ve never used that but I found a way. Thanks.

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

      @@christianarmandorivasroble604 If you want you can post your solution here 🤗😀

  • @Artur-fj5pn
    @Artur-fj5pn 7 หลายเดือนก่อน

    Hi great video but I dont understand why are you always try-catch generic cx_root? Is this some kind of best practice? Do you know where can I find some more info what and where shoud I catch?

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

      I my examples I only want to prevent a dump. Thats the reason why I use it. If you know what exceptions could be raised then you should use specific Exception Classes. Depends on your need. 🤗

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

    Thanks a lot for this, it is very helpful ! But I have a question for you. Let's say that I have an excel that I would like to convert into a txt file with a specific column delimitation (which have some differences from my excel) How can I achieve that ? My Idea was to loop the field symbol, not sure how, or try to move the content of the excel in an internal table and from there loop in a work area to put the fields as I need it, but then, how can I convert that in a TXT file that the user can download ? VIELEN VIELEN DANK !!!!

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

      The approach is good, maybe this video will help you: th-cam.com/video/RGYoJRP2Nqc/w-d-xo.html
      This is an extension in which I write the data from Excel into a database table. You would have to write the rows to a file instead of the database. 🤗

  • @adityasharma-lf2zt
    @adityasharma-lf2zt ปีที่แล้ว

    Generally works but as checked if i make partial text of row bold then it is picked as blank and also with special characters file stream breaks

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

      Normally in SAP you only need the simple data and no formatting options. The class cannot handle this. Is there a use case where you need the formatting from Excel in SAP? 🤔

    • @adityasharma-lf2zt
      @adityasharma-lf2zt ปีที่แล้ว

      @@CustAndCodeI notice if cell content example "Hard Rubber" is in bold then text is read fine but if its mixing of style example "Hard Rubber CX80" with CX80 as bold and Hard Rubber as normal then content is read blank.
      One more issue is white character (special) that look like space.This breaks stream in between and read incomplete content.To resolve this i copy cell content first to notepad and from notepad back to excel cell.

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

      @@adityasharma-lf2zt The formatting options in Excel are the problem here. Maybe there is also an option in Excel to remove all formatting then you save the copying into the notepad. 🤗

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

    I have a little question ; what should I do if I wanted to pass the data into a internal table to manipulate?

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

      After line 60 the data is assigned to the filed symbol . After that, you can copy and modify the data to an internal table. I make a video about this. Maybe in the next few days. 🤗

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

      @@CustAndCode I just did it, was lacking a little vision hahahahah thank you again.

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

      @@ben11ur congrats! 🤗

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

      @@ben11ur can u provide me a code, please?

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

      Here is the link to a video in which this is described.
      ► th-cam.com/video/RGYoJRP2Nqc/w-d-xo.html
      The code from this video will be extended to do this. 🤗

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

    I have a little question, How would I go about changing the column names?

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

      Have a look at this video: th-cam.com/video/RGYoJRP2Nqc/w-d-xo.html
      In this video I extend this code to insert the excel in a database table. For this I loop over the field symbol.
      Here you can check and change the column names. 🤗

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

    I get FILE_OPEN_ERROR dump when trying to upload a file, error occurs at gui_upload, what could be wrong? the file i am trying to upload is an .xslx file.

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

      All the information is in the dump. Have you analyzed it? Look at the code part in the dump. Which line and so on. 🤗 We need an error message 😀

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

    Please reply the code lines to populate the data into internal table.

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

      * solix -> xstring
      DATA(lv_bin_data) = cl_bcs_convert=>solix_to_xstring( it_solix = it_bin_data ).
      * create spreadsheet ref object
      DATA(o_excel) = NEW cl_fdt_xl_spreadsheet( document_name = CONV #( it_files[ 1 ]-filename )
      xdocument = lv_bin_data ).
      * get first worksheet name
      DATA: it_worksheet_names TYPE if_fdt_doc_spreadsheet=>t_worksheet_names.
      o_excel->if_fdt_doc_spreadsheet~get_worksheet_names( IMPORTING worksheet_names = it_worksheet_names ).
      IF lines( it_worksheet_names ) > 0.
      * first worksheet ref to itab
      DATA(o_worksheet_itab) = o_excel->if_fdt_doc_spreadsheet~get_itab_from_worksheet( it_worksheet_names[ 1 ] ).
      * ref to generic field symbol (excel data)
      ASSIGN o_worksheet_itab->* TO FIELD-SYMBOL().

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

    Hi Mr please I have a lot of worries about this tutorial, is there a methodology to better manage this import step by step?

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

      Importing Data from an Excel to SAP unfortunately involves a few steps. I have given these step by step. 🤔 You can use the code in every SAP System ore you can put the code in a class or function module. 🤗

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

    Can you Do a video on a File from Application Server (.xlsx) to internal table.

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

      I look at this. 😊

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

      @@CustAndCode is that possible without these F.M's ALSMX_EXCEL_TO_INTERNAL_TABLE or TEXT_CONVERT_XLS_TO_SAP. any other method.

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

    Is this working in web gui ?

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

      Yes it should! WebGui is just another way to present data from backend. The code should work for WebGui as well! 😀

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

    hey i have one little Q ,at the output A, B, C, D showing on upper side(header),how to remove this

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

      You want to remove the headerline in the excel? the columnnames? 🤔

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

      @@CustAndCodethanks for reply , at 20.01 alphabetical column(A,B,C,D,E,....) i don't want that row at the top because after converting the data (internal table to excel )first row is coming blank.

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

    Hello, I'm new to ABAP
    Can somebody tell what o_worksheet_itab type is?
    cl_abap_typedescr says that the type is "type =%_t0000450000000000000023888"
    What does it mean?
    Why we can't directly pass o_worksheet_itab to cl_salv_table=>factory ( ... ) method instead of fieldsymbol?
    Thanks in advance!

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

      Hi Max,
      o_worksheet_itab is only the referenced object, you can see this in the debugger. To work with the data or to display it you need to assign it. 🤗

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

    Can I use this using csv format? I need to solve issue with csv file having a huge data. I'm thinking to convert csv to xstring to internal table.

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

      This solution is not the best for a huge mount of data. Hava you tried this video?
      ➡th-cam.com/video/r2CQWvLRHco/w-d-xo.html
      In this video I show how to import csv files 🤗

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

      @@CustAndCode thanks. I found a solution using a SAP FM. I'm able to upload a csv file with 50k+ records with ease. I'll check the other video and check which one is better

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

    cl_fdt_xl_spreadsheet class produces an error for me. Any alternatives?

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

      But the class is available in your system? Which error do you get? Almost any error can be fixed 🤗

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

      @@CustAndCode Its catching an exception: cx_fdt_excel_core..could it be related to the file I am uploading? I also saw somewhere that this class is recommended only for BRF+ framework adhering files and produces unpredictable behavior for normal excel files..

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

      @@nisargmehta796 Could be 🤔 Maybe check your code with a simple excel file. Maybe there are some invalid values in the file itself? 🤔

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

    Thanks a lot, I work with some SAP packages but some of them are missing some functionality. 🥲🥲🥲

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

      Yes that is possible. The functions and classes depend on the SAP modules installed on the system. 🤗

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

    thank you very much!