05-12-2011 9:02 AM
Hi,
I am executing a report in background. The first time the report is executed I have to do a different processing. After the 1st execution I have to different processing.
Someone please tell me how to capture the 1st execution of a report. Is there a system variable ?
Appreciate your <removed by moderator> response.
Thanks,
Dikshitha G
Edited by: Thomas Zloch on May 12, 2011 11:36 AM
05-12-2011 9:27 AM
Hi.,
Create a Z table with one field count .
now in the first line of your report ., check the value of count by writing a select quest., if the value is initial(first time) do different processing. else do different processing. now in your report at last insert value to count.
hope this helps u.,
Thanks & regards
Kiran
05-12-2011 9:06 AM
there is way i know of to find that out during runtime.
Manually you could use TA STAD for that.
But since it seems to be a report of your own, why dont you set some variable to X in your first run. Preferably a TVARVC record.
you can maintain it as blank before first run, when it is blank assume it is first run, and during your first run set it as 'X' or whatever.
Next time you run it you get your TVARVC record again and see if it is 'X' then behave accodingly.
05-12-2011 9:13 AM
Hi,
Did you mean first time on a particular day ???
If so then check this example
TYPE-POOLS:abap.
TABLES indx.
DATA: indxkey TYPE indx-srtfd VALUE 'KEYVALUE'.
DATA:v_flag TYPE c.
indx-aedat = sy-datum.
indx-pgmid = sy-repid.
IMPORT v_flag FROM DATABASE indx(st) ID indxkey .
IF v_flag = abap_false.
WRITE: 'Not executed today'.
v_flag = abap_true.
EXPORT v_flag TO DATABASE indx(st) ID indxkey.
ELSE.
WRITE: 'Executed today'.
ENDIF.
05-12-2011 9:27 AM
Hi.,
Create a Z table with one field count .
now in the first line of your report ., check the value of count by writing a select quest., if the value is initial(first time) do different processing. else do different processing. now in your report at last insert value to count.
hope this helps u.,
Thanks & regards
Kiran
05-12-2011 9:31 AM
Hi,
I think I'll go with what Kiran says. Thanks all of you !
Regards,
Dikshitha G
05-12-2011 9:48 AM
Are you going to create a Z table for this ???? ... Is there nobody to advice you in your firm ???
05-12-2011 9:53 AM
Well Kiran proposes quite the same as me, i aint got no problem with that.
But it is really not needed to make a z-table for that. you can make use of an enrty in TVARVC.
That table is exactly forsuch purposes where you need to store just ONE field and dont want to make a z-table for that.
But yeah what you are trying to do will work.
05-12-2011 9:59 AM
Are you going to create a Z table for this ???? ... Is there nobody to advice you in your firm ???
Hello Keshav,
A couple of years ago i would have recommended using the INDX table, but it has got it's demerits.
Maintenance of Z-table is easier than the INDX table. Say there is some error in the program & you want to override the flag. Will it be easier to do so in the INDX table or via SM30 for the Z-Table?
As a matter-of-fact i will recommend using the solution provided by Florian the TVARVC technique.
1. Create a parameter(specific to your program) & transport it.(See the trxn STVARV)
2. In your program check the value of this param & set it accordingly.
Using TVARVC you will 2 birds with one stone:
1. You don't have to create a custom table.
2. Easy maintenance via STVARV trxn.
Hope you get the point!
Cheers,
Suhas
PS: In our system we have a Z-table designed specifically for this particular purpose. All the programs having this kind of requirement refer to this table.
05-12-2011 10:03 AM
Hi Suhas,
TVARVC did not come to my mind first. Actually creating table variables using TVARVC is a good approach . I am not advicing OP to use the INDX table as well ( instead he should have used TVARVC ) but i donot support creating a Z table when there is a facility already available to do this.
As you said when there is multiple programs then ok ( ztable can be used ) . Here i think its only for one program.
Anyways it depends upon OP's interest :).
Keshav
05-12-2011 10:09 AM
Ok. I'm going to use the TVARVC table. Thank you all for your response.
Regards,
Dikshitha G