Export SAP Data to different Excel Files with SAP GUI Scripting & Excel Macro VBA [english]

Sdílet
Vložit
  • čas přidán 10. 09. 2024
  • In today's video I will show you how to combine SAP GUI Script and Excel macros with each other. Very handy for users who regularly export data from SAP to Excel. We select different data and save them in separate Excel files. The whole thing happens with a script and a loop.
    #sap #excel #vba #export
    ▬▬ 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/CustAnd...
    ▶ Gamma AI: bit.ly/3nsdvgr
    ▬▬ Further Links 🔗 ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ⭐Become my subscriber: bit.ly/CustAnd...
    🎬All videos in English: bit.ly/CustAnd...
    ☕Buy me a Coffee 😀: bit.ly/3dih2cl
    *The links are affiliate links. There are no additional costs.
    Microsoft excel icons created by Pixel perfect - Flaticon
    www.flaticon.c...
    Sap icons created by Freepik - Flaticon
    www.flaticon.c...
    SAP® and SAP GUI Scripting are registered trademarks of SAP AG.

Komentáře • 57

  • @pramodpandey1772
    @pramodpandey1772 Před 3 měsíci

    Very helpful for every user. Thank you so much

    • @CustAndCode
      @CustAndCode  Před 3 měsíci

      I'm glad you liked it. And thank you for watching! 🤗

  • @sjpt1434
    @sjpt1434 Před rokem +1

    creative as usual.

    • @CustAndCode
      @CustAndCode  Před rokem

      Thank you very much for your feedback! 😀

  • @guardianjuan
    @guardianjuan Před rokem +1

    Thanks!

    • @CustAndCode
      @CustAndCode  Před rokem +1

      Wow! Many thanks for your support! I appreciate it! 🤗😀😀🤗

  • @guardianjuan
    @guardianjuan Před rokem

    This is so helpful. Thank you so much

    • @CustAndCode
      @CustAndCode  Před rokem

      Thank you for your kind feedback and your comment! 🤗😀

  • @marthareyes5266
    @marthareyes5266 Před 5 měsíci

    This is so helpful, saving a lot of time!!!! What do I need to do for the excel files to get closed. Using this code for over 50 files downloads.

    • @CustAndCode
      @CustAndCode  Před 4 měsíci

      The closing command haven't worked for me. Don't know why. 🤔 Would be great if anybody would find a solution. 🤗

  • @Digitor7
    @Digitor7 Před 10 měsíci

    This tool is exceptionally handy, and I am curious if it offers the capability to generate reports for different months. Can you please provide some examples of how to modify the date and run the report via Macro setting?

    • @CustAndCode
      @CustAndCode  Před 10 měsíci

      Thanks for your positive feedback! You can pass your variables in the excel itself. I show this in this video: czcams.com/video/8nvCW-l2Jdc/video.html
      🤗

  • @kamilagirona3120
    @kamilagirona3120 Před 2 měsíci

    how can I automate download attached files related to doc SAP number? I did a scripting but I coudn't connect with file path where I would like to save files in my windows

    • @saikrishnachiru
      @saikrishnachiru Před 26 dny

      Sorry i didnt understand your question clearly. I will try to help u. Please explain clearly

  • @daminifutane7199
    @daminifutane7199 Před 7 měsíci

    Big help for me , thanks a lot , keep bringing more content , any possibility that output sheets could be made part of same workbook?

    • @CustAndCode
      @CustAndCode  Před 6 měsíci

      Good Question, I will have a look at this. 🤗

  • @tikammolo3052
    @tikammolo3052 Před rokem

    Thank you 🎉🎉🎉

  • @jellyacecream
    @jellyacecream Před 8 měsíci

    hi, can you tell me how to close the workbooks opened after the extract from SAP? I'm running a different excel file in the next step where the extracted files are referenced. thanks
    workbook.(filename).close at the end of the macro is showing a runtime error

    • @CustAndCode
      @CustAndCode  Před 7 měsíci

      I have tested several suggestions from the internet but unfortunately none of them have been successful. 🤔

  • @nagukanuri5885
    @nagukanuri5885 Před 5 měsíci

    Hello sir im getting error in last row im stuck with that. can you help me on this

  • @mihais83
    @mihais83 Před 10 měsíci

    Does someone know why i receive this error " application defined or object defined error" for line lastRow = ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, 1).End(x1Up).Row

    • @CustAndCode
      @CustAndCode  Před 10 měsíci

      It should be xlUp, not x1Up (a lower case letter L, not the number 1). 🤗

    • @mihais83
      @mihais83 Před 10 měsíci

      Thank you!!@@CustAndCode

    • @CustAndCode
      @CustAndCode  Před 10 měsíci

      @@mihais83 🤗🤗🤗

  • @srqwnz
    @srqwnz Před měsícem

    Hello!
    I need some help. :) :(
    Whatever folder path I add, I got error: runtime error 619 the control could not be found by id (Folder is already created!)
    And in Watchlist below the coding field:
    session.FindById("wnd[1]/usr/ctxtDY_PATH").Text = "C:\Users\myuserid\Desktop\bbb"
    session.FindById("wnd[1]/usr/ctxtDY_FILENAME").Text = "xyz.xlsx"
    Thanks a lot!

    • @CustAndCode
      @CustAndCode  Před 28 dny

      Strange, should work, maybe you try to create a new script? 🤔

  • @andyjohnson9714
    @andyjohnson9714 Před 11 měsíci

    Nice but what to do if you have no authorization to run se16? I need download fse5n reports for each cocode…

    • @CustAndCode
      @CustAndCode  Před 11 měsíci

      Of course, the user with which this script is executed must have the necessary rights! 🤗

  • @mrunavailable5868
    @mrunavailable5868 Před 8 měsíci

    So I do this for work, but I use to have that window that asks for Directory and file name, but I changed my layout and now it opens a file explorer how can i change that?

    • @CustAndCode
      @CustAndCode  Před 8 měsíci

      But you use the SAP GUI or? What have you changed? 🤔

    • @mrunavailable5868
      @mrunavailable5868 Před 8 měsíci

      @@CustAndCode I fixed it, I guess I had the open microsoft dialog box check marked, so it was opening a File exlporer save as window that VBA couldn't interact with, but now its good! thanks!

    • @CustAndCode
      @CustAndCode  Před 8 měsíci

      @@mrunavailable5868 Thanks for your feedback! I think this could help other people too 🤗

    • @mrunavailable5868
      @mrunavailable5868 Před 8 měsíci +1

      ​@@CustAndCode Awesome, well to anyone looking to find this make sure your scripting option for microsoft windows dialog is unchecked. this will prompt the SAP save as window instead of a file explorer type. this saves me a ton of time when exporting since the other option is choosing file path and name each time, when you could just have it auto save, and auto put the date on the title.

    • @CustAndCode
      @CustAndCode  Před 6 měsíci +1

      Thank you for your valuable feedback and thanks that you help others in the community too! 🤗

  • @gabrielasiqueira5272
    @gabrielasiqueira5272 Před rokem

    Hi,
    When some users are saving the file opens the name and path window and others opens only the explorer window so the Macro stops. How to configure to show only the name and path window before saving?

    • @CustAndCode
      @CustAndCode  Před rokem

      Strange, I had never noticed this before with my users. Should there be a setting for this, I unfortunately don't know it. 🙄
      I would check whether it depends on the computer or the user. To do this, user 1 should log in in SAP on the computer of user 2 and vice versa.
      I guess it is the computer If yes, check security settings, user rights, reinstall SAP GUI, check Windows Profile... hth 🤗😀

    • @SharadG84
      @SharadG84 Před rokem

      excel to SAP - czcams.com/video/4ZBGywR5DqM/video.htmlsi=31yEGE4aXDAaWB7J

    • @CustAndCode
      @CustAndCode  Před 6 měsíci

      Please check if the scripting option for Microsoft Windows is unchecked. 🤗

  • @user-io8ug3pj7z
    @user-io8ug3pj7z Před 11 měsíci

    Great content bro, very helpful. how do i export SAP data onto the Macro enable spreadsheet, and not on the new sheet?

    • @CustAndCode
      @CustAndCode  Před 11 měsíci +1

      The question really comes up more often. I'll have to take a look at it. 🤗🤔

  • @dawidpe1624
    @dawidpe1624 Před 4 měsíci

    @CustAndCode could you make a video or help me what can i do in situation like in 4:31 on upper video but in my situation i want 1 report for all carryid from column A? i got over 10 carryid. big thank you for your helping.

    • @CustAndCode
      @CustAndCode  Před 4 měsíci

      You mean every carrid in a seperate tab?

    • @dawidpe1624
      @dawidpe1624 Před 4 měsíci

      @@CustAndCode thank you for your answer. iI already solved the problem. My problem was that i wanted 1 excel file, 1 table in 1 tab but which include all carryid (more than 7 was the problem for me) :)

    • @CustAndCode
      @CustAndCode  Před 4 měsíci +1

      @@dawidpe1624 Ok, great to hear that you have achieved it! 🤗😀

  • @xuanthutran9758
    @xuanthutran9758 Před rokem

    Thank you so much! So how can I automatically close opened excel files in this way? Pls show me!

    • @CustAndCode
      @CustAndCode  Před rokem +1

      It should work with "Application.quit" but it hasn't worked for me... 🤔 I am not sure what here the problem is. Maybe I try it on another mahine of mine. 🤔

    • @xuanthutran9758
      @xuanthutran9758 Před rokem

      @@CustAndCode Thank you for replying to me. I still expect perfect results from you. If there is any way please help me. I look forward to you sharing your results with me! 😍

  • @MaheshKumar-dr8xk
    @MaheshKumar-dr8xk Před 8 měsíci

    Bro can we create for background executed extraction

    • @CustAndCode
      @CustAndCode  Před 8 měsíci

      I think not, for VBA you need an active SAP GUI session. For background execution you have to use/write an ABAP report. 🤗

  • @christophwissing4877
    @christophwissing4877 Před 11 měsíci

    It would be possible to run the Skripts automatically to every hour each day ?

    • @CustAndCode
      @CustAndCode  Před 11 měsíci

      Maybe, but what is your demand? I think there are better solutions to do that, e.g. directly with ABAP. 🤗

    • @christophwissing4877
      @christophwissing4877 Před 11 měsíci

      @@CustAndCode
      Directly by abab ok - but the result is pdf not excel I think ?!

    • @CustAndCode
      @CustAndCode  Před 11 měsíci

      @@christophwissing4877 The result can be any file, but you have to code it 🤗

    • @christophwissing4877
      @christophwissing4877 Před 11 měsíci

      @@CustAndCode
      Ok do you have a CZcams video how do code excel result via abab ?

    • @CustAndCode
      @CustAndCode  Před 11 měsíci

      @@christophwissing4877 Sure, have alook at this video: czcams.com/video/R06MXVZbx2k/video.html
      🤗