Skip to main content

SAP ABAP - Add Custom Screen In MIGO Header

 1. Create BAdI MB_MIGO_BADI Implementation from tcode SE19


2. Enter Implementation Name



3. Create Enhancement Implementation





4. Open Implementing Class



5. Create variable declaration on class attribute



6. Append custom structure to GOHEAD structure from SE11








save & activate structure.

7. Create custom table to store custom field data


8. Create custom ABAP program in SE38



9. create 2 sub screen for input and display


 


All source code custom ABAP program

*&---------------------------------------------------------------------*
*& Report ZMIGO_CUSTOMFIELD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zmigo_customfield.
TABLES gohead.

DATA cs_goitem TYPE goitem.
*&---------------------------------------------------------------------*
*& Module STATUS_8000 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_8000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_8000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_8000 INPUT.
*  CASE sy-ucomm.
*    WHEN 'OK_GO'.
*    WHEN 'OK_POST1'.
*    WHEN OTHERS.
*  ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_8001 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_8001 OUTPUT.
  IMPORT cs_goitem TO cs_goitem FROM MEMORY ID 'MIGO_CUSTOMFIELD'.
  SELECT SINGLE zcustomfield FROM ztt_cstomfield
    INTO gohead-zcustomfield WHERE mblnr cs_goitem-mblnr AND mjahr cs_goitem-mjahr.
ENDMODULE.


All BAdI Method source code :

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

  METHOD if_ex_mb_migo_badi~mode_set.
    IF i_refdoc 'R01' AND i_action 'A01'.
      CLEAR display_mode.
    ELSEIF i_action 'A04' OR i_action 'A03'.
      display_mode 'X'.
    ELSE.
      display_mode 'Z'.
    ENDIF.
  ENDMETHOD.

  METHOD if_ex_mb_migo_badi~pbo_header.
    CHECK i_class_id class_id.
    IF display_mode ''.
      e_cprog   'ZMIGO_CUSTOMFIELD'.
      e_dynnr   '8000'.                     "External fields: Input
      e_heading 'MIGO Custom Field'.
    ELSEIF display_mode 'X'.
      e_cprog   'ZMIGO_CUSTOMFIELD'.
      e_dynnr   '8001'.                     "External fields: Display
      e_heading 'MIGO Custom Field'.
    ENDIF.
  ENDMETHOD.

  method IF_EX_MB_MIGO_BADI~PAI_HEADER.
    ls_gohead is_gohead.
  endmethod.

  METHOD if_ex_mb_migo_badi~post_document.
    DATA :
          ls_ztt_cstomfield TYPE ztt_cstomfield.

    IF display_mode IS INITIAL.
      CLEAR ls_ztt_cstomfield.
      ls_ztt_cstomfield-mblnr is_mkpf-mblnr.
      ls_ztt_cstomfield-mjahr is_mkpf-mjahr.
      ls_ztt_cstomfield-zcustomfield ls_gohead-zcustomfield.

      MODIFY ztt_cstomfield FROM ls_ztt_cstomfield.
    ENDIF.
  ENDMETHOD.


10. Activate Badi Implementation from SE18




11. Open MIGO transaction GR Other and here the custom screen result :D




:D :D :D

Comments

  1. Data not inserted in Z table. Its always takes previous value.

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Create a REST API in SAP ABAP — Step-by-step Guide

How to Create a REST API in SAP ABAP — Step-by-step Guide Summary: This tutorial shows how to build a REST API in SAP ABAP by creating a handler class, configuring SICF service, registering endpoints with cl_rest_router , implementing endpoint logic (example GET method), and testing the API. Based on an internal implementation reference. Why expose REST APIs from SAP? REST APIs allow SAP systems to integrate with web, mobile, and external services using standard HTTP and JSON payloads. Implementing REST endpoints in ABAP provides secure, reusable, and maintainable integration points for modern applications. Prerequisites Access to an SAP system with authorization to create classes (SE24) and SICF services (SICF). Familiarity with ABAP object-oriented concepts and basic SAP transaction codes. ABAP classes CL_REST_RESOURCE , CL_REST_ROUTER and utilities like /UI2/CL_JSON . High-level overview (4 steps) Create an API handler class (e.g. ZCL_API_HANDLER ). R...

SAP ABAP - User Exit Set Batch Characteristic Value In MIGO Goods Receipt

Customer Exit  :  MBCFC004 ( EXIT_SAPMM07M_004) Set Up Customer Exit for Classification of User-Defined Characteristics You use SAP enhancement MBCFC004 EXIT_SAPMM07M_004, which contains function module exit EXIT_SAPMM07M_004 to classify user-defined characteristics automatically during goods movements in Inventory Management. This is only possible for characteristics which are not assigned values during quality inspection. Requirements 1. The class of the batch to be classified must be known.  This means that a class must be assigned either to the material or at least to one batch of this material. 2. The exit call must be activated for the respective movement type in activity Activate batch classification during goods movements in IM using indicator 'Extended classification' . Open tcode OMC...

IT Asset Management Dengan PHP MySQL

Pada postingan kali saya akan share sebuah aplikasi IT Asset management yang fungsinya untuk memonitoring semua Asset khusus IT, contohnya : Laptop/komputer , Printer, Router, Hardisk, dll. Dalam aplkasi ini kita bisa mengetahui Asset IT posisinya dimana dan digunakan oleh siapa. untuk data-data yang dibutuhkan antara lain : 1. data kategori asset dalam menu ini kita bisa meng-input jenis2 kategory asset : tambah kategori asset : 2. data department 3. data karyawan 4. data department per karyawan 5. data asset location  6. data satuan asset dan untuk transaksi yang ada dalam aplikasi ini adalah,  1. create asset, pada menu create asset ini kita akan mengalokasikan sebuah asset ke karyawan/personnel tampilannya seperti berikut: setelah klik tombol save akan muncul seperti dibawah : untuk melihat detail asset yang sudah dibuat tadi, kita bisa pilih...