Application Development and Automation 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: 
Read only

ALV GRID + Program Errors

Former Member
0 Likes
1,460

Hello Friends,

I have written a program which calls a function module ( for further processing ), and at the end this function moduels displays the ALV-GRID. Everything looks okey, and the ALV Gribd is also displayed fine, But after the ALV Grid is displayed, and when I try to select one of the table entry and try to use the tool-bar functions ( details, sort, find, or filter ) the program shows me the error message, stating "STOP Program errors" and then program exits, any idea what's going on ?

Here is my code for ALV GRID.

DATA:

lv_custom_cont TYPE REF TO

cl_gui_custom_container,

galv_sel TYPE REF TO cl_gui_alv_grid,

ps_layout TYPE lvc_s_layo,

/cla/zz_lo_error TYPE dd02l-tabname,

ls_variant TYPE disvariant.

  • output ALV List

IF galv_sel IS INITIAL.

CREATE OBJECT galv_sel

EXPORTING i_parent = lv_custom_cont.

ls_variant-report = sy-repid.

ls_variant-username = sy-uname.

CALL METHOD

galv_sel->set_table_for_first_display

EXPORTING

i_structure_name = '/CLA/ZZ_LO_ERROR'

is_layout = ps_layout

is_variant = ls_variant

i_save = 'A'

CHANGING

it_outtab = it_update[].

  • it_fieldcatalog = pt_fieldcat

  • it_sort = pt_sort.

ELSE.

CALL METHOD galv_sel->refresh_table_display.

ENDIF.

Regards,

null

Message was edited by:

Haider Zaidi

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
868

Hello Haider

The problem is the use of the function module (TABLES ?) parameter IT_UPDATE. Please remember that the data itab must be globally defined because its is a CHANGING parameter of the method SET_TABLE_FOR_FIRST_DISPLAY.

Try the following: define a global itab in the TOP include of your function group. Before calling method SET_TABLE_FOR_FIRST_DISPLAY move the itab values to this global itab like this:

  GT_UPDATE = it_update[].

Regards

Uwe

Read only

0 Likes
868

Hello Uwa,

Thanks for your reply, now I have declared an includ, and place the declaration of it_update in this include, and I call this include at the first line of FM, but problem still there....

Any idea.....

Message was edited by:

Haider Zaidi

Read only

Former Member
0 Likes
868

Hi,

Check this sample code..

REPORT  ZTEST_VIJAY  MESSAGE-ID ZZ  .
DATA: IT_MARA TYPE TABLE OF MARA.

DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM.
data: gc_layout type LVC_S_LAYO.
DATA:  G_CONTAINER TYPE SCRFNAME VALUE 'CONTROL'.
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.


START-OF-SELECTION.
SELECT *
FROM MARA
UP TO 20 ROWS
INTO TABLE IT_MARA.

END-OF-SELECTION.
IF NOT IT_MARA[] IS INITIAL.
  CALL SCREEN 100.
ELSE.
  MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.

MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
IF G_CUSTOM_CONTAINER IS INITIAL.
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT


MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT


FORM CREATE_AND_INIT_ALV .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.

CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

data: x_variant type disvariant.
x_variant-report = sy-repid.

*Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_STRUCTURE_NAME = 'MARA'
    is_layout = gc_layout
    i_save           = 'A'
    is_variant = x_variant
    CHANGING
    IT_OUTTAB = IT_MARA[].

ENDFORM.                     "CREATE_AND_INIT_ALV

Regards

Vijay

Read only

0 Likes
868

Hello Vijay,

When I implement the functionality in single report then it usually works, but now I am facing this strange problem, and the senario is that from my program I call this fm, and inside this fm, I call the alv-grid for first display method etc.....

Any idea, why it works in single report and not in fm, and gives me this strange error msg.

Regards,

PS: if you provide me your mail id, I can send you the exact screen-shot of msg... send me mail at web_cheela@yahoo.com, ....

Message was edited by:

Haider Zaidi

Message was edited by:

Haider Zaidi