web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SAP Where Filter with ...
Power Automate
Answered

SAP Where Filter with Power Apps variable

(0) ShareShare
ReportReport
Posted on by 61

Dear all,

my Usecase and Problem is the following:

I have a collection in Power Apps with values. I chain these values with the concat command to get a string that I can use as a Where Filter in Power Automate. Variable out of Power Apps:

Pokke_3-1689752257023.png

 

Problem: 

The variable is displayed correctly in the overview in Power Automate, but the unformatted display contains exit characters that SAP does not accept.

Formatted output:

Pokke_1-1689752200609.png

 

unformatted output (with Exitcharacters):

Pokke_2-1689752224167.png

 

Pokke_0-1689752144601.png

Pokke_4-1689752284618.png

 

Error Massage: The calculated length of the value for the field exceeds the allowed value length.

Important hint:

If I copy the string directly out of the Power App, copy the Where Filter directly into it, and enclose with [], the flow will run through and return the correct data to me. But the copied string does not contain escape characters either.

 

What am I doing wrong? I've tried attaching the string to an array before, but it also doesn't work because the exit characters remain.

Categories:
  • scottwoodall Profile Picture
    Microsoft Employee on at

    Hello @Pokke -

     

    My suggestion would be to create an array of the filters instead of building a long string.

     

    This way the data types map cleanly to the Read Table function where-filter parameter. So instead of an array that contains a single string with all of your filters, build an array that has multiples values like so:

     

    [
        "VBELN EQ '123'",

        "OR VBELN EQ '456'"

    ]

     

    Cheers,

    Scott

  • Verified answer
    Pokke Profile Picture
    61 on at

    I tried it on the following way and it worked: 
    With the string out of Power Apps:
    1.

    Pokke_0-1690267177810.png

    2. 

    replace(first(body('Auswählen')),'OR ','')

    Pokke_1-1690267235096.png

    3. 

    union(outputs('Verfassen_2'),take(skip(body('Auswählen'),1),sub(length(body('Auswählen')),1)))
    Pokke_2-1690267274025.png


    4. Where filter of SAP = Output of "Verfassen"

    I think this is not the best way but it worked. Also this i can go this way for all the other Apps i plan to do.

  • abhishja Profile Picture
    35 on at

    How about filter multiple in one column?  for example each 1000 materials in filters. However its not working due to length 72 only.

  • Pokke Profile Picture
    61 on at

    There is a way to filter multiple values in one column. I found a solution in the SAP Procurement Template from Microsoft and SAP:

    SAP Procurement template for Power Platform - Power Platform | Microsoft Learn

    It is in the Flow "ReadPurchaseOrderList". 

    Pokke_0-1716280262905.png

    First Step:
    Parse List from former SAP Step.

    Pokke_1-1716280376490.png

    2. Step Prepare IN Statement:

    Pokke_2-1716280420823.png

    concat('''',item()?['VendorRaw'],'''',',')

    3. Step Finalize IN Statement:
    Pokke_3-1716280471080.png
    union(json('["LIFNR IN ("]'), body('Prepare_IN_Statement'), json('[")"]'))

    Last Step: 
    Pokke_4-1716280508312.png

    Maybe you import this solution in your tenant and have a look in this flow. 

    Hope this will help you! But i think this solution is very slow!

  • abhishja Profile Picture
    35 on at

    its not working as per your advice. its still error due to "the allowed value length is '72'. For fields of type byte array the value is base64 encoded and the decoded array length is used for length limit check."

    abhishja_0-1716295051245.png

     

     

    abhishja_1-1716295097264.png

     

  • Pokke Profile Picture
    61 on at

    I don't know whether errors can occur due to the language setting. Just to be on the safe side, I work in Germany and have all settings set to German.

    The following IN statement works for me and looks like this:

    [
    "LIFNR IN (",
    "'00000XXXXX',",
    "'00000YYYYY',",

    ")"
    ]

    Here are pictures:

    Pokke_0-1716296401072.pngPokke_1-1716296462818.png

    The limitation of 72 characters can be avoided by the correct use of , and “.





  • abhishja Profile Picture
    35 on at

    ok thanks for sharing the screen. Are you talking about Language in SAP System. for Example {"AppServerHost": "XXXX","Client":"XX","SystemNumber":"XX","LogonType":"ApplicationServer", "Language" :"DE"} correct?

  • Pokke Profile Picture
    61 on at

    sorry, please go back to the start. You want to search for several materials (probably material number) in one column and then filter. Is that correct?

    If this is the case, you can actually enter the individual materials in the WHERE filter as follows:

    Pokke_0-1716319784835.png


    As already mentioned, this works in the procurement template.

  • abhishja Profile Picture
    35 on at

    yes this is correct, however its stuck like Several retries occurred if we added this like your compose else would get failed. Without this, its working i mean filters two material only.

     

    abhishja_0-1716356959510.png

     

     

      

  • abhishja Profile Picture
    35 on at

    any Update to resolve the issue?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard