Copy Excel Ranges and Paste into SAP Multiple Selection | SAP Scripts with Excel VBA

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 89

  • @JoelTing
    @JoelTing  5 місяців тому +2

    I just launched "SAP GUI Scripting: Understanding the Basics" ebook! If you are interested to learn more, check it out in the link below:
    joelting.com/sap-ebook

  • @gaborborsi9634
    @gaborborsi9634 Рік тому +1

    I don't know how many times read discussions and didn't find the solution yet. HUGE thanks for it!!!!!

  • @Tavi_186
    @Tavi_186 3 місяці тому +1

    I will buy your e book because you deserve all the support. Thank you for introducing me to SAP automation with vba and python. I had no idea it is posible

    • @JoelTing
      @JoelTing  3 місяці тому

      Thank you so much for your support!

  • @Jst7926
    @Jst7926 2 роки тому +1

    Joel - thank you! this was great - I was able to do exactly what I needed.

  • @godnevercheats3880
    @godnevercheats3880 2 дні тому

    I'm using SAP ECC. Can you please help me with copying the text just a word/number from the saved message(it'll always appear in the left below side) that comes when you save or make any changes using a tcode.. I want to copy it and then paste it in excel.

    • @JoelTing
      @JoelTing  2 дні тому

      Hello. Are you referring to getting the text in the status bar? You can access text in status bar using session.findById("wnd[0]/sbar/pane[0]").Text

    • @godnevercheats3880
      @godnevercheats3880 2 дні тому

      @@JoelTing No, I'm refering to the dialogue box that will appear when I create/change a document. For eg: lets say I'm using VA01 T code or vf01 or any other creation or modify t code and when I'm done making changes in the document using VA01 T code, I'll save it and it will generate a Document number which will trigger a 606183 has been created or saved in the bottom left corner which you can double tap and it'll open a window(called performance assistant) from which I want copy just the 606183 number.

    • @godnevercheats3880
      @godnevercheats3880 2 дні тому

      and then paste it in a cell in excel

    • @JoelTing
      @JoelTing  2 дні тому

      If you only need the number, you can identify the pattern in it, and get the number from the text. For example if the text in the status bar is "Document Number 606183 has been created", you can try the following:
      For i = 1 To Len(sbartext)
      If IsNumeric(Mid(sbartext, i, 1)) Then
      result = result & Mid(sbartext, i, 1)
      End If
      Next i
      ‘To paste value in Excel
      Range("A1").Value = result
      Assuming there's always only one number in the text, this will extract the numerical character only in the text. Then, you can paste in one of the cell in your Excel spreadsheet or use it later in your VBA script.
      This method works best when there's only one number in your text. If your text contains multiple numbers, you might need a different approach.

    • @godnevercheats3880
      @godnevercheats3880 Годину тому

      @@JoelTing it worked.. thank you for your help.. First I had to defined sapdocnumber =session.findByld("wnd[0]/sbar/pane[0]"session.findByld("wnd[0]/sbar/pane[0]").Text).Text
      then I used the if and end if provided by you.

  • @prasenjitmandal5486
    @prasenjitmandal5486 2 роки тому +2

    You are truly Amazing 👍

  • @mirasol2229
    @mirasol2229 2 місяці тому

    Hi Joel! Thank u for this! I have created multiple tools using this method of yours. Just a question tho, what if i need to copy 2 ranges for 2 different multiple selections. I tried declaring 2 lastrows and setting 2 ranges. However i dont know how to command the code to get range a for multiple selection 1 and range B for multiple selection 2. The code only copies range B to both multiple selection 1 and 2. Can you help me with this?

    • @JoelTing
      @JoelTing  Місяць тому +1

      Hello. You can try only copying the range right before you click on the "Paste from Clipboard" button.

  • @deepu03393
    @deepu03393 26 днів тому

    Very nice and crisp liked it, can you please do a video on copy values from sap and paste on excel cells

    • @JoelTing
      @JoelTing  22 дні тому +1

      Hello! That can be done by just assigning the element text value to a cell value (for example: Cells(1,1).Value = session.findById(elementID).Text )

    • @deepu03393
      @deepu03393 22 дні тому

      @JoelTing Thank you so much!!

  • @QijiaZang
    @QijiaZang Рік тому

    Once again, many thanks to your great work! Big fan :)

  • @ketuscorpion3717
    @ketuscorpion3717 3 роки тому +1

    Hi Joel, I work in SAP VA01 PO entry. We get list of PO details which we need to enter in SAP. Is it possible to automate it where I can give the inputs from Excel file which goes into SAP VA01??

    • @JoelTing
      @JoelTing  3 роки тому +1

      Hi Ketu, I'm not very familiar with SAP VA01 entries. However, it's certainly possible to copy and pasting data from Excel file to SAP and use loops (if you have multiples PO to be entered). You can check out Csongor's video on some of the basics.
      ua-cam.com/video/oPPhA14Pm-8/v-deo.html
      I will keep that in mind and perhaps work on a video on the concept of entering multiple entries into SAP.

  • @chrisyip8260
    @chrisyip8260 4 місяці тому

    Hi Joel, million thanks about your sharing. Can I know this coding can be used in SE16N?

    • @JoelTing
      @JoelTing  4 місяці тому +1

      Hello! If you can access it through the SAP GUI, then the script should work similarly. The SAP GUI script simply mimics user interactions. As long as you have the necessary access permissions and scripting is enabled, you should be able to successfully replicate the process in the script.

    • @chrisyip8260
      @chrisyip8260 4 місяці тому

      ​@@JoelTing Thanks Joel. I tried and this is works in SE16N. What if there are multiple excel ranges and paste into multiple SAP selection? Do I need modify some coding? For example: Customer ID (A1:A5) & Country(B1:B5) in excel ranges and paste into SAP "Customer ID", "Country" multiple selection.

    • @JoelTing
      @JoelTing  4 місяці тому

      In VBA, you can just copy the range using Range().Copy, then use the upload to clipboard button in SAP to paste. Just do it in sequence, then this should work.

  • @sanjeewasamaranayake
    @sanjeewasamaranayake Рік тому

    I learned this thanks to you. Now I run one SAP t- code (IW39), use Power query to summaries and filter say order numbers and then load that as an input to commitment report (KOB2) to get the commitments for the orders. However the list goes to more than 10k items and copy paste method in most cases fail and only part of the range get copied so the KOB2 report outcome is partial. I do not get any errors but it is just that I cannot use the output from KOB2 as that is not for the full list of orders I want. When I step through with F8 it always work. I added wait times to the macros so that next step will not be executed sooner than copy paste to SAP get completed. Done lot of tweaks and nothing work 100% of the time. Added range +50 too and that still did not work. Other thing is that I run sequence of SAP scripts via combined macro with the idea of running mutiple tasks unattended and with this almost all the times the big range copies fail (in the sense only part of the list get copied so the output is incomplelte). Is there a fix for this that you can think of

    • @JoelTing
      @JoelTing  Рік тому +1

      Hi there. I seldom had experience with such a large copy and paste. So you meant the main issue is the timing of the execution, and when you add wait time, it increases the odds of the process running as intended? Since it's working all the time when you are stepping through, it's unlikely to be a SAP limitation.
      One option that you can try is you copy and paste on batches. So, basically you copy, the first 2000 values for example, click on the upload from clipboard button, then return to copy the next 2000, then click again on the upload from clipboard button. Continue that until you complete the whole list. Let me know if that would work?

  • @jearanas7569
    @jearanas7569 10 місяців тому

    Do you have video which do the opposite? From SAP fields to excel? Thank you.

    • @JoelTing
      @JoelTing  10 місяців тому

      Hi there. I have a short portion in my video on vendor creation, where I explain how you can get a field into excel.
      ua-cam.com/video/oy76Y5BakoI/v-deo.html
      I just show how to do it for 1 field, but the same concept applies to the rest.

  • @wuhanite
    @wuhanite 2 роки тому

    Thanks Joel for this useful video. I am trying to understand what you meant at 2:40 as my user case is that I want to limit my table size with my filtering , taking your example, besides County, i also want to select e.g. Customer ID and City. How should I adapt the above video with my case? TIA!

    • @JoelTing
      @JoelTing  2 роки тому

      Hi Brian,
      If there's 2 selection or more, right after you paste in the 1st selection, repeat the copy step again from Excel, open the multiple selection window for Customer ID in SAP, then click the paste from clipboard button again. Repeat the same step for the 3rd selection and so on.

    • @wuhanite
      @wuhanite 2 роки тому

      @@JoelTing Thanks, will test them out.

  • @SavorPlalate
    @SavorPlalate 4 місяці тому

    I am not able to do it showing user-defined type not defined. At Public As GuiApplication. Please help.

    • @JoelTing
      @JoelTing  4 місяці тому

      Hello! Have enabled SAP GUI Scripting API in "Reference"?
      I made a step by step video on how to enable it that you may refer to:
      ua-cam.com/video/7Rxh10Kt5v4/v-deo.html

  • @vikrantnag86
    @vikrantnag86 7 місяців тому

    Can we do it with these multiple ranges options also in SAP. Like you have County in column A2:A4, you have City in B column with values from B2:B10. Can this be incorporated with this method

    • @JoelTing
      @JoelTing  7 місяців тому

      Hi there. Yes, that's possible. Just make sure the sequence of your copy is the correct one.
      1) Copy the country in range A2:A4
      2) Open the multi select option in SAP for country and click on paste from clipboard button, click on "OK" to close
      3) Copy the City in range B2:B10
      4) Open the multi select option in SAP for City and click on paste from clipboard button, click on "OK" to close
      This way, the correct value should appear.

    • @asdfhjkl1234
      @asdfhjkl1234 2 місяці тому

      @@JoelTing Hi Joel. I used this but only the last column is being copied to all sap multi selection. Can you show tip on how to do this right? 😔

  • @ΣυμεώνΠαπαδόπουλος-λ4ο

    Great tip! Thank you very much!

  • @abbiramirez7467
    @abbiramirez7467 2 роки тому

    Hi Joel! Thank you for the video!! I have a question, do you know how to do the opposite? I mean, I want to fill an excel file with information that I have in SAP tables. Does somebody now? I already have the script recorded.
    Thank you!

    • @JoelTing
      @JoelTing  2 роки тому

      Hi Abbi, it should be similar, just identify the control id of the element you need in SAP, extract the text, then set it as a cell value.

  • @shirenegooi2135
    @shirenegooi2135 3 роки тому

    Hi Joel, thanks for the sharing.
    would you advise how if the SAP pages is without the multiple selections to let us perform the upload from clipboard? for example like when we would like to paste a large amount for invoice line item under f-32.. Appreciate for your sharing.

    • @JoelTing
      @JoelTing  3 роки тому +1

      Hi Shirene, I'm not very familiar with f-32. May I know if in usual cases, how do you perform the pasting action in F-32? since upload from clipboard is not available.

    • @shirenegooi2135
      @shirenegooi2135 3 роки тому

      @@JoelTing Hi Joel, it was like one time we can only paste 10 invoice line item, then click enter and pasted another 10 and keep on repeat until all the invoice we wanted to clear is log inside the SAP thn only can proceed for the clearing. So i am looking if this can be automated it will really save the time and the repetitive step.

    • @JoelTing
      @JoelTing  3 роки тому +1

      @Shirene Gooi Do you mind to share a video recording of the routine (with about 3 rounds of copy paste) and the SAP script that you recorded with me? Let me have a look and see if I can work something out.
      If you are comfortable sharing, you can share the files with me via my email: joelting92@gmail.com

    • @shirenegooi2135
      @shirenegooi2135 3 роки тому

      @@JoelTing Hi Joel, sure and thank you so much😊 Just give me some days, I will share u the video soon. Really appreciate it😊

    • @puffykarl3818
      @puffykarl3818 2 роки тому

      Any update on this? I’ve been looking for this content too, uploading multiple invoice thank you more power

  • @FaysalEasyExcel
    @FaysalEasyExcel 3 роки тому

    Wonderful for SAP user.

  • @kokitormmrj2320
    @kokitormmrj2320 2 роки тому

    Beautiful! Thank you so much ❤🎉

  • @douhaamri1883
    @douhaamri1883 2 роки тому

    Great job 👏

  • @kyletaylor6849
    @kyletaylor6849 3 роки тому

    This is fantastic! Thank you so much.

  • @vincentsoong7778
    @vincentsoong7778 3 роки тому

    Can you do a video of recording a sap posting and storing/saving the document number in Excel?

    • @JoelTing
      @JoelTing  3 роки тому

      Hi Vincent,
      I will try if I am able to work out something with my existing SAP server because currently, I do not have access to T-codes to perform posting. I will let you know if I'm able to work that out.
      That being said, from what I understand, you should be able to get the document number in the status bar by referencing session.findById("wnd[0]/sbar").Text and trimming it down to contain only the text you wanted.

  • @gssalian1
    @gssalian1 Рік тому

    Hi Joel, I would be very grateful if u could answer what if I have multiple ranges to copy from excel to SAP, like co.code, documents numbers in dynamic selection, also vendor codes to extract from fbl1n

    • @JoelTing
      @JoelTing  Рік тому +1

      Hi there, would you be able to do that step by step? (copy from Excel, paste in SAP for co. code, then do the same for document numbers, and then vendor codes). Would this approach work for you?

    • @gssalian1
      @gssalian1 Рік тому

      ​@@JoelTing yes Joel..... Exactly the same step....it's step by step.... Copy and paste it into SAP

  • @dhananjaypinjan2643
    @dhananjaypinjan2643 2 роки тому

    Very well explained.. How to handle SAP Login and Password through Macro..

    • @JoelTing
      @JoelTing  2 роки тому

      Hi Dhananjay, that can get a bit complicated. You can try storing your Login and Password in Azure Key Vault, then use their REST API in VBA to retrieve your login information. Personally have not try that before. Only called API with Python, but not VBA.

    • @dhananjaypinjan2643
      @dhananjaypinjan2643 2 роки тому

      So quick.. Thanks Joel

  • @kalyanamurti4624
    @kalyanamurti4624 2 роки тому

    Hi Joel,
    I am usually working with a table that has multiple columns including column for Gl account, column for cost center, column for each amount allocated to each cost center. I want to be able to copy paste the whole thing from excel to SAP. Please help me.

    • @JoelTing
      @JoelTing  2 роки тому +2

      Hi Kalyana, I'm not sure how it was structured in SAP. I would need to understand more before I can provide any suggestion. Usually as long as you can do the copy and paste as a user, you should be able to do it in the script, provided that scripting is enabled.
      Do reach out to me via email with screenshots to help me understand better. I'll see how I can help.

  • @Foodietheexplorer
    @Foodietheexplorer 3 роки тому

    Hi Joel, can you kindly prepare the same using Power Automate Desktop

    • @JoelTing
      @JoelTing  3 роки тому

      Hi Swaraj Chhallani,
      I have uploaded similar video with Power Automate Desktop previously. You can refer to this video: ua-cam.com/video/6cDj86k_l34/v-deo.html
      It is quite similar to this video but it is performing the task with Power Automate Desktop.

  • @PratikChaudhari003
    @PratikChaudhari003 Рік тому

    Can you please in this ? I am facing following error :
    Compile error :
    User-defined type not defined
    Thank you.

    • @JoelTing
      @JoelTing  Рік тому

      Hi there. Have you enabled SAP GUI Scripting API in References?

    • @PratikChaudhari003
      @PratikChaudhari003 Рік тому

      @@JoelTing Hi, I checked the .ocx file which you have mentioned in this video. But it's not there in my excel. however there are number of other sap related .ocx files. I am unable to decide which one to choose

    • @JoelTing
      @JoelTing  Рік тому

      @@PratikChaudhari003 Hi, you should specifically look for sapfewse.ocx file. That's the library that is needed to run automation. If you just look for it in file explorer, are you able to find the file?

    • @PratikChaudhari003
      @PratikChaudhari003 Рік тому

      @@JoelTing Thanks. I have to login from my organisation's device. I will check and will let you know.

  • @Crashdownfully
    @Crashdownfully 3 роки тому

    Nice. Love it!

  • @DGTransformer
    @DGTransformer Рік тому

    you are amazing man

  • @minipriyaapokala180
    @minipriyaapokala180 2 роки тому

    Hi Joel
    This Video is very useful but I want to know is there a way to give different filename everytime while exporting the data form SAP.

    • @JoelTing
      @JoelTing  2 роки тому

      Hi Mini Priyaa Pokala,
      Yes, it is possible. It depends on how it is setup. You can set it up to be unique such that whenever you run the code, it is going to capture the year, month, date and time at the point of execution and name the file based on that. That way each file name for every code execution will be unique.
      You can refer to the video below as a reference:
      ua-cam.com/video/ISDX5LwcVPQ/v-deo.html

  • @nihil_bio
    @nihil_bio 3 роки тому

    Thanks Joel for this video. Could you kindly also let us know how to copy a value/row/column from SAP screen & paste it in excel sheet using VBA codes ? Say we have the output of the customer table as shown in this video & I want to copy either whole table or selective cells and paste it directly to the excel file as a new sheet with different sheet name on each iteration of execution instead of export as spreadsheet which would create a file on every execution . In SAP , we can record till copy or copy to clipboard but beyond that I couldn’t identify the appropriate vba codes. I’m just a rookie on macros/vba/scripting.

    • @JoelTing
      @JoelTing  3 роки тому +1

      Hi NiHil, yes there's a way to interact with SAP GUI table directly but it requires some complex code writing and loops for it to work. Export as spreadsheet would be simpler but it's with it's own limitation.
      If you are interested to learn, here's one of the video I found talking about interacting with SAP GUI Gridview. ua-cam.com/video/SpGhzfN3r_s/v-deo.html
      I think it's quite technical, I'll see if I can work something out similar to simplify the process.

    • @nihil_bio
      @nihil_bio 3 роки тому

      @@JoelTing Thanks Joel. Till now for simple copy&paste, I have added the below code after “Copy to Clipboard” from SAP to paste it in a new sheet by creating one & renaming it. I’m searching on how to rename the new sheet name conveniently (without using time stamp). Still there is a lot to learn & understand.
      Sheets.Add After:=ActiveSheet
      ActiveSheet.Select
      ActiveSheet.Name = "Test_" & Date$
      Range("A1").Select
      ActiveSheet.Paste

  • @yashwinkishore4675
    @yashwinkishore4675 Рік тому

    Thank you!

  • @puffykarl3818
    @puffykarl3818 2 роки тому

    Hi Joel! I loved your channel I learned a lot from your contents. Just a quick question, what if the sap window doesn’t have a paste button. How can I macro the paste function in SAP? I’m referring to posting of payments with multiple invoice. Thanks much and more power!

    • @JoelTing
      @JoelTing  2 роки тому +2

      Hi puffykarl3818, sorry for the late reply. you don't necessarily have to use copy and paste. Usually each box in SAP is represented by an object and you can change the object value directly without using the paste function (ie. session.findById("wnd[0]/tbar[0]/okcd").text = Range("A2").Value

  • @sujithortan5773
    @sujithortan5773 3 роки тому

    Hi I like your content I stuck at a point so my job is to create credit notes referring the invoice could you help me teaching how can I run an activity multiple times for a list of invoices

    • @JoelTing
      @JoelTing  3 роки тому +1

      Hi Sujith, are you referring to multiple rows of line items in your excel and you wanted to perform the same action for every single entry? Yes, that's possible, you can do that with loop. I'm looking to do a video on something similar. Meanwhile, you can check out this video from Csongor Varga. It's quite long but it may have information that you need.
      ua-cam.com/video/oPPhA14Pm-8/v-deo.html

  • @Clock1129
    @Clock1129 2 роки тому

    Hi , it was pretty useful.Thanks👍.

    • @JoelTing
      @JoelTing  2 роки тому +1

      Hi Ángel Bultrón, I'm glad you find it helpful. Nice to meet you!

  • @Graciedits
    @Graciedits Рік тому

    First off, I want to say thank you for the amazing videos. They have been very helpful. With that said, I have an issue. I build my excel macros to pull SAP data from a pre-built SQVI query. This works great for me, but it does not work for anyone else I would like to share the tool with because they would need to have their SQVI query build exactly like mine. The other problem is that not all users I would like to share the tool with have access to Tcode SQVI. Is there a way to build a macro to pull data directly from material master records?

    • @JoelTing
      @JoelTing  Рік тому

      hey scotyy, sorry for the late reply. Unfortunately, SAP scripting is meant to work based on your user interface. If there's any difference your colleagues setup, the script will break and unable to proceed. To pull data directly from material master, you probably need to reach out to your IT. From what I understand, they can pull the data into business warehouse and everyone with the business warehouse will then be able to pull that directly without going through SAP GUI. But, still access needs to be granted first before they can access the data. SAP is setup this way for security reasons so that unintended users will not have access to the data.

  • @prasenjitmandal5486
    @prasenjitmandal5486 2 роки тому

    Can you help in Salesforce Automation through VBA code

    • @JoelTing
      @JoelTing  2 роки тому

      Hi Prasenjit Mandel, what kind of automation you are looking for when using Salesforce? I am not familiar with Salesforce, but I can try to research on it

    • @prasenjitmandal5486
      @prasenjitmandal5486 2 роки тому

      @@JoelTing loading data from Excel data to Salesforce for generating a new case on Salesforce, Data extraction from Salesforce to Excel

  • @munshirasimraja5713
    @munshirasimraja5713 2 роки тому

    Thank you