简体   繁体   中英

Disable Column in VA01

I have a requirement where I need to disable the full column in Sales Order Line item. Fields are VBAP-ARKTX and VBAP-KDMAT .

I've found the way to disable columns with data in them, but not the whole column.

I used USEREXIT_FIELD_MODIFICATION to achieve this using the following code;

IF sy-TCODE = 'VA02'.
  IF screen-name = 'VBAP-KDMAT' .
      screen-INPUT = 0.
      modify screen.
  ENDIF.
ENDIF.

Is there a way to disable the whole column?

在此处输入图片说明

Adjusting table control which contains items is the easiest and the most recommended way. It can be done for single user or for group of users. Otherwise, try to create a screen variant in SHD0. It allows easily hide any column of any table and any field on the screen.

The specific problem I faced was how to disable two fields, but let standard mapped data to be displayed in them.

To cater this requirement I used the following;

Include: MV45AFZZ
User Exit Name: USEREXIT_FIELD_MODIFICATION
Enhancement Name: -Any name you want-

I created an Enhancement and wrote the following code;

"Specify the condition
IF VBAK-VKORG = '1234' AND ( sy-TCODE = 'VA02' OR sy-TCODE = 'VA01' ) AND ( screen-name = 'VBAP-KDMAT' OR screen-name = 'VBAP-ARKTX' ).

        screen-input = 0."disable input
        MODIFY SCREEN.

         DATA: i_tab_mara TYPE TABLE OF MARA WITH HEADER LINE.
         DATA: l_maktx TYPE MAKT-MAKTX.
         DATA: WA_MARA LIKE LINE OF i_tab_mara.

         DATA: i_tab_vbap TYPE TABLE OF VBAP WITH HEADER LINE.
         DATA: wa_vbap LIKE LINE OF i_tab_vbap.

          IF sy-TCODE = 'VA01' .

             SELECT SINGLE * from MARA INTO WA_MARA WHERE MATNR eq VBAP-MATNR.

             SELECT MAKTX FROM MAKT INTO l_maktx WHERE MATNR eq VBAP-MATNR.
             ENDSELECT.

             VBAP-KDMAT = WA_MARA-KDMAT.
             VBAP-ARKTX = l_maktx.

             MODIFY SCREEN.

          ELSEIF sy-TCODE = 'VA02' .

           SELECT SINGLE * FROM VBAP INTO WA_VBAP WHERE VBELN eq VBAK-VBELN AND POSNR eq VBAP-POSNR.

           IF WA_VBAP-ARKTX eq ''." Check if the fileds are empty, otherwise old data is overwritten

             SELECT MAKTX FROM MAKT INTO l_maktx WHERE MATNR eq VBAP-MATNR.
             ENDSELECT.

             VBAP-ARKTX = l_maktx.

             MODIFY SCREEN.

           ENDIF.

           IF WA_VBAP-KDMAT eq ''." Check if the fileds are empty, otherwise old data is overwritten

             SELECT SINGLE * from MARA INTO WA_MARA WHERE MATNR eq VBAP-MATNR.

             VBAP-KDMAT = WA_MARA-KDMAT.

             MODIFY SCREEN.

           ENDIF.
    ENDIF.
ENDIF.

There is one thing, that You can do in the dynpro-designer. There You can modify the sap-standard-dynpro as a dynpro-modification. Nevertheless, this might be overwritten with the next release. Is this also an option for You ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM