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

ALV Fields summing

Former Member
0 Likes
730

I have to correct error in ALV out put. The error is the sum of amount field is not displaying in the ALV out put of particular column . Actually in SAP 4.7 version of the same program, it is summing correctly and displaying at the end of the column of that particular field .

But in 4.6 C it is not displaying. It looks the same code in both 4.6 C and 4.7 as well. Could you please suggest me how to achieve this ? This is very urgent.

Below is the code

ADD 1 TO col_pos.

fieldcat_ln-ref_tabname = ws_table . "You can also use the db tabl

fieldcat_ln-fieldname = ws_fieldname. "name(BSIS) here, but it will

fieldcat_ln-qfieldname = ws_qfieldname.

fieldcat_ln-cfieldname = ws_cfieldname.

fieldcat_ln-key = ws_key. "use the db field name instea

fieldcat_ln-do_sum = ws_sum. "of the name you give in

fieldcat_ln-col_pos = col_pos. "reptext_ddic.

fieldcat_ln-no_out = ws_noout.

fieldcat_ln-hotspot = ws_hotspot.

fieldcat_ln-outputlen = ws_outputlen.

fieldcat_ln-reptext_ddic = ws_ddic.

  • fieldcat_In-seltext_s = ws_ddic.

  • fieldcat_In-seltext_m = ws_ddic.

APPEND fieldcat_ln TO fieldcat.

********************************

data : pgm like sy-repid.

pgm = sy-repid.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = pgm

  • I_CALLBACK_PF_STATUS_SET = ' '

  • i_callback_user_command = 'USER_COMMAND'

  • I_STRUCTURE_NAME = 'DEFERRED ACCOUNTS REC RPT'

  • is_layout = lay_out

it_fieldcat = fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort = sortcat

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

is_variant = g_variant

it_events = eventcat

it_event_exit = gt_event_exit[]

tables

t_outtab = itab_alv

exceptions

program_error = 1

others = 2

.

if sy-subrc <> 0.

message i100(zg) with 'Unable to display ALV due to error'.

stop.

endif.

You help is highly appreciated.

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
695

Please try adding this one line.



ADD 1 TO col_pos.
fieldcat_ln-ref_tabname = ws_table . "You can also use the db tabl
fieldcat_ln-fieldname = ws_fieldname. "name(BSIS) here, but it will
fieldcat_ln-qfieldname = ws_qfieldname.
fieldcat_ln-cfieldname = ws_cfieldname.
fieldcat_ln-key = ws_key. "use the db field name instea
fieldcat_ln-do_sum = ws_sum. "of the name you give in
<b>fieldcat_in-datatype = 'QUAN'. "<------ Right Here</b>
fieldcat_ln-col_pos = col_pos. "reptext_ddic.
fieldcat_ln-no_out = ws_noout.
fieldcat_ln-hotspot = ws_hotspot.
fieldcat_ln-outputlen = ws_outputlen.
fieldcat_ln-reptext_ddic = ws_ddic.
* fieldcat_In-seltext_s = ws_ddic.
* fieldcat_In-seltext_m = ws_ddic.

APPEND fieldcat_ln TO fieldcat.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
695

I have to correct error in ALV out put. The error is the subtotaling of a field is not displaying in the ALV out put of particular column . Actually in SAP 4.7 version of the same program is working fine. it is doing sub-totaling.

But in 4.6 C it is not displaying. It seems the same code is copied both into 4.6 C and 4.7 as well. Could you please suggest me where to check which field I need to check ? how to achieve this ? This is very urgent.

Below is the code

ADD 1 TO col_pos.

fieldcat_ln-ref_tabname = ws_table . "You can also use the db tabl

fieldcat_ln-fieldname = ws_fieldname. "name(BSIS) here, but it will

fieldcat_ln-qfieldname = ws_qfieldname.

fieldcat_ln-cfieldname = ws_cfieldname.

fieldcat_ln-key = ws_key. "use the db field name instea

fieldcat_ln-do_sum = ws_sum. "of the name you give in

fieldcat_ln-col_pos = col_pos. "reptext_ddic.

fieldcat_ln-no_out = ws_noout.

fieldcat_ln-hotspot = ws_hotspot.

fieldcat_ln-outputlen = ws_outputlen.

fieldcat_ln-reptext_ddic = ws_ddic.

  • fieldcat_In-seltext_s = ws_ddic.

  • fieldcat_In-seltext_m = ws_ddic.

APPEND fieldcat_ln TO fieldcat.

********************************

data : pgm like sy-repid.

pgm = sy-repid.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = pgm

  • I_CALLBACK_PF_STATUS_SET = ' '

  • i_callback_user_command = 'USER_COMMAND'

  • I_STRUCTURE_NAME = 'DEFERRED ACCOUNTS REC RPT'

  • is_layout = lay_out

it_fieldcat = fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort = sortcat

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

is_variant = g_variant

it_events = eventcat

it_event_exit = gt_event_exit[]

tables

t_outtab = itab_alv

exceptions

program_error = 1

others = 2

Read only

Former Member
0 Likes
695

Hi sam,

I think the column is not Numeric,may be its CHAR.

change it to Numeric..

Read only

Former Member
0 Likes
695

It is neither numeric nor char field .

It is CURR field.

The problem is in 4.7 SAP system ...it is doing subtotaling and is working fine .

and the same program is copied to 4.6C...and in 4.6C it is not showing subtotaling.

THIS IS VERY URGENT .

COULD ANY BODY RESPOND SOON.

YOUR HELP WILL BE HIGHLY APPRECIATED.

THANKS IN ADVANCE

Read only

Former Member
0 Likes
695

Hi,

If you want to do the sub totaling..You should have a sort order for the field which you want to have a sub-total..And in the field catalog internal table for the the corresponding CURR make the DO_SUM = 'X'.

DATA: T_SORT TYPE SLIS_T_SORTINFO_ALV.

DATA: S_SORT TYPE SLIS_SORTINFO_ALV.

S_SORT-SPOS = '1'.

S_SORT-FIELDNAME = 'VBELN'. "Sales order #

S_SORT-UP = 'X'.

APPEND S_SORT TO T_SORT..

Thanks,

Naren