2006 Oct 30 1:44 PM
Hi abappers,
I am using the function module REUSE_ALV_HIERSEQ_LIST_DISPLAY to display the ALV Classic list with one header and 2 line items.
now my requirement is that the columns in the first line item should be different from the columns in the second line item, the second line item will have one column extra compared to the first, is this possible with the current FM i am using or is there any work-around?
Regards
Naren
Hi abappers,
I am using the function module REUSE_ALV_HIERSEQ_LIST_DISPLAY to display the ALV Classic list with one header and 2 line items.
now my requirement is that the columns in the first line item should be different from the columns in the second line item, the second line item will have one column extra compared to the first, is this possible with the current FM i am using or is there any work-around?
Regards
Naren
2006 Oct 30 1:47 PM
2006 Oct 30 1:52 PM
HI Narendiran,
Refer the sample code below:
&----
*& Form f0022_generate_report
&----
Subroutine to Generate Report Output in ALV
----
FORM f0022_generate_report.
*--- Calling Function Module to create Fieldcatalog
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = ws_repid
i_internal_tabname = 'I_ITEM'
i_inclname = 'ZMRO_ARKANSAS_TAX_TOP'
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-048.
ENDIF.
*--- Calling Function Module to create Fieldcatalog
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = ws_repid
i_internal_tabname = 'I_HEADER'
i_inclname = 'ZMRO_ARKANSAS_TAX_TOP'
CHANGING
ct_fieldcat = i_fieldcat1
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-048.
ENDIF.
<b>*--- Adding Fieldcatalog properties in Header Columns.</b>
LOOP AT i_fieldcat1 INTO w_fieldcat1.
*-- Column Text for DATE
IF w_fieldcat1-fieldname = 'DATE'.
w_fieldcat = w_fieldcat1.
w_fieldcat-seltext_m = text-010.
w_fieldcat-ddictxt = c_m.
w_fieldcat-outputlen = '13'.
APPEND w_fieldcat TO i_fieldcat.
ENDIF.
*-- Column Text for VENDOR
IF w_fieldcat1-fieldname = 'VENDOR'.
w_fieldcat = w_fieldcat1.
w_fieldcat-seltext_m = text-011.
w_fieldcat-ddictxt = c_m.
w_fieldcat-outputlen = '25'.
APPEND w_fieldcat TO i_fieldcat.
ENDIF.
ENDLOOP.
<b>*--- Adding Fieldcatalog properties in Item Columns.</b>
LOOP AT i_fieldcat INTO w_fieldcat.
IF w_fieldcat-fieldname = 'CO_OBJECT'.
w_fieldcat-hotspot = c_x.
w_fieldcat-outputlen = '13'.
MODIFY i_fieldcat FROM w_fieldcat.
ENDIF.
IF w_fieldcat-fieldname = 'GL_ACC'.
w_fieldcat-outputlen = '22'.
MODIFY i_fieldcat FROM w_fieldcat.
ENDIF.
*-- Column Text for TXJCD
IF w_fieldcat-fieldname = 'TXJCD'.
w_fieldcat-seltext_m = text-043.
w_fieldcat-ddictxt = c_m.
w_fieldcat-outputlen = '17'.
MODIFY i_fieldcat FROM w_fieldcat.
ENDIF.
*-- Column Text for CO_PRE_TAX
IF w_fieldcat-fieldname = 'CO_PRE_TAX'.
w_fieldcat-seltext_m = text-018.
w_fieldcat-ddictxt = c_m.
w_fieldcat-do_sum = c_x.
w_fieldcat-no_zero = c_x.
w_fieldcat-outputlen = '21'.
MODIFY i_fieldcat FROM w_fieldcat.
ENDIF.
*--- Assigning KEY FIELD between Header & Item for List Display
w_alv_keyinfo-header01 = 'ACC_DOC'.
w_alv_keyinfo-item01 = 'ACC_DOC'.
w_layout-zebra = ' '.
w_layout-numc_sum = c_x.
w_layout-get_selinfos = c_x.
w_layout-detail_popup = c_x.
w_layout-cell_merge = ' '.
w_layout-totals_before_items = c_x.
w_layout-totals_only = c_x.
*--- SORT
CLEAR w_sort.
w_sort-spos = 1.
w_sort-fieldname = 'ACC_DOC'.
w_sort-tabname = 'I_HEADER'.
w_sort-up = c_x.
w_sort-subtot = c_x.
APPEND w_sort TO w_gt_sort.
CLEAR w_sort.
SORT i_header BY acc_doc.
SORT i_item BY acc_doc.
ws_repid = sy-repid.
*--- Calling function Module for Hierarchical Report Display
CALL FUNCTION <b>'REUSE_ALV_HIERSEQ_LIST_DISPLAY'</b>
EXPORTING
i_callback_program = ws_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = w_layout
it_fieldcat = i_fieldcat
it_sort = w_gt_sort[]
is_variant = ws_variant
it_events = i_events
i_tabname_header = 'I_HEADER'
i_tabname_item = 'I_ITEM'
is_keyinfo = w_alv_keyinfo
TABLES
t_outtab_header = i_header[]
t_outtab_item = i_item[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-048.
ENDIF.
ENDFORM. " f0022_generate_report
Reward points if this Helps.
Manish
2006 Oct 30 2:15 PM
Hi Narendiran,
It is not possible to have the different columns for different line items of the hierarchycal alv report. However similar kind of report can be developed using some logical codeing and ALV display layout.
While populating the final detail(line item) internal table use some logic such that the fields values of second line item will not get populated with the value where the first line item have these fields in display.
I mean if the detain line item have the fields f1...f10 then for first line item you will populate fields f1..f5 and for second line item you will populate fields f6..f10
based on some conditions.
In the display layout, divide these fields as to rows. first row will dispaly fields f1..f5 and second row will display f6..f10.
The only disadvantage is that there will be blank line between the two line of the report output.
Regards,
Satya
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |