2010 Jun 21 12:40 PM
Hello All,
I am creating an ALV using SLIS. The number of columns to be displayed in the ALV are not fixed they are determined using the function module dynamic_table_create. My problem is I want to create the field catalog for the ALV. How can I create the field catalog dynamically.
thanks,
Anju
2010 Jun 21 12:51 PM
Hi ucan do it this way..
For Eg:
DATA: COUNTER TYPE I,
LV_COUNTER TYPE CHAR2,
LV_FIELD TYPE CHAR10.
LOOP AT INT_BUKRS INTO WA_BUKRS.
COUNTER = COUNTER + 1.
LV_COUNTER = COUNTER.
CONCATENATE 'BUKRS' LV_COUNTER INTO LV_FIELD.
CONDENSE LV_FIELD.
IS_LVC_CAT-fieldname = LV_FIELD.
IS_LVC_CAT-SCRTEXT_L = WA_BUKRS.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
IS_FIELDCAT-fieldname = LV_FIELD.
IS_FIELDCAT-OUTPUTLEN = 10.
IS_FIELDCAT-SELTEXT_L = WA_BUKRS.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
ENDLOOP.
create dynamic table:
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = IT_LVC_CAT
IMPORTING
ep_table = new_table.
Hope this helps..
There are lot of material in wiki explaining the same..
Best Regards,
navin fernandes.
Hi ucan do it this way..
For Eg:
DATA: COUNTER TYPE I,
LV_COUNTER TYPE CHAR2,
LV_FIELD TYPE CHAR10.
LOOP AT INT_BUKRS INTO WA_BUKRS.
COUNTER = COUNTER + 1.
LV_COUNTER = COUNTER.
CONCATENATE 'BUKRS' LV_COUNTER INTO LV_FIELD.
CONDENSE LV_FIELD.
IS_LVC_CAT-fieldname = LV_FIELD.
IS_LVC_CAT-SCRTEXT_L = WA_BUKRS.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
IS_FIELDCAT-fieldname = LV_FIELD.
IS_FIELDCAT-OUTPUTLEN = 10.
IS_FIELDCAT-SELTEXT_L = WA_BUKRS.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
ENDLOOP.
create dynamic table:
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = IT_LVC_CAT
IMPORTING
ep_table = new_table.
Hope this helps..
There are lot of material in wiki explaining the same..
Best Regards,
navin fernandes.
2010 Jun 21 12:51 PM
Hi ucan do it this way..
For Eg:
DATA: COUNTER TYPE I,
LV_COUNTER TYPE CHAR2,
LV_FIELD TYPE CHAR10.
LOOP AT INT_BUKRS INTO WA_BUKRS.
COUNTER = COUNTER + 1.
LV_COUNTER = COUNTER.
CONCATENATE 'BUKRS' LV_COUNTER INTO LV_FIELD.
CONDENSE LV_FIELD.
IS_LVC_CAT-fieldname = LV_FIELD.
IS_LVC_CAT-SCRTEXT_L = WA_BUKRS.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
IS_FIELDCAT-fieldname = LV_FIELD.
IS_FIELDCAT-OUTPUTLEN = 10.
IS_FIELDCAT-SELTEXT_L = WA_BUKRS.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
ENDLOOP.
create dynamic table:
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = IT_LVC_CAT
IMPORTING
ep_table = new_table.
Hope this helps..
There are lot of material in wiki explaining the same..
Best Regards,
navin fernandes.
2010 Jun 21 12:56 PM
>
> My problem is I want to create the field catalog for the ALV. How can I create the field catalog dynamically.
You can use the SALV technique to display your dynamic internal table as it doesn't require a field catalog
Refer to my response in this thread:
BR,
Suhas
2010 Jun 21 1:28 PM
Use fm LVC_TRANSFER_TO_SLIS .
On input pass lvc fieldcatalog (which you used for table generation), on output receive slis one . Then pass your generated table and slis fieldcatalog to REUSE_ALV_GRID_DISPLAY .
Regards
Marcin
2010 Jun 28 11:53 AM
2010 Jun 28 12:11 PM
hello ,
You can use the following code after populating your internaltable ,
LOOP AT IFLDCAT INTO WA_FLDCAT.
IF WA_FLDCAT-FIELDNAME = 'CURRENCY'.
WA_FLDCAT-col_pos = 0.
WA_FLDCAT-EDIT = 'X'.
WA_FLDCAT-seltext_m = 'Curr.of fare'.
WA_FLDCAT-seltext_s = 'Fare in currency'.
MODIFY IFLDCAT FROM WA_FLDCAT .
CLEAR WA_FLDCAT.
ENDIF.
ENDLOOP.
with regards ,
Arvind Venai
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |