‎2014 Feb 05 6:09 AM
Hy Experts.
Please help me.
User requirement : when creating a customer code with (XD01) vendor code require filed for some specific company.
SAP ABAP Code : We done using SAPMF02D exit and Generate Error message when creating customer code without
vendor code for some specific company.
ERROR : Now when Error message display the cursor is not point out particular field Vendor Code.
Requirement : When creating Error message Cursor auto set focus Vendor Code in General Data->Control Data.
Thanks & Regards.
Pradip Patel.
‎2014 Feb 05 6:23 AM
HI Pradip,
Please use SET CURSOR FIELD keyword..
i think it may resolve your problem.
Regards,
Thangam.P
‎2014 Feb 05 6:27 AM
HY Thangam.
I have already Use it but it not working properly. I have write code like :
IF I_KNB1-BUKRS = 'CPLC' AND I_KNA1-LIFNR = ' '.
SET CURSOR FIELD 'KNA1-LIFNR'.
MESSAGE 'Please Enter Vendor Code' TYPE 'E'.
endif.
‎2014 Feb 05 7:35 AM
Hi Pradip,
please try to change little bit. will see it may works.
IF I_KNB1-BUKRS = 'CPLC' AND I_KNA1-LIFNR = ' '.
MESSAGE 'Please Enter Vendor Code' TYPE 'E'.
SET CURSOR FIELD 'KNA1-LIFNR'.
endif.
‎2014 Feb 05 7:39 AM
Hi Pradip,
Write SET CURSOR FIELD in PBO of screen. If you write this after Error message, this statement will not be executed.
Try displaying that error message as I.
Regards,
Vijay
‎2014 Feb 05 7:40 AM
Hi PRadip
Can you please provide the detail of the exit where you have coded this..complete details please
Nabheet
‎2014 Feb 05 8:55 AM
Hy Nabheet.
Thanks for Replay.
Exit Name : SAPMF02D
INCLUDE : ZXF04U01.
Code :
IF I_KNB1-BUKRS = 'CPLC' AND I_KNA1-LIFNR = ' '.
SET CURSOR FIELD 'KNA1-LIFNR'.
MESSAGE 'Please Enter Vendor Code in General Data->Control Data' TYPE 'E'.
ENDIF.
Thanks and Regards.
pradip patel.
‎2014 Feb 05 9:06 AM
Hi Pradip
The standard SAP does this in below mentioned way. I will suggest you to use BADI CUSTOMER_ADD_DATA method CHECK_ALL_DATA fll parameters of messages and let SAP standard determines the correct position of cursor.
Include :-->MF02D_ADD_ON_FC0 Subroutine CHECK_ALL_DATA
Sample Code quoted from this subroutine.
IF NOT ( L_DYNNR IS INITIAL
AND L_SCRGR IS INITIAL
AND L_FCODE IS INITIAL ).
PERFORM DETERMINE_TARGET_SCREEN USING L_DYNNR
L_SCRGR
L_FCODE
CHANGING L_TARGET_DYNNR.
ENDIF.
CLEAR OK-CODE.
IF NOT L_TARGET_DYNNR IS INITIAL.
MESSAGE ID L_MSGID TYPE 'S' NUMBER L_MSGNO DISPLAY LIKE 'E'
WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
PERFORM NAVIGATE_TO_AFFECTED_SCREEN USING L_TARGET_DYNNR
L_SCRGR
L_FCODE.
Nabheet
‎2014 Feb 05 9:00 AM
Hi Pradip,
Set Cursor statement will not work from user-exits. You have to write it in the PBO screen of XD01 where this field LIFNR resides.
Thanks
Gangadhar