Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MIGO

Former Member
0 Likes
2,908

How to add fields in header of MIGO in different tabstrip through badi ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,136

Hi,

Go through the following Steps for adding New screen to MIGO Tcode

MB_MIGO_BADI BADI for MIGO Tcode

1) Go to Tcode SE19 Open ZMB_MIGO_BADI Implementation Name.

2) Click on Interface Tab and Double Click on

ZCL_IM_MB_MIGO_BADI as Name of implementing class then it goes to open

The SE24 Class builder.

3) You have the Following Methods

IF_EX_MB_MIGO_BADI~INIT

IF_EX_MB_MIGO_BADI~PBO_DETAIL

IF_EX_MB_MIGO_BADI~PAI_DETAIL

IF_EX_MB_MIGO_BADI~LINE_MODIFY

IF_EX_MB_MIGO_BADI~LINE_DELETE

IF_EX_MB_MIGO_BADI~RESET

IF_EX_MB_MIGO_BADI~POST_DOCUMENT

IF_EX_MB_MIGO_BADI~CHECK_ITEM

IF_EX_MB_MIGO_BADI~MODE_SET

IF_EX_MB_MIGO_BADI~STATUS_AND_HEADER

IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

IF_EX_MB_MIGO_BADI~HOLD_DATA_LOAD

IF_EX_MB_MIGO_BADI~HOLD_DATA_DELETE

IF_EX_MB_MIGO_BADI~PBO_HEADER

IF_EX_MB_MIGO_BADI~PAI_HEADER

IF_EX_MB_MIGO_BADI~CHECK_HEADER

IF_EX_MB_MIGO_BADI~PUBLISH_MATERIAL_ITEM

From the above Methods you can use the following Methods only

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

3) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

I have been modified the following Changes for the above mentioned Methods

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

method IF_EX_MB_MIGO_BADI~PBO_DETAIL.

data: ls_extdata type migo_badi_example_screen_field.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • Show screen only if there is an item

check i_line_id <> 0.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

**Start Additional Code

if g_no_input is initial.

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0001'. "External fields: Input

  • e_heading = 'MIGO BAdI Example'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0002'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Set G_LINE_ID (= line_id of item displayed on detail-tabstrip)

g_line_id = i_line_id.

  • Read data

read table gt_extdata into ls_extdata

with table key line_id = i_line_id.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_DATA'

exporting

is_migo_badi_screen_fields = ls_extdata.

endmethod.

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

method IF_EX_MB_MIGO_BADI~PBO_HEADER.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

*break-point.

if g_no_input is initial.

**Start Additional Code

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0003'. "External fields: Input

  • e_heading = 'MIGO BAdI EXAMPLE'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0004'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_HEADER'

exporting

is_migo_badi_header_fields = gs_exdata_header.

endmethod.

4) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

method IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE.

**Start Additional Code

data: ls_mara type zmara(custom Table).

**End Additional Code

  • Store data cluster (detail data) to data buffer

export gt_extdata from gt_extdata to data buffer

ls_migo_badi_hold-hold_string.

  • Store data cluster (header data) to data buffer

export gs_exdata_header from gs_exdata_header to data buffer

ls_migo_badi_hold-hold_string_head.

ls_migo_badi_hold-guid = i_guid.

  • Database update:

insert into migo_badi_hold values ls_migo _hold.

**Start Additional Code

insert into ZMARA values ls_migo_mara.

**End Additional Code

if sy-subrc <> 0.

message a398(00) with 'Error update MIGO_BADI_HOLD'(005).

endif.

Regards

Hi,

Go through the following Steps for adding New screen to MIGO Tcode

MB_MIGO_BADI BADI for MIGO Tcode

1) Go to Tcode SE19&#61664; Open ZMB_MIGO_BADI Implementation Name.

2) Click on Interface Tab and Double Click on

ZCL_IM_MB_MIGO_BADI as Name of implementing class then it goes to open

The SE24 Class builder.

3) You have the Following Methods

