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

calling a program when a table is updated

prabhu_s2
Active Contributor
0 Likes
1,101

hi all

i need to run a program whenever <b>a table</b> is updated. Say it might be a customized table or a std table. anymean we can achieve this? if yes, let me know more in detail.

i though of having the report program specific to the table which will run for every 5 mins and check if the table is updated. but internaly this might be bit complicated i believe. anyother suggestion?

regds

Prabhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,002

Hi Prabhu,

If you are updating the table through any transaction then you can create a workflow with triggered events or check if Table CDHDR or CDPOS is updated to find the tables that were changed and trigger your program accordingly.

Thanks,

Prashanth

6 REPLIES 6
Read only

Former Member
0 Likes
1,003

Hi Prabhu,

If you are updating the table through any transaction then you can create a workflow with triggered events or check if Table CDHDR or CDPOS is updated to find the tables that were changed and trigger your program accordingly.

Thanks,

Prashanth

Read only

0 Likes
1,002

thks prasanth, i havent tried this with customized tables. is that possibel of this too?

Read only

Former Member
0 Likes
1,002

Hi,

The below code demonstrates how to create a simple report which automatically updates itself every 10

seconds and displays the new results on screen. This is without any intervention from the user.

  • Automatic refresh report

*.......................................................................

*: Report: ZAUTO_REFRESH :

*: :

*: Author: SAPDev.co.uk :

*: :

*: Description: Display a report which automatically updates itself :

*: every 10 seconds :

*: :

*:.....................................................................:

REPORT zauto_refresh .

DATA: g_init_once,

ok_code(20),

g_ref_from_timer.

TYPES: BEGIN OF t_ekko,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

meins TYPE ekpo-meins,

netpr TYPE ekpo-netpr,

peinh TYPE ekpo-peinh,

END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

wa_ekko TYPE t_ekko.

IF g_init_once <> 'X'.

g_init_once = 'X'.

CALL FUNCTION 'Z_ENQUE_SLEEP'

STARTING NEW TASK 'WAIT'

PERFORMING when_finished ON END OF TASK.

ENDIF.

WRITE:/ 'wait for 10 sec....'.

AT USER-COMMAND.

CASE ok_code.

WHEN 'FCT_R'.

SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh

UP TO 10 ROWS

FROM ekpo

INTO TABLE it_ekko.

WRITE:/ sy-uzeit. "Time

LOOP AT it_ekko INTO wa_ekko.

WRITE:/ wa_ekko-ebeln, wa_ekko-ebelp.

ENDLOOP.

sy-lsind = 0.

IF g_ref_from_timer = 'X'.

CALL FUNCTION 'Z_ENQUE_SLEEP'

STARTING NEW TASK 'INFO'

PERFORMING when_finished ON END OF TASK.

g_ref_from_timer = ''.

ENDIF.

ENDCASE.

----


  • FORM WHEN_FINISHED *

----


  • ........ *

----


  • --> TASKNAME *

----


FORM when_finished USING taskname.

RECEIVE RESULTS FROM FUNCTION 'Z_ENQUE_SLEEP'.

g_ref_from_timer = 'X'.

  • Trigger an event to run the at user-command

SET USER-COMMAND 'FCT_R'.

ok_code = 'FCT_R'.

sy-ucomm = 'FCT_R'.

ENDFORM. " WHEN_FINISHED

*Signiture for creating Function module used above

FUNCTION Z_ENQUE_SLEEP.

*"----


""Local interface:

*"----


wait up to 10 seconds.

ENDFUNCTION.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

0 Likes
1,002

thkx sipra...this was indeed very helpful...but my q is how to track execute a report which is specific to table:mara when there is a table updated for the same?

Read only

Former Member
0 Likes
1,002

Hi Prabhu,

I hope it will work since customized tabele will also be update through any transaction so you can check it out by manually entering values in it.

Thanks,

Prashanth

Read only

0 Likes
1,002

thkx

let me check