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

Set-Cursor In TableControl Help Help Help

Former Member
0 Likes
448

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

3 REPLIES 3
Read only

Former Member
0 Likes
428

the check should be in a FIELD statement in the PAI.

Rob

Read only

former_member195698
Active Contributor
0 Likes
428

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

Read only

Former Member
0 Likes
428

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