Get different Invoices Number from SAP -- Correct Method

Hello UiPath Community,

i learn to use UiPath and very often the UiForum helped me to find solution by reading the questions and the answers from the community. I created now a Forum account and hope you can help me.

I use UiPath to read an Excel and go to SAP und book in SAP. Very often i need the invoice number from SAP, but this ist not in the Excel.
I go to SAP and with the “get text” activity i create a variable to use it in the following booking mask.

I use the “get text” activity and edit the selector. Often UiPath copied the correct number, but sometimes the invoice number is in the top, often in the button. Sometimes there are two invoice number, which i need.

I tried only “Get Text” or “Anchor Base acitivity” with “find element activity” and “get text”, but nothing was 100% accurate.

How is your experience by this kind of Problems? The only things there are evertytime the same are the headers and that i don´t need the “Belegnr” from the documenttype “DM”

It is everytime the other one. The document types are for example “DU”; “FR” or “RV”, but not DM.

I took a screen to show the problem better.

This was my Selector after editting, in SAP for the get text activity.

There was a number that i edit with an Wildcard “*” , because the number changes everytime.

Have someone an idea to help me? Should i read the “Colums” and then say him take the one, which is on the left side, but not from the “DM”, like an If - Else decision or i Screen scape the Window like in the screen and then try to say him split the number before the “DU, FR or RV” ?

I hope you can help me and i explain my Problem good, that you unterstand it, because my english is not good.

Thank you for the answers.

Best regards.