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: 

Do we need a DDIC structure in ALV

Former Member
0 Kudos

Hi,Iam new to OO ALV,this is my first program,do we need a DDIC structure if we use 'set_table_for_first_display' method?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

No, its not mandatory to use a DDIC structure. You can build a fieldcatalog.

CALL METHOD G_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = <internal table>
IT_FIELDCATALOG = <field catalog>
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
ENDIF.

Regards

Kannaiah

8 REPLIES 8

Former Member
0 Kudos

Hi,

try this program.

BCALV_GRID_DEMO

Code:

PROGRAM TEST.

DATA: OK_CODE LIKE SY-UCOMM,

GT_SFLIGHT TYPE TABLE OF SFLIGHT,

G_CONTAINER TYPE SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',

GRID1 TYPE REF TO CL_GUI_ALV_GRID,

G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

----


  • MAIN *

----


SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.

CALL SCREEN 100.

----


  • MODULE PBO OUTPUT *

----


MODULE PBO OUTPUT.

SET PF-STATUS 'MAIN100'.

IF G_CUSTOM_CONTAINER IS INITIAL.

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = G_CONTAINER.

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING IT_OUTTAB = GT_SFLIGHT.

ENDIF.

ENDMODULE.

----


  • MODULE PAI INPUT *

----


MODULE PAI INPUT.

  • to react on oi_custom_events:

call method cl_gui_cfw=>dispatch.

CASE OK_CODE.

WHEN 'EXIT'.

PERFORM EXIT_PROGRAM.

WHEN OTHERS.

  • do nothing

ENDCASE.

CLEAR OK_CODE.

ENDMODULE.

----


  • FORM EXIT_PROGRAM *

----


FORM EXIT_PROGRAM.

  • CALL METHOD G_CUSTOM_CONTAINER->FREE.

  • CALL METHOD CL_GUI_CFW=>FLUSH.

LEAVE PROGRAM.

ENDFORM.

Regards,

Venkatesh.

Former Member
0 Kudos

Hi,

Its not mandatory, to have a DDIC structure, its of most importance only when you use fieldcatalog.

Thanks & Regards,

Navneeth K.

Former Member
0 Kudos

No, its not mandatory to use a DDIC structure. You can build a fieldcatalog.

CALL METHOD G_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = <internal table>
IT_FIELDCATALOG = <field catalog>
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
ENDIF.

Regards

Kannaiah

0 Kudos

Thanks,Iam using 'LVC_FIELDCATALOG_MERGE' but after calling this function module name the fieldcatalog is in initial stage only,why? I have tried by passing the Internal Table name and the structure with types declaraion but none worked.

0 Kudos

You are workin Object oriented approach or Classical approach.

0 Kudos

in case of LVC function you need to have a DDIC structure. so to avoid this there is a work around. for more information

you can check this wiki article

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/creating%2blvc%2bfieldcatalog%2busing%2b...

0 Kudos

Hi,

To display the output we need either structure or fieldcatlog..!

if u want to use structure,directly u can pass this structrure , other wise build the field catlog and pass this fieldcatlog internal table to your function module..

Thanks

Regards

Aeda

0 Kudos

Thanks Vijay,u have solved my problem.