Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What's a good way to handle this conversion to a QUAN field?

former_member210148
Participant
0 Kudos
748

Good day everyone,

I developed an RFC that receives data from XI. I assign this data to a BAPI, and one of the fields is a field with a data type of QUAN(length 13, decimals 3). All works fine if XI passes me a numeric value in this field.

Here's the problem: In running some test cases through XI and into the RFC, we ran a test case where the quantity field had a value of "test" (e.g. no numeric value). Incredibly, XI transforms the text value of "test" into the value of 4534 and sends it to my RFC. So my RFC thinks everything's fine when, in fact, that number was derived from a text field and is completely wrong.

What we need to do is change the field to something that will "kick out" in XI when it tries to call my RFC. I thought I could change it to a type of NUMC, but that doesn't let me use decimals. We've already sent out the file layout to vendors, so we expect them to include numeric values with decimal places if need be.

Is my best bet changing this to a character field with a length of 17, then checking to make sure it consists only of 0-9, a space, or a decimal? I then need to assign it to the BAPI's field with the data type of QUAN(13,3) -- am I going to have issues trying to do this from a character field? Do I need to worry whether or not they include a decimal (it might be implied -- in other words, they might just say quantity is "20" which becomes "20.000" to the BAPI). Is there a nifty routine I can use to do all this easily?

Thanks everyone. Points awarded as always for ALL helpful answers.

7 REPLIES 7

former_member181962
Active Contributor
0 Kudos
317

HI Dave,

See if the Function module NUMERIC_CHECK is hepful to you.

Regards,

Ravi

LucianoBentiveg
Active Contributor
0 Kudos
317

Try replacing it by CURR(13,3) in RFC's parameters.

Regards.

0 Kudos
317

Peluka,

It looks like CURR has the same fundamental ABAP type as QUAN does, so I don't think that's going to help me.

0 Kudos
317

Yes, both DEC, sory.

Can you do a content check of that value in XI side?

Regards.

0 Kudos
317

Peluka, unfortunately I don't know XI, and the person who does is still learning and doesn't know how to have XI do the check.

former_member181962
Active Contributor
0 Kudos
317

How about checking using this condition

if v_amt co ' 0123456789,.'.

  • its a proper amount.

else.

*Its not..

endif.

Regards,

Ravi

0 Kudos
317

Ravi, that's kinda what I was thinking, but if it's true (i.e. a proper amount) can I just move the contents directly to my QUAN field? Will SAP automatically do the conversion for me such that it ends up in the right place? I've yet to have to worry about such conversions -- this is the first time I've had to deal with it -- and I want to make sure that the right value gets assigned, whether that value is "20", "54.1", "1000.25", or "986.500".