01-09-2014 10:01 AM
Hello ABAPers,
I have gone through many threads but did not find the solution. My requirement is that I am taking screen elements from table on the screen and I am performing validations on each field of the screen. Now, what I want now is that after failing of validation cursor focus should come on a particular field of the dialog screen where validation is failed.
I am using like this
SET CURSOR FIELD 'ZDB_TUSER-USER_EMPNAME'.
but still not getting cursor on this field.
Please help me..
points will be rewarded..
01-09-2014 10:13 AM
Hi,
May this sample code help you out,
REPORT xyz
DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,
name(10) TYPE c.
SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.
PARAMETERS: def RADIOBUTTON GROUP rad,
txt RADIOBUTTON GROUP rad,
f1 RADIOBUTTON GROUP rad,
f2 RADIOBUTTON GROUP rad,
f3 RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK bloc.
PARAMETERS pos TYPE i.
IF txt = 'X'.
name = 'TEXT'.
ELSEIF f1 = 'X'.
name = 'FIELD1'.
ELSEIF f2 = 'X'.
name = 'FIELD2'.
ELSEIF f3 = 'X'.
name = 'FIELD3'.
ENDIF.
CALL SCREEN 100.
MODULE cursor OUTPUT.
IF def NE 'X'.
SET CURSOR FIELD name OFFSET pos.
ENDIF.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE back INPUT.
LEAVE SCREEN.
ENDMODULE.
01-09-2014 10:10 AM
01-09-2014 10:13 AM
01-09-2014 10:19 AM
01-10-2014 5:55 AM
01-09-2014 10:13 AM
Hi,
May this sample code help you out,
REPORT xyz
DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,
name(10) TYPE c.
SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.
PARAMETERS: def RADIOBUTTON GROUP rad,
txt RADIOBUTTON GROUP rad,
f1 RADIOBUTTON GROUP rad,
f2 RADIOBUTTON GROUP rad,
f3 RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK bloc.
PARAMETERS pos TYPE i.
IF txt = 'X'.
name = 'TEXT'.
ELSEIF f1 = 'X'.
name = 'FIELD1'.
ELSEIF f2 = 'X'.
name = 'FIELD2'.
ELSEIF f3 = 'X'.
name = 'FIELD3'.
ENDIF.
CALL SCREEN 100.
MODULE cursor OUTPUT.
IF def NE 'X'.
SET CURSOR FIELD name OFFSET pos.
ENDIF.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE back INPUT.
LEAVE SCREEN.
ENDMODULE.
01-09-2014 10:20 AM
Hi
Please dont use words like points will be rewarded...We are not here for points.
Coming to your question are you throwing some error mesage if yes when are you calling set cursor after message or before?
Nabheet
01-09-2014 10:28 AM
Sorry to all ABPers,
Yes Nabheet, I am throwing error message in PAI. After that I am calling SET CURSOR in PAI itself.
My code will be like this
START OF THE CODE
MODULE user_command_0101 INPUT.
CASE ok_code.
WHEN 'TR_CREATE'.
IF zdb_tuser-user_empid IS NOT INITIAL.
FIND FIRST OCCURRENCE OF REGEX '[[:punct:]]' IN zdb_tuser-user_empid. "regular expression validation for alphanumeric field
IF sy-subrc = 0.
MESSAGE 'PLEASE ENTER ONLY ALPHANUMERIC VALUES IN EMPLOYEE ID.' TYPE 'I' DISPLAY LIKE 'E'.
SET CURSOR FIELD 'zdb_tuser-user_empid'.
ENDIF.
ENDIF.
ENDCASE.
01-10-2014 3:24 AM
Hi Dhammadeep,
Please refer this document.
Setting the Cursor Position (SAP Library - SAP NetWeaver by Key Capability)
Move the code for check and SET CURSOR to PBO. I think it will work.
Regards,
Anoop
01-10-2014 3:29 AM
Hi,
Try like this .
IN PAI
IF zapt_cust_detail-cname IS INITIAL.
SET CURSOR FIELD 'ZAPT_CUST_DETAIL-CNAME'.
MESSAGE e015.
ENDIF.
01-10-2014 3:46 AM
Hi,
Try to use the message type 'E' or use the exit command to stop the flow of the program.
Regards,
Riju Thomas.
01-09-2014 10:44 AM
Hi,
In PBO, use statement SET CURSOR FIELD to control where the cursor will be .... also, create some flag to tell you what field to choose in every interaction.
Regards,
Thiru.
01-10-2014 3:44 AM
The reason you are not getting is because your SET CURSOR statement should be followed by an
error message.
Try like this:
SET CURSOR FIELD <field_name>
MESSAGE e000 WITH text-001.
Regards,
Ashish Kumar
01-10-2014 5:00 AM
Hello,
Thank you all. I solve it. Set cursor statement should be in PBO. I have maintain flag for each validation and checking in PBO for setting cursor
01-10-2014 8:35 AM
Did you try to validate in PAI using the FIELD statement ?
It should work. Read the f1 help.
Something like below:
FIELD: ls-matnr MODULE validate.