04-09-2015 11:23 AM
Hello Folks,
I have a requirement to enhance a Transaction IW32.
IW32 already have an Enhancement tab and there is a screen area attached to it "SAPLXWOC 0900"...Now based on a condition i need to show an ALV inside the area of the enhancement tab.
Please let me know how can the screen of the enhancement tab be changed.Also attaching the screenshot of SMOD:Enhancement :IWO10018.
Thanks in Advance.
04-09-2015 1:00 PM
Create a project, attach the enhancement, create the exit dynpro, put an area in it, add logic in PBO to display the ALV in the area, receive/export parameters between function group exit and main program with the two includes of provided FM (one pre-PBO, second post-PAI) also navigate to global data of exit function group and locate the available ZX...TOP include to store data to receive/to export as well as communication, with dynpro, activate project, test, correct, test, correct, transport.
Hint: In transaction CMOD don't be afraid to use double-click to navigate/create zincludes/dynpro,and to press Enter when the usual unecessary warnings are raised...
Regards,
Raymnd
04-09-2015 1:01 PM
Go to SE80 and find Function Group XWOC, you will find your screen no and all the includes.
here EXIT_SAPLCOIH_018 can be used to get the values from the screen to your custom screen
and EXIT_SAPLCOIH_019 can be used to send the data to the screen from your custom screen.
Hope this helps.
04-09-2015 1:34 PM
Hi Former Member,
My requiremnt is use an ALV instead to of the screen used in the enhancement (SAPLXWOC 0900)..Any suggestions for that?
04-09-2015 1:39 PM
You can use custom container on that screen and use object (CL_SALV) to create ALV on that screen.
06-06-2016 7:24 AM
Go to SE80 and find Function Group XWOC, you will find your screen no and all the includes.
here EXIT_SAPLCOIH_018 can be used to get the values from the screen to your custom screen
and EXIT_SAPLCOIH_019 can be used to send the data to the screen from your custom screen.
----------------------------------------------------------ZWOCTOP--------------------------------------------------
*----------------------------------------------------------------------*
***INCLUDE ZXWOCTOP.
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: ok_code LIKE sy-ucomm,
save_ok like sy-ucomm,
g_container TYPE scrfname VALUE 'CONT1',
g_custom_container TYPE REF TO cl_gui_custom_container,
gs_layout TYPE lvc_s_layo,
g_max type i value 100.
TABLES:ZPM_OPER_Time.
CLASS LCL_GRID_EVENT_RECEIVER DEFINITION DEFERRED.
*DATA: G_EVENT_RECEIVER TYPE REF TO LCL_GRID_EVENT_RECEIVER.
*class ZCl_sub_cl_gui_alv_grid DEFINITION DEFERRED.
*CLASS ZCLTEST DEFINITION INHERITING FROM CL_GUI_ALV_GRID.
**
** define this as a subclass so we can access the protected attributes
** of the superclass cl_gui_alv_grid
* PUBLIC SECTION.
* METHODS: CONSTRUCTOR, DISP_TAB.
*ENDCLASS.
*CLASS ZCLTEST IMPLEMENTATION.
* METHOD CONSTRUCTOR.
* CALL METHOD SUPER->CONSTRUCTOR
* EXPORTING
* I_APPL_EVENTS = 'X'
* I_PARENT = g_custom_container.
* .
* ENDMETHOD.
*
*METHOD DISP_TAB.
*
*ENDMETHOD.
*ENDCLAS
TYPES:BEGIN OF typ_oper.
INCLUDE TYPE ZPM_OPERATION.
TYPES:
field_style TYPE lvc_t_styl.
TYPES: END OF typ_oper.
data: g_grid TYPE REF TO CL_GUI_ALV_GRID.
DATA:ls_good TYPE lvc_s_modi.
DATA: gt_outtab type STANDARD TABLE OF typ_oper ,
gt_outtab1 type STANDARD TABLE OF typ_oper ,
g_aufnr TYPE aufnr,
LS_OUT LIKE LINE OF gt_outtab,
ls_stylerow TYPE lvc_s_styl,
lt_stylerow TYPE lvc_t_styl.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT ,
HANDLE_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM .
* handle_data_changed
* FOR EVENT data_changed OF cl_gui_alv_grid
* IMPORTING er_data_changed.
* Status bar
ENDCLASS.
----------------------------------------------------------ZWOCTOP--------------------------------------------------
*----------------------------------------------------------------------*
------------------------------------------------------------------------------------------------------------
for pbo start of ZXWOCU15
----------------------------------------------------------
*& Include ZXWOCU15
*&---------------------------------------------------------------------*
*SET PF-STATUS 'ZSTATUS'.
*break developer1.
DATA: lt_exclude TYPE ui_functions,
cnt TYPE sy-tabix VALUE 1.
*LOOP AT SCREEN.
*
* screen-input = 0.
* MODIFY SCREEN.
*
*ENDLOOP.
*
PERFORM exclude_tb_functions CHANGING lt_exclude.
g_aufnr = sap_caufvd_imp-aufnr.
* PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container.
CREATE OBJECT g_grid
EXPORTING
i_parent = g_custom_container.
*§1.Set status of all cells to editable using the layout structure.
IF sy-tcode = 'IW32'.
gs_layout-edit = 'X'.
ENDIF.
SELECT * FROM zpm_operation INTO CORRESPONDING FIELDS OF TABLE gt_outtab WHERE aufnr = sap_caufvd_imp-aufnr.
gt_outtab1 = gt_outtab.
DATA: ob TYPE REF TO lcl_event_receiver.
CREATE OBJECT ob.
SET HANDLER ob->handle_toolbar FOR g_grid.
SET HANDLER ob->handle_user_command FOR g_grid.
* gs_layout-handle = 'handle'.
gs_layout-cwidth_opt = 'X'.
* gs_layout-zebra = 'X'.
LOOP AT gt_outtab INTO ls_out.
IF ls_out-aufnr IS NOT INITIAL.
* ls_stylerow-fieldname = 'AUFNR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_stylerow TO ls_out-field_style.
CLEAR:ls_stylerow.
MODIFY gt_outtab FROM ls_out INDEX cnt.
cnt = cnt + 1.
CLEAR:ls_stylerow,ls_out.
ENDIF.
* ls_stylerow-fieldname = 'LT'.
* ls_stylerow-style = cl_gui_alv_grid=>mc_style_button.
*
* INSERT ls_stylerow INTO TABLE ls_out-field_style.
* clear:ls_stylerow.
*
*
* MODIFY gt_outtab FROM ls_out INDEX 1.
ENDLOOP.
gs_layout-stylefname = 'FIELD_STYLE'.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZPM_OPERATION'
it_toolbar_excluding = lt_exclude
is_layout = gs_layout
CHANGING
it_outtab = gt_outtab.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
* (state "editable and ready for input").
IF sy-tcode = 'IW32'.
* CALL METHOD g_grid->set_ready_for_input
* EXPORTING
* i_ready_for_input = 0.
* CALL METHOD g_grid->REGISTER_EDIT_EVENT
* EXPORTING
* I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
** Instantiate the event or it won't work.
*
* CREATE OBJECT G_EVENT_RECEIVER.
* SET HANDLER G_EVENT_RECEIVER->HANDLE_DATA_CHANGED FOR g_grid.
ENDIF.
* SET HANDLER OB->HANDLE_TOOLBAR FOR R_GRID.
* SET HANDLER OB->HANDLE_TOP_OF_PAGE FOR R_GRID.
* SET HANDLER OB->HANDLE_TOOLBAR FOR g_grid.
ENDIF.
------------------------------------for pbo-----------------------------------------------------------------------------
end of ZXWOCU15
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------for pai-----------------------------------------------------------------
-----------------------start of ZXWOCU16--------------------------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Include ZXWOCU16
*&---------------------------------------------------------------------*
DATA: LS_OUT TYPE typ_oper,
LV_MATNR TYPE MATNR,
LS_OUT_dd TYPE ZPM_OPERATION,
cnt TYPE sy-tabix VALUE 1,
LS_ZPM_OPER_Time TYPE ZPM_OPER_Time.
BREAK developer1.
if sy-ucomm = 'BU' or sy-ucomm = '+CUK'.
MOVE-CORRESPONDING ZPM_OPER_Time to LS_ZPM_OPER_Time.
LS_ZPM_OPER_Time-aufnr = g_aufnr.
MODIFY ZPM_OPER_Time FROM LS_ZPM_OPER_Time .
clear:LS_ZPM_OPER_Time.
CALL METHOD G_GRID->CHECK_CHANGED_DATA.
LOOP AT gt_outtab INTO LS_OUT.
LS_OUT-AUFNR = g_aufnr.
IF LS_OUT-MAKTX IS NOT INITIAL.
select MAKTX from makt INTO LS_OUT-MAKTX where matnr = ls_out-matnr.
ENDSELECT.
ENDIF.
SELECT MATNR FROM MARA INTO LV_MATNR WHERE MATNR = LS_OUT-MATNR.
ENDSELECT.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING ls_out to LS_OUT_dd.
MODIFY gt_outtab FROM ls_out.
MODIFY ZPM_OPERATION FROM LS_OUT_dd.
ELSE.
MESSAGE'Please check your material code'TYPE 'I'.
RETURN.
ENDIF.
ENDLOOP.
*SAP_CAUFVD_IMP-AUFNR
MESSAGE 'Main:Plan Details updated Successfully' TYPE 'I'.
CALL METHOD G_GRID->CHECK_CHANGED_DATA.
LOOP AT gt_outtab INTO ls_out.
IF ls_out-aufnr IS NOT INITIAL.
* ls_stylerow-fieldname = 'AUFNR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
if ls_out-field_style is INITIAL.
APPEND ls_stylerow TO ls_out-field_style.
clear:ls_stylerow.
endif.
*
* ls_stylerow-fieldname = 'POSNR' .
* ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
* APPEND ls_stylerow TO ls_out-field_style.
* clear:ls_stylerow.
MODIFY gt_outtab FROM ls_out INDEX cnt.
cnt = cnt + 1.
clear:ls_stylerow,ls_out.
endif.
endloop.
CALL METHOD g_grid->refresh_table_display.
ELSEIF sy-ucomm = ''.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
* data is changed and cursor is moved from the cell
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDIF.
------------------end of ZXWOCU16------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hope this will help you.
for further help mail me: mohanty.sumitsapabap@gmail.com