5 Replies Latest reply: Jan 14, 2014 10:30 AM by tabrez shaikh RSS

CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'

Tushar Shah
Currently Being Moderated

I am newbie to ABAP.

To get the characteristic values I am using following FM inside a BADI called Batch_Master.

When I test this FM in se37 I get the desired values in t_class with one entry and t_objectdata with 4 entries.

I know what to fill in for class, classtype, object.

 

<b>Now when I call this FM in BADI how do I read my data from t_class and t_objectdata ??</b>

 

CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'

EXPORTING

class = i_class

classtype = i_classtype

object = i_objek

TABLES

t_class =

t_objectdata =

*EXCEPTIONS

*no_classification = 1

*no_classtypes = 2

*invalid_class_type = 3

*OTHERS = 4

  • Re: CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    Debasish Pattnayak
    Currently Being Moderated

    Hi Tushar,

    Here is a sample code.

    
    DATA : LV_CLASSNUM LIKE KLAH-CLASS,
           LV_CLASS LIKE BAPI1003_KEY-CLASSTYPE VALUE '002' ,
           LV_OBJECTKEY LIKE BAPI1003_KEY-OBJECT ,
           LV_TAB LIKE BAPI1003_KEY-OBJECTTABLE VALUE 'EQUI',
           LT_CLASSSTRUCT TYPE STANDARD TABLE OF SCLASS,
           LT_VAL_CHAR TYPE STANDARD TABLE OF CLOBJDAT,
           LW_VAL_CHAR TYPE CLOBJDAT .
           
        CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
             EXPORTING
                  CLASS              = LV_CLASSNUM
                  CLASSTEXT          = 'X'
                  CLASSTYPE          = LV_CLASS
                  LANGUAGE           = SY-LANGU
                  OBJECT             = LV_OBJECTKEY
                  OBJECTTABLE        = LV_TAB
                  KEY_DATE           = SY-DATUM
                  INHERITED_CHAR     = 'X'
             TABLES
                  T_CLASS            = LT_CLASSSTRUCT
                  T_OBJECTDATA       = LT_VAL_CHAR
             EXCEPTIONS
                  NO_CLASSIFICATION  = 0
                  NO_CLASSTYPES      = 0
                  INVALID_CLASS_TYPE = 0
                  OTHERS             = 0.
        IF SY-SUBRC <> 0.
        ENDIF.
      ENDIF.
    
    
      SORT LT_VAL_CHAR BY ATNAM .
      READ TABLE LT_VAL_CHAR INTO LW_VAL_CHAR WITH KEY ATNAM = 'PROPERTY' BINARY SEARCH .
    
      IF SY-SUBRC EQ 0 .
        P_LW_REPORT_CHARAC =  LW_VAL_CHAR-AUSP1
      ENDIF.
    

     

    You also can consider using the BAPI BAPI_OBJCL_GETDETAIL.

     

    Hope it helps,

    Thanks, Debasish

  • Re: CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    Tushar Shah
    Currently Being Moderated

    Thanks Debashish,

    Still its a very challenging situation.

    I have to use a function CLAF_CLASSIFICTION_OF_OBJECTS'

    inside a <b>BADI called BATCH_Master.</b>

    Now the thing is that the data which I have to read gets fetched in one of the tables of function module.

     

    Following CODE works fine if <b>I am not using BADI.</b>

     

    Data: P_CLASS like SCLASS occurs 0 with header line,

        P_OBJECTDATA like CLOBJDAT occurs 0 with header line.

     

    *

    *

    Call Function 'CLaff_Classification_OF OBjects'

    *

    *

    TABLES

        T_CLASS                    = P_Class

        T_OBJECTDATA               = P_OBJECTDATA.

    *

    *

     

    LOOP AT P_OBJECTDATA.

    WRITE: / P_OBJECTDATA-AUSP1.

    ENDLOOP.

     

    <b>But if I am use BADI then I can't use header line.</b>

     

    Data:

      P_Class TYPE STANDARD TABLE OF SCLASS initial size 0, 

      P_Objectdata TYPE STANDARD TABLE OF CLOBJDAT initial size 0.

     

    Now I can't print the values of P_Objectdata because I am not using header line since I am using BADI.

     

    How can I print P_Objectdata because I can't use header line in BADI while declaring any table (Due to OO Concept) ?

    • Re: CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
      Debasish Pattnayak
      Currently Being Moderated

      HI Tushar,

      You don't have to use header line to loop on an internal table. I did some minor modifications to your code.

       

      Data: P_CLASS type table of SCLASS,
      P_OBJECTDATA type table of CLOBJDAT,
      PS_OBJECTDATA type CLOBJDAT.
      
      *
      *
      Call Function 'CLAF_CLASSIFICATION_OF_OBJECTS'
      *
      *
      TABLES
      T_CLASS = P_Class
      T_OBJECTDATA = P_OBJECTDATA.
      *
      *
      
      LOOP AT P_OBJECTDATA into PS_OBJECTDATA.
      WRITE: / PS_OBJECTDATA-AUSP1.
      ENDLOOP.
      
      

       

      It should work fine now.

      Thanks, Debasish

  • Re: CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    tabrez shaikh
    Currently Being Moderated

    This FM taking too much time can any one suggest how to improve performance for that fm...?

    plaese replay soon......???

    • Re: CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
      tabrez shaikh
      Currently Being Moderated

      This is the sample code


      FORM voorraden_in_output TABLES xmchb STRUCTURE wa_xmchb

                              CHANGING wa_vart04_charg

                                       STRUCTURE wa_vart04_charg.

         SORT xmchb BY werks lgort matnr.

       

      * charge tabel lezen

         LOOP AT xmchb INTO wa_xmchb WHERE matnr = wa_vart04_charg-matnr.

           l_wa_mchb = wa_xmchb.

           wa_vart04_charg-werks   = l_wa_mchb-werks.

      * magazijn

           wa_vart04_charg-lgort   = l_wa_mchb-lgort.

      * charge

           wa_vart04_charg-charge  = wa_xmchb-charg.          "LCMG PD 20070712

      * bepaal batchclassificatie

           PERFORM clear_class_fields CHANGING wa_vart04_charg.

           IF NOT wa_xmchb-charg IS INITIAL.                  "LCMG PD 20070712

             PERFORM get_classificatie_batch TABLES ta_object_data

                                              USING wa_vart04_charg-matnr

                                                    wa_vart04_charg-charge.

      *  vul wa_vart04_charg met gegevens uit ta_object_data

             PERFORM kenmerken_in_output TABLES ta_object_data

                                                ta_class

                                         USING  wa_vart04_charg

                                                wa_xmchb.     "LCMG PD 20070712

           ENDIF.

           PERFORM check_kenmerken USING wa_vart04_charg

                                CHANGING sy-subrc.

           IF sy-subrc <> 0.

             CHECK 1 = 2.

           ENDIF.

      *  gereserveerde voorraad bepalen

           PERFORM gereserveerde_voorraad  CHANGING l_wa_mchb

                                                    wa_vart04_charg.

      *  voorraden charge regel bepalen

           PERFORM charge_voorraden           USING l_wa_mchb

                                                    wa_vart04_charg.

      * charge regel is volledig bepaald

           APPEND wa_vart04_charg TO ta_vart04_charg.

         ENDLOOP.

      ENDFORM


      * lokale data vullen

         l_object(18)    = artikel.

         l_object+18(10) = charg.

         l_classtype     = c_023.

         l_obtab         = 'MCH1'.

       

      *

      FORM get_classificatie_batch TABLES  ta_object_data STRUCTURE clobjdat

                                     USING  artikel TYPE mara-matnr

                                            charg   TYPE mchb-charg.

       

         DATA: l_object TYPE ausp-objek,

               l_classtype  TYPE  klah-klart,

               l_obtab TYPE  tcla-obtab.

       

      * lokale data vullen

         l_object(18)    = artikel.

         l_object+18(10) = charg.

         l_classtype     = c_023.

         l_obtab         = 'MCH1'.

       

      * schonen interne classificatie tabellen

      *  REFRESH: ta_class, ta_object_data.                  "LCMG PD 20070712

         CLEAR  : ta_class, ta_object_data.

         CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'

           EXPORTING

             classtype          = l_classtype

             language           = sy-langu

             object             = l_object

             objecttable        = l_obtab

             key_date           = sy-datum

             no_value_descript  = 'X'                              " 467394GVE

             initial_charact    = ' '

           TABLES

             t_class            = ta_class

             t_objectdata       = ta_object_data

           EXCEPTIONS

             no_classification  = 1

             no_classtypes      = 2

             invalid_class_type = 3

             OTHERS             = 4.

       

      ENDFORM

Actions