Application Development and Automation 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: 
Read only

Hi Experts....

Former Member
0 Likes
911

how can i dynamically retrieve any table structure in alv????

how can i dynamically retrieve any table structure in alv????

7 REPLIES 7
Read only

Former Member
0 Likes
881

try Using the FM 'DDIF_TABL_GET' .

Read only

0 Likes
881

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......

Read only

0 Likes
881

*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.

Read only

Former Member
0 Likes
881

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

Read only

former_member404244
Active Contributor
0 Likes
881

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

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
881

Hi

Use FM:

REUSE_ALV_FIELDCATALOG_MERGE.

Regards,

kumar

Read only

Former Member
0 Likes
881

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.