Application Development and Automation 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: 
Read only

Data extraction automatically

Former Member
0 Likes
2,308

Hi,

I have a requirement where user requests data from database table once using an interface. Process needs to run continuously until data gets updated in DB table. DB table can get updated any time. Actually can I keep a process timingly check the DB automatically without user action?

Thanks In Advance.

Yaseen.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,513

You can setup a background job which runs every 5 minutes.

Regards,

Rich Heilman

11 REPLIES 11
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,514

You can setup a background job which runs every 5 minutes.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,513

Hi ,

If you are updating the data base table in background. You can check the log thru T/code SM37.

Lanka

Read only

Former Member
0 Likes
1,513

You can trigger the event when data gets uploaded or inserted in the table using table maintenance generator. You can create a event based job which has your interface program which executes when ever event is triggered.

Hope this helps.

Read only

Former Member
0 Likes
1,513

Hi Yaseen,

1. Is ur requirement something like this ?

2. On exection of seleciton scren,

some report (alv list) is displyuaed !

3. U want to REFRESH this alv list every

10 seconds or 1 minute for eg ??

regards,

amit m.

Read only

0 Likes
1,513

Hi Amit,

In place of list think it as a custom transaction interface. Yes I wnat to refresh on time basis with out user action.

Thanks,

Yaseen

Read only

0 Likes
1,513

Hi again,

1. CL_GUI_TIMER

Using this class we can achieve refresh automatically.

2. we have to trigger sy-ucomm (our code)

so that refresh takes place.

regards,

amit m.

Read only

0 Likes
1,513

Hi Amit,

Do u have any sample code.

Thanks,

Read only

Former Member
0 Likes
1,513

Hi again,

1. Ya, sample code is there

(but if u copy-paste directly in ur

program, it won't work bcos

my zinclude is there

)

2. However, The LOGIC will be clear to you

once u see this program.

3.

REPORT abc.

TYPE-POOLS : icon.

INCLUDE yhri_inclfor_alv.

DATA : ctr TYPE i,

nummax TYPE i.

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA: END OF itab..

*----


CLASS my DEFINITION.

PUBLIC SECTION.

METHODS : run_handler FOR EVENT finished OF cl_gui_timer.

ENDCLASS. "my DEFINITION

DATA timer TYPE REF TO cl_gui_timer.

DATA myh TYPE REF TO my.

----


  • CLASS my IMPLEMENTATION

----


*

----


CLASS my IMPLEMENTATION.

METHOD run_handler.

  • BREAK-POINT.

ctr = ctr + 1.

IF ctr >= 6.

EXIT.

ENDIF.

CALL METHOD timer->run.

PERFORM mylist.

  • SET USER-COMMAND 'TMR'.

ENDMETHOD. "run_handler

ENDCLASS. "my IMPLEMENTATION

*----


*----


Init

INITIALIZATION.

nummax = 5.

CREATE OBJECT timer.

CREATE OBJECT myh.

SET HANDLER myh->run_handler FOR ALL INSTANCES.

PARAMETERS : a TYPE c.

*----


End of selection

END-OF-SELECTION.

SELECT * FROM t001

INTO TABLE itab.

timer->interval = '0.5'.

CALL METHOD timer->run.

*----


PERFORM alv_customize USING sy-repid 'ITAB'.

PERFORM alv_display USING itab[].

*AB WRITE /: 'abc'.

*----


AT USER-COMMAND.

BREAK-POINT.

IF sy-ucomm = 'TMR'.

MESSAGE i999(yhr) WITH 'MM'.

ENDIF.

  • BREAK-POINT.

*----


FORM mylist.

PERFORM alv_customize USING sy-repid 'ITAB'.

PERFORM alv_display USING itab[].

*AB write 😕 'A'.

ENDFORM. "MYLIST

Regards,

amit m.

Read only

0 Likes
1,513

Hi Amit,

In ur above program we are just setting a timer(just few time), In that time if data doesnt get updated then program gets ended automatically. Here in my scenario I dont know how much time the process is going to take to update data in DB. Could you help me in this.

Thanks,

Yaseen

Read only

0 Likes
1,513

Hi again,

1. updated then program gets ended automatically

Our program will not end automatically.

2. In the User_command form,

write this again.

timer->interval = '0.5'.

CALL METHOD timer->run.

so that the TIMER is set AGAIN.

3. This will AUTO REFRESH after every 5 (eg)

seconds.

regards,

amit m.

Read only

0 Likes
1,513

Hi again,

1. use this code (just copy paste in new program)

It will work because simple write is use.

2. The system will WRITE hello

every five seconds.

3. Execute the program first.

4.

REPORT abc.

DATA : ctr TYPE i,

nummax TYPE i.

*----


DEFN

CLASS my DEFINITION.

PUBLIC SECTION.

METHODS : run_handler FOR EVENT finished OF cl_gui_timer.

ENDCLASS. "my DEFINITION

DATA timer TYPE REF TO cl_gui_timer.

DATA myh TYPE REF TO my.

----


  • CLASS my IMPLEMENTATION

----


*

----


CLASS my IMPLEMENTATION.

METHOD run_handler.

ctr = ctr + 1.

IF ctr >= 6.

EXIT.

ENDIF.

CALL METHOD timer->run.

PERFORM mylist.

ENDMETHOD. "run_handler

ENDCLASS. "my IMPLEMENTATION

*----


Init

INITIALIZATION.

nummax = 5.

CREATE OBJECT timer.

CREATE OBJECT myh.

SET HANDLER myh->run_handler FOR ALL INSTANCES.

*----


selection screen (just)

PARAMETERS : a TYPE c.

*----


start-OF-SELECTION.

timer->interval = '0.5'.

CALL METHOD timer->run.

WRITE /: 'abc'.

*----


FORM mylist.

write 😕 'Hello !'.

ENDFORM. "MYLIST

regards,

amit m.