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

Setting cursor on particular field

former_member671224
Participant
0 Likes
526

Hi,

Lets take two fields as field A and Field B.

Based on the input given to field A, field B will be mandatory. So if Field B is not entered then it should show error message. Its working fine. but after displaying error message, the cursor should be in field B. but the cursor is in field A.

So how should i code it to set the cursor in Field B?

the order of the fields in screen is First field A then Field B.

can someone help me in this...

Regards,

Amal

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
497

Use statement SET CURSOR in the PBO.

Regards,

RIch Heilman

Read only

0 Likes
497

But im doing validation in PAI. the actual senario is,

<b>if the value for field A = 'NJ' then field B should be mandatory. and if the value for Field A = 'CA' then field C should be mandatory.</b>

<b>below is the code :</b>

*Set Company or CA License as mandatory based on ZSATATE

chain.

field vbap-zcomp.

field vbap-zstate module ZZCOMP_MANDATORY on input.

endchain.

chain.

field vbap-zcalic.

field vbap-zstate module ZZCALIC_MANDATORY on input.

endchain.

&----


*& Module ZZCOMP_MANDATORY INPUT

&----


  • Set Company field as mandatory if state is NJ *

----


module ZZCOMP_MANDATORY input.

if vbap-zstate = 'NJ'.

if vbap-zcomp is initial.

message e111(ZMOD).

endif.

endif.

endmodule. " ZZCOMP_MANDATORY INPUT

*} INSERT

*{ INSERT DEVK938515 5

&----


*& Module ZZCALIC_MANDATORY INPUT

&----


  • Set CA License as mandatory if state is CA *

----


module ZZCALIC_MANDATORY input.

if vbap-zstate = 'CA'.

if vbap-zcalic is initial.

message e112(ZMOD).

endif.

endif.

endmodule. " ZZCALIC_MANDATORY INPUT

now the curosr is at ZSTATE but it should be in ZCOMP or ZCALIC based on the input given to ZSTATE.

Plz help me its very urgent.

Regards,

Amal.

Read only

Former Member
0 Likes
497

Hi Amal,

In the PAI, check for the value of field 'A' and set a flag if 'B' is to be made mandatory and the curspor to be put there.

In the PBO, check for this flag..

If flag is checked, LOOP AT SCREEN.

IF screen-name = 'B' (Field name).

screen-mandatory(required) = 1.

MODIFY screen.

ENDIF.

ENDLOOP.

SET SURSOR field 'B'.

Thanks and Best Regards,

Vikas Bittera.

**Points for useful answers**