Skip to Content
0
Mar 24, 2006 at 09:21 AM

ON change does not detect my first record.

35 Views

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.