IF_EX_MB_MIGO_BADI~INIT

IF_EX_MB_MIGO_BADI~PBO_DETAIL

IF_EX_MB_MIGO_BADI~PAI_DETAIL

IF_EX_MB_MIGO_BADI~LINE_MODIFY

IF_EX_MB_MIGO_BADI~LINE_DELETE

IF_EX_MB_MIGO_BADI~RESET

IF_EX_MB_MIGO_BADI~POST_DOCUMENT

IF_EX_MB_MIGO_BADI~CHECK_ITEM

IF_EX_MB_MIGO_BADI~MODE_SET

IF_EX_MB_MIGO_BADI~STATUS_AND_HEADER

IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

IF_EX_MB_MIGO_BADI~HOLD_DATA_LOAD

IF_EX_MB_MIGO_BADI~HOLD_DATA_DELETE

IF_EX_MB_MIGO_BADI~PBO_HEADER

IF_EX_MB_MIGO_BADI~PAI_HEADER

IF_EX_MB_MIGO_BADI~CHECK_HEADER

IF_EX_MB_MIGO_BADI~PUBLISH_MATERIAL_ITEM

From the above Methods you can use the following Methods only

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

3) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

I have been modified the following Changes for the above mentioned Methods

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

method IF_EX_MB_MIGO_BADI~PBO_DETAIL.

data: ls_extdata type migo_badi_example_screen_field.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • Show screen only if there is an item

check i_line_id <> 0.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

**Start Additional Code

if g_no_input is initial.

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0001'. "External fields: Input

  • e_heading = 'MIGO BAdI Example'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0002'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Set G_LINE_ID (= line_id of item displayed on detail-tabstrip)

g_line_id = i_line_id.

  • Read data

read table gt_extdata into ls_extdata

with table key line_id = i_line_id.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_DATA'

exporting

is_migo_badi_screen_fields = ls_extdata.

endmethod.

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

method IF_EX_MB_MIGO_BADI~PBO_HEADER.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

*break-point.

if g_no_input is initial.

**Start Additional Code

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0003'. "External fields: Input

  • e_heading = 'MIGO BAdI EXAMPLE'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0004'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_HEADER'

exporting

is_migo_badi_header_fields = gs_exdata_header.

endmethod.

4) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

method IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE.

**Start Additional Code

data: ls_mara type zmara(custom Table).

**End Additional Code

  • Store data cluster (detail data) to data buffer

export gt_extdata from gt_extdata to data buffer

ls_migo_badi_hold-hold_string.

  • Store data cluster (header data) to data buffer

export gs_exdata_header from gs_exdata_header to data buffer

ls_migo_badi_hold-hold_string_head.

ls_migo_badi_hold-guid = i_guid.

  • Database update:

insert into migo_badi_hold values ls_migo _hold.

**Start Additional Code

insert into ZMARA values ls_migo_mara.

**End Additional Code

if sy-subrc <> 0.

message a398(00) with 'Error update MIGO_BADI_HOLD'(005).

endif.

Regards

4 REPLIES 4
Read only

Former Member
0 Likes
2,136

hello,

Please follow the steps:

go to se19:create a custom BADI and create

give implementation name as MB_MIGO_BADI and create

once inside the BADI->fill the text -> on the top menu -> GOTO -> Sample code ->copy->SAP asks if over write is O.K...click "YES"

Activte and Run "MIGO"

You can notice that a custom "MIGO_BADI_EXAMPLE" in the header and another tab in the detail screen...

I have implemented the same scenario in MIGO header and item level with the extra fields being diverted to another Z-table

following are the steps i followed

1) create an instance of the BADI....go to se19..create BADI..give definition name

as MB_MIGO_BADI and activated after copying the sample code from

GOTO->sample code-> COPY to get an extra tab in header and item level inside

the BADI

2)Did changes to the screen fields in PBO header inside the interfaces at

PBO_HEADER

PAI_HEADER..commented unnecessary codes in the BADI

