GoodleAds

MODIFY DATA INTERNAL TABLE BY USING MODIFY KEYWORD


Modify the data in internal table by using modify keyword

    This is 2 step procedure.
1. Fill the latest information into the work area.
2. Modify the internal table based on work area.

Syntax:- Modify <it> from <wa>  transporting <field1> <field2>  where <condition>

Ex: - WA_T001-ORT01 = ‘BAN’. 
         Modify IT_T001 from WA_T001 transporting ORT01 where BUKRS = ‘2000’.

If we are maintaining all the fields information in the work area (key field)

Syntax: - Modify <it> from <wa> 

PROGRAM:

*&---------------------------------------------------------------------*
*& Report  ZR_MODIFY_KEYWORD
*&
*&---------------------------------------------------------------------*
REPORT ZR_MODIFY_KEYWORD.
TYPE-POOLS SLIS.
TABLES EKKO.
SELECT-OPTIONS S_EBELN FOR EKKO-EBELN.
DATABEGIN OF WA_EKKO,
      EBELN 
LIKE EKKO-EBELN,
      BEDAT 
LIKE EKKO-BEDAT,
      LIFNR 
LIKE EKKO-LIFNR,
      
END OF WA_EKKO.


DATA IT_EKKO LIKE TABLE OF WA_EKKO.


SELECT EBELN BEDAT LIFNR
  
FROM EKKO
  
INTO TABLE IT_EKKO
  
WHERE EBELN IN S_EBELN.


DATAIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT 
LIKE LINE OF IT_FCAT.


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME  =
 SY-CPROG
      I_INTERNAL_TABNAME  
'WA_EKKO'
      I_INCLNAME  
SY-CPROG    CHANGING
      CT_FIELDCAT  
IT_FCAT.


* Modify the field catalog based on requirement 


WA_FCAT-KEY = 'X'.                   " VENDOR DISPLAYED WITH KEY FIELD COLOUR


MODIFY IT_FCAT
       
FROM WA_FCAT
       
TRANSPORTING KEY EMPHASIZE
       
WHERE FIELDNAME 'LIFNR'.

WA_FCAT-HOTSPOT  =  'X'.


MODIFY IT_FCAT
       
FROM WA_FCAT
       
TRANSPORTING HOTSPOT
       
WHERE FIELDNAME 'LIFNR'.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     IT_FIELDCAT 
IT_FCATTABLES
     T_OUTTAB  =
 IT_EKKO.



OUTPUT:


No comments:

Post a Comment