Skip to Content
0
Former Member
Dec 22, 2009 at 02:21 PM

Important points to be cautios of when updating a standard table

194 Views

Dear SDNers,

Based on the check on the selection screen for the field xerwrt, I am using the below code to modify/update the contents of the standard table ANLA.

meaning:

If the user selects the check for the field xerwrt, then the corresponding field of the record from the table ANLA has to get updated with a check(yes) too.

Kindly let me know what are the things that i need to be cautions of since i am updating the standard table ANLA.

REPORT ZAUPDATE_MEMO_VALUE .
*TABLE Declarations*
TABLES : ANLA.
 
*Internal table declarations
DATA: W_ANLA LIKE ANLA.
 
*Selection Screen*
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE ANLA-BUKRS OBLIGATORY,
            P_ANLN1 LIKE ANLA-ANLN1 OBLIGATORY,
            P_ANLN2 LIKE ANLA-ANLN2 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
PARAMETERS: P_XERWRT LIKE ANLA-XERWRT.
SELECTION-SCREEN END OF BLOCK BLK2.
 
*at selection-screen.
AT SELECTION-SCREEN.
  SELECT SINGLE *
                FROM ANLA INTO W_ANLA
                WHERE BUKRS = P_BUKRS
                AND ANLN1 = P_ANLN1
                AND ANLN2 = P_ANLN2.
  IF NOT SY-SUBRC IS INITIAL.
    MESSAGE E001(ZZ)."No data found for search criteria
  ENDIF.
 
  IF P_XERWRT = 'X'.
    W_ANLA-XERWRT = 'X'.
    UPDATE ANLA FROM W_ANLA .
    CLEAR W_ANLA.
     ENDIF.

Regards,

SuryaD.