You can add a custom field in transaction MIRO with the BAdI MRM_ITEM_CUSTFIELDS, you can follow complete steps to add a custom field in item screen.

For example for this article, we want to add a custom tab with 3 fields they are. XREF1, XREF2, XREF3

Follow these steps to add a custom tab or custom field in MIRO item screen.

1.Create implementation for BAdI MRM_ITEM_CUSTFIELDS.

2.You must specify a name for tab strip, you can use method TABPAGE_LABEL_SET to input name of tab strip, for this sample we named it PPh Info.

 

3.The fields that are copied from your subscreen to the invoice document must be created in the ABAP Dictionary structure CI_DRSEG_CUST. This structure is already a component of the structure DRSEG_CI, which in turn is assigned to the structure DRSEG. for the next step, you need to enhance those structure.

 

4.Go to SE11 transaction code and open DRSEG_CI structure and then add custom field within CI_DRSEG_CUST structure. for example, those fields are ZZXREF1, ZZXREF2, ZZXREF3 then activate.

add-custom-field-in-miro-sap-2

5.Still on SE11 transaction code open RSEG ( Document Item: Incoming Invoice ) table and create custom structure and add three fields ZZXREF1, ZZXREF2, ZZXREF3. your data in those custom field will be saved into them.

add-custom-field-in-miro-sap-3

6.Back to SE18 then open your BAdI implementation, double click on method INVOICE_DATA_TRANSFER this method run to display data to custom screen field. write this ABAP code to this method.

7.After user changed data, the attribute H_CHANGE also has been changed, so you need to add ABAP code in method CUSTOM_DATA_GET to return custom data to standard program.

8. Use method INVOICE_DATA_GET, this method is called from PBO ( Process Before Output ) of the flow logic dynpro screen. this method run to return contents of your data in custom field to dynpro.

9. Use method CUSTOM_DATA_TRANSFER will be called from PAI ( Process After Input ) of the flow logic dynpro, this method will return indicator of determination whether any data has been changed.

10. After all of MRM_ITEM_CUSTFIELDS required method has been set, then you need to create program with have type Module Pool. then declare these global variable.

11. Go to SE38 and create ABAP Program with type Module pool and create new screen for this example Screen 100 with screen type is Subscreen. then create table control, this step you have two option, i.e using wizard or manually. the important part for this step, we will use global data or variable for table control that we declare before to create table control field. as you can see on picture below. ( for example we create programe with name ZMME001 ).

add-custom-field-in-miro-sap-4

12.Create Module GET_DATA in PBO and write this ABAP Code.

13.Create module CHANGE_ATTRIBUTE_FIELD in PBO and write this ABAP code, this module run to control screen attribute, if open display mode then prevent input for custom field.

14.Create module WRITE_DATA in PAI then write this ABAP Code.

15. Go back to SE18 open BAdI implementation, click on tab Subscreens and input your ABAP Program which you’ve created before and your dynpro screen number.

add-custom-field-in-miro-sap-6

This is the complete ABAP code PBO and PAI in dynpro program.

And finally you will get the result like this.

add-custom-field-in-miro-sap-5

Incoming search terms: