Application Development 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: 

Dump on Summation in Hierarchical ALV

0 Kudos

Hi,

After the Hierarchical ALV Output is shown, i click on an Currency field and click on Summation(add) in toolbar.This leads to a dump.

My catalog looks as below.

ls_fieldcat-col_pos = 2 .

ls_fieldcat-fieldname = 'VALUE'.

ls_fieldcat-ref_tabname = 'ZREF_ITM_CTR' .

ls_fieldcat-tabname = 'ITEM' .

ls_fieldcat-cfieldname = 'CURRENCY' .

ls_fieldcat-ctabname = 'ZREF_ITM_CTR' .

ls_fieldcat-datatype = 'CURR'.

ls_fieldcat-seltext_m = 'Price'.

append ls_fieldcat to lt_fieldcat .

Please let me know if any correction needs to be made.

Cheers!!!

1 ACCEPTED SOLUTION

0 Kudos

Can you please let me know the way to use this FM,

How do i pass the parameters for the cfieldname and ctabname here ?

10 REPLIES 10

Former Member
0 Kudos

Hi

ls_fieldcat-col_pos = 2 .

ls_fieldcat-fieldname = 'VALUE'.

ls_fieldcat-ref_tabname = 'ZREF_ITM_CTR' .

ls_fieldcat-tabname = 'ITEM' .

ls_fieldcat-cfieldname = 'CURRENCY' .

*ls_fieldcat-ctabname = 'ZREF_ITM_CTR' .

<b>ls_fieldcat-ctabname = 'ITEM' . <----


</b>

ls_fieldcat-datatype = 'CURR'.

ls_fieldcat-seltext_m = 'Price'.

append ls_fieldcat to lt_fieldcat .

The currency field <b>CURRENCY</b> has to belong to the internal table <b>ITEM</b> too.

Here you have to transfer the currency symbol.

Max

0 Kudos

Yes the currency field belongs to the internal table 'ITEM' .

0 Kudos

Hi

If it's so you need to replace the code line

ls_fieldcat-ctabname = 'ZREF_ITM_CTR' .

with

ls_fieldcat-ctabname = 'ITEM' .

Max

0 Kudos

Tried doing that but it again leads to the same dump.

"GETWA_NOT_ASSIGNED "

0 Kudos

Hi

Yes I know, It's the typical error of ALV.

There are something wrong in your catalog definition.

Max

0 Kudos

I have put the ALV Part of code here.

Let me know if anything needs to be changed.

The header table is 'HEADER' and Item table is 'ITEM' .

DATA:

ls_layout TYPE slis_layout_alv,

ls_keyinfo TYPE slis_keyinfo_alv,

ls_sort TYPE slis_sortinfo_alv,

lt_sort TYPE slis_t_sortinfo_alv," Sort table

ls_fieldcat TYPE slis_fieldcat_alv,

lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog

ls_layout-colwidth_optimize = c_x.

ls_layout-zebra = c_x.

ls_layout-expand_fieldname = 'EXPAND'.

ls_layout-expand_all = c_x.

PERFORM f_fill_fieldcat_entry_01 USING

'1' "Col Position

'OBJECT_ID' " fieldname

'ZREF_HDR_CTR'

'HEADER'

' '

' '

' '

' '

' ' ' ' '50' .

PERFORM f_fill_fieldcat_entry_01 USING

'2' "Col Position

'GUID' " fieldname

'ZREF_HDR_CTR'

'HEADER'

' '

' '

' '

' '

' ' ' ' '50' .

PERFORM f_fill_fieldcat_entry_01 USING

'1' "Col Position

'NUMBER_INT' " fieldname

'ZREF_ITM_CTR'

'ITEM'

' ' ' ' ' ' ' ' ' ' ' ' '50'.

ls_fieldcat-col_pos = 2 .

ls_fieldcat-fieldname = 'VALUE'.

ls_fieldcat-ref_tabname = 'ZREF_ITM_CTR' .

ls_fieldcat-tabname = 'ITEM' .

ls_fieldcat-cfieldname = 'CURRENCY' .

ls_fieldcat-ctabname = 'ITEM' .

append ls_fieldcat to lt_fieldcat .

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

define m_sort .

ls_sort-tabname = &1 .

ls_sort-fieldname = &2 .

ls_sort-up = &3 .

