2

I'm using .Net Sap Connector 3 and function "RFC_READ_TABLE" to read PA0001 table data.

Where condition I'm using seem stupid, but it's only to explain that my problem is the length of this expression.

If I use:

MANDT = '100' OR MANDT = '100' OR MANDT = '100' OR MANDT = '100'

it work. But if I use

MANDT = '100' OR MANDT = '100' OR MANDT = '100' OR MANDT = '100' OR MANDT = '100'

I have this exception: "A condition specified dynamically has an unexpected format".

I tried to break the string with the character ~ and specify this character as a separator

function.SetValue ("DELIMITER", "~")

but the problem persists

Help me!

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Daniele
  • 203
  • 6
  • 20
  • I found the problem. WHere condition cannot exceeds 72 chars :( – Daniele Oct 25 '13 at 14:06
  • Is there a workaround? – Daniele Oct 25 '13 at 14:07
  • 3
    Resolved! In code you have to split where-condition and add every item generated IRfcTable inputTableOptions = function.GetTable("OPTIONS"); string[] aWhere = sWhereExpression.Split("~".ToCharArray()); foreach (string cond in aWhere) { inputTableOptions.Append(); inputTableOptions.SetValue("TEXT", cond); } – Daniele Oct 25 '13 at 15:28
  • 4
    You should add your solution as an answer –  Dec 09 '13 at 18:01

1 Answers1

0

Adding OP's comment as an answer to help future visitors:

OPTIONS line has a 72 char limitation, so if one has a long condition the solution would be to split it into several lines:

inputTableOptions = function.GetTable("OPTIONS"); 
string[] aWhere = sWhereExpression.Split("~".ToCharArray()); foreach (string cond in aWhere) { inputTableOptions.Append(); 
inputTableOptions.SetValue("TEXT", cond);
Suncatcher
  • 10,355
  • 10
  • 52
  • 90