Skip to Content
Author's profile photo Former Member

How to create a custom TAB for MIGO Item Details

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

1.JPG

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.

2.JPG

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

3.JPG

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

4.JPG

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

5.JPG

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

6.JPG7.JPG

Step 7: SE19 -> Badi Name: MB_MIGO_BADI

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

8.JPG

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

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

9.JPG

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

10.JPG

(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.

11.JPG

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

Thanks

Debdutta Satpathy

Assigned tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Chandu Rdy
      Chandu Rdy

      Nicely Documented, It really works. My ABAPER tried this.

      Thanks

      Author's profile photo Former Member
      Former Member

      Good Doc..

      Author's profile photo Debesh Tiwari
      Debesh Tiwari

      Very nice document..

      Author's profile photo Former Member
      Former Member

      Your paper helped me a lot today. Thanks!!!

      Author's profile photo A N
      A N

      Dear Debdutta,

      Thanks for sharing document.

      I have gone through the process and successfully created custom tab in ITEM Details but unable to SAVE data in ZTABLE ZTB_WARRENTY.

      I am unable to the understand the PROGRAM created, to pass the zfield values.
      Can you please suggest.

      Thanks,

      AN

      Author's profile photo Former Member
      Former Member

      hello everyone , nice sharing , thank you very much.

      i have a question about GET PARAMETER, i can not display data when re-open my document. below i added my code.