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

Do_sum with dump

Former Member
0 Likes
1,237

Hi All

I have a ALV report that works OK apart when I set the dosum 'X' option in one of the fields (they are type P).

In this case do not work and I get a short dump.

Any idea of how I can try to solve it ?

Many thanks in advance.

Cristina Neale

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,142

Cris...

Please check this field in your field catalg.

'MWVSKZ' 'MWVSKZ' 'bset' '' '' '' 18 text-026 ztabla,

This field is different in your table... the correct name is mwskz LIKE bset-mwskz.

BJS!!

11 REPLIES 11
Read only

Former Member
0 Likes
1,142

If this field is set, the ALV uses this field to calculate the total (this corresponds to the generic totals function in the toolbar.)

Check out few examples where do_sum is used

http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm

http://sap4.com/codigo-101.html

Hope this helps you.

~thomas

Read only

Former Member
0 Likes
1,142

Hi Cristina,

The problem is that your sum value is exceeding the maximum possible value allowed for that data type.

Declare your field with more length.

eg: if your quantity field is declared as

qty(5) type p decimals 2.

then declare it as qty(6) type p decimals 2.

Regards,

Ravi

Read only

Former Member
0 Likes
1,142

hi,

Declare it as a <b>currency</b> field instead of type P .

Regards,

Santosh

Read only

Former Member
0 Likes
1,142

Thank you a lot for your help but still doesnt work. Im posting the definition of my internal table and catalog to see if this way you have another idea.

DATA: BEGIN OF ti_cf OCCURS 0,

itmnum LIKE j_1bnflin-itmnum,

budat LIKE bsik-budat,

bldat LIKE bsik-bldat,

vfecha LIKE bsik-bldat,

bupla LIKE bsik-bupla,

gsber LIKE bsik-gsber,

xblnr LIKE bsik-xblnr,

stcd1 LIKE lfa1-stcd1,

lifnr LIKE bsik-lifnr,

name1 LIKE lfa1-name1,

belnr LIKE bsik-belnr,

hkont LIKE bsik-hkont,

txt50 LIKE skat-txt50,

sgtxt LIKE bsik-sgtxt,

nbm LIKE j_1bnflin-nbm,

text1 LIKE t604n-text1,

base LIKE bset-hwbas,

nftot LIKE j_1bnflin-netpr,

pswsl LIKE bsik-pswsl,

shkzg LIKE bsik-shkzg,

menge LIKE j_1bnflin-menge,

meins LIKE j_1bnflin-meins,

usnam LIKE bkpf-usnam,

mwskz LIKE bset-mwskz,

bsipi LIKE bset-hwbas,

peripi LIKE j_1bnfstx-rate,

valipi LIKE bset-hwste,

bscof LIKE bset-hwbas,

percof LIKE j_1bnfstx-rate,

valcof LIKE bset-hwste,

bspis LIKE bset-hwbas,

perpis LIKE j_1bnfstx-rate,

valpis LIKE bset-hwste,

END OF ti_cf.

  • fieldname structure table key dosum nout len txt table_out

'ITMNUM' 'ITMNUM' 'j_1bnflin' '' '' '' 15 text-004 ztabla,

'BUDAT' 'BUDAT' 'bsik' '' '' '' 15 text-005 ztabla,

'BLDAT' 'BLDAT' 'bsik' '' '' '' 18 text-006 ztabla,

'VFECHA''BLDAT' 'bsik' '' '' '' 18 text-003 ztabla,

'BUPLA' 'BUPLA' 'bsik' '' '' '' 18 text-007 ztabla,

'GSBER' 'GSBER' 'bsik' '' '' '' 18 '' ztabla,

'XBLNR' 'XBLNR' 'bsik' '' '' '' 18 text-008 ztabla,

'STCD1' 'STCD1' 'lfa1' '' '' '' 18 '' ztabla,

'LIFNR' 'LIFNR' 'bsik' '' '' '' 18 text-009 ztabla,

'NAME1' 'NAME1' 'lfa1' '' '' '' 18 text-010 ztabla,

'BELNR' 'BELNR' 'bsik' '' '' '' 18 text-011 ztabla,

'HKONT' 'HKONT' 'bsik' '' '' '' 18 text-014 ztabla,

