cancel
Showing results for 
Search instead for 
Did you mean: 

How to log change history in dso when it’s not coming from source sap bw

0 Kudos
272

Hi

I have a requirement where in I have to. Log the change change detail of the data.


existing record in dso

Key 1. Key 2. Valid from date Valid To date KPI

11 22 01012011 31129999 100

NEW RECORD COMING FROM SOURCE

Key 1. Key 2. Valid from date Valid To date KPI

11 22 01012011 31129999 200


Now the requirement is:

When we do the data load ,it will amend a new row in target adso with the same key 1 and key 2 value and first row valid to will b loading date -1 and second row valid from will b loading date ..So basically the expected output is like :

Key 1. Key 2. Valid from date Valid To date KPI

11 22 01012011 25072022 100

11 22 26072023. 31129999 200


pls help me how we can achieve it..

0 Kudos

kindly help me since it is urgent

Accepted Solutions (0)

Answers (5)

Answers (5)

appel_solar_dk
Active Participant
0 Kudos

Hi Tiwari

First of all you will need a target where the key is not only key1 and key2, you need to introduce a "valid to" and then you need to update the old record and create a new, but its overcomplicating things.

A more simple solution is to create a time dependent master data object and let that handle the date logic.

When updating the master data object you just feed

valid to = '99991231'

valid from = sy-datum

and then 1:1 for your key fields and your KPI.

I have here an example from an object in my system where we keep track of changes to 0material

Then BW will take care of changing the "valid to" date of the previous record. It may create many records that are basically the same day after day, you can compress them in a process chain with the process type "reorganize attributes and texts for master data"

If you want it you can then source the characteristic back to a DSO.

0 Kudos

In addition to avove,in source they won be changing the valid from and valid to..They will just change the KPI..We need to log the change date in BW

0 Kudos

In addition to avove,in source they won be changing the valid from and valid to..They will just change the KPI..We need to log the change date in BW

0 Kudos

Hi,

I have written below cod ein start routine :

DATA: gs_valid_records TYPE /BIC/AXXXXX.

DATA: gt_valid_records TYPE STANDARD TABLE OF /BIC/AXXXXX.
DATA: gv_date TYPE D.

gv_date = SY-DATUM.
data: lv_index TYPE i.



*"Create a workarea gs_valid_records with structure same as internal
*"table gt_vIalid_records
*DATA: gs_valid_records TYPE ty_s_valid_records.
*
*DATA: gt_valid_records TYPE STANDARD TABLE OF ty_s_valid_records.



.
SELECT * FROM /BIC/AXXXX
INTO TABLE gt_valid_records
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE TRMID = SOURCE_PACKAGE-TRMID AND
LOCFR = SOURCE_PACKAGE-LOCFR AND
LOCTO = SOURCE_PACKAGE-LOCTO AND
TTYPE = SOURCE_PACKAGE-TTYPE .

*
if gt_valid_records[] is not INITIAL.
SORT gt_valid_records by TRMID LOCFR LOCTO TTYPE VALFR VALTO.
endif.
*
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
READ TABLE gt_valid_records INTO gs_valid_records WITH key TRMID =
<source_fields>-TRMID
LOCFR = <source_fields>-LOCFR
LOCTO = <source_fields>-LOCTO
TTYPE = <source_fields>-TTYPE
VALFR = <source_fields>-VALFR
VALTO = <source_fields>-VALTO.

*TRANSPORTING NO FIELDS.
*VALFR = <source_fields>-VALFR
*VALTO = <source_fields>-VALTO.
lv_index = sy-tabix.

IF sy-subrc = 0.
* <SOURCE_FIELDS>-VALFR = SY-DATUM.

gv_date = SY-DATUM - 1.



gs_valid_records-VALTO = gv_date .

*gs_valid_records-VALFR = SY-DATUM .
MODIFY gt_valid_records INDEX lv_index FROM gs_valid_records
TRANSPORTING VALTO.
*"Update table
MODIFY /BIC/XXXXXX FROM TABLE gt_valid_records .
*"Modifying table with logic of -1 of sy-datum for existing record
ENDIF.
*

ENDLOOP.

*“Appending record

CLEAR : gs_valid_records .
*
REFRESH : gt_valid_records .

*“Appending record

CLEAR : gs_valid_records .

REFRESH : gt_valid_records .

LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
IF SY-SUBRC = 0.

<source_fields>-VALFR = sy-datum.

GS_VALID_RECORDS-TRMID = <source_fields>-TRMID.

gs_valid_records-LOCFR = <source_fields>-LOCFR.

gs_valid_records-LOCTO = <source_fields>-LOCTO.

gs_valid_records-TTYPE = <source_fields>-TTYPE.

gs_valid_records-VALFR = <source_fields>-VALFR.

gs_valid_records-VALTO = <source_fields>-VALTO.

gs_valid_records-DURAT = <source_fields>-DURAT.

APPEND gs_valid_records TO gt_valid_records.

INSERT /BIC/AXXXXX FROM TABLE gt_valid_records .

.

ENDIF.

ENDLOOP.


But its not giving me desired output

appel_solar_dk
Active Participant
0 Kudos

Hi XYZ Tiwari

Maybe you could elaborate on what you have tried so far and why you think it's not working?

regards

Kristian

PS I have never found that urgency is a reason to help. Urgency is typically something others define and it is not objective. Is it urgent because your business will face problems if it's not fixed before noon? Is it urgent because you are at an exam? Will you be fired at noon if it's not fixed? Did you promise somebody that you were able to do it, but wasn't?