Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

load system date into an internal table ?

former_member182467
Participant
0 Kudos

Hi,

I want to load sytem date to all the entries into to that DSO when ever the data gets loaded to it.

Can anyone suggest me how to load the sydatum to the internal table ?

for example the internal table is tablea.

update zdate in intable where zdate =system date. ( i dont know abap) >pleae suggest.

Thank You,

Daniel

14 REPLIES 14

Former Member
0 Kudos

Use zdate = sy-datum.

Former Member
0 Kudos

update statement cannot be used for Internal Table in ABAP.

so you use the following code:

modify itab from wa transporting zdate where zdate = sy-datum.

Former Member
0 Kudos

Hi Daniel,

in your routine, u can try the following. u should be able to proceed

data : w_date type sy-datum.

w_date = sy-datum.

modify tablea from wa_tablea transporting zdate where zdate = w_date.

" wa_tablea -> work area for the internal table - tablea.

Thanks

Vivek

raymond_giuseppi
Active Contributor
0 Kudos

Check MODIFY itab statement documentation first like in

l_s_datapak_line-xxxxx = sy-datum.

MODIFY datapak FROM  l_s_datapak_line TRANSPORTING xxxxx WHERE xxxxx NE sy-datum.

(Basic question - Read the Rules of Engagement.)

Regards,

Raymond

Former Member
0 Kudos

Hi Daniel,

Say your internal table name is TABLEA.

Also your internal table contains a date field say DATE1 which is of type SY-DATUM.

Then you can use below logic to load the SY-DATUM value to DATE1 field of all records of the internal table TABLEA.

Case-1: If your internal table TABLEA is with header line

LOOP AT TABLEA.

     TABLEA-DATE1 = SY-DATUM.

     MODIFY TABLEA TRANSPORTING DATE1.

CLEAR TABLEA.

ENDLOOP.

Case-2:  if the TABLEA internal table is with out header line, then declare a workarea X_TABLEA of type TABLEA.

then use the below logic.

LOOP AT TABLEA INTO X_TABLEA.

     X_TABLEA-DATE1 = SY-DATUM.

     MODIFY TABLEA FROM X_TABLEA TRANSPORTING DATE1.

CLEAR X_TABLEA.

ENDLOOP.

Hope this will help you.

Thanks & Regards,

Venugopal M N

Former Member
0 Kudos

Hi Daniel,

Suppose your internal table is lt_dso and work area as wa_dso.

If you want to populate system date to your date field of internal table refer the code below.

Loop at lt_dso into wa_dso.

wa_dso-date = sy-datum.

modify lt_dso from wa_dso.

endloop.

0 Kudos

Hi Venkat,

Thanks for the update. Can i write this code in the expert routine of the transformation ? Do you have idea about the SAP BI Transformation ? After every data load, I want to upload all the values of the DSO with the current day's system date.

So...if the dso name is DSOA....Can I write this below code in the expert routine of the DSO, if you are not aware, expert routine is executed at the end of the DSO loading. ...or Can I write this in the start routine of the DSO ? I think start routine is fine as anyway we dont change this zdate field anywhere .....did you get my query ? Please suggest.

IT_DSOA will be the internal active table of the DSO....is it /bic/adsoa00

Loop at /bic/adsoa00 into wa_dso.

wa_dso-date = sy-datum.

modify /bic/adsoa00 from wa_dso.

endloop.

Cheers,

DR

0 Kudos

Hi Daniel,

Actually i don't have much knowledge on BI but  i discussed your issue with one of my BI colleague and got some input for you.

As per our discussion, he told that code should be written in Start Routine since the field ZDATE will be in the internal table SOURCE_PACKAGE.

Where

SOURCE_PACKAGE type _ty_t_SC_1.

WA type _ty_s_SC_1.

loop at SOURCE_PACKAGE into wa.

wa-zdate = sy-datum.

modify source_package from wa.

endloop.


0 Kudos

Thank you so much. I appreciate your help. I understand your point, but here my case is different, if we put it in the source_package, only that load will get the date as the system date. But here our case is different, let me explain....we have a field called last loaded date in the report and we are using a zfield in the infocube to get this value which is populated with the system date. ....if we use this we cannot get the correct loaded date for all the previous delta records......so i want to load all the values in the infocube with the current system date for which we can get that value which ever record we pick from the infocube. For that I should take the internal tabl of the infocube and should load all the records of it with that day's system date so that I can get the loaded date which ever record I access. Hope I dint confuse you

Thanks again,

DR

0 Kudos

Daniel,

Are u uploading full upload or delta upload?

If you are doing full upload change the code which i given in the end routine.

Replace source_package with Result_Package as shown below

loop at Result_PACKAGE into wa.

wa-zdate = sy-datum.

modify Result_PACKAGE from wa.

endloop.

Delete the entire data from the Infocube.

Reload the data from DSO to cube so that every record zdate will be replaced with system date.

Incase of delta uplaod, we can't make changes for the previous data in Infocube.

0 Kudos

Thank You Venkat. Its a daily delta load, full load would have resolved my issue. Now my options,

1) daily delete and reload infocube.

2) do a self loop on the infocube, and change only that date. ...in the transformation.

I will try these and will update you tmrw.

Thanks agian bro.

Cheers,

DR

0 Kudos

Hi Venkat,

I have a problem, I have tried that but all the records are getting doubled, as the Infocube does not have an overwrite option. I am getting all the result with as a 2nd set with the system date (loaded date). In that case, is there any other option other than deleting the records before loading to the same cube.

You got me ? For example if the sales is 50,000 $ for 9/4/2013. After doing the self load, i got today's system date for all the data but the report is showing 50,000 $ for 9/4/2013 and 50,000 for 10/4/2013. I cannot delete the data from the existing cube as in production we will be having huge volume of sales into it.

Can we add a ZKF with date option and replace all the value's in the infocube for that date KF, through a routine in the start routine or end routine. Will that work ? Please suggest.

I have written the code in the start routine by adding a zdate key figure to the test cube. But I am unable to get the values and its throwing an error. Can u pls review my code. I appreciate it.

' TESTcube --> is the infocube name, where i have added the keyfigure as date.

Declaration: this is the factable name of the infocube.

   data : itab1 type table of /BIC/FTESTCUBE,
             wa1 type /BIC/FTESTCUBE.

  itab1[] = /BIC/FTESTCUBE[].
   loop at itab1 into wa1.
    wa1-/BIC/ZKF_DATE = sy-datum.
    modify /BIC/FTESTCUBE from wa1.

     ENDLOOP.

Thanks,

DR

0 Kudos

Hi Daniel,

we should not use /bic/ftestcube as a internal table

Write the code in End Routine.

Also, i will update the reply with code shortly..

0 Kudos

Hi Venkat,

Please provide the code to use it in the end routine. And also, I have another doubt, can we use last value property for this zdate so that it will always display the last loaded date in this field. Can we use this property in the bex ? For this to enable, should we load the sy-datum in the kf or char ? Please suggest your views on this option.

Thank You,

DR