field is non editable while creating PR using code in ABAP.

 Task: Agreement can be non-editable field.

            Agreement tech name - KONNR


1. Find out the meta field value.

      * Goto T-code - SE37.

     * Give FM name - MEMFS_BUILD_MAPPING_PO_DOC.

        * Click on display.

       * Put breakpoint on first perform (12 line).

       * Execute the FM.

       * Give IM_APPLICATION name - MMPUR_PR_DOC.

       * Click on execute.

       * Goto Desktop3(preferable) and give CH_MAPPING in right side click on F6 button and check the data in CH_MAPPING.

        * Finally  meta field value for KONNR - '022'.

2. Goto Se37 and give FM name 'MEREQBADI_FS_ITEM' click on display.

3. Goto edit --> enhancement operations --> Show implicit enhancement.

 4. Place the cursor on Enhancement and click on enhance button.


5. Right click on enhancement (139 line) --> Enhancement operations--> Create Implementation.

6. Choose type of enhancement - Code.

7. Give enhancement implementation name and short text.

8. After write code like this.

ENHANCEMENT 1  ZIMPL_ASC.    "active version
         IF sy-uname 'TRNGAB63'.
           
DATAwa_header TYPE mereq_header,

                wa_item   TYPE mereq_item,
                lv_konnr TYPE mmpur_metafield VALUE '022'.
          FIELD-SYMBOLS<fs_konnr> like line of ch_fieldselection.
          CLEAR:wa_item.
          call METHOD im_header->get_data
            
RECEIVING
              re_data =    wa_header              " Header Data
            .
          call METHOD im_item->get_data
            RECEIVING
              re_data =   wa_item    .           " Item Data
*            if wa_item-afnam = 'ajay'.
          if wa_item-bnfpo '10'.
*          if wa_item-bsart = 'NB'.
            READ TABLE ch_fieldselection ASSIGNING <fs_konnr> WITH TABLE KEY metafield lv_konnr.
            IF  sy-subrc 0.
                <fs_konnr>-fieldstatus '*'.
            ENDIF.
          ENDIF.
          ENDIF.

ENDENHANCEMENT.

9. Goto T-code - ME51N.

        * GIVE ITEM - 10 AND PRESS ENTER.



Comments

Popular posts from this blog

Pf status and user command in factory method - OOPS ALV in ABAP

fetch the data from table and send an email in ABAP

Enhancements in abap