Dear all, I have implemented a custom tab in MIGO, you can follow the steps.

My requirement was to add a new tab named “Warranty” in MIGO.

Step1 : Create a custom table to store the data of  “Warranty”  tab

 

The first four fields should be the key fields, and the rest fields are your required custom fields.

Step 2: create a structure with the custom field you require on the MIGO.

 

Step 3: open structure GOITEM and append the same custom structure into it as shown below.

 

Step 4: Create another structure and append the table created in Step-1.

 

Step 5:  Create a Table type of the structure created in step-4 as shown below.

 

Step 6: go to SE80 and create a program as shown below. This screen must contain two screen.

 

Step 7: SE19 -> Badi Name: MB_MIGO_BADI

Press Create Impl. Button and create Implementation: ZMIGO_WARRENTY as shown below.

 

Step 8: Create a Class : ZCLASS_MIGO_WARRENTY as shown below.

Step 9: Maintain the following attributes in your Class Interface as shown below.

 

Step 10: Write the following codes for the methods shown below.

 

(a) for    IF_EX_MB_MIGO_BADI~INIT

METHOD if_ex_mb_migo_badi~init.
APPEND gf_class_id TO ct_init.ENDMETHOD.

(b) for   IF_EX_MB_MIGO_BADI~PBO_DETAIL

METHOD if_ex_mb_migo_badi~pbo_detail.
DATA: wa_extdata  TYPE zst_warrenty.
DATA :gf_class_id TYPE migo_class_id.
gf_class_id
= ‘ZCLASS_MIGO_WARRENTY’.
CHECK i_class_id = gf_class_id.
IF g_no_input IS INITIAL.
e_cprog  
= ‘ZSAPMZMM_MIGO_WARENTY’.
e_dynnr  
= ‘9001’.                     “External fields: Input
e_heading
= ‘Warranty’(001).
ELSE.
e_cprog  
= ‘ZSAPMZMM_MIGO_WARENTY’.
e_dynnr  
= ‘9002’.                     “External fields: Display
e_heading
= ‘Warranty’(001).
ENDIF.
g_line_id
= i_line_id.
READ TABLE gt_extdata INTO wa_extdata WITH KEY line_id = g_line_id.
IF sysubrc = 0 AND wa_extdatamblnr IS NOT INITIAL AND wa_extdatamjahr IS NOT INITIAL AND wa_extdatazeile IS NOT INITIAL.
SELECT SINGLE * FROM ztb_warrenty
CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF wa_extdata
WHERE mandt = symandt
AND   mblnr = wa_extdatamblnr
AND   mjahr = wa_extdatamjahr
AND   zeile = wa_extdatazeile.
SET PARAMETER ID: ‘ZWARANTY’ FIELD wa_extdatazzwarnt,
‘ZWARBEGD’ FIELD wa_extdatazzwbegd,
‘ZWARENDD’ FIELD wa_extdatazzwendd.
ELSE.
SET PARAMETER ID: ‘ZWARANTY’ FIELD space,
‘ZWARBEGD’ FIELD space,
‘ZWARENDD’ FIELD space.
ENDIF.ENDMETHOD.

(c) for    IF_EX_MB_MIGO_BADI~PAI_DETAIL

METHOD if_ex_mb_migo_badi~pai_detail.
e_force_change
= ‘X’.ENDMETHOD.

(d) for    IF_EX_MB_MIGO_BADI~LINE_MODIFY

METHOD if_ex_mb_migo_badi~line_modify.
DATA: ls_extdata  TYPE zst_warrenty.
IF cs_goitemmblnr IS NOT INITIAL AND cs_goitemmjahr IS NOT INITIAL AND cs_goitemzeile IS NOT INITIAL.
ls_extdata
line_id  = i_line_id.
ls_extdata
mblnr    = cs_goitemmblnr.
ls_extdata
mjahr    = cs_goitemmjahr.
ls_extdata
zeile    = cs_goitemzeile.
ls_extdata
zzwarnt  = cs_goitemzzwarnt.
ls_extdata
zzwbegd  = cs_goitemzzwbegd.
ls_extdata
zzwendd  = cs_goitemzzwendd.
DELETE gt_extdata WHERE line_id = ls_extdataline_id.
INSERT ls_extdata INTO TABLE gt_extdata.
ELSE.
ls_extdata
line_id  = i_line_id.
ls_extdata
zzwarnt  = cs_goitemzzwarnt.
ls_extdata
zzwbegd  = cs_goitemzzwbegd.
ls_extdata
zzwendd  = cs_goitemzzwendd.
DELETE gt_extdata WHERE line_id = ls_extdataline_id.
INSERT ls_extdata INTO TABLE gt_extdata.
ENDIF.ENDMETHOD.

(e) for    IF_EX_MB_MIGO_BADI~RESET

METHOD if_ex_mb_migo_badi~reset.
CLEAR: gt_extdata,
g_no_input
,
gs_exdata_header
,
g_cancel
,
g_line_id
.ENDMETHOD.

(f) for    IF_EX_MB_MIGO_BADI~POST_DOCUMENT

METHOD if_ex_mb_migo_badi~post_document.
DATA: wa_warrenty TYPE ztb_warrenty,
it_warrenty
TYPE TABLE OF ztb_warrenty,
wa_mseg    
TYPE mseg,
wa_extdata 
TYPE zst_warrenty.

LOOP AT it_mseg INTO wa_mseg.
READ TABLE gt_extdata INTO wa_extdata WITH KEY line_id = wa_msegline_id.
IF sysubrc = 0.
MOVE-CORRESPONDING wa_mseg TO wa_extdata.
MOVE-CORRESPONDING wa_extdata TO wa_warrenty.
APPEND wa_warrenty TO it_warrenty.
ENDIF.
ENDLOOP.
MODIFY ztb_warrenty FROM TABLE it_warrenty.
ENDMETHOD.

(g) for    IF_EX_MB_MIGO_BADI~CHECK_ITEM

METHOD if_ex_mb_migo_badi~check_item.
DATA: wa_extdata  TYPE zst_warrenty,
ls_bapiret
TYPE bapiret2.

READ TABLE gt_extdata INTO wa_extdata WITH TABLE KEY line_id = i_line_id.
IF wa_extdatazzwarnt IS INITIAL.
ls_bapiret
type       = ‘E’.
ls_bapiret
id         = ‘M7’.
ls_bapiret
number     = ‘895’.
ls_bapiret
message_v1 = ‘Enter warranty condition’(002).
APPEND ls_bapiret TO et_bapiret2.
ENDIF.
IF wa_extdatazzwarnt = ‘YES’ AND ( wa_extdatazzwbegd IS INITIAL OR wa_extdatazzwendd IS INITIAL OR ( wa_extdatazzwbegd GT wa_extdatazzwendd ) ).
ls_bapiret
type       = ‘E’.
ls_bapiret
id         = ‘M7’.
ls_bapiret
number     = ‘895’.
ls_bapiret
message_v1 = ‘Enter appropriate warranty Start and End date’(003).
APPEND ls_bapiret TO et_bapiret2.
ENDIF.
ENDMETHOD.

(h) for    IF_EX_MB_MIGO_BADI~MODE_SET

METHOD if_ex_mb_migo_badi~mode_set.
CLEAR : g_no_input.
IF i_action = ‘A04’ .
g_no_input
= ‘X’.
ENDIF.

IF i_action = ‘A03’.
g_cancel
= ‘X’.
ENDIF.ENDMETHOD.

Note: Leave the other Methods blank. Do not write any thing in that.

Step 11: Open MIGO , you will be able to see the new tab “WARRANTY” as shown below.

 

The system will store the data of your custom screen into the table created in Step-1.

Thanks

Debdutta Satpathy

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !