17. Juni 2009 17:48
17. Juni 2009 20:43
18. Juni 2009 07:43
18. Juni 2009 09:07
18. Juni 2009 09:44
F_Änderungsprotokoll()
Name                      DataType   Subtype   Length
RR_Key                      Record                   Key   
RR_Field                      Record                   Field   
RR_Tabelle      RecordRef      
RR_Change Log Entry      Record                   Change Log Entry   
VV_PrimaryKey      Text                      1024
VV_PK_1_Name      Text                      30
VV_PK_2_Name      Text                      30
VV_PK_3_Name      Text                      30
VV_PK_1_Nummer      Integer      
VV_PK_2_Nummer      Integer      
VV_PK_3_Nummer      Integer      
VV_PK_1_Value   Text      30
VV_PK_2_Value   Text      30
VV_PK_3_Value   Text      30
VV_PK_1_Name   := '';
VV_PK_2_Name   := '';
VV_PK_3_Name   := '';
VV_PK_1_Nummer := 0;
VV_PK_2_Nummer := 0;
VV_PK_3_Nummer := 0;
VV_PK_1_Value  := '';
VV_PK_2_Value  := '';
VV_PK_3_Value  := '';
RR_Key.SETRANGE(TableName,TABLENAME);
RR_Key.SETRANGE("No.",1);
IF NOT RR_Key.FINDFIRST THEN CLEAR(RR_Key);
VV_PrimaryKey := RR_Key.Key;
IF STRPOS(VV_PrimaryKey,',') <> 0 THEN BEGIN
   VV_PK_1_Name := COPYSTR(VV_PrimaryKey,1,STRPOS(VV_PrimaryKey,',')-1);
   RR_Field.RESET;
   RR_Field.SETRANGE(TableNo,RR_Key.TableNo);
   RR_Field.SETRANGE(FieldName,VV_PK_1_Name);
   IF NOT RR_Field.FINDFIRST THEN CLEAR(RR_Field);
   VV_PK_1_Nummer := RR_Field."No.";
   VV_PrimaryKey := COPYSTR(VV_PrimaryKey,STRPOS(VV_PrimaryKey,',')+1);
END ELSE BEGIN
   VV_PK_1_Name := RR_Key.Key;
   RR_Field.RESET;
   RR_Field.SETRANGE(TableNo,RR_Key.TableNo);
   RR_Field.SETRANGE(FieldName,VV_PK_1_Name);
   IF NOT RR_Field.FINDFIRST THEN CLEAR(RR_Field);
   VV_PK_1_Nummer := RR_Field."No.";
END;
IF STRPOS(VV_PrimaryKey,',') <> 0 THEN BEGIN
   VV_PK_2_Name := COPYSTR(VV_PrimaryKey,1,STRPOS(VV_PrimaryKey,',')-1);
   RR_Field.RESET;
   RR_Field.SETRANGE(TableNo,RR_Key.TableNo);
   RR_Field.SETRANGE(FieldName,VV_PK_2_Name);
   IF NOT RR_Field.FINDFIRST THEN CLEAR(RR_Field);
   VV_PK_2_Nummer := RR_Field."No.";
   VV_PrimaryKey := COPYSTR(VV_PrimaryKey,STRPOS(VV_PrimaryKey,',')+1);
END;
IF STRPOS(VV_PrimaryKey,',') <> 0 THEN BEGIN
   VV_PK_3_Name := COPYSTR(VV_PrimaryKey,1,STRPOS(VV_PrimaryKey,',')-1);
   RR_Field.RESET;
   RR_Field.SETRANGE(TableNo,RR_Key.TableNo);
   RR_Field.SETRANGE(FieldName,VV_PK_3_Name);
   IF NOT RR_Field.FINDFIRST THEN CLEAR(RR_Field);
   VV_PK_3_Nummer := RR_Field."No.";
   VV_PrimaryKey := COPYSTR(VV_PrimaryKey,STRPOS(VV_PrimaryKey,',')+1);
END;
RR_Tabelle.OPEN(RR_Field.TableNo);
RR_Tabelle.GETTABLE(Rec);
VV_PK_1_Value := FORMAT(RR_Tabelle.FIELD(VV_PK_1_Nummer));
IF VV_PK_2_Nummer <> 0 THEN
   VV_PK_2_Value := FORMAT(RR_Tabelle.FIELD(VV_PK_2_Nummer));
IF VV_PK_3_Nummer <> 0 THEN
   VV_PK_3_Value := FORMAT(RR_Tabelle.FIELD(VV_PK_3_Nummer));
"RR_Change Log Entry".RESET;
"RR_Change Log Entry".SETCURRENTKEY("Table No.",
                                    "Primary Key Field 1 Value",
                                    "Primary Key Field 2 Value",
                                    "Primary Key Field 3 Value",
                                    "Date and Time");
"RR_Change Log Entry".SETRANGE("Table No.",RR_Key.TableNo);
"RR_Change Log Entry".SETRANGE("Primary Key Field 1 Value",VV_PK_1_Value);
IF VV_PK_2_Nummer <> 0 THEN
   "RR_Change Log Entry".SETRANGE("Primary Key Field 2 Value",VV_PK_2_Value);
IF VV_PK_3_Nummer <> 0 THEN
   "RR_Change Log Entry".SETRANGE("Primary Key Field 3 Value",VV_PK_3_Value);
FORM.RUN(595,"RR_Change Log Entry");