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

BADI

Former Member
0 Likes
1,602

Hi,

My requirement is to make PAN number as mandatory while creating vendor.

In XK01 PAN field was not there. After making settings in SPRO one extra tab 'CIN Detail' came inside xk01 and inside that PAN number is there. Through SPRO settings i cannot make this field as mandatory. So using user exit i have to write validations.I found two user exit for vendor master.But for both Exit there is no PAN filed. I dont know how to use BADI. Can you help me to make PAN as mandatory using BADi.

14 REPLIES 14
Read only

p291102
Active Contributor
0 Likes
1,500

Hi,

REPORT  YMS_USEREXITBADITEST                    .

TABLES : TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.

DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.

PARAMETERS : P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .


DATA WA_TADIR TYPE TADIR.

START-OF-SELECTION.

  IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.

  ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
  ENDIF.

  IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.

    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

    IF SY-SUBRC NE 0.
      SELECT SINGLE * FROM TRDIR
      WHERE NAME = TSTC-PGMNA.
      IF TRDIR-SUBC EQ 'F'.
        SELECT SINGLE * FROM TFDIR
        WHERE PNAME = TSTC-PGMNA.

        SELECT SINGLE * FROM ENLFDIR
        WHERE FUNCNAME = TFDIR-FUNCNAME.

        SELECT SINGLE * FROM TADIR
        WHERE PGMID = 'R3TR'
        AND OBJECT = 'FUGR'
        AND OBJ_NAME EQ ENLFDIR-AREA.

        MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
      ENDIF.
    ENDIF.

    SELECT * FROM TADIR INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT IN ('SMOD', 'SXSD')
    AND DEVCLASS = V_DEVCLASS.


    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.

    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
      WRITE:/(105) SY-ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED ON.

* SORTING THE INTERNAL TABLE
      SORT JTAB BY OBJECT.
      DATA : WF_TXT(60) TYPE C,
      WF_SMOD TYPE I ,
      WF_BADI TYPE I ,
      WF_OBJECT2(30) TYPE C.
      CLEAR : WF_SMOD, WF_BADI , WF_OBJECT2.

*GET THE TOTAL SMOD.

  LOOP AT JTAB INTO WA_TADIR.
    AT FIRST.
      FORMAT COLOR COL_HEADING INTENSIFIED ON.

      WRITE:/1 SY-VLINE,
      2 'Enhancement/ Business Add-in',
      41 SY-VLINE ,
      42 'Description',
      105 SY-VLINE.
      WRITE:/(105) SY-ULINE.
    ENDAT.
    CLEAR WF_TXT.
    AT NEW OBJECT.
      IF WA_TADIR-OBJECT = 'SMOD'.
        WF_OBJECT2 = 'Enhancement' .
      ELSEIF WA_TADIR-OBJECT = 'SXSD'.
        WF_OBJECT2 = ' Business Add-in'.

      ENDIF.
      FORMAT COLOR COL_GROUP INTENSIFIED ON.

      WRITE:/1 SY-VLINE,

      2 WF_OBJECT2,
      105 SY-VLINE.
    ENDAT.

    CASE WA_TADIR-OBJECT.
      WHEN 'SMOD'.
        WF_SMOD = WF_SMOD + 1.
        SELECT SINGLE MODTEXT INTO WF_TXT
        FROM MODSAPT
        WHERE SPRSL = SY-LANGU
        AND NAME = WA_TADIR-OBJ_NAME.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

      WHEN 'SXSD'.


*  FOR BADIS
        WF_BADI = WF_BADI + 1 .
          SELECT SINGLE TEXT INTO WF_TXT
          FROM SXS_ATTRT
          WHERE SPRSL = SY-LANGU
          AND EXIT_NAME = WA_TADIR-OBJ_NAME.
          FORMAT COLOR COL_NORMAL INTENSIFIED ON.

      ENDCASE.


      WRITE:/1 SY-VLINE,
      2 WA_TADIR-OBJ_NAME HOTSPOT ON,
      41 SY-VLINE ,
      42 WF_TXT,
      105 SY-VLINE.
      AT END OF OBJECT.
        WRITE : /(105) SY-ULINE.
      ENDAT.


    ENDLOOP.

    WRITE:/(105) SY-ULINE.



    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , WF_SMOD.
    WRITE:/ 'No.of BADis:' , WF_BADI.

  ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
  ENDIF.
ELSE.
  FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
  WRITE:/(105) 'Transaction does not exist'.
ENDIF.

AT LINE-SELECTION.

  DATA : WF_OBJECT TYPE TADIR-OBJECT.
  CLEAR WF_OBJECT.


  GET CURSOR FIELD FIELD1.
  CHECK FIELD1(8) EQ 'WA_TADIR'.
  READ TABLE JTAB WITH KEY OBJ_NAME = SY-LISEL+1(20).
  MOVE JTAB-OBJECT TO WF_OBJECT.

  CASE WF_OBJECT.
    WHEN 'SMOD'.
      SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).

      CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    WHEN 'SXSD'.
      SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
      CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
  ENDCASE.

Thanks,

Sankar M

Read only

Former Member
0 Likes
1,500

Hi,

i have find out the BADI's. What is the next step??

