2007 Feb 27 9:55 AM
how can i dynamically retrieve any table structure in alv????
2007 Feb 27 10:02 AM
2007 Feb 27 12:51 PM
hi
the actual requirement is i should be able to get the structure of any table in the database to alv.... initially i thought of doing tht as giving a parameter and thn asking for the table name and putting tht in
"CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'"
but i dont know how to give name dynamically....i am new to this ...so could you please help me out....
if there is any other way to do so . please lemme know...
thanks in advance......
2007 Feb 27 12:55 PM
*For Function module ALV (report)
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
DATA: table LIKE DD02L-TABNAME.
Populate the table nam here.
table = 'MARA'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = table
CHANGING
ct_fieldcat = it_fieldcat
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.U have to pass the value to table so that it will create the structure.
reward if u find helpful.
2007 Feb 27 10:04 AM
YOu can use the fm GET_COMPONENT_LIST to get the structure of the internal table at the run time.
You can also use the REUSE_ALV_FIELDCATALOG_MERGE fm.
Regards,
Ravi
2007 Feb 27 10:13 AM
Hi,
Use the FM ->REUSE_ALV_FIELDCATALOG_MERGE.
init pass the program name ,include name and the final internal table.u will get the fieldcatalog.
Regards,
nagaraj
2007 Feb 27 10:15 AM
2007 Feb 27 11:55 AM
hi..
try this FM:
GET_COMPONENT_LIST
REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_DISPLAY
Or
GET_COMPONENT_LIST
REUSE_ALV_FIELDCATALOG_MERGE
Regards,
shamim.