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

hi experts,

Former Member
0 Likes
875

can anyone please tell me what are the control events and explain the use of it with examples?

thanks,

Sangeetha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
836

Hi

An SAP event is a "flag" that is created in SAP (SM62). This event (or flag) can be triggered (from a Unix job to an incoming file), causing a job to execute in the background. This event (or flag) can be triggered within R/3 or can be done at the Unix level.

First, create an event in SM62. It’s easy - just create it under "user event names" and "maintain". You’ll find the create option from there.

Once created go to SM36 and create the job. Put in the job name you want to call it - fill in the ABAP/4 program you’ll want executed, but under "START DATE" select option AFTER EVENT. Then plug in your SAP event name you created. Fill in the remaining information on this screen and save.

Once saved, an entry is put in table BTCEVTJOB. The entry is the name of the event you raised. This is the system’s way of keeping track of which jobs are in the queue waiting for an event to occur.

Now, once the event is triggered this newly created job will execute. The event can be triggered via sap (SM64) or at the Unix level.

SM64 is pretty self-explanatory. To get the event triggered from Unix:

-Log into the <SID>adm user id at the Unix level and go to directory /usr/sap/<SYSID>/SYS/exe/run (there is an alias called 'cdexe' that will get you there)

-From there look for an executable called sapevt. Open another Unix window cause now you are going to need to cut and paste.

-At the other sap window switch user to the <SID>adm user and go to the /usr/sap/<SYSID>/SYS/profile directory ('cdpro' is the alias)

-Do an "ll | more" and look for the instance profile name (the sapevt executable will want this!) Example: <SID>_DVEBMGS00_<SYSNAME>

-Go back to the sapevt window and enter this command to get the event to raise:

sapevt <event_name> -t pf=<instance_profile_directory_and_name> nr=<SYS_number>

Example: sapevt roberts_test -t pf=/usr/sap/<SID>/SYS/profile/<SID>_DVEBMGS00_<SYSNAME> nr=00

-This will raise the event, and cause the job scheduled within SAP to execute.

Once the job has executed the SAP event that was in the table BTCEVTJOB will disappear.

Another table, TABTCO, will now have an entry in it with the SAP job that was executed. Once you’ve found that job name in this table you can double click on its entry and see that it was executed via an event.

-


To set TRACE level WITHOUT bringing down the system:

Find the dispatcher process at the Unix level like this:

ps -ef | grep dw.sap | more

In the third column look for the "child" process ID number that repeats itself over and over

Then verify that number to the number in the second column, which should be the parent PID number.

Then issue the Unix command: kill -usr3 parent-pid-number (to turn on level 3 trace)

kill -usr2 parent-pid-number (to turn on level 2 trace)

kill -usr1 parent-pid-number (to turn on level 1 trace)

-


To Transport Maintenance Dialogs, you need to enter the object(s) in the following manner in the command file:

R3TR TOBJ tablename …. (11th position) S

Function Group

Table Structure

And the entries for your table in TVDIR and TDDAT

To see if a rollback is occurring at the Informix database level, do the following:

onstat -u | more

Look for the letter "R" in the 3rd column under the "flags". "R" means rollback - "P" means primary - "X" means critical

Reward all helpfull answers

Regards

Pavan

can anyone please tell me what are the control events and explain the use of it with examples?

thanks,

Sangeetha

3 REPLIES 3
Read only

Former Member
0 Likes
836

hi,

AT - Control breaks with extracts

Variants:

1. AT NEW f.

2. AT END OF f.

3. AT FIRST.

4. AT LAST.

5. AT fg.

Effect

In a LOOP which processes a dataset created with EXTRACT, you can use special control structures for control break processing. All these structures begin with AT and end with ENDAT. The sequence of statements which lies between is executed whenever a control break occurs.

You can use these key words for control break processing with extract datasets only if the active LOOP statement is processing an extract dataset.

