Help forgoing Excel to format for a txt file to be used in SAP

I currently have a business process that uses Excel, which is used for a couple of calculations and to format a couple of exchange rates. This is then pasted into a .txt file that is used to run an SAP t-code. We are trying to build this while avoiding using Excel entirely. Getting the calculations doesn’t seem too hard but formatting it properly to be uploaded into the .txt file is something new to me. I have attached how it was formatted in Excel and then what it would look like in the txt document. Thank you for any insight you can provide.
TxtER

@john.weber

welcome to the community

looks like its a tab delimited file

if you are able to build a datatable then you can use output table activity to convert to string and replace comma with tab or use write csv with tab dilimiter…both would work

cheers

1 Like

Thank you for the response. According to the business, it is a fixed width file and not delimited by a character. If I set it to be tab delimited in UiPath, will that still work with the formatting to be uploaded into SAP, or do I need to construct the table differently in UiPath?

@john.weber Yes it will work, I have also worked in same scenario, a Tab delimited file will be uploaded in SAP and it is supported!

You just have to take 2 Activity as mentioned below:

  1. Output Datatable → Input variable is Datatable(Your Excel datatable after all the manipulation) and Output variable is String(A text columns separated with Comma “,”)

  2. Write Text File Activity → Input variable is String i.e str_OuputText.Replace(“,”,vbTab)
    2nd Input is Txt File Path and Name with Extension(For eg: “SAPOuput.txt”)

Note: str_OuputText.Replace(“,”,vbTab) → Using this Comma “,” will be replaced by Tab(vbTab)

After all these steps your text file is ready to upload on SAP.

Attaching screenshot for your reference

Hope you got better understanding after this!

Regards,
Ajay Mishra
RPA Developer

Hi @john.weber ,

Please Check the attached sample and Tune it according to your needs.
ForumQuestion.zip (10.7 KB)

Hope this helps you.!

Happy Automating…!

Thanks,
Gautham.