cancel
Showing results for 
Search instead for 
Did you mean: 

space, XML and JCO

matthias_prller
Participant
0 Kudos

Hello everybody,

I'm quite confused about the behavior of MII's handling of spaces:

What I sm trying to do:

I select a space or an 'E' from a custom database and call a function module via JCO with this values.

But when I look at the XML file of my SQL-Query result I recieve something like this:

...<row>
<test />
</row...

which is not the same as

...<row>
<test> </test>
</row>...

(which I expect to recieve)

I tried to recieve the "&160;" value instead of space but then MII replaces the "&" by &amp;amp; and so I don't have any solutions by now.

Can somebody please help me?

Thank you!

Regards

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Matthias,

that's quite interesting. I knew that the queries sometimes changes data, e.g. dates are effected.

If you are using Oracle, maybe the DECODE function helps to translate the blank into something else to preserve it:

select DECODE(field, ' ', '-', field) as field from table

If the field contains a blank, it is translated to hyphen, else the field value is returned. You may also use a stored procedure to read the table and convert the value before returning it to the MII query.

Michael

matthias_prller
Participant
0 Kudos

Michael,

thank you. I can change the space to any other value, that's not the problem.

The problem is how can I put a space to the function module via JCO.

If I select '-' instead of ' ' how can I transform this to space again? (XSLT is also possible solution but I don't know how I can do this here)

this is a part of my XSLT file:


<FIN_CONF>
    <xsl:value-of select="FIN_CONF"/>
</FIN_CONF>

and for fin_conf it is important if I have a space or if I have nothing.

Thank you.

Regards

Matthias

Former Member
0 Kudos

When I get you right, after you have assigned the space to the according node of the JCO request XML and execute the JCO (RFC) call, the space is gone again in SAP?

Michael

matthias_prller
Participant
0 Kudos

No, not exactly. Sorry for the confusion:

The problem is how can I make MII assign the space in the request-XML.

My transaction has the following (main) steps:

1. select data from Oracle

2. transform the SQL.result to the jco.request XML with XSLT

3. Call the function module via JCO

And as MII does not clearly differenciate between space and nothing I loose the space in the first step but I need it in the third.

a possible solution could be using something in XSLT like

if FIN_CONF is '-' then replace it by space

(within a for-each-loop)

Is this possible with XSLT? And if so: how?

And if it is possible will MII keep the space if I call the JCO?

Regard Matthias

agentry_src
Active Contributor
0 Kudos

Hi Matthias,

Normal convention is the put an 'X' in the FIN_CONF field rather than a space.

Why are you using a space in the database for providing the input to a confirmation bapi field?

Not sure where your problem lies as there are many circumstances in databases, xml, mii, unicode, etc. where spaces are not considered valid values and could be removed by the equivalent of a SQL Server LTrim or RTrim function.

It does not look like the xml is modified within MII, at least not with my simple testing.

Regards,

Mike

matthias_prller
Participant
0 Kudos

Hi Mike,

thank you for your help.

I use the BAPI_PRODORDCONF_GET_TT_PROP and it has 4 valid parameters:

X : fin confirmation

space: part confirmation

1: auto confirmation

but also nothing --> in this case this bapi suggests one of the 3 parameters above in the response.

And I want to fill it with "space" because the result is different to nothing.

If I select "space" from my database (oracle) I get an empty XML value ( <FIN_CONF /> ).

And the only problem is how to transfer <FIN_CONF /> into <FIN_CONF> </FIN_CONF>

Any suggestions how I can solve this problem?

Thank you

Matthias

Former Member
0 Kudos

Matthias,

is it a must to use XSLT to fill the JCO XML?

I agree with Mike that MII will keep the space once it has reached the BLT. Would it be an option to set the FIN_CONF value separately after running the XSLT, using an assignment action?

Michael

agentry_src
Active Contributor
0 Kudos

Hi Matthias,

I see why you want to have the space, but you may end up having to do as Michael suggested and use an assignment block in your BLT. The logic should be very easy to implement. Although I also have some curiousity as to where the space is being "trimmed".

Have you tested your SQL from TOAD (or within Oracle) and compared the results to the same SQL Query run from both the Query Template and from within the BLT? And does it make a difference to generate the result set in different formats (html, xml, csv)?

Regards,

Mike

Former Member
0 Kudos

Can the ABAP contstant SPACE be passed into the BAPI? If so maybe you could modify your app to store SPACE in the DB instead of a space

Nope. doesn't work. Sorry.

Edited by: Christian Libich on Jul 9, 2010 8:54 PM

matthias_prller
Participant
0 Kudos

Hello again,

I tested today some things:

First I testet what is happening if I run my sql statement not from MII but from an Oracle client: I get the space as I expected it.

Second: I tried your suggestion with replacing a dash (or any other char) by a space with a repeater.

I'm not sure what I did wrong but here MII replaces the space again. I only get the <FIN_CONF/> in my XML-Output but I need somehow <FIN_CONF> </FIN_CONF>

Here the steps I made:

1. Load the XML-Document and assigned it as Local.WorkingDocument

(it has dashes and 'E' in the FIN_CONF)

2. Repeater over this XML-Document

3. Conditonal: if( Repeater_0.Output{/Row/FIN_CONF} == "-", true, false)

4. Assignment: Local.WorkingDocument{/Rowsets/Rowset/Row[#Repeater_0.CurrentItem#]/FIN_CONF}

and assigned here this string " " (including quotation marks)

I tried it with &160; too, but here again I get & amp;160; as result

MII is 12.0.8 if this is important.

Thank you for your help.

Regards

Matthias

Former Member
0 Kudos

Matthias,

I have tried some similar (MII 12.0.2) with one difference. I used an assigment with the following stringif to fill the node.

stringif( Repeater_0.Output{/Row/FIN_CONF} == "-", " ",Repeater_0.Output{/Row/FIN_CONF}  )

I can't imagine why this should make a difference, but you can give it a try.

MIchael

matthias_prller
Participant
0 Kudos

Michael,

I do not understand why this should make a difference... but it does.

Thank you for your help. You just made my day!

Regards

Matthias

Answers (0)