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 Field

Former Member
0 Likes
2,908

hey guys,

MODULE PAI_CHECK.

MODIFY MYTAB FROM LTAB INDEX ZTABDISP-CURRENTLINE transporting KUNRR STATUS.

SET CURSOR FIELD 'LTAB-KUNNR'

MESSAGE E005.

....

END MODULE.

does not allow me to put cursor at KUNNR field, instead

it stands in first column itself..

what could be the reason here..

ambichan

17 REPLIES 17
Read only

Former Member
0 Likes
1,970

Is KUNNR in field list

eg

loop

field kunnr

module pai_check

endloop...

regds

gv

Read only

0 Likes
1,970

hey venkat,

yes

its like this

LOOP AT MYTAB.

CHAIN

FIELD KBN:

INPT:

KUNNR:

MATNR:

ZLOTB:

MODIFY ZTABDISP_MODULE ON CHAIN REQUEST.

ENDCHAIN.

MODULE ZTABDISP_MODULE.

MODIFY....

SET CURSOR FIELD ...

MESSAGE E003.

ENDMODULE.

like this..

ambichan

Read only

0 Likes
1,970

I think it doesn't work, if you put a control with error or warming message into CHAIN/ENDCHAIN statament, I believe the system sets cursor in the first field.

Read only

0 Likes
1,970

hey guys,

could you pls give me correct alternative code or idea to replace my code..equavalantly?

thanks in advance.

ambichan

Read only

0 Likes
1,970

Hi

try this.

SET CURSOR FIELD <b>LTAB-KUNNR</b>

LINE <tablecontrol name>-CURRENT_LINE.

Message ....

Delete the single code between the field LTAB-KUNNR and try.

regds

gv

Message was edited by: Venkat

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,970

Try setting the cursor field in the PBO.

If this is to point the user at the error which is occuring, then it should happend automatically if you are coding it correctly.

This statement should actually be in its own module.



MODIFY MYTAB FROM LTAB INDEX ZTABDISP-CURRENTLINE transporting KUNRR STATUS. 


The checks should be in their own modules.



MODULE CHECK_KUNNR.

IF ltab-kunnr is initial.
message E005.
endif.

ENDMODULE.

In your flow logic, in the PAI, you should be coding your checks like this.



  LOOP AT LTAB.
    
      MODULE YOUR_MODIFY_STATEMENT.

      FIELD LTAB-KUNNR MODULE CHECK_KUNNR.

  ENDLOOP.



Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,970

I think you should write in which line you want to set cursor:

SET CURSOR FIELD 'LTAB-KUNNR' LINE SY-STEPL.

Read only

Former Member
0 Likes
1,970

for that field check in attributes in screen painter, whether set and get parameters are unchecked.

not sure just a try, hope it help

regards

Read only

0 Likes
1,970

hey surpreet singh,

thanks for your reply.

i am just working on this..if solved i will surely close this thread.

Sorry for late response.

ambichan

Read only

0 Likes
1,970

Hello Ambi,

it's ok , but be sure to get back how you solved this problem.

Cause what i told you, i read that yesterday in one of thread here.

regards

Read only

0 Likes
1,970

Sure supreet singh.

I am always in touch..

btw, i just tried the above option too..i could not

set the cursor field to particular error place.

it always stands in first place..

is it drawback of CHAIN and ENDCHAIN?

I checked attributes also..set and get parameters are

not checked.

just looking what could be the alternate way..

ambichan.

Read only

0 Likes
1,970

ambi

did u try this

SET CURSOR FIELD LTAB-KUNNR

LINE <tablecontrol name>-CURRENT_LINE.

Message ....

Delete the single code between the field LTAB-KUNNR and try.

regds

gv

Read only

0 Likes
1,970

hay venkat,

yes again i tried with your command.

SET CURSOR FIELD LTAB-KUNNR LINE ZTABDIS-CURRENT_line.

but still not working..

does the cursor field wont work in chain..endchain?

ambichan

Read only

0 Likes
1,970

No! I think it doesn't work in PAI.

I created a dynpro with 3 fields: A, B, C. In PAI I put only one module: SET_CURSOR

MODULE SET_CURSOR INPUT.

SET CURSOR FIELD 'B'.

ENDMODULE.

In PBO i put only one module: GET_CURSOR

MODULE GET_CURSOR OUTPUT.

DATA FIELD.

GET CURSOR FIELD FIELD.

ENDMODULE. " GET_CURSOR OUTPUT

The get cursor command always return sy-subrc = 4

Read only

0 Likes
1,970

Hey max,

Thanks for your reply.

Hey Rich, I did not get your explanation clearly w.r.t

SET CURSOR FIELD.

could you pls state your point little bit clear and more.

will be great help.

ambichan.

Read only

0 Likes
1,970

I think you can solve your problem using a message type I, not E.

PROCESS PBO

LOOP...

MODULE SET_CURSOR.

ENDLOOP.

PROCESS PAI

LOOP..

CHAIN.

FIELD: FIELD1,

FIELD2,

FIELD3 MODULE CHECK_FIELD.

ENDCHAIN.

ENDLOOP.

MODULE CHECK_FIELD.

clear step_error.

IF FIELD = ERROR.

MESSAGE I208(00) WITH 'Error'.

CLEAR OK_CODE.

step_error = sy-stepl.

  • Leave PAI process:

leave screen.

ENDIF.

ENDMODULE.

MODULE SET_CURSOR.

CHECK STEP_ERROR > 0.

SET CURSOR FIELD 'KUNNR' LINE STEP_ERROR.

ENDMODULE.

Read only

0 Likes
1,970

LOOP..

CHAIN.

FIELD: FIELD1,

FIELD2,

FIELD3 MODULE CHECK_FIELD on chain-request.

ENDCHAIN.

ENDLOOP.

if we use field1,2,3 and on chain-request then the cursor automatically goes to field1 eventhough if we set the cursor externally.

so u have to remove <b>ON CHAIN-REQUEST</b> or have to think different logic.

regards

gv