cancel
Showing results for 
Search instead for 
Did you mean: 

What will be the max values these fields(Amount) can take ,plz help

Former Member
0 Kudos

Hello ABAP Gurus

What will be the max values these fields(Amount) can take ?,for validation purpose , if anybode have any related code plz give .

CGL_QTY KWMENG QUAN 15 Cumulative order quantity in sales units

CGL_UPRICE KBETR CURR 11 Rate (condition amount or percentage)

CGL_TOT KZWI3 CURR 13 2 Subtotal 3 from pricing procedure for condition

Actually if user enters some values to these fields for which Total values r exceeding (gives arithmatic overflow errors)

How to restrict the user .

I have the following code

under chain -endchain

PROCESS BEFORE OUTPUT.

MODULE SET_STATUS.

LOOP AT ITAB

WITH CONTROL TCL1

CURSOR TCL1-CURRENT_LINE .

MODULE SET_LINE_COUNT .

ENDLOOP.

PROCESS AFTER INPUT.

MODULE UPD_OK_COD.

MODULE EXIT_COMAND AT EXIT-COMMAND.

MODULE SCROLL_SORT.

LOOP AT ITAB.

<i>CHAIN.

FIELD:ITAB-STATUS, ITAB-FDAT, ITAB-CGL_TOT, ITAB-BHEL_TOT,

ITAB-ALSTOM_TOT,ITAB-SIEMENS_TOT,ITAB-TELK_TOT,ITAB-OTH_TOT.

MODULE ITAB_VALIDITY ON CHAIN-REQUEST.

ENDCHAIN.</i>

MODULE UPDATE_ITAB.

ENDLOOP.

MODULE UPDATE_TABLE.

Plz just give some hints ,

<b>i need 2 know for validations purpose of these fields .</b>

Thnx

Moni

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Message was edited by: md monirujjaman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Moni,

SAP has a wonderful feature in ABAP. There are some Runtime Errors that you can <i>catch</i>. This is somewhat similar to the Exception Handling procedure in Java / C++. So here's how you go about it....

Sometimes there might some calculations that we do, multiplication , for example, where the result of the arithmetic operation is known only at run-time. And the recepient for this result may not always be of the right type to take the result. Consider the following code:

parameters a type i obligatory.

data : b type i,
       c type i.

b = 99999999.

** Assume that the user has entered 99999999 for the value of the parameter a.

c = a * b.    " 99999999 * 99999999 "

write c.

This program will certainly give a short dump saying that there was an arithmetic overflow. But we can actually avoid this Shor Dump and handle the situation quite elegantly. consider the following.



parameters a type i obligatory.

data : b type i,
       c type i.

b = 99999999.


CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
** Assume that the user has entered 99999999 for the value of the parameter a.
   c = a * b.    " 99999999 * 99999999 "
ENDCATCH.

if sy-subrc ne 0.
  write: 'There was an arithmetic overflow in the calculation.'
else.
  write c.
endif. 

This way you can actually avoid the short dump and make the system set a value for sy-subrc. Based on the avlue of the sy-subrc, you can go ahead with further processing / error-handling, as the case may be.

Here, ARITHMETIC_EXCEPTIONS is called an <i>exception group</i>. For more information on what other run-time errors can be <i>caught</i>, and What the various exception groups contain, please refer to the online documentation for the CATCH statement.

Regards,

Anand Mandalika.

Answers (0)