Read only

Former Member
0 Likes
1,500

Hi Hima,

There are 2 badis which points to your requirement

VENDOR_ADD_DATA_CS

VENDOR_ADD_DATA

With the first one we can add custom fields in the screen and with the second one we can validate it...but since you have already added the field using SPRO check the steps suggested in the other link for an exit that may serve your purpose...

If you have found the BADI which suits your purpose create an implementation for it and write the code in the suitable method and see if it is trigerred by putting break points or throwing messages

reward all helpful answers .....

Regards

Byju

please check your other post and avoid duplicate postings unless absalutely necessary

Read only

Former Member
0 Likes
1,500

Hi Byju,

i will remove the settings which i have done in SPRO. Can you tell me how can i add custom fields using the BADI 'VENDOR_ADD_DATA_CS' & also how can i validate.

Read only

Former Member
0 Likes
1,500

Hi Hima,

If we can close this by user exit,we need not go for a badi

so let us see if we can close this issue using the user exit

For this i need the following information...

(1) go to the screen in XK01...where you added the PAN field..press "f1"

(2) A pop up window comes

(3)Click on "Technical information"

(4) another pop up is displayed

(5) you can see lots of data on them

(6) send me the

Table Name

Field Name

if the table name is present in the exit , then we can solve your problem without using the BADI

Please check and let me know?

Regards

Byju

Read only

Former Member
0 Likes
1,500

Hi byju,

Table name: J_1IMOVEND

Field name : J_1IPANNO

its urgent.. Please help me..

Edited by: Hima on Apr 2, 2008 8:04 AM

Read only

Former Member
0 Likes
1,500

Hi Hima,

We have 2 options but each comes at a cost

(1) We can create a BADI and add fields with validation but they will be stored in a Ztable...and not in satandard table

(2) We can use field exits since this is a table dictionary field...You need to check if basis has configured to allow field exits...

I recommend field exit for this particular situation.....

steps to create field exit are as follows

go to se38 -> enter RSMODPRF

click on "execute"

A screen with "Data Element" and "number of field exit" id displayed

Enter "J_1IPANNO" in dataelemt field

Click execute

It shows a function module "FIELD_EXIT_J_1IPANNO"

Click on create....

a pop up comes..enter the function group and text for it...

If a function group is not available for you..create one and activate the function group

inside the function module you have 2 paramters only

input and other is output

write the fllowing code in the function module

if input is initial.

Message 'Enter PAN number' type 'E'.

endif.

Save and activate the function module

execute transaction ‘CMOD’.

Choose option: Goto-> Text Enhancements->Data elements->New DE cust docu.

Enter data element "J_1IPANNO"

Click on "original text" ..give some text ,save and activate

Execute program ‘RSMODPRF’ again but this time leave data element field blank.

Select the checkbox for the data element you have just created and choose option: ‘Assign prog./screen’

A pop will come..we need to fill this otherwise wherever data element will come this field exit will be triggered

Remember how you took technical details of the PAN number field by pressing F1..in there you can also see program name and screen number..you need to enter the same program name and screen number here also..save and activate

Execute program ‘RSMODPRF’ again but this time leave data element field blank.

Select the checkbox for the data element you have just created and choose option:

Field exit->Activate

This will activate the field exit ...and see if it works in XK01..

always check with your basis and see if field exit property is activate..

Regards

Byju

Read only

Former Member
0 Likes
1,500

Hi byju,

i have created field exit. Inside that input & output field is there. In input parameter whether i have to specify

PAN field or not.

Read only

Former Member
0 Likes
1,500

Hi Hima,

No need..

in the function module...only check if the the importing parameter is initial or not ..nothing else..it means we are checking in that program for XK01 we are checking in the screen if the field PAN is initial or not,

just try the steps mentioned and revert back...

Regard

Byju

Read only

Former Member
0 Likes
1,500

I got one error system is not configured for field exits

Read only

Former Member
0 Likes
1,500

Hi,

I found the user exit for Bw.

EXIT_SAPLRSAP_001 Transaction data

EXIT_SAPLRSAP_002 Master Data

EXIT_SAPLRSAP_003 Master Text

EXIT_SAPLRSAP_004 Hierarchy

i havnt got the clear picture of the requiremment.

I think i have do the code inside the exit basd on the requirement.

I dnt how to code in this user exit.

Please help me and guide me in future.

Sincerely

Jaya

Read only

Former Member
0 Likes
1,500

Hi Hima,

Check with your basis team ...

reason : goto RZ10, Give instance profile and Extended maintainance,

then press change, there find for ABAP/field exit parameter.

in your case this field will be missing or deactivated

Solution

This entry has to be maintained for the field exit to work...now contact your basis guy and tell him that an entry "ABAP/field" be maintained so as to do the field exit

Regards

Byju

Read only

Former Member
0 Likes
1,500

Hi byju,

Basis guys configured the settings. I have done all the things what u told step by step. But still if i am not giving the pan number i can save the vendor.

Read only

Former Member
0 Likes
1,500

Hi byju,

I have created field exit & while creating vendor if im not opening the CIN details tab that message is not coming otherwise it is working properly.

Any solution for this. please help me.