Skip to Content
author's profile photo Former Member
Former Member

badi CUSTOMER_ADD_DATA

Hi I am using this BAdI CUSTOMER_ADD_DATA and the method I am using is check_all_data . The purpose is to make a field mandatory for a required condition ( else I need to display a message ). The problem is I am unable to display the message on the screen which contains the field .

below are details .

The transaction is fd01 or fd02.

the badi is triggered when i try to save .

expected solution .

I guess i can move to the required screen by using the last 3 parameters of the method where i can specify the screen number and screen group to navigate to . But I am unable to do so .

any help wud be highly appreciated .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 14, 2006 at 12:33 PM

    Hello Prince

    Assuming you want to make a field on tabstrip "Address" (screen '0301') mandatory then you have to return the message (E_MSGID, E_MSGNO, E_MSGV1,...) and E_DYNNR = '0301' (leaving E_SCRGR and E_FCODE empty).

    To see which values for E_DYNNR, E_SCRGR (attribute of the screens) and E_FCODE are possible have a look at the following coding (just behind the BAdI call) in SAPMF02D (form CHECK_ALL_DATA):

    *&---------------------------------------------------------------------*
    *&      Form  check_all_data
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM CHECK_ALL_DATA .
    
      DATA: L_MSGID        TYPE SYMSGID,
            L_MSGTY        TYPE SYMSGTY,
            L_MSGNO        TYPE SYMSGNO,
            L_MSGV1        TYPE SYMSGV,
            L_MSGV2        TYPE SYMSGV,
            L_MSGV3        TYPE SYMSGV,
            L_MSGV4        TYPE SYMSGV,
            L_DYNNR        TYPE SYDYNNR,
            L_SCRGR        TYPE CUST_SCGR,
            L_FCODE        TYPE TAXITABS-FCODE,
            L_TARGET_DYNNR TYPE SYDYNNR.
    
      PERFORM GET_BADI_INSTANCE.
    
      check not g_additional_data is initial.                   " TP 563352
    
      CALL METHOD G_ADDITIONAL_DATA->CHECK_ALL_DATA
        EXPORTING
          I_ACTIVITY = T020-AKTYP
          S_KNA1     = KNA1
          S_KNB1     = KNB1
          S_KNVV     = KNVV
          T_KNAS     = XKNAS[]
          T_KNB5     = XKNB5[]
          T_KNBK     = XKNBK[]
          T_KNEX     = XKNEX[]
          T_KNVA     = XKNVA[]
          T_KNVD     = XKNVD[]
          T_KNVI     = XKNVI[]
          T_KNVK     = XKNVK[]
          T_KNVL     = XKNVL[]
          T_KNVP     = XKNVP[]
          T_KNZA     = XKNZA[]
        CHANGING
          E_MSGID    = L_MSGID
          E_MSGNO    = L_MSGNO
          E_MSGV1    = L_MSGV1
          E_MSGV2    = L_MSGV2
          E_MSGV3    = L_MSGV3
          E_MSGV4    = L_MSGV4
          E_DYNNR    = L_DYNNR
          E_SCRGR    = L_SCRGR
          E_FCODE    = L_FCODE.
    
    * Fehlerbehandlung uebernehmen
      CHECK NOT L_MSGID IS INITIAL.
    
    * Wandelt E-message in W-message, wenn man navigieren muss
      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.
      ELSE.
    *   Dieser Fall tritt nur auf, wenn L_DYNNR, L_SCRGR und L_FCODE keine
    *   sinnvolle Kombination darstellen.
    *   Nur als Notlösung vorgesehen, damit die Sicherung nicht beendet wird
        MESSAGE ID L_MSGID TYPE 'E' NUMBER L_MSGNO
              WITH L_MSGV1 L_MSGV2 L_MSGV3 L_MSGV4.
      ENDIF.
    
    ENDFORM.                    " check_all_data

    Note that I tested this in our IDES system (with the available BAdI implementations) and it worked.

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2006 at 09:14 AM

    Thanks buddy .

    Best regards

    Sharad

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.