Application Development and Automation 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: 
Read only

runtime error

Former Member
0 Likes
770

hi all,

In the following code

When adding value in qty getting runtime error as unable to interpret 1000 as number_.

Problem only with 4 digits no.

Working with 3 digits no.

The value is storing in qty2 (4digit no.),when comming to addition its giving this runtime error.

Can any one help me out plz.

FORM quan TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

TABLES : vbrp.

DATA :

invar(10) TYPE c,

qty1 TYPE char17,

qty2 TYPE tdsymvalue.

STATICS : qty TYPE char17,

  • QTY1 like vbrp-fkimg,

out(10) TYPE c,

count(2).

READ TABLE in_tab WITH KEY name = 'VBDKR-VBELN'.

invar = in_tab-value.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = invar

IMPORTING

output = invar.

*select sum( fkimg ) from vbrp into qty1 where vbeln = invar.

SELECT COUNT(*) FROM vbrp INTO count WHERE vbeln = invar.

READ TABLE in_tab WITH KEY name = 'VBDPR-FKIMG'.

out = out + 1.

qty1 = in_tab-value .

MOVE qty1 TO qty2.

IF out > count OR out < 1.

CLEAR qty.

CLEAR out.

out = 1.

ENDIF

qty = qty + qty2.

READ TABLE out_tab WITH KEY name = 'QTY'.

out_tab-value = qty.

MODIFY out_tab INDEX sy-tabix.

ENDFORM.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
715

Hi,

Check qty2 variable when there are 4 digits system is placing the thousand seperator...because of which you are getting the Short Dump.

Check this sample code ....

DATA :
qty1 TYPE char17 value '1,234.12',       " Later remove the thousand seprator from 1,234.12 and check
qty2 TYPE tdsymvalue value '123.12'.

DATA : qty TYPE char17.
qty = qty1 + qty2.

write:/ qty , qty1 , qty2.

5 REPLIES 5
Read only

Former Member
0 Likes
715

Hi Sudhir, this generally happens in sap script., to solve this..

when u r writing

QTY1 = IN_TAB-VALUE .

first take value on in_tab-value in some temp variable of type FKIMG.

and then assign that temp variable to qty1.

try this.. it should work

Read only

0 Likes
715

Code with changes,

&----


*& Form quan

&----


  • text

----


  • -->IN_TAB text

  • -->OUT_TAB text

----


FORM QUAN TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

TABLES : VBRP.

DATA :

INVAR(10) TYPE C,

QTY1 TYPE VBDPR-FKIMG,

QTY2 TYPE VBDPR-FKIMG,

TEMPFKIMG TYPE VBDPR-FKIMG.

STATICS : QTY TYPE CHAR17,

  • QTY1 like vbrp-fkimg,

OUT(10) TYPE C,

COUNT(2).

READ TABLE IN_TAB WITH KEY NAME = 'VBDKR-VBELN'.

INVAR = IN_TAB-VALUE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = INVAR

IMPORTING

OUTPUT = INVAR.

*select sum( fkimg ) from vbrp into qty1 where vbeln = invar.

SELECT COUNT(*) FROM VBRP INTO COUNT WHERE VBELN = INVAR.

READ TABLE IN_TAB WITH KEY NAME = 'VBDPR-FKIMG'.

OUT = OUT + 1.

TEMPFKIMG = IN_TAB-VALUE.

QTY1 = TEMPFKIMG .

MOVE QTY1 TO QTY2.

IF OUT > COUNT OR OUT < 1.

CLEAR QTY.

CLEAR OUT.

OUT = 1.

ENDIF.

QTY = QTY + QTY2.

READ TABLE OUT_TAB WITH KEY NAME = 'QTY'.

OUT_TAB-VALUE = QTY.

MODIFY OUT_TAB INDEX SY-TABIX.

ENDFORM. "quan

try this...

Read only

Former Member
0 Likes
716

Hi,

Check qty2 variable when there are 4 digits system is placing the thousand seperator...because of which you are getting the Short Dump.

Check this sample code ....

DATA :
qty1 TYPE char17 value '1,234.12',       " Later remove the thousand seprator from 1,234.12 and check
qty2 TYPE tdsymvalue value '123.12'.

DATA : qty TYPE char17.
qty = qty1 + qty2.

write:/ qty , qty1 , qty2.

Read only

0 Likes
715

thks u.thats the problem.

How to remove separator in 4 digits no. when we are calling from bd table.

Read only

0 Likes
715

Hi,

Check this FM

lv_text = 10,000.

CALL FUNCTION 'STRING_REPLACE'
EXPORTING
pattern = ','
substitute = space
changing
text = lv_text
EXCEPTIONS
WRONG_STRING_LENGTH = 1
OTHERS = 2.

lv_text will hold 10000.