The control level structure with extract datasets is dynamic. It corresponds exactly to the sort key of the extract dataset, i.e. to the order of fields in the field group HEADER by which the extract dataset was sorted.

At the end of a control group ( AT END OF, AT LAST), there are two types of control level information between AT and ENDAT:

If the sort key of the extract dataset contains a non-numeric field h (particularly in the field group HEADER), the field CNT(h) contains the number of control breaks in the (subordinate) control level h.

For extracted number fields g (see also ABAP Number Types), the fields SUM(g) contain the relevant control totals.

Notes

The fields CNT(h) and SUM(g) can only be addressed after they have been sorted. Otherwise, a runtime error may occur.

The fields CNT(h) and SUM(g) are filled with the relevant values for a control level at the end of each control group ( AT END OF, AT LAST), not at the beginning (AT FIRST, AT NEW).

When calculating totals with SUM(g), the system automatically chooses the maximum field sizes so that an overflow occurs only if the absolute value area limits are exceeded.

You can also use special control break control structures with LOOPs on internal tables.

Variant 1

AT NEW f.

Variant 2

AT END OF f.

Effect

f is a field from the field group HEADER. The enclosed sequence of statements is executed if

the field f occurs in the sort key of the extract dataset (and thus also in the field group HEADER) and

the field f or a superior sort criterion has a different value in the current LOOP line than in the preceding (AT NEW) or subsequent (AT END OF) record of the extract dataset.

If f is not an assigned field symbol, the control break criterion is ignored, and the subsequent sequence of statements is not executed. If a field symbol is assigned, but does not point to the HEADER field group, the system triggers a runtime error.

Example

DATA: NAME(30),

SALES TYPE I.

FIELD-GROUPS: HEADER, INFOS.

INSERT: NAME INTO HEADER,

SALES INTO INFOS.

...

LOOP.

AT NEW NAME.

NEW-PAGE.

ENDAT.

...

AT END OF NAME.

WRITE: / NAME, SUM(SALES).

ENDAT.

ENDLOOP.

Notes

If the extract dataset is not sorted before processing with LOOP, no control level structure is defined and the statements following AT NEW or AT END OF are not executed.

Fields which stand at hex zero are ignored by the control break check with AT NEW or AT END OF. This corresponds to the behavior of the SORT statement, which always places unoccupied fields (i.e. fields which stand at hex zero) before all occupied fields when sorting extract datasets, regardless of whether the sort sequence is in ascending or descending order.

Variant 3

AT FIRST.

Variant 4

AT LAST.

Effect

Executes the relevant series of statements just once - either on the first loop pass (with AT FIRST) or on the last loop pass (with AT LAST).

Variant 5

AT fg.

Addition:

... WITH fg1

Effect

This statement makes single record processing dependent on the type of extracted record.

The sequence of statements following AT fg are executed whenever the current LOOP record is created with EXTRACT fg (in other words: when the current record is a fg record).

Addition

... WITH fg1

Effect

Executes the sequence of statements belonging to AT fg WITH fg1 only if the record of the field group fg in the dataset is immediately followed by a record of the field group fg1.

Additional help

Control Level Processing

Read only

Former Member
0 Likes
836

Hi Sangeeta ,

This is a report which handles user events .On trigerring of control event for sender the module for reciever is called. Please award points

REPORT ya26.

----


  • CLASS sender DEFINATION

----


CLASS c_sender DEFINITION.

PUBLIC SECTION.

DATA : var_sender TYPE i.

EVENTS : event_call .

METHODS : sub_sender EXPORTING var TYPE i.

PRIVATE SECTION.

DATA : value TYPE i VALUE 2 .

ENDCLASS. "sender DEFINITION

----


  • CLASS sender IMPLEMENTATION

----


*

----


CLASS c_sender IMPLEMENTATION.

METHOD sub_sender.

var = value * 2.

WRITE : 'Double : ' , var .

RAISE EVENT event_call.

ENDMETHOD. "sub_sender

ENDCLASS. "sender IMPLEMENTATION