append ls_sort to lt_sort .

end-of-definition .

m_sort 'HEADER' 'OBJECT_ID' ' '.

m_sort 'ITEM' 'NUMBER_INT' ' ' .

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

ls_keyinfo-header01 = 'GUID' .

ls_keyinfo-item01 = 'HEADER' .

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

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

is_layout = ls_layout

it_fieldcat = lt_fieldcat

it_sort = lt_sort

i_tabname_header = 'HEADER'

i_tabname_item = 'ITEM'

is_keyinfo = ls_keyinfo

TABLES

t_outtab_header = HEADER

t_outtab_item = ITEM

EXCEPTIONS

program_error = 1

OTHERS = 2.

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

*Filling the catalog

FORM f_fill_fieldcat_entry_01

using p_col_pos like ls_fieldcat-col_pos

p_fieldname like ls_fieldcat-fieldname

p_ref_tabname like ls_fieldcat-ref_tabname

p_tabname like ls_fieldcat-tabname

p_cfieldname like ls_fieldcat-cfieldname

p_ctabname like ls_fieldcat-ctabname

p_qfieldname like ls_fieldcat-qfieldname

p_qtabname like ls_fieldcat-qtabname

p_no_sum like ls_fieldcat-no_sum

p_do_sum like ls_fieldcat-do_sum

p_outputlen like ls_fieldcat-outputlen.

ls_fieldcat-col_pos = p_col_pos .

ls_fieldcat-fieldname = p_fieldname.

ls_fieldcat-ref_tabname = p_ref_tabname .

ls_fieldcat-tabname = p_tabname .

ls_fieldcat-cfieldname = p_cfieldname .

ls_fieldcat-ctabname = p_ctabname .

ls_fieldcat-qfieldname = p_qfieldname .

ls_fieldcat-qtabname = p_qtabname .

ls_fieldcat-no_sum = p_no_sum .

ls_fieldcat-do_sum = p_do_sum .

ls_fieldcat-outputlen = p_outputlen .

append ls_fieldcat to lt_fieldcat .

ENDFORM.

0 Kudos

Hi

U should past the definations of the table HEADER and ITEM too, anyway try to use this code to fill catalog table:

* Insert header fields
PERFORM FILL_CATALOG_TABLE USING 'HEADER'.
* Insert item fields
PERFORM FILL_CATALOG_TABLE USING 'ITEM'.


*---------------------------------------------------------------------*
*       FORM FILL_CATALOG_TABLE                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  TABLE                                                         *
*---------------------------------------------------------------------*
FORM FILL_CATALOG_TABLE USING TABLE TYPE  SLIS_TABNAME.

  DATA: I_PROGRAM_NAME LIKE  SY-REPID.

  I_PROGRAM_NAME = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME     = I_PROGRAM_NAME
            I_INTERNAL_TABNAME = TABLE
            I_INCLNAME                  = I_PROGRAM_NAME
       CHANGING
            CT_FIELDCAT                = LT_FIELDCAT.
ENDFORM.

Max

0 Kudos

Can you please let me know the way to use this FM,

How do i pass the parameters for the cfieldname and ctabname here ?

0 Kudos

Hi

that fm fills the catalog table in order to definition of internal table.

So if it needs to display the table ITAB by ALV, it can fill catalog table manually or automatically.

U're using manual solution, but here sometime some data is missing or wrong, so if it wants to fill it automatically:

DATA: BEGIN OF ITAB OCCURS 0,
             FIELD1 LIKE ........
           END   OF ITAB.

It's import not to use the TYPE statament, because it's not supported.

It's need to transfer the name of internal table for the output, the report and the include name where the internal table is defined. If the internal table is defined in the report and not in the include, the include name'll be the report name.

The fm'll read the defintion in the report and fill the FIELDCAT table automatically.

  DATA: GT_REPID LIKE SY-REPID,
        GT_INCLUDE LIKE SY-REPID.

  GT_REPID   = SY-REPID.
  GT_INCLUDE = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME     = GT_REPID
            I_INTERNAL_TABNAME = 'ITAB'
            I_INCLNAME         = GT_INCLUDE
       CHANGING
            CT_FIELDCAT        = LT_FIELDCAT.

After filling it you can do all modifications you need.

Max

0 Kudos

I tried using the FM and this has solved the problem.

Thanks and Full points awarded.