Please check my screenshot:
-I have a bunch of pdf files in a folder.
-I would like to upload each of those pdf files to sap (attaching them to an invoice number)
-I need always the number at the beginning of the pdf name (always 6 digits at the beginning of the file name) to search this invoice in sap. (I also need to add 4 fixed digits infront of the 6 digits).
Any suggestion how to start here?
I would start with sth. like “for each” item in the folder, but I dont really know how to get the 6 digits at the beginning of the filename and add the 4 fixed digits to search and add the pdf file in SAP.
Many thanks for any help!
@Markus3003 - Please check this…
My PDF files in the “DeleteFiles” Folder
Directory.GetFiles("YourFolderName").Select(function(d) new fileinfo(d).Name.Substring(0,6)).toarray
Assign the above code to stringArray … and then use For Each loop and Search in SAP…
If you use (0,4) in the substring…you will get first 4 digits…
Thanks @prasath17, I will try that. With the 4 digits I meant that I have to add infront of each invoice number from the files 4 fixed digits in order to find the invoice in SAP, so for example:
Any idea how I can add those “5555” infront of each invoice number from the file names?
Directory.GetFiles("YourFolderName").Select(function(d) "5555"+ new fileinfo(d).Name.Substring(0,6)).ToArray
@prasath17 any idea what I am doing wrong?
@Markus3003 - You have used incorrect activity…Instead of using “For Each” , you have used “For Each Row” which should have used for Datatable/datarow etc…
@prasath17 , I would like to put the variable now into SAP, so that I can search for all the different numbers.
Can you tell me what is missing?
Thanks a lot!
@Markus3003 - ArrFiles is stringArray varaible, which you cannot give in SetText activity.
you have to pass String variable in the Set Text.
Please check this…
I would suggest you to take RPA Developer Foundation academy course, especially variable , Data Types and Control Flows which will put in a very good spot in understanding of the variables.
Thank you, I will have a look into the courses.
Still sturgling here:
@Markus3003 - Please check your For each argument type…it should be string.
If its a object then you have to use as item.tostring.
@prasath17 , thanks a lot, I am almost done with my automation.
My last problem now is, that I would like to attach the pdfs from the folder in SAP.
But to attach them I have to put the directory and the whole file name into the type into activity. In my arrFiles variable I only have the first 6 digits.
Do you have any idea?
@Markus3003 - In that case, change your logic as shown below…
For Each code should be Directory.GetFiles(“YourFolderName”)
Here Each File will give you the path name and next “5555” + path.GetFileName(Eachfile).Substring(0,6) will give you the invoice #…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.