2007 Nov 27 4:33 PM
Hi All
I am creating a ALV report and had realized that we can use REUSE_ALV_FIELDCATALOG_MERGE to create a fieldcatalog.
However in I_STRUCTURE_NAME parameters I have to pass only structure that are defined in DDIC. I can"t pass my internal table defined for output.
So this option maynot be much useful. instead I can build fieldcatalog manually.
Am I right ? also at this time I am only concentrating on ALV using Functional Modules. Please let me know.
Regards
Madhu.
2007 Nov 27 4:43 PM
hi Madhu,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'the_name_of_your_program'
i_internal_tabname = 'the_name_of_the_internal_table_in_your_program'
...
hope this helps
pls. note that the fields in your internal table have to be declared with LIKE, otherwise the standard FM won't be able to build the fieldcatalouge.
ec
hi Madhu,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'the_name_of_your_program'
i_internal_tabname = 'the_name_of_the_internal_table_in_your_program'
...
hope this helps
pls. note that the fields in your internal table have to be declared with LIKE, otherwise the standard FM won't be able to build the fieldcatalouge.
ec
2007 Nov 27 4:42 PM
Yes you right. If you don't have the structure in the DDIC, fill the field catalog manually.
Regards,
Naimesh Patel
2007 Nov 27 4:43 PM
Yup you are right!
But if you want to test out the FM REUSE_ALV_FIELDCATALOG_MERGE then create a custom structure in DDIC and it will work!
2007 Nov 27 4:43 PM
hi Madhu,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'the_name_of_your_program'
i_internal_tabname = 'the_name_of_the_internal_table_in_your_program'
...
hope this helps
pls. note that the fields in your internal table have to be declared with LIKE, otherwise the standard FM won't be able to build the fieldcatalouge.
ec
2007 Nov 27 4:53 PM
Hi Eric and others,
Thank you very much for your replies.
Actually Eric answer is right to my question. maybe I did not asked the question rightly.
I was in impression that we can"t build fieldcatlog automatically for user build internal table using 'REUSE_ALV_FIELDCATALOG_MERGE' .
now I have understund that, I have one more question.
in my internal table, I have a amount field, I want to create totals for that, how can I do that. I am using 'REUSE_ALV_FIELDCATALOG_MERGE' for build field catalog automatically.
Thank you
madhu
2007 Nov 27 4:56 PM
Ok.. After building the fieldcatalog just loop on the that FCAT table and set DO_SUM for the amount field.
LIKE:
DATA: l_fcat TYPE slis_fieldcat_alv.
LOOP AT FCAT INTO L_FCAT WHERE FIELDNAME = 'AMOUNT'.
L_FCAT-DO_SUM = 'X'.
MODIFY FCAT FROM L_FCAT.
ENDLOOP.Regards,
Naimesh Patel
2007 Nov 27 4:58 PM
1. you have to change the fieldcatalog for the field you want to make sum (there is a field do_sum, change it to X for the fields you want to make sum (if it is not done automatically)
2. you have to build a sort table for that and pass that table to the REUSE_ALV_LIST_DISPLAY FM (or GRID_DISPLAY). in the sort table you can also tell to the system if you want make subtotal acc. to the sorted field. pls. check the type slis_sortinfo_alv in type group slis
2007 Nov 27 5:58 PM
Hi ERIC and others,
Thanks you once again.
Can you please let me know where I am doing mistake, i am not getting totals on price but I getting sort on carrid and they are grouping.
Please help me.
REPORT ZALV_REPORT_SFLIGHT.
TABLES : SFLIGHT.
TYPE-POOLS : SLIS.
DATA : IT_SFLIGHT TYPE TABLE OF SFLIGHT.
**DATA DECLARTION
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_sort type STANDARD TABLE OF slis_sortinfo_alv WITH HEADER LINE,
I_REPID LIKE SY-REPID.
i_repid = sy-repid.
perform get_data.
perform build_fieldcat.
perform display.
&----
*& Form get_data
&----
form get_data .
select * from sflight into table it_sflight.
endform. " get_data
&----
*& Form build_fieldcat
&----
form build_fieldcat .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IT_SFLIGHT'
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = FIELDCATALOG[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GD_sort-fieldname = 'CARRID'.
GD_sort-tabname = 'SFLIGHT'.
*GD_sort-up =
*GD_sort-down =
*GD_sort-group = 'X'.
GD_sort-subtot = 'X'.
append gd_sort TO GD_SORT.
endform. " build_fieldcat
&----
*& Form display
&----
form display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = I_REPID
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = FIELDCATALOG[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GD_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_SFLIGHT
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.
endform. " display
Thank you
2007 Nov 27 6:04 PM
GD_sort-fieldname = '<b>CARRID</b>'. <i>Put ur price's fieldname instead of CARRID</i>
GD_sort-tabname = 'SFLIGHT'.
*GD_sort-up =
*GD_sort-down =
*GD_sort-group = 'X'.
GD_sort-subtot = 'X'.
append gd_sort TO GD_SORT.
Cheers
~Arun
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |