Skip to Content
Technical Articles
Author's profile photo João Secco

Challenge Submission – Introducing FejucaBot

Hello SAP Experts!

This blog is part of the SAP Conversational AI Tutorial Challenge 2021.

After I read this blog post, and with help of a previous tutorial I felt ready to at least try to build a chatbot using this knowledge. This is the result.

 

Business Case

A Brazilian Company named “Samba com Feijoada Inc.” manufactures cavaquinhos, tamborins and some others Samba Instruments

 

 

This company, due to Covid-19, needs to avoid human contact unless it’s really necessary. So, when a truck arrives at the company’s parking lot, the Logistics Teams needs to know what is the freight order(SAP TM) in order to start the dispatch process.

Earlier, when truck arrives a person would do the first contact with the driver and take the truck data, that is not a option now.

 

Solution Design

In this scenario, Samba e Feijoada needs a ChatBot, and the tool to connect with this ChatBot will be Telegram (Popular messaging app, light, fit the need to work in almost every smartphone)

Truck Driver arrives, he/she access Telegram on his/her phone, find our Bot and text “check freight order number”.

Our solution needs to verify if the Freight Order is in the correct Status, if it is, it needs to verify the deliveries status are ok, if they are, give the possibility to the driver generate a billing document request for the whole freight order (it’ll make the waiting in the truck faster) or just wait.

In Brazil, we have a legal requirement to generate the billing prior to the truck leave the plant with the goods

 

In every case, the solution needs to inform the Logistics Team the truck arrived and the status of the freight order/Deliveries. This communication will be done through e-mail.

 

Solution Screenshots

This is FejucaBot

First interaction and responses(small talk)

Truck Arrival Solution Part 1

Truck Arrival “Help them”

Websites “Wait”

E-mail example (Sent to Logistics Team)

 

How did we build FejucaBot

First Steps

Enter SAP CAI Website and create your account or Sign On

Click on New Bot

Choose the type of Bot, FejucaBot is a Perform Actions type

Choose standard skills, FejucaBot knows Greetings, Small Talk and Weather (a real gentleman)

Give a name to your Bot, and choose the main language (you can add more languages later, so don’t worry)

 

Choose Data Policy

Choose Bot Visibility (In this case we chose private because there is a access to a SAP S/4 Hana application, and unfortunately we cannot share it)

Then, click on Create a Bot

Intent

We will need three intents for FejucaBot. A initial one to get the Freight Order using phrases like “Check Freight Order 99999999999” or “Check 99999999999”, one for Waiting and another for Generate Billing Requests

So click on +Create (Train – Intent)

Insert the phrases that will trigger your skill

Skills

Click on Build and then on Add Skill

Click on Skill Name and then in trigger, assign your intent to the skill. This means everytime someone text FejucaBot “check 9999999”, SAP CAI will trigger skill Check Freight Order

Then, click on Requirements, insert the fields (Available on Intent) your skill needs, at this moment you can assign an alias.

Now, click on Actions

Fejuca Bot was build using Connect External Service(API), Edit Memory and Send Message.

 

Connect External Service API 1

In a single GET in CPI, we connect on a S/4 Hana 1909 Application.

First, we build a Custom CDS View for the SAP Transportation Management tables, in this API we get the Status of the document and the deliveries.

Second, in a standard API for Outbound Deliveries, we verify if these deliveries are ready to be invoiced (if needed)

Then CPI send an email to the Logistics Team informing the truck arrival, freight order and status.

Finally it sends back to SAP CAI the status and the Freight Order data.

Send Message 1

Using system variables as $freightorder $status and $address, we send a custom message for each status of Freight Order, If the freight Order does not exists, a message is sent as well.

Connect External Service API 2

After the first CPI interaction, if the status is 100% ok, we have the final destination partner for this Freight Order, then we do another Standard API for Business Partner to get the address of the final destination partner.

Send Message 2

Verify that this message will trigger two skills:

Help Them

It will trigger  a POST API on CPI(Creating the Invoice Requests) and send an email to the team.

 

Wait

It will trigger a simple skill as below and send an email.

It will also trigger  a POST API on CPI(with a different header parameter) and send an email to the team.

Telegram

To connect to Telegram, click on Connect and then on Telegram, SAP CAI already have a good tutorial about it.

 

Improvement Ideas

The solution works, but it is not perfect, the good people from IT of Samba com Feijoada Inc already assemble a RoadMap

  • Verify the location of the truckdriver through GPS, to be sure he is close to the plant
  • Verify the IP Address, and provide a Wi-fi connection in the parking lot.
  • Catch the License Plate, name and ID of the driver, and later updates in the Freight Order

 

 

 

 

Finally…

I would like to specially thank:

  • Diego Lima, for the CPI part of this solution.
  • Pedro Rocha, for encouraging me.
  • Numen, the best SAP Partner I know, for providing all the tools we need to build this solution.

 

Also, thank you for reading! Any questions or thoughts please comment!

 

Assigned tags

      47 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Douglas Adachi
      Douglas Adachi

      Very smart solution to improve efficiency by reducing truck waiting times.

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Douglas!

      Author's profile photo Rafael Aires
      Rafael Aires

      Secco, very nice solution, congratulations to those involved.

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thanks Rafire

      Author's profile photo Henrique Guimarães
      Henrique Guimarães

      I can say that we have many companies that would pay for it! Great initiative!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Henrique!

      Author's profile photo Everton Fernando Mazzer
      Everton Fernando Mazzer

      Great initiative, Fantastic!!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Everton!

      Author's profile photo Luciana Rodrigues
      Luciana Rodrigues

      Muito bom João. Parabéns!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Obrigado Lu!!!

      Author's profile photo Eric Cassaro
      Eric Cassaro

      Johnny Dry! You´re legend!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Eric "The Legend" Cassaro!

      Author's profile photo Gilson Ramos dos Santos
      Gilson Ramos dos Santos

      Parabéns Secco!! Muito bom!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Obrigado Gilshow! Tamo junto!

      Author's profile photo Matheus Ribeiro
      Matheus Ribeiro

      Congrats Secco!! Amazing post!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Little Matheus! Tamo junto!

      Author's profile photo Kessia Salazar
      Kessia Salazar

      Well done. Congratulations!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Kessia!

      Author's profile photo Thiago Rigo
      Thiago Rigo

      Excelent, Secco! Congratulations!!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Mr. Rigo! Tamo junto!

      Author's profile photo Eduardo Chagas
      Eduardo Chagas

      Amazing Secco. Proud of you budy!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thanks Edu!

      Author's profile photo Douglas Brito
      Douglas Brito

      Congrats!! Nice!!!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Brito, tamo junto!

      Author's profile photo João Vasconcellos
      João Vasconcellos

      Proud of You, Brou!! Excellent Solution!!

      in PT: Voa mlk!!!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Tamo junto Jony!

      in EN: Thank you Johnny, I appreciate it.

      Author's profile photo Wesley Yamaguti
      Wesley Yamaguti

      What a great solution! Congrats!

      Author's profile photo João Secco
      João Secco
      Blog Post Author

      Thank you Wes!

      Author's profile photo Daiane Cristina Zigiotto de Medeiros
      Daiane Cristina Zigiotto de Medeiros

      Congrats! Nice blog! 🙂

      Author's profile photo Pedro Rocha
      Pedro Rocha

      Congrats João! Great Solution!

      Author's profile photo Alexander Mello
      Alexander Mello

      Congrats João!

      Author's profile photo Rafael Augusto de Melo
      Rafael Augusto de Melo

      Congrats!! Great solution João!

      Author's profile photo Paulo Ruiz
      Paulo Ruiz

      Congrats to all team!

      Author's profile photo Mauricio Martins
      Mauricio Martins

      Great! Congratulations!!!

      Author's profile photo Carmen Queija
      Carmen Queija

      Great solution! Congrats!!

      Author's profile photo Andreia Tsuruhame
      Andreia Tsuruhame

      Congrats, Diego, Pedro and Secco... I´ve learned a lot, it is clear to understand !

      Author's profile photo Vanessa Freitas
      Vanessa Freitas

      Very Good!!!!

      Author's profile photo Fernando Lima
      Fernando Lima

      Really good

      Author's profile photo Marcelo Mariussi
      Marcelo Mariussi

      Fantastic ! this is a really good idea. ! Congratulations !

      Author's profile photo Gabriel G
      Gabriel G

      Great job!! Great class!!

      Author's profile photo Caio Gondran
      Caio Gondran

      Excellent! Nice job.

      Author's profile photo Alessandro Monteiro
      Alessandro Monteiro

      Congratulations João and team! Great job!!!

      Author's profile photo Sandra Takahasi
      Sandra Takahasi

      Well Done!! Congrats!!

      Author's profile photo Tatiana Rigo
      Tatiana Rigo

      Very good job Jony Dry!! Congrats!

      Author's profile photo Joao Pedro Silva Faria
      Joao Pedro Silva Faria

      Congratulations João !! Keep going !

      Author's profile photo Rafael Vieira Velozo
      Rafael Vieira Velozo

      Nice done! Telegram is awesome, this is a great solution!

      Author's profile photo Jose Carlos de Castro
      Jose Carlos de Castro

      Great Solution !!!!