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

while doing alvs how to connect module pool program to se38

Former Member
0 Likes
516

hi gurus

while we are creating alv with oops

we cretae a container in modulepool

how to connect it to se38

i could not get it

could naybody suggest me

thank you

kals.

4 REPLIES 4
Read only

Former Member
0 Likes
498

Hi,

Create a report program in SE38.

CALL SCREEN 100.

Double click on 100 & then create the container for alv.. in the PBO, PAI build the necessary logic.

Best regards,

Prashant

Read only

Former Member
0 Likes
498

HI,

for doing this you need to use these FMs

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.

OR ELSE USE MY CODE ITS EXACTLY THE SAME THING WHAT YOU WANT.

*&---------------------------------------------------------------------*
*& Report  Z8HG_OOPS_ALV                                               *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  z8hg_oops_alv                           .


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

REWARD IF HELPFUL

VIVEKANAND

Read only

varma_narayana
Active Contributor
0 Likes
498

Hi Kalyan..

There is no need to Create a Module pool for Creating a SCREEN in case of ALV reports.

Just Create the SCREEN for the REPORT program itself and call the screen using

CALL SCREEN <NO>.

<b>reward if Helpful.</b>

Read only

hymavathi_oruganti
Active Contributor
0 Likes
498

1.just create a blank custom control in the layout. name it. ex: CUST_CONTROL

2. come to the report,

***data declaration

DATA:

GO_GRID type ref to cl_gui_alv_grid,

go_custom_container type ref to cl_gui_custom_container.

    • creation of objects and linking the custom container

CREATE OBJECT GO_CUSTOM_CONTAINER

EXPORTING

CONTAINER_NAME = <b>'CUST_CONTROL'.</b>

CREATE OBJECT GO_GRID

EXPORTING

I_PARENT = GO_CUSTOM_CONTAINER.