2008 Dec 22 11:55 AM
Dear Guru's,
I need your help.
I have written a code to display three ALV's in a single screen. But the method "set_table_for_first_display" is giving me a dump "GETWA_NOT_ASSIGNED".
I have shown the code here. Please help me out. I have used OO Concept.
{ls_fieldcatalog-fieldname = 'Rank'.
ls_fieldcatalog-ref_field = 'RANK'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
ls_fieldcatalog-DD_ROLL = 'RANK'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Personnel No'.
ls_fieldcatalog-ref_field = 'PERNR'.
ls_fieldcatalog-ref_table = 'PA0001'.
ls_fieldcatalog-DD_ROLL = 'PERNR_D'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Object ID'.
ls_fieldcatalog-ref_field = 'OBJID'.
ls_fieldcatalog-ref_table = '/SHSPE60/L001H71'.
ls_fieldcatalog-DD_ROLL = 'HROBJID'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Score'.
ls_fieldcatalog-ref_field = 'ZTOT'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Total'.
ls_fieldcatalog-ref_field = 'ZTOT'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = it_overall
IT_FIELDCATALOG = LT_FIELDCATALOG
EXCEPTIONS
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.}
The o/p table is IT_OVERALL. But is has no dictionary structure it has 5 fields mentioned below.
With Warm Regards
Vijay
2008 Dec 22 12:05 PM
Hi
Check the name of the fields passed to field catalog and the ITAB.
Make sure both are same
Regards
SHiva
when there is no data in the Itab.. I see the ALV field header.
Regards
Vijay
2008 Dec 22 12:02 PM
Hello,
Is your object go_grid1 initialized i.e. does it has any value.
Thanks,
Jayant
2008 Dec 22 12:06 PM
2008 Dec 22 12:12 PM
Hello,
I am not asking you to default it to any value but you need to create a object. You can use the below program for your reference.
*&---------------------------------------------------------------------*
*& Report ZTEST *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
report ZTEST .
data : g_container type scrfname value 'CONTAINER1',
g_custom_container type ref to cl_gui_custom_container,
g_alv_grid type ref to cl_gui_alv_grid.
types : begin of struct,
matnr type matnr,
mtart type mtart,
meins type meins,
end of struct.
data : itab type standard table of struct with header line.
data : ok_code_0101(20).
data : i_fieldcat type lvc_t_fcat.
data : l_fieldcat type lvc_s_fcat.
start-of-selection.
select matnr
mtart
meins into table itab
from mara
where mtart = 'FERT'.
call screen 0101.
*&---------------------------------------------------------------------*
*& Module STATUS_0101 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0101 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
perform initialise_alv.
perform build_fieldcat using i_fieldcat.
perform alv_display.
endmodule. " STATUS_0101 OUTPUT
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_FIELDCAT text
*----------------------------------------------------------------------*
form build_fieldcat using p_i_fieldcat type lvc_t_fcat.
refresh p_i_fieldcat.
perform fill_fcat using '1' 'MATNR' 'ITAB' 'MATERIAL' '20' '1'.
perform fill_fcat using '2' 'MTART' 'ITAB' 'TYPE' '20' '1'.
perform fill_fcat using '3' 'MEINS' 'ITAB' 'UNIT' '20' '1'.
endform. " BUILD_FIELDCAT
*&---------------------------------------------------------------------*
*& Form FILL_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0079 text
* -->P_0080 text
* -->P_0081 text
* -->P_0082 text
* -->P_0083 text
* -->P_0084 text
*----------------------------------------------------------------------*
form fill_fcat using p_col_pos type lvc_s_fcat-col_pos
p_fieldname type lvc_s_fcat-fieldname
p_tabname type lvc_s_fcat-tabname
p_seltext type lvc_s_fcat-scrtext_l
p_outputlen type lvc_s_fcat-outputlen
p_row_pos type lvc_s_fcat-row_pos.
clear l_fieldcat.
l_fieldcat-col_pos = p_col_pos.
l_fieldcat-fieldname = p_fieldname.
l_fieldcat-tabname = p_tabname.
l_fieldcat-scrtext_l = p_seltext.
l_fieldcat-outputlen = p_outputlen.
l_fieldcat-row_pos = p_row_pos.
append l_fieldcat to i_fieldcat.
endform. " FILL_FCAT
*&---------------------------------------------------------------------*
*& Form INITIALISE_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form initialise_alv .
if g_custom_container is initial.
create object g_custom_container
exporting
* PARENT =
container_name = g_container
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
create object g_alv_grid
exporting
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = g_custom_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endform. " INITIALISE_ALV
*&---------------------------------------------------------------------*
*& Form ALV_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form alv_display .
call method g_alv_grid->set_table_for_first_display
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
changing
it_outtab = itab[]
it_fieldcatalog = i_fieldcat
* IT_SORT =
* IT_FILTER =
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.
endform. " ALV_DISPLAY
*&---------------------------------------------------------------------*
*& Module EXIT_MODULE INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module exit_module input.
set screen 0.
leave program.
endmodule. " EXIT_MODULE INPUT
.
Also, you have created a screen with custom container I assume that.
Thanks,
Jayant
2008 Dec 22 12:20 PM
when there is no data in the Itab.. I see the ALV field header.
Regards
Vijay
2008 Dec 22 12:05 PM
Hi
Check the name of the fields passed to field catalog and the ITAB.
Make sure both are same
Regards
SHiva
2008 Dec 22 12:25 PM
Hello Vijay,
AFAIK you have to create a GUI Container and attach the same to your program. Please refer to the program BCALV_GRID_DEMO for details.
I think you have not declared a container & are trying to display your grid )
BR,
Suhas
2008 Dec 22 12:33 PM
2008 Dec 22 12:44 PM
Hi,
ls_fieldcatalog-fieldname = 'Rank'.
ls_fieldcatalog-ref_field = 'RANK'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
ls_fieldcatalog-DD_ROLL = 'RANK'. *check this line RANK is a DDROLL or ref_field?*
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Personnel No'.
ls_fieldcatalog-ref_field = 'PERNR'.
ls_fieldcatalog-ref_table = 'PA0001'.
ls_fieldcatalog-DD_ROLL = 'PERNR_D'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Object ID'.
ls_fieldcatalog-ref_field = 'OBJID'.
ls_fieldcatalog-ref_table = '/SHSPE60/L001H71'.
ls_fieldcatalog-DD_ROLL = 'HROBJID'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Score'.
ls_fieldcatalog-ref_field = 'ZTOT'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'Total'.
ls_fieldcatalog-ref_field = 'ZTOT'.
ls_fieldcatalog-ref_table = 'ZOVERALL'.
APPEND ls_fieldcatalog to lt_fieldcatalog.
CLEAR ls_fieldcatalog.
Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = it_overall
IT_FIELDCATALOG = LT_FIELDCATALOG
EXCEPTIONS
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.}
The o/p table is IT_OVERALL. But is has no dictionary structure it has 5 fields mentioned below.
{TYPES: BEGIN OF ty_overall,
RANK TYPE I,
pernr type pernr_d,
objid type HROBJID,
WEIGH TYPE P DECIMALS 2,
TOTAL TYPE P DECIMALS 2,
END OF ty_overall.
DATA: IT_overall TYPE TABLE OF ty_overall,
WA_overall TYPE ty_overall.Regards
2008 Dec 22 1:02 PM
GOT IT. I has misspelled the keywords in the field name. I am soo sorry. Jus wasted 2 hrs of productive time on a silly mistake.
Regards
Vijaya Sankar.VJ
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |