Application Development 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: 

ALV Grid in Screen (using OO)

Former Member
0 Kudos

Cheers everyone.

This is my first posting to the SDN.

I'm trying to display an ALV Grid (using OO) in a screen called with "Call screen 0200 startin at XX YY", to get a popup-style display. My Grid will not show. If i call the screen directly (full screen mode), there are no problems.

I was wondering if it was even possible to display this object in this kind of screen.

My screen is defined as a "normal" screen. I tried with a "modal dialog box" but same result.

This is a 4.6C environment. If anyone has had this problem and could shed some light on what i might be missing, I'd appreciate it.

Thank you.

1 ACCEPTED SOLUTION

0 Kudos

Hello Jester,

Have a look at the demo program 'BCALV_GRID_AND_POPUP'.

I think that should help you.

Cheers,

Jitendar

7 REPLIES 7

0 Kudos

Hello Jester,

Have a look at the demo program 'BCALV_GRID_AND_POPUP'.

I think that should help you.

Cheers,

Jitendar

0 Kudos

Hi Jitendar.

I didn't think to look for a demo of this specific problem.

Thanks a lot.

I guess it was just the stucture of my program(timing of object creation) because i simply moved code around, and it now works.

I appreciate it.

(I hope i attributed the points correctly)

Jester.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sure, here is a generic function module that I recently did.

Create screen 200, set as normal screen, create custom control "ALV_CONTAINER" in the screen.



function z_popup_with_alvgrid.
*"----------------------------------------------------------------------
*"*"Global interface:
*"  IMPORTING
*"     REFERENCE(ENDPOS_COL) TYPE  I DEFAULT 90
*"     REFERENCE(ENDPOS_ROW) TYPE  I DEFAULT 22
*"     REFERENCE(STARTPOS_COL) TYPE  I DEFAULT 10
*"     REFERENCE(STARTPOS_ROW) TYPE  I DEFAULT 2
*"     REFERENCE(TEXTLINE1) TYPE  C OPTIONAL
*"     REFERENCE(TEXTLINE2) TYPE  C OPTIONAL
*"     REFERENCE(TEXTLINE3) TYPE  C OPTIONAL
*"     REFERENCE(TEXTLINE4) TYPE  C OPTIONAL
*"     REFERENCE(TITLE) TYPE  C OPTIONAL
*"     REFERENCE(FIELDCAT) TYPE  LVC_T_FCAT
*"  TABLES
*"      I_ALV
*"----------------------------------------------------------------------

  call screen 0200 starting at startpos_col
                               startpos_row
                     ending at endpos_col
                               endpos_row.

endfunction.

************************************************************************
*      Module  STATUS_0200  OUTPUT
************************************************************************
module status_0200 output.

  set pf-status '0200'.
  set titlebar  '0200' with title.

  data: alv_container  type ref to cl_gui_custom_container.
  data: alv_grid       type ref to cl_gui_alv_grid.

  data: xfieldcat type lvc_t_fcat.

  xfieldcat = fieldcat.

* Create Controls
  create object:

     alv_container
             exporting
                   container_name    = 'ALV_CONTAINER',

     alv_grid
             exporting
                   i_parent          =  alv_container.

*  Set grid for first display
  call method alv_grid->set_table_for_first_display(
      exporting
           i_structure_name       = 'I_ALV'
      changing
           it_outtab       = i_alv[]
           it_fieldcatalog = xfieldcat[] ).

endmodule.

************************************************************************
*     Module  USER_COMMAND_0100  INPUT
************************************************************************
module user_command_0200 input.

  case sy-ucomm.
    when 'CONTINUE' or 'CANCEL'.
      set screen 0.
      leave screen.
  endcase.

endmodule.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Jester,

So it has taken you about 5 months to make your first post? Just Kidding :-). Welcome to SDN and to this forum in particular. Hope you're gonna have some interesting/informative discussions here.

Regards,

Anand Mandalika.

P.S. : It is sort of customary for the newbies to read <a href="/people/mark.finnern/blog/2004/08/10/spread-the-love blog</a>. Have you?

0 Kudos

Hi Anand.

Yeah, i'm a "long time user, first time poster".

Thanks for the welcome.

I read your link, but i don't remember seing the "Reward Message" button next to a reply. I selected the radio button accordingly (problem solved), and i hope this accomplished the reward properly.

Thanks again.

Jester

eyal_alsheikh
Active Participant
0 Kudos

Hi Jester,

Instead of using "Call screen" you can use class

cl_gui_dialogbox_container. This class is a popup container and you can pass it to the i_parent parameter of you ALV grid.

I used it in similar situation as you are describing.

There is a good example here:

http://www.sapgenie.com/abap/controls/splitter.htm

Hope it helped you,

Eyal.

0 Kudos

Eyal,

When the object go_toolbar is created, a return code of 1 is occurring. Do you have any idea what might be causing this?

Thanks

Bruce

*----


  • Create Toolbar and set parent to the Splitter container

*----


CREATE OBJECT go_toolbar

EXPORTING

parent = go_splitter_container

EXCEPTIONS

others = 1.

IF sy-subrc <> 0.

message e000(zf) with

'CREATE OBJECT go_toolbar failure'.

ENDIF.