How to Add a Timestamp Field to an SAP Data Source
In this blog, we are going to learn how to add timestamp field to a data source. We will try to load data for respective time intervals by,
- Enhancing the Data Source.
- Selecting the options.
- Replicating Data source in BW.
Blog content:
Option 1:
Check whether the field is there in the Data Source. If the field is available enhance the Data Source in Rsa6, checking the selection checkbox and replicating the Data Source in BW.
Fields in Data Source of type RAW and Decimal is not available for selection in filter conditions of DTP.
Option 2
New custom field in the structure. This structure extends the standard structure of the Data Source. The system triggers the enhancement when it calls the Include from the Function group. The input of this new custom field is the output of the previously available field (Raw or Decimal).
Option 1
We did not have Time Stamp Field enabled in oFI_ACDOCA_20 Data Source.
It is easy to load respective day’s data when we enable Time Stamp field in Data Source.
To add a field, we need to enhance the Data Source.
Go to RSA6 Transaction
Select the Data Source, for this 0FI_ACDOCA_20.
Double click on the data Source and the field is not there in selections.
Select your data source and click on the edit icon. Collect TR and enable selections for Timestamp by checking Selection checkbox for Timestamp.
Deselect the check boxes ‘Hide field’ and ‘Field only known in customer exit’. Save.
(Note: if you do not deselect these options here, the field will not come to BW).
Replicate the Data Source.
Use this while extracting data from Data Source in filter conditions.
Using Timestamp in filters we can load respective time data.
Here Timestamp field is decimal Datatype.
Here Timestamp field is the Decimal data type.
Fields in Data source of type RAW and Decimal is not available for selection in filter conditions of DTP. Option 1 won’t work because the field is decimal.
Option 2
Here we need to create a custom field with Char datatype.
The Purpose of the custom field is to maintain the Time Stamp value. The previously defined Time Stamp field is of decimal data type, In BW we cannot use Decimal and Raw data types in Info-Package selection filters. So, we are creating a new Time Stamp field of CHAR datatype.
Developers write the code so that the newly created custom field (ZZ_TIMESTAMP) retrieves its value from the old field (TIMESTAMP). As a result, we use this new custom field in the BW Info-Package selection filter to extract data for a specific timestamp.
ECC – BACKEND1
The system creates the new custom field ZZ_TIMESTAMP in the structure ZFINS_AS_****_BW_TS. This structure extends the standard structure FINS_ACDOCA_BW_CT (Extractor) of the Data Source 0FI_*_20. The custom field includes a predefined data element ZDE_TIMESTAMP, with a CHAR type and a length of 15.2.
The system triggers the enhancement ZEI_BW__TIMESTAMP when it calls the **Include LFIS__BIWF01 from the **Function group SAPLFIS_*_BIW.
The system activates the implicit enhancement.
3. When Data Source is 0FI_*****_20 is being extracted using t-code RSA3, the enhancement is triggered from the said call. Internal table I_T_SELECT contains the inputted filters used for extraction. The internal table is checked for not null condition and if success, the said table is read for fieldname ‘TIMESTAMP’.
4. I_T_SELECT table is looped for fieldname ‘ZZ_TIMESTAMP’ into work area LS_SELECTION. The work area is then assigned value ‘TIMESTAMP’ to it, for fieldname FIELDNM. This work area is appended to the table.
Here we are passing TIMESTAMP field to custom ZZ_TIMESTAMP field.
ECC – BW Changes Enabled custom field for display and selection in the Data Source capture the changes (same as option 1).
BW- BACKEND
Replicate the Data Source in BW, new field is available in Info Package Selection.
Captured Active version of Data Source.
Now, Newly created custom field can filter records specific to timestamp.