----


  • CLASS reciever DEFINITION

----


*

----


CLASS reciever DEFINITION.

PUBLIC SECTION.

METHODS : sub_reciever FOR EVENT event_call OF c_sender .

ENDCLASS. "reciever DEFINITION

----


  • CLASS reciever IMPLEMENTATIO

----


*

----


CLASS reciever IMPLEMENTATION.

METHOD sub_reciever.

WRITE : 'triple'.

ENDMETHOD. "reciever

ENDCLASS. "reciever IMPLEMENTATIO

START-OF-SELECTION.

DATA : ref1 TYPE REF TO c_sender.

DATA : ref2 TYPE REF TO reciever.

CREATE OBJECT ref2.

CREATE OBJECT ref1.

SET HANDLER ref2->sub_reciever FOR ref1.

CALL METHOD ref1->sub_sender.

Read only

Former Member
0 Likes
837

Hi

An SAP event is a "flag" that is created in SAP (SM62). This event (or flag) can be triggered (from a Unix job to an incoming file), causing a job to execute in the background. This event (or flag) can be triggered within R/3 or can be done at the Unix level.

First, create an event in SM62. It’s easy - just create it under "user event names" and "maintain". You’ll find the create option from there.

Once created go to SM36 and create the job. Put in the job name you want to call it - fill in the ABAP/4 program you’ll want executed, but under "START DATE" select option AFTER EVENT. Then plug in your SAP event name you created. Fill in the remaining information on this screen and save.

Once saved, an entry is put in table BTCEVTJOB. The entry is the name of the event you raised. This is the system’s way of keeping track of which jobs are in the queue waiting for an event to occur.

Now, once the event is triggered this newly created job will execute. The event can be triggered via sap (SM64) or at the Unix level.

SM64 is pretty self-explanatory. To get the event triggered from Unix:

-Log into the <SID>adm user id at the Unix level and go to directory /usr/sap/<SYSID>/SYS/exe/run (there is an alias called 'cdexe' that will get you there)

-From there look for an executable called sapevt. Open another Unix window cause now you are going to need to cut and paste.

-At the other sap window switch user to the <SID>adm user and go to the /usr/sap/<SYSID>/SYS/profile directory ('cdpro' is the alias)

-Do an "ll | more" and look for the instance profile name (the sapevt executable will want this!) Example: <SID>_DVEBMGS00_<SYSNAME>

-Go back to the sapevt window and enter this command to get the event to raise:

sapevt <event_name> -t pf=<instance_profile_directory_and_name> nr=<SYS_number>

Example: sapevt roberts_test -t pf=/usr/sap/<SID>/SYS/profile/<SID>_DVEBMGS00_<SYSNAME> nr=00

-This will raise the event, and cause the job scheduled within SAP to execute.

Once the job has executed the SAP event that was in the table BTCEVTJOB will disappear.

Another table, TABTCO, will now have an entry in it with the SAP job that was executed. Once you’ve found that job name in this table you can double click on its entry and see that it was executed via an event.

-


To set TRACE level WITHOUT bringing down the system:

Find the dispatcher process at the Unix level like this:

ps -ef | grep dw.sap | more

In the third column look for the "child" process ID number that repeats itself over and over

Then verify that number to the number in the second column, which should be the parent PID number.

Then issue the Unix command: kill -usr3 parent-pid-number (to turn on level 3 trace)

kill -usr2 parent-pid-number (to turn on level 2 trace)

kill -usr1 parent-pid-number (to turn on level 1 trace)

-


To Transport Maintenance Dialogs, you need to enter the object(s) in the following manner in the command file:

R3TR TOBJ tablename …. (11th position) S

Function Group

Table Structure

And the entries for your table in TVDIR and TDDAT

To see if a rollback is occurring at the Informix database level, do the following:

onstat -u | more

Look for the letter "R" in the 3rd column under the "flags". "R" means rollback - "P" means primary - "X" means critical

Reward all helpfull answers

Regards

Pavan