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.

              6-3-2014 3-58-41 PM.jpg

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 FMMEGUI_BUILD_REQ_HEADER_PLUGIN which enables custom tab at header level if we can create an implicit enahncment in it as shown below.

6-6-2014 12-38-47 AM.jpg

**–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.

6-6-2014 12-55-09 AM.jpg              

  6-6-2014 12-58-33 AM.jpg

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

         6-6-2014 1-05-32 AM.jpg

             [ 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..!!

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. mohammed farooq

    Hi Siva,

    Hope you are doing great.  I have a similar requirement where in I have to add a custom tab at PR header and add some custom field and update those fields to the table when we save the PR or do some changes to the PR. I followed your docuement and able to add the tab and fields to the custom tab. Now the problem i am facing here is when ever i am i am creating the PR and entering the custom fields it’s not updating into the table. and same is happeing for the PR change. Can you please help me where exactly i am missing the logic or please to send the code you have implemented the code for this requirement.

    Hoping for the reply from your side.

    Thanks and Regards,

    Mohammed Farooq

    (0) 
    1. Siva rama Krishna Pabbraju Post author

      Hi Farooq,

                   Please share me your approach to save the entries, meanwhile I shall search my code and will update you.

                Code for saving entries would be very similar to the BADI screen enhancement ON PO/PR to store custom fields in Ztable/Standard table.

      Have a Nice day ..!!

      Regards,

      Siva

      (0) 
  2. sunil kumar

    Hi Shiva,

     

    I am unable to create a screen in above approach..Kindly explain me bit clear and kindly  share the datailed documantaion.

     

    Regards,

    Sunil kumar

    (0) 

Leave a Reply