Google Search - Blog...........

Add Customer Field To The T-Codes ME51N / ME52N / ME53N

Create a new field in the transaction ME51N or ME52N or ME53N. Go to CMOD and create a new project with the custom name using the enhancement MEREQ001.

in this the possible enhancements are :

Function exit EXIT_SAPLMEREQ_001
EXIT_SAPLMEREQ_002
EXIT_SAPLMEREQ_003
EXIT_SAPLMEREQ_004
EXIT_SAPLMEREQ_005
EXIT_SAPLMEREQ_006
EXIT_SAPLMEREQ_007
EXIT_SAPLMEREQ_008
EXIT_SAPLMEREQ_009
EXIT_SAPLMEREQ_010

Screen exit SAPLMEGUI

Include tables CI_EBANDB
CI_EBANDBX
CI_EBANMEM
First you need to enhance the standard structures EBAN and CI_EBANDB with the custom field ( ZPRTY ).

in this create the screen exit, go to se51 and enter the program name as SAPLXM02
and screen number as 111. In the layout create the custom field as EBAN-ZPRTY.


in the PBO write the coding like as follows :

MODULE status_0111 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

DATA: v_char TYPE c,
v_screen TYPE screen,
v_input TYPE screen-input,
v_output TYPE screen-output.

IMPORT v_char FROM MEMORY ID 'ZTEST'.

CONCATENATE 'EBAN' '-ZPRTY' INTO v_name.
CONDENSE v_name.
ASSIGN (v_name) TO .
= v_char.

DATA: re_aktvt TYPE aktvt.

IMPORT re_aktvt FROM MEMORY ID 'ZACT'.


IF sy-tcode = 'ME53N'AND re_aktvt IS INITIAL.

LOOP AT SCREEN.
IF screen-name = 'EBAN-ZPRTY'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF sy-tcode = 'ME53N'AND re_aktvt IS NOT INITIAL.

LOOP AT SCREEN.
IF screen-name = 'EBAN-ZPRTY'.
CASE : re_aktvt.
WHEN 'A'. "-----> Only display mode
screen-input = '1'.
WHEN 'V'. "------> Input/output mode
screen-input = '0'.
ENDCASE.
MODIFY SCREEN.
ENDIF.

ENDLOOP.
ELSEIF sy-tcode = 'ME52N'AND re_aktvt IS NOT INITIAL.

LOOP AT SCREEN.
IF screen-name = 'EBAN-ZPRTY'.
CASE : re_aktvt.
WHEN 'A'. "-----> Only display mode
screen-input = '1'.
WHEN 'V'. "------> Input/output mode
screen-input = '0'.
ENDCASE.
MODIFY SCREEN.
ENDIF.

ENDLOOP.
ELSEIF sy-tcode = 'ME52N'AND re_aktvt IS INITIAL.

LOOP AT SCREEN.
IF screen-name = 'EBAN-ZPRTY'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

ENDIF.
ENDMODULE. " STATUS_0111 OUTPUT

and in the PAI write the coding like this :

MODULE user_command_0111 INPUT.

CONCATENATE 'EBAN' '-ZPRTY' INTO v_name.
CONDENSE v_name.
ASSIGN (v_name) TO .

CONCATENATE 'CI_EBANDB' '-ZPRTY' INTO v_name1.
CONDENSE v_name1.
ASSIGN (v_name1) TO .

= .


ENDMODULE. " USER_COMMAND_0111 INPUT


Activate the user exit : ZXM02U01( this will trigger before the display from the tcode)


*&---------------------------------------------------------------------*
*& Include ZXM02U01
*&---------------------------------------------------------------------*

DATA : l_mereq_item TYPE mereq_item.

l_mereq_item = im_req_item->get_data( ).

DATA : v_name TYPE char30,
v_char type c.
FIELD-SYMBOLS: .

CONCATENATE 'EBAN' '-ZPRTY' INTO v_name.
CONDENSE v_name.
ASSIGN (v_name) TO .

IF NOT l_mereq_item-zprty IS INITIAL.
assign l_mereq_item-zprty to .
move to v_char.
export v_char to memory id 'ZTEST'.
ENDIF.

*&---------------------------------------------------------------------*
*& Include ZXM02U03
*&---------------------------------------------------------------------*

TABLES: ci_ebandb.

DATA : l_mereq_item TYPE mereq_item.

l_mereq_item = im_req_item->get_data( ).

MOVE-CORRESPONDING ci_ebandb TO l_mereq_item .

CALL METHOD im_req_item->set_data( l_mereq_item ).
ex_changed = 'X'.


DATA: re_aktvt TYPE aktvt.
CALL METHOD im_req_item->get_activity
RECEIVING
re_aktvt = re_aktvt.

CASE re_aktvt.
*---this will handles the toggling between change and display between the screens without changing the tcodes ( i mean ME52N to ME53N)
EXPORT re_aktvt TO MEMORY ID 'ZACT'.
WHEN 'A'. "-----> Only display mode
WHEN 'V'. "------> Input/output mode
ENDCASE.

No comments:

Post a Comment