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

Problem facing in ALV OOPS

Former Member
0 Likes
738

Hi,

I am facing a problem in ALV Display using OOPS Approach.

I have made a custom container and I want my ALV grid to fit in that Container.

But in the output, I am getting a blank part of size of that container and behind it the ALV grid is displaying.

As I press Back button, it shows correct format but not in the container but on the whole screen..

I have given code for BACK button.

Leave to screen 0.

Please solve this error.

Thanks in Advance,

Nitin

7 REPLIES 7
Read only

Former Member
0 Likes
712

HI,

Check if you are passing the correct parameters..

it would be easy if you can paste some part of your list.

santhosh.

Read only

Former Member
0 Likes
712

Here is my code :

&----


*& Form alv_data1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv_data1 .

CALL SCREEN 2003.

ENDFORM. " alv_data1

&----


*& Module status_2003 OUTPUT

&----


  • text

----


MODULE status_2003 OUTPUT.

SET PF-STATUS 'MAIN'.

SET TITLEBAR 'ALV for Sales Order using OOPS'.

ENDMODULE. " status_2003 OUTPUT

&----


*& Module alv_display OUTPUT

&----


  • text

----


MODULE alv_display OUTPUT.

IF w_grid IS INITIAL.

*creating an object for custom container of header

CREATE OBJECT w_custom_container

EXPORTING

container_name = w_custom_control.

*creating an object for grid1

CREATE OBJECT w_grid

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = w_parent_grid

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

  • I_FCAT_COMPLETE = SPACE

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.

*Perform for filling field-catalog

PERFORM prepare_field_catalog_1 CHANGING t_fldcat.

*Perform for Coloring the fields

  • perform prepare_color_field using t_fldcat

  • changing w_color.

*Perform for filling field-Layout

PERFORM prepare_fld_layout CHANGING w_layout.

*calling method for first display

PERFORM call_method_display CHANGING it_merge[]

t_fldcat[].

ENDIF.

ENDMODULE. " alv_display OUTPUT

&----


*& Form prepare_field_catalog_1

&----


  • text

----


  • <--P_T_FLDCAT text

----


FORM prepare_field_catalog_1 CHANGING pt_fldcat TYPE lvc_t_fcat.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'VBELN' 'IT_MERGE' text-009 text-009 text-009 space c_x.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'POSNR' 'IT_MERGE' text-015 text-015 text-015 space c_x.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'AUDAT' 'IT_MERGE' text-011 text-011 text-011 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'VKORG' 'IT_MERGE' text-012 text-012 text-012 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'VTWEG' 'IT_MERGE' text-013 text-013 text-013 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'SPART' 'IT_MERGE' text-014 text-014 text-014 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'MATNR' 'IT_MERGE' text-016 text-016 text-016 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'MEINS' 'IT_MERGE' text-017 text-017 text-017 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'NETPR' 'IT_MERGE' text-018 text-018 text-018 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'NETWR' 'IT_MERGE' text-019 text-019 text-019 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'ARKTX' 'IT_MERGE' text-020 text-020 text-020 space c_space.

PERFORM fill_fieldcat_alv TABLES pt_fldcat USING

'BSTNK' 'IT_MERGE' text-010 text-020 text-020 space c_space.

ENDFORM. " prepare_field_catalog_1

&----


*& Form prepare_fld_layout

&----


  • text

----


  • <--P_W_LAYOUT text

----


FORM prepare_fld_layout CHANGING p_w_layout TYPE lvc_s_layo.

p_w_layout-zebra = 'X'.

p_w_layout-cwidth_opt = 'X'.

p_w_layout-grid_title = 'Sales Document'.

ENDFORM. " prepare_fld_layout

&----


*& Module user_command_2003 INPUT

&----


  • text

----


MODULE user_command_2003 INPUT.

CASE sy-ucomm.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " user_command_2003 INPUT

&----


*& Form call_method_display

&----


  • text

----


  • <--P_IT_MERGE[] text

  • <--P_T_FLDCAT[] text

----


FORM call_method_display CHANGING p_it_merge TYPE ty_t_merge

p_t_fldcat TYPE lvc_t_fcat.

CALL METHOD w_grid->set_table_for_first_display

EXPORTING

  • is_variant = gs_variant

is_layout = w_layout

  • i_save = 'A'

CHANGING

it_outtab = p_it_merge[]

it_fieldcatalog = p_t_fldcat[].

ENDFORM. " call_method_display

&----


*& Form fill_fieldcat_alv

&----


  • text

----


  • -->P_PT_FLDCAT text

  • -->P_0645 text

  • -->P_0646 text

  • -->P_TEXT_009 text

  • -->P_TEXT_009 text

  • -->P_TEXT_009 text

  • -->P_SPACE text

  • -->P_C_X text

----


FORM fill_fieldcat_alv TABLES p_t_fldcat TYPE lvc_t_fcat

USING p_fieldname

p_tabname

p_coltext

p_seltext_m

p_seltext_s

p_color TYPE any

p_c_x.

p_t_fldcat-fieldname = p_fieldname.

p_t_fldcat-tabname = p_tabname.

p_t_fldcat-coltext = p_coltext.

p_t_fldcat-scrtext_m = p_seltext_m.

p_t_fldcat-scrtext_s = p_seltext_s.

p_t_fldcat-emphasize = p_color.

p_t_fldcat-key = p_c_x.

APPEND p_t_fldcat.

ENDFORM. " fill_fieldcat_alv

Read only

0 Likes
712

*creating an object for grid1

CREATE OBJECT w_grid

EXPORTING

I_SHELLSTYLE = 0

I_LIFETIME =

i_parent = w_parent_grid

I_APPL_EVENTS = space

I_PARENTDBG =

I_APPLOGPARENT =

I_GRAPHICSPARENT =

I_NAME =

I_FCAT_COMPLETE = SPACE

Here

I_PARENT should be eq to w_custom_container

can you check that..

santhosh

Read only

Former Member
0 Likes
712

Thanks a lot Kaluvala.

It is working now.

One more favour please.

Would you send me some links on ALV Events ?

Read only

0 Likes
712

Check out this thread on SDN

santhosh

Read only

Former Member
0 Likes
712

Hi there,

I know you got it resolved, but just to add one more thing:

I had a similar problem. I resolved this with changing the type of container i had (DOCKING container) to the GUI_CUSTOM_CONTAINER type.

Be careful! Docking containers also give "funny" scrolling capabilities at the bottom of the container that might make users feel disorientated.

Christiaan

Read only

Former Member
0 Likes
712

Hi there,

I know you got it resolved, but just to add one more thing:

I had a similar problem. I resolved this with changing the type of container i had (DOCKING container) to the GUI_CUSTOM_CONTAINER type.

Be careful! Docking containers also give "funny" scrolling capabilities at the bottom of the container that might make users feel disorientated.

Christiaan