cancel
Showing results for 
Search instead for 
Did you mean: 

Passing xml string to BLS

Former Member
0 Kudos

Hi,

I am trying to pass a string to BLS - this string is mapped to an xml input parameter which is used in the BLS code. The formation of the string is fine using javascript as i am monitoring before i pass. But once i pass this with setParam(1,Variable) something occurs and the whole string is not passed in. I am outputing my inputed string from BLS to monitor what has been passed in - only a portion of my input is passed.

I am passing - this is fine have taken care of the construction of this via javascript

<?xml version="1.0" encoding="UTF-8"?><OPTIONS><item><TEXT>WERKS LIKE 'IE08' and HSDAT &gt; '20080501' and MATNR = 000000000000125401</TEXT></item><item><TEXT>and BWART LIKE '321'</TEXT></item></OPTIONS>

Only this reaches my BLS input parameter:

<?xml version="1.0" encoding="UTF-8"?>

Is there a limit on string lengths etc ?

Thanks,

Emmett

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Emmett,

I do not know if there is limit to the length of xml as a parameter of entry, but if there is, of course is much bigger than this because I have used xml messages much higher than this. I believe that the error should be in your javascript to assign the parameter of entry. Try to assign this parameter directly into the BLS to see the result. This answer that you are getting is the standard format for any parameter xml, does not mean that was attributed by its code.

Greetings,

Marcelo.

agentry_src
Active Contributor
0 Kudos

Have you tried the functions xmlencode, xmldecode? You cannot directly pass a string into an xml property. The result set you are seeing is not from passing in your string. It is the preset configuration of an xml property. So you are not actually seeing any part of your string, just the default value of the xml property.

You look like you are invoking RFC_READ_TABLE or something similar from your BLS. You may want to map just the text portion into pre-configured xml fields instead of mapping xml in a string property.

"WERKS LIKE 'IE08' and HSDAT > '20080501' and MATNR = 000000000000125401" is an input text string

<item><TEXT></TEXT></item> can be configured as a transaction property, populated with your input text string and then appended to <OPTIONS> and do this for as many inputs as you have.

You also need to replace '>' with the SAP equivalent of GT (or .GT., I forget the exact syntax).

Good luck,

Mike

Former Member
0 Kudos

Mike,

Correct on the RFC_READ_TABLE - need to assign the where clause as xml as i am using more than 72 characters, the limit on a single <TEXT> field - so need to create a structure to assign to multiple <TEXT> fields.

Would the way to do this be to assign the incoming string to a string input param

i.e. XMLString = <OPTIONS><item><TEXT>WERKS LIKE 'IE08' and HSDAT &gt; '20080501' and MATNR = 000000000000125401</TEXT></item><item><TEXT>and BWART LIKE '321'</TEXT></item></OPTIONS>

Then using bls assign the xml to the OPTIONS field via

"<?xml version=1.0 encoding=UTF-8?>" + transaction.XMLString

Will this work ?

Thanks,

Emmett

agentry_src
Active Contributor
0 Kudos

Emmett,

I think you are over complicating this. This is a crude approach and there is a blog around here somewhere which explains it a little better, but once you have stepped through this, you should understand the basics.

Create a local property named ItemXML of type xml. Paste an empty item segment into it like this:

<item><TEXT></TEXT></item>

Create another local property named OptionsXML of type xml. Paste an empty segment into it like this:

<OPTIONS></OPTIONS>

Under your repeater on the first cycle, use an assignment block to paste your string "WERKS LIKE 'IE08' and HSDAT > '20080501' and MATNR = 000000000000125401" to the field TEXT of ItemXML. Using a second assignment block to paste the ItemXML to OptionsXML. Make sure you check the radio button for Append XML. Use a tracer to see OptionsXML after each repeater cycle.

Under your repeater on the second cycle, paste your string "and BWART LIKE '321'" to the field TEXT of ItemXML.

Your tracer should now show Options as follows:

NOTE: <?xml version=1.0 encoding=UTF-8?><OPTIONS><item><TEXT>WERKS LIKE 'IE08' and HSDAT > '20080501' and MATNR = 000000000000125401</TEXT></item><item><TEXT>and BWART LIKE '321'</TEXT></item></OPTIONS>

At this point, you should be able to link your Local.OptionXML to OPTIONS on the Request segment of the BAPI (use assignXML this time). And your BAPI should execute using both item segments.

SAP may accept LIKE and >, but it is a better practice to use CP and GT.

Good Luck,

Mike