'TXT50' 'TXT50' 'skat' '' '' '' 18 text-015 ztabla,

'SGTXT' 'SGTXT' 'bsik' '' '' '' 18 text-016 ztabla,

'NBM' 'NBM' 'j_1bnflin' '' '' '' 18 text-017 ztabla,

'TEXT1' 'TEXT1' 't604n' '' '' '' 18 text-018 ztabla,

'BASE' 'HWBAS' 'bset' '' '' '' 18 text-019 ztabla,

'NFTOT' 'NETPR' 'j_1bnflin' '' '' '' 18 text-020 ztabla,

'PSWSL' 'PSWSL' 'bsik' '' '' '' 18 text-021 ztabla,

'SHKZG' 'SHKZG' 'bsik' '' '' '' 18 text-022 ztabla,

'MENGE' 'MENGE' 'j_1bnflin' '' '' '' 18 text-023 ztabla,

'MEINS' 'MEINS' 'j_1bnflin' '' '' '' 18 text-024 ztabla,

'USNAM' 'USNAM' 'bkpf' '' '' '' 18 text-025 ztabla,

'MWVSKZ' 'MWVSKZ' 'bset' '' '' '' 18 text-026 ztabla,

'BSIPI' 'HWBAS' 'bset' '' '' '' 18 text-027 ztabla,

'PERIPI' 'RATE' 'J_1BNFSTX' '' '' '' 18 text-028 ztabla,

'VALIPI' 'HWSTE' 'bset' '' '' '' 18 text-029 ztabla,

'BSCOF' 'HWBAS' 'bset' '' '' '' 18 text-030 ztabla,

'PERCOF' 'RATE' 'J_1BNFSTX' '' '' '' 18 text-028 ztabla,

'VALCOF' 'HWSTE' 'bset' '' '' '' 18 text-031 ztabla,

'BSPIS' 'HWBAS' 'bset' '' '' '' 18 text-032 ztabla,

'PERPIS' 'RATE' 'J_1BNFSTX' '' '' '' 18 text-028 ztabla,

'VALPIS' 'HWSTE' 'bset' '' 'X' '' 18 text-033 ztabla.

Read only

0 Likes
1,142

for which field did you set the do_sum as 'X'?

Read only

0 Likes
1,142

The last one VALPIS.

Read only

Former Member
0 Likes
1,142

it seems that you have missed this part of code

DEFINE add_catalog.

clear x_fldcat.

x_fldcat-fieldname = &1.

x_fldcat-seltext_m = &2.

x_fldcat-outputlen = &3.

x_fldcat-tech = &4.

x_fldcat-col_pos = &5.

x_fldcat-no_zero = 'X'.

x_fldcat-ddictxt = 'M'.

x_fldcat-datatype = &6.

x_fldcat-ddic_outputlen = &7.

if &6 = 'N'.

x_fldcat-lzero = 'X'.

endif.

if &8 = 'X'.

<b> x_fldcat-datatype = 'CURR'.</b>

endif.

x_fldcat-do_sum = &8.

*--build field catalog

x_fldcat-tabname = &9.

append x_fldcat to t_field.

END-OF-DEFINITION.

Read only

Former Member
0 Likes
1,142

Hi christina,

try

hwste like bset-hwbas.

because <b>hwbas has CURR 15</b>, hwste has only CURR 13!!

Regards, Dieter

Read only

Former Member
0 Likes
1,143

Cris...

Please check this field in your field catalg.

'MWVSKZ' 'MWVSKZ' 'bset' '' '' '' 18 text-026 ztabla,

This field is different in your table... the correct name is mwskz LIKE bset-mwskz.

BJS!!

Read only

Former Member
0 Likes
1,142

Hello all

Many thanks for the help, the problem was as Andrea suggested, the catalog definition of the field 'MWSKZ'.

Now it is working !

Cheers.

Cristina

Read only

0 Likes
1,142

Hi Cristina,

one Information.

It's simle to get the Fieldcat with right parameters

with the FM 'REUSE_ALV_FIELDCATALOG_MERGE'

Here a short example.

PROGNAME = SY-REPID.

*

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = PROGNAME

I_INTERNAL_TABNAME = 'ITAB'

I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = PROGNAME

CHANGING

CT_FIELDCAT = FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

*

Regards, Dieter