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: 

on change-request

Former Member
0 Kudos

hello experts,

I want to know the functionality of on change-request(with coding)..

Thanks & Regards

Subhash.

POINT WILL BE REWARDED.

1 ACCEPTED SOLUTION

Simha_
Employee
Employee
0 Kudos

Hi,

ON CHANGE OF has become obsolete in latest sap versions.

Better use AT NEW statement

It will do the same function.

see the doc

All this AT NEW, AT FIRST, AT END OF and AT LAST are called control break statements of Internal tables and are used to calculate the TOTALS based on sertain key fields in that internal table

FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.

Some time you will get * when mopving data from this int table to other table using these commands

so you have to use

READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them

DATA: sflight_tab TYPE SORTED TABLE OF sflight

WITH UNIQUE KEY carrid connid fldate,

sflight_wa LIKE LINE OF sflight_tab.

SELECT *

FROM sflight

INTO TABLE sflight_tab.

sort sflight by carrid connid.

LOOP AT sflight_tab INTO sflight_wa.

AT NEW connid.

WRITE: / sflight_wa-carrid,

sflight_wa-connid.

ULINE.

ENDAT.

WRITE: / sflight_wa-fldate,

sflight_wa-seatsocc.

AT END OF connid.

SUM.

ULINE.

WRITE: / 'Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

SKIP.

ENDAT.

AT END OF carrid.

SUM.

ULINE.

WRITE: / 'Carrier Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

NEW-PAGE.

ENDAT.

AT LAST.

SUM.

WRITE: / 'Overall Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

ENDAT.

ENDLOOP.

Cheers,

Simha.

3 REPLIES 3

Former Member
0 Kudos

Hi Chandra,

Is it on change of??? i don't on change-request any where

REPORT ABC.

DATA : BEGIN OF ITAB OCCURS 0,

bukrs like t001-bukrs,

f1(10) type c,

end of itab.

itab-bukrs = '1000'.

itab-f1 = '1111111'.

append itab.

itab-bukrs = '1100'.

itab-f1 = '3333333'.

append itab.

itab-bukrs = '1200'.

itab-f1 = '555555'.

append itab.

*----


AT NEW

loop at itab.

at new bukrs.

write 😕 itab-bukrs , itab-f1.

endat.

endloop.

*----


AT ONCHANGE

loop at itab.

ON CHANGE OF ITAB-BUKRS.

write 😕 itab-bukrs , itab-f1.

ENDON.

Reward if this helps,

Satish

Simha_
Employee
Employee
0 Kudos

Hi,

ON CHANGE OF has become obsolete in latest sap versions.

Better use AT NEW statement

It will do the same function.

see the doc

All this AT NEW, AT FIRST, AT END OF and AT LAST are called control break statements of Internal tables and are used to calculate the TOTALS based on sertain key fields in that internal table

FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.

Some time you will get * when mopving data from this int table to other table using these commands

so you have to use

READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them

DATA: sflight_tab TYPE SORTED TABLE OF sflight

WITH UNIQUE KEY carrid connid fldate,

sflight_wa LIKE LINE OF sflight_tab.

SELECT *

FROM sflight

INTO TABLE sflight_tab.

sort sflight by carrid connid.

LOOP AT sflight_tab INTO sflight_wa.

AT NEW connid.

WRITE: / sflight_wa-carrid,

sflight_wa-connid.

ULINE.

ENDAT.

WRITE: / sflight_wa-fldate,

sflight_wa-seatsocc.

AT END OF connid.

SUM.

ULINE.

WRITE: / 'Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

SKIP.

ENDAT.

AT END OF carrid.

SUM.

ULINE.

WRITE: / 'Carrier Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

NEW-PAGE.

ENDAT.

AT LAST.

SUM.

WRITE: / 'Overall Sum',

sflight_wa-seatsocc UNDER sflight_wa-seatsocc.

ENDAT.

ENDLOOP.

Cheers,

Simha.

former_member491305
Active Contributor
0 Kudos

Hi Chandra,

You mean to ask in Modules.Right.The event which can control the execution of a Modules are,

Extras:

1. ... ON INPUT

2. ... ON REQUEST

3. ... ON *-INPUT

4. ... ON {CHAIN-INPUT}|{CHAIN-REQUEST}

5. ... AT CURSOR-SELECTION

2 .Field MATNR Module matnr_validate ON REQUEST .

Effect

With this condition, module mod is called only if the value of the screen field MATNR has been changed by input after the event PBO. It is considered as input if the existing input is overwritten with the same value or if the initial value of the field is entered explicitly.

But there is no event ON CHANGE-REQUEST.

Regards,

Vigneswaran S