Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Char to Quantity conversion

Hello All,

I am getting the shortdump when I am trying to pass the value from char field to quantity .

Example:

Data : lv_comp_qty like STPO_API02-COMP_QTY.

Data: lv_stpo_qty like STPO_MENGE.

I am getting dump when I am trying to pass 4,123 ( value of lv_comp_qty ) to lv_stpo_qty .

lv_stpo_qty = lv_comp_qty .

I've tried all the possibilities and also FM CHECK_AND_CONVERT_NUMERICS but no luck.

Please give ur input.

Thanks in Advance,

Vinay.

Edited by: Vinay parakala on Jun 8, 2011 6:29 AM

Former Member
Former Member replied

Hi Vinay,

When you are passing the value to the FM "CHECK_AND_CONVERT_NUMERICS" make sure you take out the ',' comma, from the character field.

I guess others weren't getting any errors as they were passing proper integer values into the char variable.

So,

Data : lv_comp_qty like STPO_API02-COMP_QTY VALUE 4123.
Data: lv_stpo_qty like STPO-MENGE.

lv_stpo_qty = lv_comp_qty .
WRITE : / lv_stpo_qty.

Will not throw an error, but if they tried the same with a small change like below, they too will get a short dump

Data : lv_comp_qty like STPO_API02-COMP_QTY VALUE '4,123'.
Data: lv_stpo_qty like STPO-MENGE.

lv_stpo_qty = lv_comp_qty .
WRITE : / lv_stpo_qty.

Umang has already mentioned this, My Bad didnt go through the complete thread.

Regards,

Chen

Edited by: Chen K V on Jun 8, 2011 4:00 PM

Edited by: Chen K V on Jun 8, 2011 4:02 PM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question