10-09-2007 6:33 PM
Hi Guys,
I am using ALV grid in my program with OO Concepts.I was not able to see the final o/p after entering the data into the selection Screen.Can anybody tell me what's the reason.I am sending u the code.
Call Method grid1->set_table_for_first_display
Exporting I_Structure_name = 'T_FINAL_OUT'
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
Please respond to this mail
Thanks,
Gopi.
10-09-2007 6:39 PM
The parameters are not correctly passed. Check this sample code.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'GT_FCAT'
IS_PRINT = GS_PRINT
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = IT_FINAL.
OR
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'GT_FCAT'
IS_PRINT = GS_PRINT
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = IT_FINAL[].
ashish
10-09-2007 6:46 PM
Hi Ashish,
What is meant by Structure name.I am defining my own struicture.so does i need to keep that structure name also?
Thanks,
Gopi.
10-09-2007 6:49 PM
As you have I_FCAT, just replace the same by I_FCAT. and it should work.
10-09-2007 6:59 PM
Hi Ashish,
I tried like what u told. but its not working.
I am sending u the complete code.
My only doubt is regarding Container does i need to crerate a conatiner .I created a custome control also but same problem
Data : grid1 type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
i_FCAT TYPE LVC_T_FCAT,
i_FCAT_str type lvc_s_fcat,
Structure for layout
i_layout_s TYPE lvc_s_layo,
i_lvccat TYPE lvc_t_fcat,
************************************************************************
INITIALIZATION of Fields
************************************************************************
Initialization.
v_repid = sy-repid.
set screen '101'.
MODULE STATUS_0101 output.
if g_custom_container is initial .
create object g_custom_container
Exporting
Container_name = 'CCCONTAINER'
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
Others = 5.
If sy-subrc <> 0.
ENDIF.
Create Object grid1
Exporting
I_Parent = g_custom_container
Exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
Others = 5.
If sy-subrc <> 0.
ENDIF.
Start-OF-Selection
i_FCAT_str-col_pos = 1.
i_FCAT_str-fieldname = 'MATNR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-024.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 2.
i_FCAT_str-fieldname = 'GJAHR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-012.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 3.
i_FCAT_str-fieldname = 'PERIO'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-013.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 4.
i_FCAT_str-fieldname = 'LIFNR_ND1'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-014.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
if not grid1 is Initial.
If sy-SUBRC = 0.
Call Method grid1->set_table_for_first_display
Exporting
I_STRUCTURE_NAME = 'I_FCAT'
IS_LAYOUT = i_layout_s
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
ENDIF.
Else.
if g_custom_container is initial .
create object g_custom_container
Exporting
Container_name = 'CCCONTAINER'
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
Others = 5.
If sy-subrc <> 0.
ENDIF.
Create Object grid1
Exporting
I_Parent = g_custom_container
Exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
Others = 5.
If sy-subrc <> 0.
ENDIF.
Call Method grid1->set_table_for_first_display
Exporting
I_STRUCTURE_NAME = 'I_FCAT'
IS_LAYOUT = i_layout_s
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
Endif.
ENDIF.
Thanks,
Gopi.
10-09-2007 7:04 PM
10-09-2007 7:06 PM
Hi,
Check the code below:
*Create object for Custom container
CREATE OBJECT G_CUSTOM_CONTAINER_0100
EXPORTING
CONTAINER_NAME = G_CONTAINER_0100
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
*Create object for ALV grid
CREATE OBJECT G_ALV_GRID_0100
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_0100.
G_MYLAYOUT-GRID_TITLE = 'Display Scanning data'.
*Call method for table Display
CALL METHOD G_ALV_GRID_0100->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = <F_FS>
IT_FIELDCATALOG = L_ALV_CAT1_TAB
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-09-2007 7:36 PM
Hi Kannaiah,
Where we have to declare this code.I mean in Start of selection or where ? does we need to write any code in PBO Module ?
Thanks,
Gopi.
10-09-2007 7:44 PM
HI,
--
INITIALIZATION.
--
AT SELECTION-SCREEN.
To validate the data entered in selection screen
--
START-OF-SELECTION.
*To fetch the data from table yyle0003
PERFORM GET_INPUT_DATA.
*To create the Dynamic Field Catalog
PERFORM GET_FIELDCAT.
To populate the data to final table
PERFORM GET_FINAL_DATA. in this perform at end Call the screen where Custom container is defined
CALL SCREEN 0100.
--
----
MODULE status_0100 OUTPUT *
----
.... *
----
MODULE STATUS_0100 OUTPUT.
*set title bar and PF status.
SET PF-STATUS 'ZVKS'.
SET TITLEBAR 'ZVKS'.
CHECK SY-UCOMM IS INITIAL.
SORT G_SCANDATA_TAB BY TKNUM VHILM.
*Create object for Custom container
CREATE OBJECT G_CUSTOM_CONTAINER_0100
EXPORTING
CONTAINER_NAME = G_CONTAINER_0100
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
*Create object for ALV grid
CREATE OBJECT G_ALV_GRID_0100
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_0100.
G_MYLAYOUT-GRID_TITLE = 'Display Scanning data'.
*Call method for table Display
CALL METHOD G_ALV_GRID_0100->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = <F_FS>
IT_FIELDCATALOG = L_ALV_CAT1_TAB
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.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
User Interaction
----
MODULE USER_COMMAND_0100 INPUT.
CALL METHOD CL_GUI_CFW=>DISPATCH.
*To exit , back or cancel
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Kannaiah
10-09-2007 7:49 PM
Hi kanniah,
Thanks for ur answer.
What's the problem i was not able see column Headings.I am getting Blank.
Can u tell me why?
What's the purpose of the below code
&----
*& Module USER_COMMAND_0100 INPUT
&----
User Interaction
----
MODULE USER_COMMAND_0100 INPUT.
CALL METHOD CL_GUI_CFW=>DISPATCH.
*To exit , back or cancel
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
" ?
Thanks,
Gopi
10-09-2007 8:06 PM
Hi,
Check the field catalog.
Its used in our screen to have some other functionality.
Regards
Kannaiah
10-09-2007 8:14 PM
Hi Kannaiah,
This is the field catalog which i defined and assigned .In the output
i was not able to get column headings but when i take my my mouse on the columns then i am getting a mesaage with columns name .
Data : grid1 type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
i_FCAT TYPE LVC_T_FCAT,
i_FCAT_str type lvc_s_fcat,
Structure for layout
i_layout_s TYPE lvc_s_layo,
gt_final1 type table of t_Final_out.
i_FCAT_str-col_pos = 1.
i_FCAT_str-fieldname = 'MATNR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-024.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 2.
i_FCAT_str-fieldname = 'GJAHR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-012.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 3.
i_FCAT_str-fieldname = 'PERIO'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-013.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 4.
i_FCAT_str-fieldname = 'LIFNR_ND1'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = Text-014.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 5.
i_FCAT_str-fieldname = 'MISCH_VERH1'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-015.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 6.
i_FCAT_str-fieldname = 'LIFNR_ND2'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-016.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 7.
i_FCAT_str-fieldname = 'MISCH_VERH2'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-017.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 8.
i_FCAT_str-fieldname = 'LIFNR_ND3'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-018.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 9.
i_FCAT_str-fieldname = 'MISCH_VERH3'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-019.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 10.
i_FCAT_str-fieldname = 'LIFNR_ND4'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-020.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 11.
i_FCAT_str-fieldname = 'MISCH_VERH4'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-021.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 12.
i_FCAT_str-fieldname = 'LIFNR_ND5'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-022.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 13.
i_FCAT_str-fieldname = 'MISCH_VERH5'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-seltext = Text-023.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
if not grid1 is Initial.
If sy-SUBRC = 0.
Call Method grid1->set_table_for_first_display
Exporting
I_STRUCTURE_NAME = 'I_FCAT'
IS_LAYOUT = i_layout_s
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
Thanks,
Gopi Anne.
10-09-2007 8:35 PM
Hi,
I dont know why u r using this:
if not grid1 is Initial.
If sy-SUBRC = 0.
endif.
endif.
create a customer container and assign this custom container to grid1 and then call the table to be displayed in the grid.
Regards
Kannaiah
10-09-2007 8:43 PM
Hi Kannaiah,
i had done like that only but no display of headings
if g_custom_container is initial .
create object g_custom_container
Exporting
Container_name = 'CCCONTAINER'
Ratio = '95'
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
Others = 5.
If sy-subrc <> 0.
Leave list-processing.
ENDIF.
Create Object grid1
Exporting
I_Parent = g_custom_container
Exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
Others = 5.
If sy-subrc <> 0.
ENDIF.
ENDIF.
Call Method grid1->set_table_for_first_display
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
Thanks,
Gopi.
10-09-2007 8:50 PM
Hi,
check the declaration:
DATA: CCCONTAINER TYPE SCRFNAME VALUE 'LIST', ( LIST should be displayed in the screen 100).
Regards
Kannaiah
10-09-2007 9:06 PM
Hi Kannaiah,
"LIST should be displayed in the screen 100" means what?
what i had done is i just drag and dropped a custom control in the screen 100.
other than this i have to do anythinf .Like i have to declare any filed names in screen 100?
Thanks,
Gopi.
10-09-2007 9:10 PM
Hi,
U need to define this CUSTOM CONTROL as some value say LIST while u r creating in screen.Double click on the CUSTOM CONTROL and define the value in first field.
Regards
Kannaiah.
10-09-2007 9:16 PM
Hi Kannaiah,
I had done like that what u told .I had defined custom control and double click on th custom control after than i assigned the value as 'LIST'.
but the output looks the same with no headings
Thanks,
Gopi Anne.
10-09-2007 9:16 PM
Hi Kannaiah,
I had done like that what u told .I had defined custom control and double click on th custom control after than i assigned the value as 'LIST'.
but the output looks the same with no headings
Thanks,
Gopi Anne.
10-09-2007 9:36 PM
In your field catalog, set COLTEXT to the corresponding column text rather than SELTEXT that you are using currently.
10-09-2007 10:00 PM
Thanks for all ur help.
i got it by keeping scrText_m ='MATERIAL'
Thanks,
Gopi
10-09-2007 6:41 PM
Hi
WHy you commented the EXPORTING
parameter Layout
see the sample code
CALL METHOD lcl_grid2->set_table_for_first_display
EXPORTING
is_layout = lw_layout
CHANGING
it_outtab = gt_error
it_fieldcatalog = lt_fieldcatalog.
Regards
Anji
10-09-2007 6:51 PM
Hi Anji reddy,
Does we need to assign any thing for the layout which i declared.
i just declared layout and assgned to this Method.
code :
data : i_layout_s TYPE lvc_s_layo.
Call Method grid1->set_table_for_first_display
Exporting IS_LAYOUT = i_layout_s
Changing it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
Exceptions
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
Thanks,
Gopi.
10-09-2007 6:54 PM
Remove '[]' from
Changing it_outtab = i_final_out1[]
and try again.
10-09-2007 7:03 PM
Hi Ashish,
i tried like that also.But no change.Can u have look at my code which i send u previously and tell me the changes which i have to make.
i am having doubt on call screen sattement and PBO Module.
Thanks,
Gopi.