the program name(e_cprog ) in the PBO_DETAIL contains screen 001/002 for item and 003/004 for header PBO_HEADER..go change the screen fields to be added according to your requirement here in the program

3)in the ( IF_EX_MB_MIGO_BADI~POST_DOCUMENT) which is the

POST_DOCUMENT in the interface tab,in the update function module code was

written to fill in the desired table fields(CALL FUNCTION " function name" IN

UPDATE TASK)

inside the "POST DOCUMENT" you can see the importing parameters are (MKPF and MSEG)

there is a code "MOVE-CORRESPONDING is_mkpf TO gs_exdata_header." and a simultaneous update task function module being called which saves data into the table required.I used the structure of my requirement which is a Ztable structure and added code in update task function module to update the ztable required

The current system with Z-table is working fine now

Note:all tables and function groups were termed "EXAMPLE" so i had to create a set of function groups and tables/structures to serve my purpose

Debugg the sample code copy of the BADI using break points if my comments were confusing in any way,to understand in-depth

Reward points if they were of any use

Regards

Byju

Read only

Former Member
0 Likes
2,137

Hi,

Go through the following Steps for adding New screen to MIGO Tcode

MB_MIGO_BADI BADI for MIGO Tcode

1) Go to Tcode SE19&#61664; Open ZMB_MIGO_BADI Implementation Name.

2) Click on Interface Tab and Double Click on

ZCL_IM_MB_MIGO_BADI as Name of implementing class then it goes to open

The SE24 Class builder.

3) You have the Following Methods

IF_EX_MB_MIGO_BADI~INIT

IF_EX_MB_MIGO_BADI~PBO_DETAIL

IF_EX_MB_MIGO_BADI~PAI_DETAIL

IF_EX_MB_MIGO_BADI~LINE_MODIFY

IF_EX_MB_MIGO_BADI~LINE_DELETE

IF_EX_MB_MIGO_BADI~RESET

IF_EX_MB_MIGO_BADI~POST_DOCUMENT

IF_EX_MB_MIGO_BADI~CHECK_ITEM

IF_EX_MB_MIGO_BADI~MODE_SET

IF_EX_MB_MIGO_BADI~STATUS_AND_HEADER

IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

IF_EX_MB_MIGO_BADI~HOLD_DATA_LOAD

IF_EX_MB_MIGO_BADI~HOLD_DATA_DELETE

IF_EX_MB_MIGO_BADI~PBO_HEADER

IF_EX_MB_MIGO_BADI~PAI_HEADER

IF_EX_MB_MIGO_BADI~CHECK_HEADER

IF_EX_MB_MIGO_BADI~PUBLISH_MATERIAL_ITEM

From the above Methods you can use the following Methods only

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

3) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

I have been modified the following Changes for the above mentioned Methods

1) IF_EX_MB_MIGO_BADI~PBO_DETAIL

method IF_EX_MB_MIGO_BADI~PBO_DETAIL.

data: ls_extdata type migo_badi_example_screen_field.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • Show screen only if there is an item

check i_line_id <> 0.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

**Start Additional Code

if g_no_input is initial.

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0001'. "External fields: Input

  • e_heading = 'MIGO BAdI Example'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0002'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Set G_LINE_ID (= line_id of item displayed on detail-tabstrip)

g_line_id = i_line_id.

  • Read data

read table gt_extdata into ls_extdata

with table key line_id = i_line_id.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_DATA'

exporting

is_migo_badi_screen_fields = ls_extdata.

endmethod.

2) IF_EX_MB_MIGO_BADI~PBO_HEADER

method IF_EX_MB_MIGO_BADI~PBO_HEADER.

  • This check is obligatory, otherwise the program flow is incorrect

  • (If there would be more than one implementation of BAdI MB_MIGO_BADI,

  • only one subscreen would be displayed).

check i_class_id = gf_class_id.

  • External subscreen:

  • The content of global field G_NO_INPUT (set in method MODE_SET) will

  • influence the number of external subsreen:

*break-point.

if g_no_input is initial.

**Start Additional Code

e_cprog = 'ZSAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0100'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

**End Additional Code

  • e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

  • e_dynnr = '0003'. "External fields: Input

  • e_heading = 'MIGO BAdI EXAMPLE'(004).

else.

e_cprog = 'SAPLMIGO_BADI_EXAMPLE'.

e_dynnr = '0004'. "External fields: Display

e_heading = 'MIGO BAdI EXAMPLE'(004).

endif.

  • Export data to function group (for display on subscreen)

call function 'MIGO_BADI_EXAMPLE_PUT_HEADER'

exporting

is_migo_badi_header_fields = gs_exdata_header.

endmethod.

4) IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE

method IF_EX_MB_MIGO_BADI~HOLD_DATA_SAVE.

**Start Additional Code

data: ls_mara type zmara(custom Table).

**End Additional Code

  • Store data cluster (detail data) to data buffer

export gt_extdata from gt_extdata to data buffer

ls_migo_badi_hold-hold_string.

  • Store data cluster (header data) to data buffer

export gs_exdata_header from gs_exdata_header to data buffer

ls_migo_badi_hold-hold_string_head.

ls_migo_badi_hold-guid = i_guid.

  • Database update:

insert into migo_badi_hold values ls_migo _hold.

**Start Additional Code

insert into ZMARA values ls_migo_mara.

**End Additional Code

if sy-subrc <> 0.

message a398(00) with 'Error update MIGO_BADI_HOLD'(005).

endif.

Regards

Read only

0 Likes
2,136

Could u pls tell me ,what i there in z program and in zmara table,i thing table consist of all three field,but pls tell how to go for z program.

Read only

0 Likes
2,136

Hello,

Query1

********************************************************************************************

The Zprogram is for designing the screens which will come inside the TAB you add for the MIGO...in the BADI itself in the method IF_EX_MB_MIGO_BADI~PBO_DETAIL

you can see the code

if g_no_input is initial.

e_cprog = <b>'SAPLMIGO_BADI_EXAMPLE'.</b>

e_dynnr = '001'. "External fields: Input

e_heading = 'MIGO BAdI Example 1'.

else.

e_cprog = <b>'SAPLMIGO_BADI_EXAMPLE'.</b>

e_dynnr = '002'. "External fields:Display

e_heading = 'MIGO BAdI Example 1'.

endif

if you have copied and created the BADI as i have mentioned above from the standard copy function and activated it then you will see SAPLMIGO_BADI_EXAMPLE in the IF_EX_MB_MIGO_BADI~PBO_DETAIL and

IF_EX_MB_MIGO_BADI~PBO_HEADER....

you can go to se38 ...write 'SAPLMIGO_BADI_EXAMPLE' copy it to ZSAPLMIGO_BADI_EXAMPLE to avoid using the sample code.....once you have created this Zprogram you have to design the screen with whatever fields from the tables of your desire using screen painter or going to the layout of the screen 001/002/003/004

screen 001 is for item level input

screen 002 is for item level display

screen 003 is for header level input

screen 004 is for header level display

Query 2

********************************************************************************************

ZMARA table is just an example given to you my friend,

instead you should put the name of the Z-table you need to pass value into...

Additional INFO

********************************************************************************************

to save the data during posting....

in IF_EX_MB_MIGO_BADI~POST_DOCUMENT you need to perform the function module in update task......

CALL FUNCTION 'MIGO_BADI_UPDATE_HEAD' IN UPDATE TASK

EXPORTING

is_migo_badi_header_fields = gs_exdata_header1.

where : gs_exdata_header1 contains header details you have captured on screen

inside 'MIGO_BADI_UPDATE_HEAD' function module add the code:

change :

data: ls_migo_badi type ZTABLE.

move-corresponding is_migo_badi_header_fields to ls_migo_badi. "already there

INSERT ZTABLE FROM ls_migo_badi. "database update

Hope it solved your problem

Reward if helpful

Regards

Byju