SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_CLASS_GET_CHARACTERISTICS



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1637

PostPosted: Sat May 10, 2008 7:55 pm    Post subject: BAPI_CLASS_GET_CHARACTERISTICS Reply with quote

BAPI_CLASS_GET_CHARACTERISTICS - Returns Chars with Attributes and Values for Class

Check out the following code which is for assigning Materials to classes and characteristics.

Code:
 WRITE:/ 'CLASS TYPE : 001' COLOR 2.

  LOOP AT it_001 INTO x_001.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = x_001-matnr
      IMPORTING
        output = x_001-matnr.

    v_objkey = x_001-matnr.

    v_cnt = 0.
    REFRESH: it_bapi_char,it_bapi_char_values ,it_bapiret_create,
             it_alwval_num,it_alwval_char,it_alwval_curr .
    CLEAR: x_bapiret1,x_bapi_char,x_bapi_char_values ,
             x_alwval_num,x_alwval_char,x_alwval_curr.
    LOOP AT it_class INTO x_class WHERE recid = x_001-recid AND class = x_001-class.
      v_cnt = v_cnt + 1.
      IF v_cnt = 1.
        CALL FUNCTION 'BAPI_CLASS_GET_CHARACTERISTICS'
          EXPORTING
            classnum        = x_class-class
            classtype       = '001'
          IMPORTING
            return          = x_bapiret1
          TABLES
            characteristics = it_bapi_char
            char_values     = it_bapi_char_values.
      ENDIF.
      SORT :it_bapi_char,it_bapi_char_values.
      READ TABLE it_bapi_char INTO  x_bapi_char WITH KEY name_char = x_class-atnam BINARY SEARCH.
      IF sy-subrc = 0.

*READ TABLE it_bapi_char_values INTO x_bapi_char_values
*WITH KEY name_char = x_class-atnam char_value = x_class-atwrt.
*IF sy-subrc = 0.

        IF x_bapi_char-data_type = 'CHAR'.
          TRANSLATE  x_class-atwrt TO UPPER CASE.
          x_alwval_char-charact = x_class-atnam.
          x_alwval_char-value_char = x_class-atwrt.
          APPEND x_alwval_char TO it_alwval_char.
        ELSEIF   x_bapi_char-data_type = 'CURR'.
          x_alwval_curr-charact = x_class-atnam.
          x_alwval_curr-value_from = x_class-atwrt.
          x_alwval_curr-currency_from = 'USD'.
          APPEND x_alwval_curr TO it_alwval_curr.
        ELSEIF x_bapi_char-data_type = 'NUM'  OR  x_bapi_char-data_type = 'DATE'
        OR  x_bapi_char-data_type = 'TIME'.
          x_alwval_num-charact = x_class-atnam.
          x_alwval_num-value_from = x_class-atwrt.
          APPEND x_alwval_num TO it_alwval_num.
        ENDIF.

*ENDIF.

      ENDIF.
    ENDLOOP.

     CALL FUNCTION 'BAPI_OBJCL_CREATE'
      EXPORTING
        objectkeynew    = v_objkey
        objecttablenew  = 'MARA'
        classnumnew     = x_class-class
        classtypenew    = '001'
      TABLES
        allocvaluesnum  = it_alwval_num
        allocvalueschar = it_alwval_char
        allocvaluescurr = it_alwval_curr
        return          = it_bapiret_create.

    READ TABLE it_bapiret_create INTO x_bapiret WITH KEY type = 'E'  .
    IF sy-subrc NE 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    WRITE:/ 'Material  : ', v_objkey  COLOR 4.
    LOOP AT it_bapiret_create INTO x_bapiret WHERE type = 'E' OR type = 'S' .
      WRITE: /1 x_bapiret-type, 6  x_bapiret-message.
    ENDLOOP.
    SKIP 2.
  ENDLOOP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.