Screen Programming(Module Pool ) using Abap Objects
Hi gurus.,
I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields..
Regards.,
S.Sivakumar
Hi Sivakumar,
Go through the following links:
[url]http://www.savefile.com/download/156691?PHPSESSID=c49d6bed6630d830f3270f7eab51e547 [url]
[url]http://www.sapdb.info/category/sap-ebooks[url]
[url]http://sap.niraj.tripod.com/id25.html[url]
[url]http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-module-pool_17.html[url]
Thank you,
Prasad G.V.K
Edited by: Craig Cmehil on Jul 1, 2008 9:48 PM
Similar Messages
-
Module pool using ABAP Objects
Hi All ,
I have a requirement for creating a transaction/module pool prog using OO ABAP .
Can you please send some sample documents to guide completely about the creation and execution of the transaction .
Rewards are assured !!
Regards,
RanjitaHi
see this code for ALV report in which we used the Modules which is similar to Module pool
OOPs ABAP uses Classes and Interfaces which uses Methods and events.
If you have Java skills it is advantage for you.
There are Local classes as well as Global Classes.
Local classes we can work in SE38 straight away.
But mostly it is better to use the Global classes.
Global Classes or Interfaces are to be created in SE24.
SAP already given some predefined classes and Interfaces.
This OOPS concepts very useful for writing BADI's also.
So first create a class in SE 24.
Define attributes, Methods for that class.
Define parameters for that Method.
You can define event handlers also to handle the messages.
After creation in each method write the code.
Methods are similar to ABAP PERFORM -FORM statements.
After the creation of CLass and methods come to SE38 and create the program.
In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
Example:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
chk this blog
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
Reward points if useful
Regards
Anji -
Tutorial for Screen programming & Module-Pool programming
Hi Experts,
I have no previous knowledge of Screen programming & Module-pool programming.
Please provide me good tutorials on those so that I can master those in a couple of days as I need to use those in my current assignment.
I require those badly.
Rewards assured.
Thanks.
Anirban.
Moderator message: please do not ask for documents or tutorials, search for available information, do not use terms that assign a higher priority to your issue compared to all others, do not promise rewards.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
Edited by: Thomas Zloch on Nov 15, 2010 2:14 PMhai guru,
use abapdocu----- tcode give ur keyword and search it.
or
sap technical .
search in sap sdn ok.
thanks.
anji -
Good afternoon.
First excuse my English is not very good.
Like to know if any have any example Program Module Pool built using the concept of OO ABAP.
For example a program with a tab control with methods to insert, update or delete in a table Z.
I have applied to programs for example report.
Or programs of ALV.
But an example of Module Pool, not thought.
I know that the concept is the same, but I would like to see a practical example.
If someone can help me I am very grateful.You may need to look into examples from demo transaction DWDM
a® -
Module Pool Programming using Abap Objects
Hi gurus.,
I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields.. plz help me with Sample Code....
Regards.,
S.SivakumarHi Marcelo Ramos.,
here is my code without using WebLOg ..
PROGRAM ZACR018_BOXKOD .
TABLES DECLARATION
TABLES: ZACT02_BOXKOD, ZACS018_STR, MARA.
CONTROLS TABC TYPE TABLEVIEW USING SCREEN 102.
END OF TABLES DECLARATION
DEFINE DYN_DECLARE_CREATE.
DATA: &1 TYPE REF TO &2.
CREATE OBJECT &1.
END-OF-DEFINITION.
CONSTANTS C_WERKS TYPE WERKS_D VALUE '7600'.
CONSTANTS C_REPID TYPE SY-REPID VALUE SY-REPID.
CONSTANTS C_VERID TYPE VERID VALUE '0001'.
CONSTANTS C_MDV01 TYPE MDV01 VALUE 'F3LB02'.
CLASS CL_TABLE_CONTROL DEFINITION.
PUBLIC SECTION.
CLASS-DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
CLASS-DATA: WA_DISPLAY TYPE ZACS018_STR.
CLASS-DATA: WA_COLS LIKE LINE OF TABC-COLS.
CLASS-METHODS M1 IMPORTING WA_C_DISPLAY TYPE ZACS018_STR EXPORTING ZACS018_STR_C TYPE ZACS018_STR.
CLASS-METHODS M2 IMPORTING ZACS018_STR_C TYPE ZACS018_STR CHANGING IT_C_DISPLAY LIKE IT_C_DISPLAY.
CLASS-METHODS M3 IMPORTING SAVE_OK TYPE SY-UCOMM CHANGING C_TABC TYPE CX_TABLEVIEW.
CLASS-METHODS M4 IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
SAVE_OK TYPE SY-UCOMM
CHANGING C_TABC TYPE CX_TABLEVIEW.
ENDCLASS.
CLASS CL_TABLE_CONTROL IMPLEMENTATION.
METHOD M1.
ZACS018_STR_C = WA_C_DISPLAY.
ENDMETHOD.
METHOD M2.
DESCRIBE TABLE IT_C_DISPLAY.
IF TABC-CURRENT_LINE > SY-TFILL.
APPEND ZACS018_STR_C TO IT_C_DISPLAY.
ELSE.
MODIFY IT_C_DISPLAY FROM ZACS018_STR_C INDEX TABC-CURRENT_LINE.
ENDIF.
ENDMETHOD.
METHOD M3.
IF SAVE_OK = 'CHECK'.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 0.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 1.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD M4.
IF MASTER_PATTERN IS INITIAL OR PATTERNSLNO IS INITIAL.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 0.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ELSE.
IF SAVE_OK NE 'CHECK'.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 1.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
INTERFACE I_DATA.
DATA: WA_MARA TYPE MARA.
DATA: WA_MARC TYPE MARC.
DATA: WA_MAST TYPE MAST.
DATA: WA_STKO TYPE STKO.
DATA: WA_MKAL TYPE MKAL.
DATA: IT_STPOX TYPE STANDARD TABLE OF STPOX.
DATA: WA_STPOX TYPE STPOX.
DATA: WA_ZACT02_BOXKOD TYPE ZACT02_BOXKOD.
DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
DATA: IT_SORT_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
DATA: WA_DISPLAY TYPE ZACS018_STR.
DATA: W_YIELD(5) TYPE P DECIMALS 2.
METHODS PARTNO_VAL IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE.
METHODS MAINBI_VAL IMPORTING MAINB TYPE ZACS018_STR-MAINB.
METHODS CAVITY_VAL IMPORTING CAVITY TYPE ZACS018_STR-CAVITY.
METHODS GET_COMP_WT IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE EXPORTING GROSSWT TYPE ZACS018_STR-GROSSWT.
METHODS NETWT_VAL IMPORTING NETWT TYPE ZACS018_STR-NETWT GROSSWT TYPE ZACS018_STR-GROSSWT.
METHODS MASPAT_VAL IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN.
METHODS PATSLNO_VAL IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
METHODS MAX_REF EXPORTING VERSNO TYPE ZACT02_BOXKOD-VERSNO.
METHODS NOOFBOX_VAL IMPORTING BMSCH TYPE ZACT02_BOXKOD-BMSCH.
METHODS TOTTIME_VAL IMPORTING VGW01 TYPE ZACT02_BOXKOD-VGW01.
METHODS TOTRUNWT IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
EXPORTING W_SUM_RUNWT LIKE ZACS018_STR-NETWT.
METHODS TOTCOMP_WT IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
EXPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT.
METHODS CHECK_OK IMPORTING SAVE_OK TYPE SY-UCOMM.
METHODS SCREEN_DISPLAY IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
SAVE_OK TYPE SY-UCOMM.
METHODS DUP_CHECK IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY.
METHODS BOX_YLD IMPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT
W_TOT_WT LIKE ZACS018_STR-NETWT
EXPORTING W_YIELD LIKE W_YIELD.
ENDINTERFACE.
CLASS CL_CONTROL_EVENTS DEFINITION.
PUBLIC SECTION.
CLASS-DATA: C_WERKS TYPE WERKS_D VALUE C_WERKS.
INTERFACES I_DATA.
ENDCLASS.
CLASS CL_CONTROL_EVENTS IMPLEMENTATION.
METHOD I_DATA~PARTNO_VAL.
SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = PARTCODE.
IF SY-SUBRC <> 0.
MESSAGE TEXT-001 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARA-MTART NE 'HALB'.
MESSAGE TEXT-002 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = PARTCODE AND
WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-003 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARC-FEVOR NE 'KOD'.
MESSAGE TEXT-004 TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
SELECT SINGLE * FROM MKAL INTO I_DATA~WA_MKAL WHERE MATNR = PARTCODE AND
WERKS = C_WERKS AND
VERID = C_VERID AND
MDV01 = C_MDV01.
IF SY-SUBRC <> 0.
MESSAGE TEXT-028 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~CAVITY_VAL.
SET CURSOR FIELD 'ZACS018_STR-CAVITY' LINE SY-STEPL.
IF CAVITY IS INITIAL.
MESSAGE TEXT-005 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MAINBI_VAL.
SET CURSOR FIELD 'ZACS018_STR-MAINB' LINE SY-STEPL.
IF MAINB IS INITIAL.
MESSAGE TEXT-006 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~GET_COMP_WT.
SET CURSOR FIELD 'ZACS018_STR-PARTCODE' LINE SY-STEPL.
*SELECT SINGLE MAST~MATNR
MAST~WERKS
MAST~STLAL
STKO~DATUV
INTO (I_DATAWA_MAST-MATNR,I_DATAWA_MAST-WERKS,I_DATAWA_MAST-STLAL,I_DATAWA_STKO-DATUV)
FROM MAST AS MAST INNER JOIN STKO AS STKO
ON STKOSTLNR = MASTSTLNR AND STKOSTLAL = MASTSTLAL
WHERE MAST~MATNR = PARTCODE AND
STKO~STLST = '1' AND
STKO~STLTY = 'M' AND
STKO~LKENZ = '' AND
STKO~LOEKZ = ''.
SELECT SINGLE * FROM MAST INTO I_DATA~WA_MAST WHERE MATNR = PARTCODE AND
STLAN = '1' AND
STLAL = '01' AND
WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-009 TYPE 'E'.
ENDIF.
*CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 50
TEXT = TEXT-007.
*WAIT UP TO 2 SECONDS.
REFRESH I_DATA~IT_STPOX.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
FTREL = 'X'
ALEKZ = ' '
ALTVO = ' '
AUFSW = ' '
AUMGB = ' '
AUMNG = 0
AUSKZ = 'X'
AMIND = ' '
BAGRP = ' '
BEIKZ = ' '
BESSL = ' '
BGIXO = 'X'
BREMS = 'X'
CAPID = 'PP01'
CHLST = ' '
COSPR = ' '
CUOBJ = 000000000000000
CUOVS = 0
CUOLS = ' '
DATUV = SY-DATUM
DELNL = SPACE
DRLDT = ' '
EHNDL = '1'
EMENG = 0
ERSKZ = ' '
ERSSL = ' '
FBSTP = ' '
KNFBA = ' '
KSBVO = ' '
MBWLS = ' '
MKTLS = 'X'
MDMPS = ' '
MEHRS = ' '
MKMAT = ' '
MMAPS = ' '
SALWW = ' '
SPLWW = ' '
MMORY = '0'
MTNRV = PARTCODE
NLINK = ' '
POSTP = ' '
RNDKZ = ' '
RVREL = ' '
SANFR = ' '
SANIN = ' '
SANKA = ' '
SANKO = ' '
SANVS = ' '
SCHGT = ' '
STKKZ = ' '
STLAL = '01'
STLAN = '1'
STPST = 0
SVWVO = 'X'
WERKS = C_WERKS
NORVL = ' '
MDNOT = ' '
PANOT = ' '
QVERW = ' '
VERID = ' '
VRSVO = 'X'
IMPORTING
TOPMAT =
DSTST =
TABLES
STB = I_DATA~IT_STPOX
MATCAT =
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_DATA~IT_STPOX INTO I_DATA~WA_STPOX.
SELECT SINGLE FEVOR FROM MARC INTO I_DATA~WA_MARC-FEVOR WHERE MATNR = I_DATA~WA_STPOX-IDNRK AND
WERKS = I_DATA~WA_STPOX-WERKS AND
FEVOR = 'MLT'.
IF SY-SUBRC EQ 0.
GROSSWT = I_DATA~WA_STPOX-MNGLG.
EXIT.
ELSE.
CLEAR GROSSWT.
ENDIF.
ENDLOOP.
IF GROSSWT IS INITIAL.
MESSAGE TEXT-008 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~NETWT_VAL.
SET CURSOR FIELD 'ZACS018_STR-NETWT' LINE SY-STEPL.
IF NETWT IS INITIAL.
MESSAGE TEXT-010 TYPE 'E'.
ELSE.
IF NETWT >= GROSSWT.
MESSAGE TEXT-011 TYPE 'E'.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MASPAT_VAL.
IF MASTER_PATTERN IS INITIAL.
MESSAGE TEXT-014 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = MASTER_PATTERN.
IF SY-SUBRC <> 0.
MESSAGE TEXT-001 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARA-MTART NE 'FHMI'.
MESSAGE TEXT-012 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = MASTER_PATTERN AND
WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-003 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARC-FEVOR NE 'MLD'.
MESSAGE TEXT-013 TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~PATSLNO_VAL.
IF PATTERNSLNO IS INITIAL.
MESSAGE TEXT-016 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
AND PATTERNSLNO = PATTERNSLNO.
IF SY-SUBRC EQ 0.
MESSAGE TEXT-015 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MAX_REF.
SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO.
VERSNO = VERSNO + 1.
ENDMETHOD.
METHOD I_DATA~NOOFBOX_VAL.
IF BMSCH IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-PRD_ACT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-SHOTS'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
MESSAGE TEXT-017 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~TOTTIME_VAL.
IF VGW01 IS INITIAL.
MESSAGE TEXT-018 TYPE 'E'.
ENDIF.
IF VGW01 > 480.
MESSAGE TEXT-019 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~TOTRUNWT.
CLEAR W_SUM_RUNWT.
LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
W_SUM_RUNWT = W_SUM_RUNWT + I_DATA~WA_DISPLAY-NETWT * I_DATA~WA_DISPLAY-CAVITY.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~TOTCOMP_WT.
CLEAR W_SUM_COMPWT.
LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
W_SUM_COMPWT = W_SUM_COMPWT + I_DATA~WA_DISPLAY-GROSSWT * I_DATA~WA_DISPLAY-CAVITY.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~CHECK_OK.
IF SAVE_OK = 'CHECK'.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD I_DATA~SCREEN_DISPLAY.
IF MASTER_PATTERN IS INITIAL
OR PATTERNSLNO IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
IF SAVE_OK NE 'CHECK'.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~DUP_CHECK. " IMPORTING IT_C_DISPLAY
DATA: W_PARTCODE LIKE I_DATA~WA_DISPLAY-PARTCODE.
I_DATA~IT_SORT_DISPLAY = IT_C_DISPLAY.
SORT I_DATA~IT_SORT_DISPLAY BY PARTCODE.
CLEAR W_PARTCODE.
LOOP AT I_DATA~IT_SORT_DISPLAY INTO I_DATA~WA_DISPLAY.
IF W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
MESSAGE TEXT-027 TYPE 'E'.
ENDIF.
W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~BOX_YLD.
W_YIELD = ( W_SUM_COMPWT / W_TOT_WT ) * 100.
ENDMETHOD.
ENDCLASS.
inherited class for edit mode
CLASS CL_CONTROL_EDIT DEFINITION INHERITING FROM CL_CONTROL_EVENTS .
PUBLIC SECTION.
METHODS GET_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
EXPORTING VERSNO TYPE ZACT02_BOXKOD-VERSNO
CHANGING ZACT02_BOXKOD TYPE ZACT02_BOXKOD
IT_C_DISPLAY LIKE I_DATA~IT_C_DISPLAY
IT_DEL_DISPLAY LIKE I_DATA~IT_C_DISPLAY
TABC TYPE CX_TABLEVIEW.
METHODS PATSLNO_VAL_CHG IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
ENDCLASS.
CLASS CL_CONTROL_EDIT IMPLEMENTATION.
METHOD GET_DATA.
IF MASTER_PATTERN IS NOT INITIAL AND PATTERNSLNO IS NOT INITIAL.
IF IT_C_DISPLAY IS INITIAL.
IF IT_DEL_DISPLAY IS INITIAL.
SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO WHERE
MASTER_PATTERN = MASTER_PATTERN AND
PATTERNSLNO = PATTERNSLNO.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
MASTER_PATTERN = MASTER_PATTERN AND
PATTERNSLNO = PATTERNSLNO AND
VERSNO = VERSNO..
SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
MASTER_PATTERN = MASTER_PATTERN AND
PATTERNSLNO = PATTERNSLNO AND
VERSNO = VERSNO.
IT_DEL_DISPLAY[] = IT_C_DISPLAY[].
DESCRIBE TABLE IT_C_DISPLAY.
TABC-LINES = SY-TFILL.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD PATSLNO_VAL_CHG.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
AND PATTERNSLNO = PATTERNSLNO.
IF PATTERNSLNO IS INITIAL.
MESSAGE TEXT-016 TYPE 'E'.
ENDIF.
IF SY-SUBRC <> 0.
MESSAGE TEXT-022 TYPE 'E'.
ENDIF.
ENDMETHOD.
ENDCLASS.
inheriting for display
CLASS CL_CONTROL_DISPLAY DEFINITION INHERITING FROM CL_CONTROL_EDIT .
PUBLIC SECTION.
METHODS GET_DISPLAY_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
VERSNO TYPE ZACT02_BOXKOD-VERSNO
CHANGING IT_C_DISPLAY LIKE I_DATA~IT_C_DISPLAY
ZACT02_BOXKOD TYPE ZACT02_BOXKOD
TABC TYPE CX_TABLEVIEW.
ENDCLASS.
CLASS CL_CONTROL_DISPLAY IMPLEMENTATION.
METHOD GET_DISPLAY_DATA.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
MASTER_PATTERN = MASTER_PATTERN AND
PATTERNSLNO = PATTERNSLNO AND
VERSNO = VERSNO..
IF SY-SUBRC <> 0.
MESSAGE TEXT-026 TYPE 'E'.
ENDIF.
SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
MASTER_PATTERN = MASTER_PATTERN AND
PATTERNSLNO = PATTERNSLNO AND
VERSNO = VERSNO.
DESCRIBE TABLE IT_C_DISPLAY.
TABC-LINES = SY-TFILL.
ENDMETHOD.
ENDCLASS.
DATA: O_CONTROL_EVENTS TYPE REF TO CL_CONTROL_EVENTS.
DATA: O_CONTROL_EVENTS_EDIT TYPE REF TO CL_CONTROL_EDIT.
DATA: O_CONTROL_EVENTS_DISPLAY TYPE REF TO CL_CONTROL_DISPLAY.
SELECTION SCREEN
END OF SELECTION SCREEN
VARIABLE DECLARATION BEGIN WITH W_
DATA: OK_CODE TYPE SY-UCOMM,
SAVE_OK TYPE SY-UCOMM.
DATA: W_TOT_WT LIKE ZACS018_STR-NETWT,
W_SUM_COMPWT LIKE ZACS018_STR-NETWT,
W_SUM_RUNWT LIKE ZACS018_STR-NETWT,
W_YIELD(5) TYPE P DECIMALS 2.
DATA: W_TIMLO TYPE SY-TIMLO,
W_MODE TYPE SY-UCOMM.
DATA: W_SCREEN_NO TYPE SY-DYNNR.
END OF VARIABLE DECLARATION
WORK AREAS DECLARATION BEGIN WITH WA_
DATA: WA_DISPLAY TYPE ZACS018_STR.
END OF WORK AREAS DECLARATION
INTERNAL TABLES BEGIN WITH IT_
DATA: IT_DISPLAY TYPE ZACS018_STR OCCURS 0.
DATA: IT_DISPLAY_PRD TYPE ZACS018_STR OCCURS 0.
DATA: IT_DEL_DISPLAY TYPE ZACS018_STR OCCURS 0.
DATA: IT_ZACT02_BOXKOD TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
DATA: IT_ZACT02_BOXKOD_DEL TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF IT_F4MASTERPAT OCCURS 0,
MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
END OF IT_F4MASTERPAT.
DATA: BEGIN OF IT_F4PATSLNO OCCURS 0,
MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
PATTERNSLNO LIKE ZACT02_BOXKOD-PATTERNSLNO,
VERSNO LIKE ZACT02_BOXKOD-VERSNO,
END OF IT_F4PATSLNO.
DATA: IT_EXCLUDE TYPE TABLE OF SY-UCOMM..
DATA : IT_DYNPRO LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
END OF INTERNAL TABLES DECLARATIONS
LOAD-OF-PROGRAM.
CREATE OBJECT O_CONTROL_EVENTS.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
W_MODE = SAVE_OK.
CASE SAVE_OK.
WHEN 'CREATE'.
CALL SCREEN 101.
WHEN 'CHANGE'.
CREATE OBJECT O_CONTROL_EVENTS_EDIT.
CALL SCREEN 101.
WHEN 'DISPLAY'.
APPEND 'SAVE' TO IT_EXCLUDE.
APPEND 'CHECK' TO IT_EXCLUDE.
APPEND 'ADD' TO IT_EXCLUDE.
CREATE OBJECT O_CONTROL_EVENTS_DISPLAY.
CALL SCREEN 101.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0102 OUTPUT
text
MODULE STATUS_0102 OUTPUT.
CALL METHOD CL_TABLE_CONTROL=>M3 EXPORTING SAVE_OK = SAVE_OK CHANGING C_TABC = TABC.
CALL METHOD O_CONTROL_EVENTS->I_DATA~CHECK_OK EXPORTING SAVE_OK = SAVE_OK.
CALL METHOD O_CONTROL_EVENTS->I_DATA~SCREEN_DISPLAY EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
SAVE_OK = SAVE_OK.
CALL METHOD CL_TABLE_CONTROL=>M4 EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
SAVE_OK = SAVE_OK
CHANGING C_TABC = TABC.
DESCRIBE TABLE IT_DISPLAY.
IF TABC-LINES <= 1.
IF SY-TFILL = 0.
TABC-LINES = 1.
ENDIF.
ENDIF.
IF SAVE_OK NE 'CHECK'.
IF ZACT02_BOXKOD-TOOL_ACT <> 'X'.
CLEAR ZACT02_BOXKOD-PRD_ACT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTRUNWT EXPORTING IT_C_DISPLAY = IT_DISPLAY
IMPORTING W_SUM_RUNWT = W_SUM_RUNWT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTCOMP_WT EXPORTING IT_C_DISPLAY = IT_DISPLAY
IMPORTING W_SUM_COMPWT = W_SUM_COMPWT.
CLEAR W_TOT_WT.
W_TOT_WT = W_SUM_RUNWT + W_SUM_COMPWT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~BOX_YLD EXPORTING W_SUM_COMPWT = W_SUM_COMPWT
W_TOT_WT = W_TOT_WT
IMPORTING W_YIELD = W_YIELD.
IF W_MODE <> 'CREATE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-SHOTS'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF W_MODE = 'DISPLAY'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ADD' OR SCREEN-NAME = 'ICON_DELETE'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0102 OUTPUT
*& Module STATUS_0101 OUTPUT
text
MODULE STATUS_0101 OUTPUT.
SET PF-STATUS 'STANDARD' EXCLUDING 'SAVE'.
IF W_MODE = 'CREATE'.
SET TITLEBAR 'STANDARD'.
ELSEIF W_MODE = 'DISPLAY'.
SET TITLEBAR 'STD_DIS'.
ELSE.
SET TITLEBAR 'STD_EDIT'.
ENDIF.
IF SAVE_OK = 'CHECK'.
DESCRIBE TABLE IT_DISPLAY.
IF SY-TFILL > 0.
SET PF-STATUS 'STANDARD'.
ENDIF.
ENDIF.
IF W_MODE = 'DISPLAY'.
SET PF-STATUS 'STANDARD' EXCLUDING IT_EXCLUDE.
ENDIF.
IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
ZACT02_BOXKOD-PATTERNSLNO IS NOT INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'TOP'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF W_MODE = 'DISPLAY'.
IF ZACT02_BOXKOD-VERSNO IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0101 OUTPUT
*& Module USER_COMMAND_0102 INPUT
text
MODULE USER_COMMAND_0102 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'ADD'.
DESCRIBE TABLE IT_DISPLAY.
IF SY-TFILL >= TABC-LINES.
IF TABC-LINES < 16.
TABC-LINES = SY-TFILL + 1.
ENDIF.
ENDIF.
WHEN 'DEL'.
LOOP AT IT_DISPLAY INTO WA_DISPLAY WHERE MARK = 'X'.
DELETE IT_DISPLAY INDEX SY-TABIX.
ENDLOOP.
DESCRIBE TABLE IT_DISPLAY.
IF SY-TFILL >= 1.
TABC-LINES = SY-TFILL.
ELSE.
TABC-LINES = 1.
ENDIF.
WHEN 'CHECK'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~DUP_CHECK EXPORTING IT_C_DISPLAY = IT_DISPLAY.
WHEN 'SAVE'.
W_TIMLO = SY-TIMLO.
IF W_MODE = 'CREATE'.
PERFORM CREATE_SAVE.
ENDIF.
IF W_MODE = 'CHANGE'.
PERFORM EDIT_SAVE.
ENDIF.
ENDCASE.
IF W_MODE = 'DISPLAY'.
SAVE_OK = 'CHECK'.
ENDIF.
ENDMODULE. " USER_COMMAND_0102 INPUT
*& Module MOD_TABLE INPUT
text
MODULE MOD_TABLE INPUT.
CALL METHOD CL_TABLE_CONTROL=>M2 EXPORTING ZACS018_STR_C = ZACS018_STR CHANGING IT_C_DISPLAY = IT_DISPLAY.
ENDMODULE. " MOD_TABLE INPUT
*& Module ASSIGN OUTPUT
text
MODULE ASSIGN OUTPUT.
CALL METHOD CL_TABLE_CONTROL=>M1 EXPORTING WA_C_DISPLAY = WA_DISPLAY IMPORTING ZACS018_STR_C = ZACS018_STR.
ENDMODULE. " ASSIGN OUTPUT
*& Module CHK_PARTCODE INPUT
text
MODULE CHK_PARTCODE INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~PARTNO_VAL EXPORTING PARTCODE = ZACS018_STR-PARTCODE.
ENDMODULE. " CHK_PARTCODE INPUT
*& Module CHK_CAVITY INPUT
text
MODULE CHK_CAVITY INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~CAVITY_VAL EXPORTING CAVITY = ZACS018_STR-CAVITY.
ENDMODULE. " CHK_CAVITY INPUT
*& Module CHK_MAINB INPUT
text
MODULE CHK_MAINB INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MAINBI_VAL EXPORTING MAINB = ZACS018_STR-MAINB.
ENDMODULE. " CHK_MAINB INPUT
*& Module GET_COMP_WT INPUT
text
MODULE GET_COMP_WT INPUT.
IF W_MODE <> 'DISPLAY'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~GET_COMP_WT EXPORTING PARTCODE = ZACS018_STR-PARTCODE
IMPORTING GROSSWT = ZACS018_STR-GROSSWT.
ENDIF.
ENDMODULE. " GET_COMP_WT INPUT
*& Module CHK_NETWT INPUT
text
MODULE CHK_NETWT INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~NETWT_VAL EXPORTING NETWT = ZACS018_STR-NETWT
GROSSWT = ZACS018_STR-GROSSWT.
ENDMODULE. " CHK_NETWT INPUT
*& Module CHK_MPAT INPUT
text
MODULE CHK_MPAT INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MASPAT_VAL EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN.
ENDMODULE. " CHK_MPAT INPUT
*& Module CHK_SLNO INPUT
text
MODULE CHK_SLNO INPUT.
IF W_MODE = 'CREATE'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~PATSLNO_VAL EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
ELSEIF W_MODE = 'CHANGE' .
CALL METHOD O_CONTROL_EVENTS_EDIT->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
CALL METHOD O_CONTROL_EVENTS_EDIT->GET_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
IMPORTING VERSNO = ZACT02_BOXKOD-VERSNO
CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
IT_C_DISPLAY = IT_DISPLAY
IT_DEL_DISPLAY = IT_DEL_DISPLAY
TABC = TABC.
ELSE.
CALL METHOD O_CONTROL_EVENTS_DISPLAY->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
ENDIF.
ENDMODULE. " CHK_SLNO INPUT
*& Module MAX_VER INPUT
text
MODULE MAX_VER INPUT.
IF W_MODE = 'CREATE'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MAX_REF IMPORTING VERSNO = ZACT02_BOXKOD-VERSNO.
ENDIF.
IF W_MODE = 'DISPLAY'.
IF ZACT02_BOXKOD-VERSNO IS INITIAL.
MESSAGE TEXT-023 TYPE 'E'.
ENDIF.
IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
ZACT02_BOXKOD-PATTERNSLNO IS NOT INITIAL AND
ZACT02_BOXKOD-VERSNO IS NOT INITIAL.
CALL METHOD O_CONTROL_EVENTS_DISPLAY->GET_DISPLAY_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
VERSNO = ZACT02_BOXKOD-VERSNO
CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
IT_C_DISPLAY = IT_DISPLAY
TABC = TABC.
ENDIF.
ENDIF.
ENDMODULE. " MAX_VER INPUT
*& Module CHK_NOBOXES INPUT
text
MODULE CHK_NOBOXES INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~NOOFBOX_VAL EXPORTING BMSCH = ZACT02_BOXKOD-BMSCH.
ENDMODULE. " CHK_NOBOXES INPUT
*& Module CHK_TOTTIME INPUT
text
MODULE CHK_TOTTIME INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTTIME_VAL EXPORTING VGW01 = ZACT02_BOXKOD-VGW01.
ENDMODULE. " CHK_TOTTIME INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'INITIAL'.
SET TITLEBAR 'STANDARD_MAIN'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module EXIT_PROGRAM INPUT
text
MODULE EXIT_PROGRAM INPUT.
LEAVE TO TRANSACTION 'ZAC16'.
ENDMODULE. " EXIT_PROGRAM INPUT -
Links/Docs for Module Pool Programing using abap objects
Hi all,
Can anyone send me links/docs related to Module Pool programing using Abap Objects.
Thanks n Regards
Maruthi Rao. Ahi maruthi rao,
check the below link
http://abapcode.blogspot.com/2007/06/object-oriented-alv-sample-program-to.html -
Building Module Pool using Objects ?
Hi,
I want to develop custom module pool programs / transactions, using ABAP Objects, can anybody please provide me some sample abap code ( or links ) or coding conventions to develop a custom transaction using ABAP objects.
thanks and regards,
Navneeth K.Hi Navneeth,
<b>Please check out this below Module Pool
SAPM00PS_WB</b>
HR PS : Process Workbench Engine ( PWE)
This Program seems to be a good example
SAPSIMPLE_TREE_CONTROL_DEMO
++++++
DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
DEMO_ABAP_OBJECTS_DIALOG_BOX Splitter Control for Screen with Dialog Box
DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
<b>Try out Transaction
ABAPDOCU
Or better in SE38
DEMO* and press F4</b>
Regards,
ABY -
Uploding sub screens in module pool programs
HI,
Can any one help in uploading sub screens in module pool program .
Regards,
Mahendra.Hi
Debugging of module pool is same as reports, use /h or put breakpoint
but u shud know what u want to check
there are generally two event used in module pool
PBO
This event is used before displaying the screen,It is used to clear fields table, show table control, tabstrip and most important conditionally modify the scrren .
PAI
is used to validate the fields which are entered on the screen with database values and then fetch records from table.
i mean all values to make available in internal table
now u would be sure which part u want to debug.
<REMOVED BY MODERATOR>
Regards,
Chandru
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 6:19 PM -
Call report selection screen in module pool program with tab strip control
Hi,
Could anyone explain in detail to call report selection screen in module pool program with tab strip control.
Thanks
ManoHi,
Refer std program:
demo_sel_screen_in_tabstrip.
demo_sel_screen_with_tabstrip.
Call your program with SUBMIT stmt form module program.
Reward points if this Helps.
Manish -
Is it possible to print the current screen in Module pool program(Dynpro)?
Is it possible to print the current screen in Module pool program(Dynpro)?
I create a Module pool program , and customer hope can print the screen when they click print button, Is it possible?Does the customer want a screen shot or what? Please elaborate on your requirement.
Maybe you should create a smartform first, which is called when one clicks on print button. But in fact, we need a bit more info than this. -
Advanced ALV using ABAP objects
Hi All ABAPers,
I have a question in Advanced ALV using ABAP objects.Can we display the output ie., ALV Grid without defining the custom cointainer?ie., just as we do in the classical ALV without defining any screens.Can we do that as a normal executable program ie., without using module pool programming.Please give me a solution.
Thanks & Regards,
Chaitanya.If you want editable grids then the cl_salv_table method won't unfortunately be of use since (currently) there's no editable facility / method.
So if you are using cl_gui_alv_grid here's how to "get round" the problem.
I'm essentially using my own alv class which is a reference to cl_gui_alv_grid but the methodology shown here is quite simple.
What you can do is to create a method which calls a function module for example ZZ_CALL_SCREEN so you only have to code a Screen and a GUI in ONE function module and not in every ALV report.
for example you could create something like this
My version has the option of 2 screens - so when I double click on a cell in one grid I can perform some actions and then display a 2nd grid before returning back to the ist grid.You can easily modify this to suit your applications.
The parameters are fairly self evident from the code. You can just use this as a model for your own applications.
I agree that having to code a separate screen and GUI for OO ALV GRID reports was for some people a "show stopper" in switching from the old SLIS to OO ALV reports.
I Hope if any SAP development guys are reading this PLEASE PROVIDE EDITABLE FUNCTIONALITY IN THE NEW CL_SALV_TABLE class. Thanks in advance.
method display_data.
call function 'ZZ_CALL_SCREEN'
exporting
screen_number = screen_number
program = program
title_text = title_text
i_gridtitle = i_gridtitle
i_zebra = i_zebra
i_edit = i_edit
i_opt = i_opt
i_object = z_object
changing
e_ucomm = e_ucomm
it_fldcat = it_fldcat
gt_outtab = gt_outtab.
e_ucomm = sy-ucomm.
endmethod.
function zz_call_screen .
*"*"Local interface:
*" IMPORTING
*" REFERENCE(SCREEN_NUMBER) TYPE SY-DYNNR
*" REFERENCE(PROGRAM) TYPE SY-REPID
*" REFERENCE(TITLE_TEXT) TYPE CHAR50
*" REFERENCE(I_GRIDTITLE) TYPE LVC_TITLE
*" REFERENCE(I_ZEBRA) TYPE LVC_ZEBRA
*" REFERENCE(I_EDIT) TYPE LVC_EDIT
*" REFERENCE(I_OPT) TYPE LVC_CWO
*" REFERENCE(I_OBJECT) TYPE REF TO ZZHR_ALV_GRID
*" CHANGING
*" REFERENCE(E_UCOMM) TYPE SY-UCOMM
*" REFERENCE(IT_FLDCAT) TYPE LVC_T_FCAT
*" REFERENCE(GT_OUTTAB) TYPE STANDARD TABLE
assign gt_outtab to <dyn_table>.
move title_text to screen_title.
assign i_object to <zogzilla>.
export <dyn_table> to memory id 'dawggs'.
export i_gridtitle to memory id 'i_gridtitle'.
export i_edit to memory id 'i_edit'.
export i_zebra to memory id 'i_zebra'.
export i_opt to memory id 'í_opt'.
export it_fldcat to memory id 'it_fldcat'.
case screen_number.
when '100'.
call screen 100.
when '200'.
call screen 200.
endcase.
endfunction.
process before output.
module status_0100.
process after input.
module user_command_0100.
rocess before output.
module status_0200.
process after input.
module user_command_0200.
* INCLUDE LZHR_MISCO01 *
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
import <dyn_table> from memory id 'dawggs'.
import i_gridtitle from memory id 'i_gridtitle'.
import i_edit from memory id 'i_edit'.
import i_opt from memory id 'í_opt'.
import it_fldcat from memory id 'it_fldcat'.
i_object = <zogzilla>.
call method i_object->display_grid
exporting
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
i_opt = i_opt
g_fldcat = it_fldcat
g_outtab = <dyn_table>
changing
it_fldcat = it_fldcat
gt_outtab = <dyn_table>.
set pf-status '001'.
set titlebar '000' with screen_title.
endmodule. " STATUS_0100 OUTPUT
*& Module STATUS_0200 OUTPUT
* text
module status_0200 output.
import <dyn_table> from memory id 'dawggs'.
import i_gridtitle from memory id 'i_gridtitle'.
import i_edit from memory id 'i_edit'.
import i_opt from memory id 'í_opt'.
import it_fldcat from memory id 'it_fldcat'.
i_object = <zogzilla>.
call method i_object->display_grid
exporting
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
i_opt = i_opt
g_fldcat = it_fldcat
g_outtab = <dyn_table>
changing
it_fldcat = it_fldcat
gt_outtab = <dyn_table>.
set pf-status '001'.
set titlebar '000' with screen_title.
endmodule. " STATUS_0200 OUTPUT
* INCLUDE LZHR_MISCI01 *
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave program.
when 'RETURN'.
leave program.
when others.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Module USER_COMMAND_0200 INPUT
* text
module user_command_0200 input.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave program.
when 'RETURN'.
leave program.
when others.
endcase.
endmodule. " USER_COMMAND_0200 INPUT
Cheers
jimbo -
ALV Tree Report without using ABAP Objects
Hi all,
I want to know the name of a function module to create ALV Tree in SE38 as a report. I am required to create this ALV Tree Report without using ABAP OBJECTS. Can u pls help me as early as possible.Hi
see this link
http://www.sapdev.co.uk/reporting/alv/alvtree.htm
*& Report ZBCALV_TREE
REPORT ZBCALV_TREE.
class cl_gui_column_tree definition load.
class cl_gui_cfw definition load.
data tree1 type ref to cl_gui_alv_tree.
data mr_toolbar type ref to cl_gui_toolbar.
include <icon>.
include bcalv_toolbar_event_receiver.
include bcalv_tree_event_receiver.
data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
data: gt_VBAK type VBAK occurs 0, "Output-Table
gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
ok_code like sy-ucomm. "OK-Code
start-of-selection.
end-of-selection.
call screen 100.
*& Module STATUS_0100 OUTPUT
text
module STATUS_0100 output.
SET PF-STATUS 'MAIN'.
if tree1 is initial.
perform Zinit_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " STATUS_0100 OUTPUT
*& Form Zinit_tree
text
--> p1 text
<-- p2 text
form Zinit_tree .
perform Zbuild_fieldcatalog.
create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_tree_container_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
endif.
create tree control
create object tree1
exporting
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_html_header = ''
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform zbuild_hierarchy_header changing l_hierarchy_header.
create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform Zbuild_comment using
lt_list_commentary
l_logo.
repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
create emty tree-control
call method tree1->set_table_for_first_display
exporting
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
changing
it_outtab = gt_VBAK "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
create hierarchy
perform Zcreate_hierarchy.
add own functioncodes to the toolbar
perform zchange_toolbar.
register events
perform zregister_events.
endform. " Zinit_tree
*& Form Zbuild_fieldcatalog
text
--> p1 text
<-- p2 text
form Zbuild_fieldcatalog .
get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'VBAK'
changing
ct_fieldcat = gt_fieldcatalog.
sort gt_fieldcatalog by scrtext_l.
change fieldcatalog
data: ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'AUART' .
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
endform. " Zbuild_fieldcatalog
*& Form zbuild_hierarchy_header
text
<--P_L_HIERARCHY_HEADER text
form zbuild_hierarchy_header changing
p_hierarchy_header type treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
endform. " zbuild_hierarchy_header
*& Form Zbuild_comment
text
-->P_LT_LIST_COMMENTARY text
-->P_L_LOGO text
form Zbuild_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree-demo: flight-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
STATUS LINE: TYPE S
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ACTION LINE: TYPE A
clear ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
append ls_line to pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
endform. " Zbuild_comment
*& Form Zcreate_hierarchy
text
--> p1 text
<-- p2 text
form Zcreate_hierarchy .
data: ls_vbak type vbak,
lt_vbak type vbak occurs 0.
get data
select * from vbak into table lt_vbak
up to 200 rows . "#EC CI_NOWHERE
sort lt_vbak by AUART.
add data to tree
data: l_AUART_key type lvc_nkey.
loop at lt_vbak into ls_vbak.
on change of ls_vbak-AUART.
perform Zadd_AUART_line using ls_vbak
changing l_AUART_key.
endon.
endloop.
calculate totals
call method tree1->update_calculations.
this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " Zcreate_hierarchy
*& Form Zadd_AUART_line
text
-->P_LS_vbak text
-->P_0379 text
<--P_L_AUART_KEY text
form Zadd_AUART_line using p_ls_vbak type vbak
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_vbak type vbak.
set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
add node
l_node_text = p_ls_vbak-AUART.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_vbak
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key .
endform. " Zadd_AUART_line
*& Form zchange_toolbar
text
--> p1 text
<-- p2 text
form zchange_toolbar .
get toolbar control
call method tree1->get_toolbar_object
importing
er_toolbar = mr_toolbar.
check not mr_toolbar is initial.
add seperator to toolbar
call method mr_toolbar->add_button
exporting
fcode = ''
icon = ''
butn_type = cntb_btype_sep
text = ''
quickinfo = 'This is a Seperator'. "#EC NOTEXT
add Standard Button to toolbar (for Delete Subtree)
call method mr_toolbar->add_button
exporting
fcode = 'DELETE'
icon = '@18@'
butn_type = cntb_btype_button
text = ''
quickinfo = 'Delete subtree'. "#EC NOTEXT
add Dropdown Button to toolbar (for Insert Line)
call method mr_toolbar->add_button
exporting
fcode = 'INSERT_LC'
icon = '@17@'
butn_type = cntb_btype_dropdown
text = ''
quickinfo = 'Insert Line'. "#EC NOTEXT
set event-handler for toolbar-control
create object toolbar_event_receiver.
set handler toolbar_event_receiver->on_function_selected
for mr_toolbar.
set handler toolbar_event_receiver->on_toolbar_dropdown
for mr_toolbar.
endform. " zchange_toolbar
*& Form zregister_events
text
--> p1 text
<-- p2 text
form zregister_events .
define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append l_event to lt_events.
call method tree1->set_registered_events
exporting
events = lt_events
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
set Handler
data: l_event_receiver type ref to lcl_tree_event_receiver.
create object l_event_receiver.
set handler l_event_receiver->handle_node_ctmenu_request
for tree1.
set handler l_event_receiver->handle_node_ctmenu_selected
for tree1.
set handler l_event_receiver->handle_item_ctmenu_request
for tree1.
set handler l_event_receiver->handle_item_ctmenu_selected
for tree1.
endform. " zregister_events
*& Module USER_COMMAND_0100 INPUT
text
module USER_COMMAND_0100 input.
ok_code = sy-ucomm.
clear sy-ucomm.
case ok_code.
when 'EXIT' or 'BACK' or 'CANC'.
perform Zexit_program.
when others.
call method cl_gui_cfw=>dispatch.
endcase.
clear ok_code.
call method cl_gui_cfw=>flush.
endmodule. " USER_COMMAND_0100 INPUT
*& Form Zexit_program
text
--> p1 text
<-- p2 text
form Zexit_program .
call method tree1->free.
leave program.
endform. " Zexit_program
<b>Reward if usefull</b> -
Selection- screen in module pool
hi all,
how to create selection screen in module pool programing,
in screen attributes of module pool, 4 screens are present, but selection screen radio button has been disabled.
how to work by using selection screen radio button.
Regards
SuprithHI Suprith,
You ll find a LAYOUT button on the application tool bar just click that button sceen painter sceen will be opend there you have to design your selection screen. Letf side of the sceen painter you see the options use the options as per your requiment and activate . If you are using module pool program go to SE93 create the t-code and give the program name and the screen name which you have created in se51.
hope this will help you...
reward if useful
regards,
sunil kairam. -
Upload an excel file input into an itab,display in ALV using ABAP objects
Requirement:
Create a selection screen which takes an excel file as input with parameters emp id, emp name, salary, mnth, ph no.
Create a database table with the same fields.
The program needs to have two modes. Display mode and update mode.
Display mode only displays the file data in alv grid and update mode updates database table with similar parameters as above and also shows alv grid output.
task is to do using Object oriented approach. This should also have the facility to modify the cell values in ALV grid and once saved then it needs to update the database accordingly.
I have done the same functionality in a report program without using ABAP objects but finding difficulty in using object oriented approach.Please help me as i am new to abap-objects.
Thanks in advance.......Hi,
The selection screen design and all remains the same.
Get all the detials which you need in your final internal table.
This internal table will be used to display in the ALV grid.
The approach remains the same as the normal programing.
Prepare a field catalog table and then use it along with the internal table to display in the grid.
The only change is that instead of FM you will have to make us of classes and their methods.
Firstly you will have to create a screen.
On this screen create a custom control object and give it some name. say for eg. CC_CONTAINER.
This will be a container on which the ALV grid object will be placed.
2 objects are needed to display the grid
CL_GUI_CUSTOM_CONTAINER and CL_GUI_ALV_GRID.
In the PBO of the screen first create an instance of object CL_GUI_CUSTOM_CONTAINER
CREATE OBJECT y_lobj_cont
EXPORTING
container_name = 'CC_CONTAINER'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Then create a instance of the GRID
IF y_lobj_grid IS INITIAL.
CREATE OBJECT y_lobj_grid
EXPORTING
i_parent = y_lobj_cont
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5 .
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Then call the method SET_TABLE_FOR_FIRST_DISPLAY to display the grid.
CALL METHOD y_lobj_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = y_v_lt_exclude
CHANGING
it_outtab = y_li_tbl
it_fieldcatalog = y_li_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Check the example program BCALV_GRID_EDIT for better understanding.
Regards,
Ankur Parab -
How to set the size of the screen in module pool.
how to edit the actual size of the screen in module pool programing.
Hi purshothaman,
1. use the FM RPY_DYNPRO_READ
2. Pass the programname and screen number
3. We will get back various values in HEADER structure
LINES
COLUMNS
regards,
amit m.
Maybe you are looking for
-
Confuse about Configuring Oracle Warehouse Builder
newbie here... i am abit confuse on how to configure the Oracle Warehouse builder... I have 2 database... 1 source and 1 new one... I understand that i have to install the Runtime Repository in the database computer and the Target Schema through the
-
Limit contacts to phone numbers only
Is there a way to limit the contacts list to phone numbers only instead of having it list people by phone and all of the email addresses that aren't associated with email addresses?
-
Camera and Video will not open
I get a screen message" Could not start the camera. Close other applications and try opening the camera again" I have a 4 GB card installed. have used the camera to take 5 pictures, saving them to the card. I have e-mailed one picture, and used one
-
Itunes would not open. Deleted it and tried to reinstall it. Got message "The installer has insufficient privildges to access the directory :C:\Program Files (x86)\itunes. The installation cannont continue. Log on as administrator or contact you s
-
I have installed OS X Lion and noticed 2 issues with Quicktime. 1) If I quit Quicktime with cmd+q, the next time I open Quicktime my previous video is loaded again together with the new opened video. Only clicking the close button will prevent the vi