Application Development 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: 

Dynamic ALV

Former Member
0 Kudos
173

How to create dynamic ALV,

like some columns are static and some are

dynamic.

if atleast a single value is available for the

any of the dynamic columns need to display that

otherwise dont display.

i used already flag setting method that is working properly but dont want hardcoded method?

becoz no. of dynamic columns are not defined .

8 REPLIES 8

former_member188685
Active Contributor
0 Kudos
113

Based on Certain conditions you can set the NO_OUT = 'X' or SPACE in fieldcatalog for the fields which you want them to see or not in LIST...

if some condition....

x_fieldcat-...

x_fieldcat-..

x_fieldcat-no_out = 'X'.

endif.

if some condition....

x_fieldcat-...

x_fieldcat-..

x_fieldcat-no_out = ' '.

endif.

Former Member
0 Kudos
113

Savita,

Please check my blog.

/people/ravikumar.allampallam/blog/2005/05/31/expand-the-list-of-columns-in-a-report-dynamically

This should give you an idea. If you have further questions please let me know.

Setting NO_OUT flag is not the right solution because if the user tries to change the layout entire list of fields will be available for him.

Regards,

Ravi

Note : Please reward posts that are helpful.

0 Kudos
113

HI,

I USED THE FUNCTION 'LVC_FIELDCATALOG_MERGE'

WHERE STRUCT IS MY STRUCTURE WHERE I HAVE ALL FIELDS

WHICH SHOULD BE DYNAMIC

AND IN I_TABLE1 I HAVE STATIC INTERNAL TABLE WHICH HAS TO DISPLAY IN THE ALV

BUT GETTING ERROR WHILE CALLING FUNCTION

CAN U HELP ,

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

I_STRUCTURE_NAME = 'STRUCT'

I_INTERNAL_TABNAME = I_TABLE1[]

  • CHANGING

  • ct_fieldcat = i_table1[].

.

0 Kudos
113

Hi,

Why dont you use FM 'REUSE_ALV_GRID_DISPLAY'.

Check this link it is very help full for you.

http://www.sapdevelopment.co.uk/reporting/alvhome.htm

Thanks.

If this helps u reward with points.

0 Kudos
113

give the code how are you calling..

please specify what parameters you are passing to FM.

vijay

0 Kudos
113

I NEED TO DISPLAY BOTH STSTIC AND DYNAMIC ALV TOGETHER

.I HAVE INTERNAL(I_TABLE1) TABLE IN WHICH HAVING ALL STATIC DATA

.THEN DEFINE A STRUCTURE HAVING ALL FIELDS NAME

WHICH WLL DISPLAY DYNAMICALLY WITH STATIC

.THEN USED LVC_FIELDCATALOG_MERGE "FM"

I_STRUCTURE_NAME = 'STRUCT'

I_INTERNAL_TABNAME = I_TABLE1[]

.THEN FM cl_alv_table_create=>create_dynamic_table

Exporting

IT_FIELDCATALOG = T_FIELDCAT

Importing

EP_TABLE = T_OUTPUT

WHERE DATA: T_OUTPUT TYPE REF TO DATA

FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE

THEN FILL THE DYNAMIC STRUCTURE WITH DATA

TRY IT DONT KNOW EXACTLY

GETTING ERROR IN LVC_FIELDCATALOG_MERGE' "FM"

OF TYPE MISMATCH.

DOES ANYBODY KNOW ITS URGENT....

0 Kudos
113
  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = sflight
    changing
      ct_fieldcat            = ct_fcat[]
    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.

0 Kudos
113

hi,

i need to build a dynamic alv from 2 internal tables. data one table is static and the other one is dynamic. Could you help me in how to link the alv for those tables please.

thanks

ck