2007 Mar 13 11:41 AM
Hi,
The internal table values are not populated into the alv.Everything is okay other than this.
Can anyone look upon it and post the cause for the error of this program.
Looking forward for ur reply.
Advance thanks.
REPORT zreport1 .
*Global data
TYPES : BEGIN OF ig_ekt ,
c1 TYPE sflight-carrid,
c2 TYPE sflight-connid,
END OF ig_ekt.
DATA ig_ek TYPE STANDARD TABLE OF ig_ekt.
DATA wa_igek LIKE LINE OF ig_ek.
DATA: cont TYPE REF TO cl_gui_custom_container,
alv1 TYPE REF TO cl_gui_alv_grid,
alv2 TYPE REF TO cl_gui_alv_grid,
g_fcat TYPE lvc_t_fcat,
w_fcat TYPE lvc_s_fcat.
DATA splitter TYPE REF TO cl_gui_splitter_container.
DATA container1 TYPE REF TO cl_gui_container.
DATA container2 TYPE REF TO cl_gui_container.
----
CLASS select DEFINITION
----
........ *
----
CLASS select DEFINITION.
PUBLIC SECTION.
METHODS: selectquery,
field_catalog.
ENDCLASS.
----
CLASS select IMPLEMENTATION
----
........ *
----
CLASS select IMPLEMENTATION.
METHOD selectquery.
SELECT carrid connid INTO wa_igek FROM sflight.
APPEND wa_igek TO ig_ek.
ENDSELECT.
ENDMETHOD.
METHOD field_catalog.
W_FCAT-COL_POS = 1.
w_fcat-fieldname = 'CONNID'.
w_fcat-tabname = 'IG_EK'.
w_fcat-ref_field = 'CONNID'.
w_fcat-ref_table = 'SFLIGHT'.
w_fcat-coltext = 'COLUMN2'.
w_fcat-outputlen = '50'.
APPEND w_fcat TO g_fcat.
w_fcat-fieldname = 'CARRID'.
w_fcat-tabname = 'IG_EK'.
w_fcat-ref_field = 'CARRID'.
w_fcat-ref_table = 'SFLIGHT'.
w_fcat-coltext = 'COLUMN1'.
w_fcat-outputlen = '50'.
APPEND w_fcat TO g_fcat.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA selref TYPE REF TO select.
CREATE OBJECT selref.
CALL METHOD : selref->selectquery,
selref->field_catalog.
CALL SCREEN 101.
END-OF-SELECTION.
----
MODULE STATUS_0101 OUTPUT *
----
........ *
----
MODULE status_0101 OUTPUT.
SET PF-STATUS 'GUI'.
SET TITLEBAR 'SAP LIST VIEWER'.
IF cont IS INITIAL.
CREATE OBJECT cont
EXPORTING container_name = 'CONTAINER'.
CREATE OBJECT splitter
EXPORTING
LINK_DYNNR =
LINK_REPID =
SHELLSTYLE =
LEFT =
TOP =
WIDTH =
HEIGHT =
METRIC = cntl_metric_dynpro
ALIGN = 15
parent = cont
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = container1
.
CALL METHOD splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = container2
.
CREATE OBJECT alv1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = container1.
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_USE_VARIANT_CLASS = SPACE
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.
CREATE OBJECT alv2
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_USE_VARIANT_CLASS = SPACE
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.
CALL METHOD alv1->set_table_for_first_display
CHANGING
it_outtab = ig_ek
it_fieldcatalog = g_fcat.
CALL METHOD alv1->set_table_for_first_display
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
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 =
CHANGING
it_outtab = ig_ek[]
it_fieldcatalog = g_fcat
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.
CALL METHOD alv2->set_table_for_first_display
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
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 =
CHANGING
it_outtab = ig_ek[]
it_fieldcatalog = g_fcat
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.
ENDIF.
ENDMODULE. " STATUS_0101 OUTPUT
&----
*& Module USER_COMMAND_0101 INPUT
&----
text
----
MODULE user_command_0101 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0101 INPUT
2007 Mar 13 11:58 AM
Hello Raj
If you rename the fields in your workarea you have to "tell" this to the data base. Thus, make the following change:
METHOD selectquery.
SELECT carrid as c1
connid as c2
INTO wa_igek FROM sflight.
APPEND wa_igek TO ig_ek.
ENDSELECT.
ENDMETHOD.
Regards
Uwe
2007 Mar 13 11:58 AM
Hello Raj
If you rename the fields in your workarea you have to "tell" this to the data base. Thus, make the following change:
METHOD selectquery.
SELECT carrid as c1
connid as c2
INTO wa_igek FROM sflight.
APPEND wa_igek TO ig_ek.
ENDSELECT.
ENDMETHOD.
Regards
Uwe
2007 Mar 13 12:07 PM
2007 Mar 13 12:06 PM
hope you understood the above reply
or change the declaration like this
TYPES : BEGIN OF ig_ekt ,
<b>carrid</b> TYPE sflight-carrid,
<b>conid</b> TYPE sflight-connid,
END OF ig_ekt.
2007 Mar 13 12:08 PM