Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
krish469
Contributor
15,775

As we all know we can create a custom tab at item level in Purchase Requistion and wonder is it possible to create custom tab in header lvel of Purchase Requistion ??

                       I have tried a lot by searching all the Function exists, Sreen exists and BADI but unable to find any enahcement . I even searched SAP forums but could not find any positive approach.At last I have found myself small information which lead to me to discover custom tab in Header level in Purchase Requistion.

             

We can clealry see that CUSTOM TAB which we create '0111' in Program SAPLXM02  is register here. So there may possibilty for custom tab in header level also.With this intennt I tried hard to explore, than I FM - MEGUI_BUILD_REQ_HEADER_PLUGIN which enables custom tab at header level if we can create an implicit enahncment in it as shown below.

**--Declare a custom header view with ref to local class  LCL_CUST_HEADER_VIEW_MM of function pool MEGUI.

DATA: CUST_HEADER_VIEW   TYPE REF TO LCL_CUST_HEADER_VIEW_MM.


  CREATE OBJECT CUST_HEADER_VIEW
                EXPORTING im_dynpro         = '1227'               "Custom tab provided by SAP
                          im_prog                         = megui               "Function Group
                         im_foreign_prog            = 'SAPLXM02'    "Main Program to create Custom Screen
                         im_foreign_dynpro        = '0999'.              "Custom screen ->Can have any no


  CALL METHOD CUST_HEADER_VIEW->set_label( 'Custom Tab - Header ').    "Set Label as shown on screen
  CALL METHOD CUST_HEADER_VIEW->set_name( 'Cust Header Tab' ).          "Set a name to refer
  CALL METHOD CUST_HEADER_VIEW->set_struct_name( ).                             "Get default structure


  CALL METHOD header_view->add
    EXPORTING
      im_screen_view = CUST_HEADER_VIEW
      im_position    = 4.


  SET HANDLER CUST_HEADER_VIEW->if_observer_mm~handle_subject_changed
              FOR header_view.

  SET HANDLER header_view->if_observer_mm~handle_subject_changed FOR
              CUST_HEADER_VIEW.

                 Now, we need to create a screen in the program SAPLXM02, I shall leave this to you guys. We need to create implicit enhancement to method 'TRANSPORT_FROM_MODEL'  of class LCL_CUST_HEADER_VIEW_MM  to view the custom tab at header level.

              

 

DATA: L1_HEADER        TYPE REF TO IF_PURCHASE_REQUISITION.
        
    FOREIGN_APPLICATION_OK = MMPUR_NO.
    MMPUR_DYNAMIC_CAST L1_HEADER MY_MODEL.
    CHECK NOT L1_HEADER IS INITIAL.
    FOREIGN_APPLICATION_OK = MMPUR_YES.
 
**---Export values to PBO of Custom Screen 999 of SAPLXM02- to use in PBO

      EXPORT L1_HEADER from L1_HEADER to MEMORY id 'REq@Header_value'.
        
    EXIT."Over write Standard Implementation -THIS IS MANDATORY

            Now, we are all set to call transaction ME51N to view Custom tab in Header level in Purchase Requisition

        

             [ Now the data part is left to you, how to handle data at PAI , PBO and fetch from Table and Save into Table .......Hope this helps at least a bit]

DISCLAIMER: APOLOGIZE IF MY INFORMATION TOO OLD TO SHARE..!!

22 Comments
Labels in this area