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

Numeric Data Type beyond 18,2

Former Member
0 Likes
2,118

Hi,

I have a variable which is storing the totals of a column of type BSEG-DMBTR. (This is defined as CURR - 13,2). The totals are beyond 18,2 in PRD Client because of which it gives me a dump in form of a 'COMPUTE_BCD_OVERFLOW'. To overcome this problem, I have declared the totals variable as TYPE C LENGTH 25. The output is in an ALV grid, the totals column end up as left-aligned and no totals / sub-totals are shown. How do I overcome this problem ?

Regards,

Hema.

13 REPLIES 13
Read only

Former Member
0 Likes
1,815

CAN YOU CHECK WITH NUMERIC TYPE VAR 25 LENGTH.

REGARDS

SHIBA DUTTA

Read only

0 Likes
1,815

Dear Shiba,

How do I declare this ?

Regards,

Hema

Read only

sourabhshah
Product and Topic Expert
Product and Topic Expert
0 Likes
1,815

hi,

Create a ALV output table using a user defined new type and define column BSEG-DMBTR with new lenght 18,2 instead of 13,2.I think this will help.

Regards,

Sourabh

Read only

Former Member
0 Likes
1,815

Declare it as pack.

data: g_amt(25) type p decimals 2.

Read only

0 Likes
1,815

For Type P, a maximum of 16 is allowed, this is an ABAP limitation.

Regards,

Hema.

Read only

Former Member
0 Likes
1,815

Hi

Use justify for the display

just(1) type c, " (R)ight (L)eft (C)ent.

regards

Shiva

Read only

Former Member
0 Likes
1,815

I dont know y the user will try to see the value when it is exceeding 18 and above .

cause if the length is say 22 value length im not going to see that length programatically .

insted i would prefer to round that value .

data : v1 type f .

       v1 = '12333333333333333333333333333333333.25'.

       write:/ v1.

@shaik

g_amt(25) type p decimals 2.

i think type p will allow only 16 places max

regards,

vijay

Read only

Former Member
0 Likes
1,815

SORRY I HAVE GIVEN THE WRONG ANSWER BECAUSE YOU CANT DECLARE NUMERIC TYPE WITH CURRENCY THE DECIMAL PTS WILL NOT COME FOR CURRENCY. TYPE P IS ALSO NOT HELPFUL I THINK ? THEN I DONT KNOW HOW TO RECTIFY THIS?

LET US CHECK IF ANY ONE CAN NSWER OR NOT.

REGARDS

SHIBA DUTTA

Read only

Former Member
0 Likes
1,815

See if u have BF_DMBTR element, if it is there then declare it. its length is 23.

TYPE-POOLS: SLIS.

data: begin of itab occurs 0,

SL TYPE SY-TABIX,

c_val TYPE BF_DMBTR,

end of itab.

DATA: ws_repid LIKE sy-repid.

DATA: ws_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ws_set_status TYPE slis_formname VALUE 'F4900_SET_PF_STATUS'.

DATA: ws_sort TYPE slis_t_sortinfo_alv. " For sorting the

DATA: f8000_ws_fieldcat TYPE slis_fieldcat_alv.

DATA: it_sort TYPE slis_t_sortinfo_alv.

DATA :wa_sort TYPE slis_sortinfo_alv.

DATA: g_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv,

g_layout TYPE slis_layout_alv.

f8000_ws_fieldcat-tabname = 'ITAB'.

f8000_ws_fieldcat-fieldname = 'SL'.

f8000_ws_fieldcat-seltext_l = 'SNO'.

APPEND f8000_ws_fieldcat TO G_fieldcat.

CLEAR f8000_ws_fieldcat.

f8000_ws_fieldcat-tabname = 'ITAB'.

f8000_ws_fieldcat-fieldname = 'C_VAL'.

f8000_ws_fieldcat-seltext_l = 'VALUE'.

f8000_ws_fieldcat-do_sum = 'X'.

f8000_ws_fieldcat-just = 'R'.

APPEND f8000_ws_fieldcat TO G_fieldcat.

CLEAR f8000_ws_fieldcat.

itab-c_val = '123456789112345678.30'.

ITAB-SL = 1.

append itab.

itab-c_val = '1234.10'.

ITAB-SL = 1.

append itab.

itab-c_val = 12345.

ITAB-SL = 2.

append itab.

ws_repid = sy-repid.

REFRESH: it_sort.

CLEAR: it_sort.

CLEAR wa_sort.

wa_sort-spos = '01'.

wa_sort-up = 'X'.

wa_sort-fieldname = 'SL'.

WA_SORT-SUBTOT = 'X'.

APPEND wa_sort TO it_sort.

CLEAR wa_sort.

wa_sort-spos = '02'.

  • wa_sort-up = 'X'.

wa_sort-fieldname = 'C_VAL'.

  • WA_SORT-SUBTOT = 'X'.

  • WA_sort2-group = '*'.

APPEND wa_sort TO it_sort.

CLEAR wa_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = WS_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = G_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = IT_SORT

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ITAB

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

Former Member
0 Likes
1,815

Hi Hema ,

Due to limiation of ABAP datatype P, the fixed length can not be extended.

So, in your case , i suggest u to do following things

:- Display fields as complete one in char format. At the time of Taking totals and Subtotals, use your processing logic to do type conversion and splitting. Modify the data accordingly and display truncated result if it is not harming in a long way.

Regards.

Note: Reward if useful.

Read only

Former Member
0 Likes
1,815

I think Sourabh is correct. Do not declare that field in you ALV output table with data type DMBTR. Instead declare it as 18,2 in predefined type. This can be done by creating structure in SE11.

Read only

Former Member
0 Likes
1,815

I think Sourabh is correct. Do not declare that field in you ALV output table with data type DMBTR. Instead declare it as 18,2 in predefined type. This can be done by creating structure in SE11.

Read only

0 Likes
1,815

Hi,

BSEG-DMBTR is not declared 15,2 but just CURR - currency value, The decimals depend on the currency connected. If you transfer to a non-currency field, you loose the currency information and will be misinterpreted, Internal CURR has 3 decimals.

Regards

Clemens