2007 Oct 17 8:12 AM
Hello Friends
Please HelpOut for Sure
i had an table control which is filled by internal Table itab_emp
i m applying condition on that internal table
its giving error message
i want that cursor should be placed to that position that gives errormessage
i m sending u code
Just tell me changes
LOOP AT ITAB_EMP WHERE MARK = 'X' .
IF SY-SUBRC = 0.
ITAB_TEST[] = ITAB_EMP[].
DELETE ADJACENT DUPLICATES FROM ITAB_TEST.
LOOP AT ITAB_TEST.
CLEAR SUM .
LOOP AT ITAB_EMP WHERE PERID = ITAB_TEST-PERID.
SUM = SUM + ITAB_EMP-OTIME.
IF SUM > '100000'.
MESSAGE E018.
<b>ELSEIF ITAB_EMP-OTIME > '010000'.
MESSAGE E017.
SET CURSOR FIELD ITAB_EMP-OTIME .</b> ELSE.
MOVE-CORRESPONDING ITAB_EMP TO ITAB_OTAPP .
ITAB_OTAPP-OBJID = 1.
ITAB_OTAPP-INACT = 'X'.
ITAB_OTAPP-TODTE = ZHR_PR_M_OTAPP-TODTE.
ITAB_OTAPP-FRDTE = ZHR_PR_M_OTAPP-FRDTE.
ITAB_OTAPP-IMMHD = ZHR_PR_M_OTAPP-IMMHD.
ITAB_OTAPP-CRETM = SY-UZEIT.
ITAB_OTAPP-CREON = SY-DATUM.
ITAB_OTAPP-CREBY = SY-UNAME.
APPEND ITAB_OTAPP.
ENDIF.
ENDLOOP.
ENDLOOP.
endif.
endloop.
LOOP AT ITAB_OTAPP INTO WA_ITAB_OTAPP.
MODIFY ZHR_PR_M_OTAPP FROM WA_ITAB_OTAPP.
ENDLOOP.
BOLD lines are the condition checking
if check all the lines and then if any of the line gives error it reflects now i want to place cursor on that field which is giving error
sy-tabix will work
BUT HOW?????
Hope this time any of the genius gotmy problem
With Best Regards
Ruby
Hello Friends
Please HelpOut for Sure
i had an table control which is filled by internal Table itab_emp
i m applying condition on that internal table
its giving error message
i want that cursor should be placed to that position that gives errormessage
i m sending u code
Just tell me changes
LOOP AT ITAB_EMP WHERE MARK = 'X' .
IF SY-SUBRC = 0.
ITAB_TEST[] = ITAB_EMP[].
DELETE ADJACENT DUPLICATES FROM ITAB_TEST.
LOOP AT ITAB_TEST.
CLEAR SUM .
LOOP AT ITAB_EMP WHERE PERID = ITAB_TEST-PERID.
SUM = SUM + ITAB_EMP-OTIME.
IF SUM > '100000'.
MESSAGE E018.
<b>ELSEIF ITAB_EMP-OTIME > '010000'.
MESSAGE E017.
SET CURSOR FIELD ITAB_EMP-OTIME .</b> ELSE.
MOVE-CORRESPONDING ITAB_EMP TO ITAB_OTAPP .
ITAB_OTAPP-OBJID = 1.
ITAB_OTAPP-INACT = 'X'.
ITAB_OTAPP-TODTE = ZHR_PR_M_OTAPP-TODTE.
ITAB_OTAPP-FRDTE = ZHR_PR_M_OTAPP-FRDTE.
ITAB_OTAPP-IMMHD = ZHR_PR_M_OTAPP-IMMHD.
ITAB_OTAPP-CRETM = SY-UZEIT.
ITAB_OTAPP-CREON = SY-DATUM.
ITAB_OTAPP-CREBY = SY-UNAME.
APPEND ITAB_OTAPP.
ENDIF.
ENDLOOP.
ENDLOOP.
endif.
endloop.
LOOP AT ITAB_OTAPP INTO WA_ITAB_OTAPP.
MODIFY ZHR_PR_M_OTAPP FROM WA_ITAB_OTAPP.
ENDLOOP.
BOLD lines are the condition checking
if check all the lines and then if any of the line gives error it reflects now i want to place cursor on that field which is giving error
sy-tabix will work
BUT HOW?????
Hope this time any of the genius gotmy problem
With Best Regards
Ruby
2007 Oct 17 10:00 PM
2007 Oct 17 11:48 PM
Try this
Set the cursor before raising the error message and in the set cursor statement pass the Line number of the table control being processed
Regards,
Aj
2007 Oct 18 12:33 AM
Some of the logic is a bit confusing (would be easier to read if you used the "Code" button in the SDN message editor)... for example:
LOOP AT ITAB_EMP WHERE MARK = 'X' .
IF SY-SUBRC = 0.... the "IF SY-SUBRC" won't be reached unless there is at least one row where "mark = 'X'.''...
Anyhow, where is this code implemented currently?... the usual approach to validating a table control is to have a module called inside the "loop at table control" in the PAI of the screen flow... then the contents of each row on the screen will get passed into your logic a row at a time automatically and the "set cursor field" + "message e999(zz)" type code should work as it will refer to the current row being checked.
Jonathan