10-14-2008 7:19 AM
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?
10-14-2008 7:29 AM
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
10-14-2008 7:25 AM
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.
10-14-2008 7:28 AM
Hi,
Its not mandatory, to have a DDIC structure, its of most importance only when you use fieldcatalog.
Thanks & Regards,
Navneeth K.
10-14-2008 7:29 AM
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
10-14-2008 11:26 AM
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.
10-14-2008 11:27 AM
10-14-2008 11:33 AM
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
10-14-2008 11:44 AM
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
10-14-2008 11:44 AM