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

Former Member
0 Likes
1,639

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.

8 REPLIES 8
Read only

thangam_perumal
Contributor
0 Likes
1,196

HI Pradip,

             Please use SET CURSOR FIELD keyword..

i think it may resolve your problem.

Regards,

Thangam.P

Read only

0 Likes
1,196

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.

Read only

thangam_perumal
Contributor
0 Likes
1,196

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.

Read only

VijayaKrishnaG
Active Contributor
0 Likes
1,196

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

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,196

Hi PRadip

Can you please provide the detail of the exit where you have coded this..complete details please

Nabheet

Read only

0 Likes
1,196

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.

Read only

0 Likes
1,196

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

Read only

former_member223133
Active Participant
0 Likes
1,196

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