‎2007 Mar 01 3:07 AM
Hi all,
can i use alv in module pool programming? In my module pool program, there is 4 screens.in my first , 2nd & 3 rd screen, i am using table control.i want to display those table controls in alv format i.e all the records in table control should come in alv grid format.is it possible.
plz send me some good materials & links for module pool?
my mail id---pmr_sir@yahoo.co.in
Thanks & Regards
‎2007 Mar 01 3:40 AM
Yeah you can do that with the help of REUSE_ALV_GRID_DISPLAY FM in th module pool.
Check following links -
<a href="http://www.erpgenie.com/sap/abap/controls/alvgrid.htm">http://www.erpgenie.com/sap/abap/controls/alvgrid.htm</a>
<a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm">http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm</a>
If you want to do it using OO method try BCALV_* in SE38 for examples.
Regards,
Amit
Reward all helpful replies.
‎2007 Mar 01 3:40 AM
Yeah you can do that with the help of REUSE_ALV_GRID_DISPLAY FM in th module pool.
Check following links -
<a href="http://www.erpgenie.com/sap/abap/controls/alvgrid.htm">http://www.erpgenie.com/sap/abap/controls/alvgrid.htm</a>
<a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm">http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm</a>
If you want to do it using OO method try BCALV_* in SE38 for examples.
Regards,
Amit
Reward all helpful replies.
‎2007 Mar 01 3:56 AM
Hi Pabitra,
For ALV in Module pool you have to use Class. For Complete Details of ALV you can visit...
http://help.sap.com/saphelp_erp2005vp/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
Main things about ALV in module pool is it's different than ALV using FM.
Here are steps to do so...
1. Creating a control and integrating it into the screen
2. Passing methods from the backend to the frontend
3. Handling events triggered by the control at the frontend
4. Destroying the control (Lifetime Management)
Hope this will help... For more information... Please write back...I will be more than happy to help.
Only condition is u have to reward points
‎2007 Mar 01 9:06 AM
Hi darshan,
can u plz explain more elaborately so that it will be easy for me.plz give me some sample code & examples for module pool with alv.it's very urgent.
i have rewarded u the max points.
Thanks & Regards
pabitra
‎2007 Mar 01 9:21 AM
‎2007 Mar 01 9:25 AM
Check the following ex code:
*& diaglog screen 0100 should be created and custom container should *
*& be placed on this screen to run this report *
&----
REPORT ZSD_ALV2 .
Tables:kna1.
types: begin of itab,
kunnr like kna1-kunnr,
land1 like kna1-land1,
name1 like kna1-name1,
name2 like kna1-name2,
ort01 like kna1-ort01,
pstlz like kna1-pstlz,
telf1 like kna1-telf1,
adrnr like kna1-adrnr,
end of itab.
DATA: ok_code LIKE sy-ucomm,
S_OKCODE LIKE OK_CODE.
data: gr_alvgrid type ref to cl_gui_alv_grid,
gr_cust_control type scrfname value 'ALV_GRID',
gr_container type ref to cl_gui_custom_container,
gt_fieldcat type lvc_t_fcat,
gs_layout type lvc_s_layo.
data: itab1 type table of itab with header line.
START-OF-SELECTION.
SET SCREEN 100.
perform fill_data.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module STATUS_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
perform disp_alv.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
S_OKCODE = OK_CODE.
CLEAR OK_CODE.
CASE S_OKcode.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
Do nothing
ENDCASE.
endmodule. " USER_COMMAND_0100 INPUT
form fill_data.
select kunnr land1 name1 from kna1 into corresponding fields of table
itab1.
endform. " fill_data
&----
*& Form disp_alv
&----
text
----
--> p1 text
<-- p2 text
----
form disp_alv.
if gr_alvgrid is initial.
create object gr_container
exporting
PARENT =
container_name = 'CUST_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 gr_alvgrid
exporting
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = gr_container
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.
perform field_catlog changing gt_fieldcat.
perform pre_layout changing gs_layout.
CALL METHOD gr_alvgrid->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 = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
CHANGING
it_outtab = itab1[]
IT_FIELDCATALOG = gt_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.
CALL METHOD gr_alvgrid->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 1
others = 2
.
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. " disp_alv
&----
*& Form field_catlog
&----
text
----
<--P_GT_FIELDCAT text
----
form field_catlog changing p_gt_fieldcat type lvc_t_fcat.
data: ls_fcat type lvc_s_fcat.
ls_fcat-fieldname = 'KUNNR'.
ls_fcat-inttype = 'C'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = 'Cust No'.
ls_fcat-seltext = 'Cust No'.
APPEND ls_fcat to p_gt_fieldcat.
ls_fcat-fieldname = 'LAND1'.
ls_fcat-inttype = 'C'.
ls_fcat-outputlen = '3'.
ls_fcat-coltext = 'COUNTRY'.
ls_fcat-seltext = 'COUNTRY'.
APPEND ls_fcat to p_gt_fieldcat.
ls_fcat-fieldname = 'NAME1'.
ls_fcat-inttype = 'C'.
ls_fcat-outputlen = '15'.
ls_fcat-coltext = 'Cust Name'.
ls_fcat-seltext = 'Cust Name'.
APPEND ls_fcat to p_gt_fieldcat.
endform. " field_catlog
&----
*& Form pre_layout
&----
text
----
<--P_GS_LAYOUT text
----
form pre_layout changing p_gs_layout type lvc_s_layo.
p_gs_layout-zebra = 'X'.
p_gs_layout-grid_title = 'CUSTOMERS'.
p_gs_layout-smalltitle = 'X'.
endform. " pre_layout