on 03-24-2006 9:21 AM
Hello experts,
I have added a code that every time it detects a change on field ls_lines it would do the functions below. But my problem is that when I run my sapscript form the first record does not display. I have posted below my code which is inside a form that is inside a loop..Any alternatives here guys?thanks a lot!
ON CHANGE OF MKPF-MBLNR OR MSEG-EBELN OR MSEG-BWART OR MSEG-WERKS.
CLEAR XKOPFDR.
ENDON.
ON change of ls_lines.
CLEAR XKOPFDR.
NEW_PAGE = X.
endon.
IF XKOPFDR IS INITIAL.
XKOPFDR = X.
IF NEW_PAGE = X.
clear new_page.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING COMMAND = 'NEW-PAGE'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'KOPF'
WINDOW = 'KOPF'.
NEW_PAGE = X.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'POS_ZEILE'
WINDOW = 'MAIN'.
LOOP AT SERIAL_TAB.
IF SY-TABIX EQ L_LINES.
V_FINISH = 'Y'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = 'SERNUM'
WINDOW = 'MAIN'.
V_FIRST_NUM = 'N'.
ENDLOOP.
HI viray,
just store the ls_lines into a tmp variable and check it every time..
when not equal .. means a change..
if tmp_ls_line NE ls_lines.
CLEAR XKOPFDR.
NEW_PAGE = X.
endif.
tmp_ls_lines = ls_lines.
this will work for all records...
regards
satesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Viraylab,
As u have said within loop u r executing a perform and within this u are checking for on change. This field ls_lines is field in internal table traptab?
if yes then the code should be
on change traptab-ls-lines.
clear ...
endon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You should sort on the fields which you are using in ON CHANGE OF.
If it still does not work,
try replacing ON CHANGE by AT NEW.
Regards,
Shashank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Viraylab,
use 'AT NEW F'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If you have not done so already, please read the F1 documentation for ON CHANGE OF.
The following conditions are necessary -
1. This statement is to be used within a LOOP...ENDLOOP.
2. The Table should be sorted by the fileds which are being used in ON CHANGE OF.
3. You should not use LOOP AT WHERE.
Regards,
Anand Mandalika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Viray,
Try to use At new followed by ENDAT instead of On Change.
It is always suggested to use At New control statemnet for the reqmt. ur looking for.
You can check for more help on AT new , bu preesing F1 on the same.
Cheers
Sunny
Rewrd points, if found helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are u using LOOP AT WHERE or only LOOP bcoz control breaks will not work in LOOP AT WHERE condition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.