zoukankan      html  css  js  c++  java
  • SAP供应商和客户的创建

    【转自http://blog.csdn.net/lyb_yt/article/details/17962609】
    进来遇到一个创建供应商的需求,由于在系统中关于供应商和客户的创建比较特殊,且没有相关函数进行创建,

    找到一个类和方法来创建,类名:VMD_EI_API  方法名:MAINTAIN_DIRECT_INPUT,类似的

    * 供应商表头
      ls_vendors-header-object_instance-lifnr = lv_vendor.  "供应商
      ls_vendors-header-object_task 'M'.              "创建/更改
    * 通用数据
      ls_vendors-central_data-central-data-stceg       = stceg.      "增值税登记号
      ls_vendors-central_data-central-data-ktokk       '0001'.     "账户组
      ls_vendors-central_data-central-data-j_1kfrepre  = j_1kfrepre"代表名称
      ls_vendors-central_data-central-datax-stceg      'X'.        "增值税登记号
      ls_vendors-central_data-central-datax-ktokk      'X'.        "账户组
      ls_vendors-central_data-central-datax-j_1kfrepre 'X'.        "代表名称
    * 电话
      ls_phone-contact-data-telephone = phone.
      APPEND ls_phone TO ls_vendors-central_data-address-communication-phone-phone.
      CLEAR ls_phone.
    * 邮箱
      ls_smtp-contact-data-e_mail      = smtp.
      APPEND ls_smtp TO ls_vendors-central_data-address-communication-smtp-smtp.
      CLEAR ls_smtp.

      ls_vendors-central_data-address-postal-data-name         = name.       "名称
      ls_vendors-central_data-address-postal-data-name_2       = name.       "名称
      ls_vendors-central_data-address-postal-data-sort1        = sort1.      "属性(SAP为搜索项 1)
      ls_vendors-central_data-address-postal-data-street       = street.     "街道/门牌号
      ls_vendors-central_data-address-postal-data-postl_cod1   = postl_cod1"邮政编码
      ls_vendors-central_data-address-postal-data-city         = city.       "城市
      ls_vendors-central_data-address-postal-data-country      country.    "国家
      ls_vendors-central_data-address-postal-data-region       = region.     "地区
      ls_vendors-central_data-address-postal-data-langu        '1'.        "语言
      ls_vendors-central_data-address-postal-datax-name        'X'.
      ls_vendors-central_data-address-postal-datax-name_2      'X'.
      ls_vendors-central_data-address-postal-datax-sort1       'X'.
      ls_vendors-central_data-address-postal-datax-street      'X'.
      ls_vendors-central_data-address-postal-datax-postl_cod1  'X'.
      ls_vendors-central_data-address-postal-datax-city        'X'.
      ls_vendors-central_data-address-postal-datax-country     'X'.
      ls_vendors-central_data-address-postal-datax-region      'X'.
      ls_vendors-central_data-address-postal-datax-langu       'X'.
    * 采购组织数据
      ls_purchasing-task 'M'.
      ls_purchasing-data_key-ekorg '1000'.
      ls_purchasing-data-waers = waers.
      ls_purchasing-data-verkf = verkf.
      ls_purchasing-data-telf1 = telf1.
      ls_purchasing-data-eikto = eikto.
      ls_purchasing-data-webre  'X'.
      ls_purchasing-datax-waers 'X'.
      ls_purchasing-datax-verkf 'X'.
      ls_purchasing-datax-telf1 'X'.
      ls_purchasing-datax-webre 'X'.
      ls_purchasing-datax-eikto 'X'.

      IF requesttype 'CREATE'.
        ls_functions-task 'I'.
        ls_functions-data_key-parvw 'BA'.
        ls_functions-data-defpa ''.
        ls_functions-data-partner = lv_vendor.
        ls_functions-datax-defpa 'X'.
        ls_functions-datax-partner 'X'.
        APPEND ls_functions TO lt_functions.
        ls_functions-data_key-parvw 'LF'.
        ls_functions-data-defpa ''.
        ls_functions-data-partner = lv_vendor.
        ls_functions-datax-defpa 'X'.
        ls_functions-datax-partner 'X'.
        APPEND ls_functions TO lt_functions.
        ls_functions-data_key-parvw 'RS'.
        ls_functions-data-defpa ''.
        ls_functions-data-partner = lv_vendor.
        ls_functions-datax-defpa 'X'.
        ls_functions-datax-partner 'X'.
        APPEND ls_functions TO lt_functions.
        ls_purchasing-functions-functions = lt_functions.
      ENDIF.
      APPEND ls_purchasing TO ls_vendors-purchasing_data-purchasing.
      CLEAR ls_purchasing.

      APPEND ls_vendors TO lt_vendors.
      CLEAR ls_vendors.
      ls_main-vendors = lt_vendors.

    * 创建或者更新供应商
      CALL METHOD vmd_ei_api=>maintain_direct_input
        EXPORTING
          is_master_data           = ls_main
        IMPORTING
          es_master_data_correct   = l1
          es_message_correct       = l2
          es_master_data_defective = l3
          es_message_defective     = l4.
      IF l4-is_error ''.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait 'X'.
        return_status 'S'.
        IF requesttype 'CREATE'.
          return_value '供应商创建成功!'.
        ELSEIF requesttype 'UPDATE'.
          return_value '供应商更新成功!'.
        ENDIF.
        sapcode = lv_vendor.
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        return_status 'F'.
        CLEAR ls_message.
        READ TABLE l4-messages INTO ls_message WITH KEY type 'E'.
        IF sy-subrc 0.
          MESSAGE ID ls_message-id              
    TYPE ls_message-type              
    NUMBER ls_message-number              
    WITH  ls_message-message_v1                    ls_message
    -message_v2                    ls_message
    -message_v3                    ls_message
    -message_v4              
    INTO return_value.    
    ENDIF.  
    ENDIF.

  • 相关阅读:
    windows 共享文件夹 给 mac
    给mac配置adb 路径
    关于android 加载https网页的问题
    http tcp udp ip 间的关系
    手机服务器微架构设计和实现专题
    添加ssh key
    本人对于线程池的理解和实践
    使用Android Butterknife
    记一次失败的笔试(华为研发工程师-汽水瓶笔试题)
    简易坦克大战python版
  • 原文地址:https://www.cnblogs.com/rainysblog/p/3992548.html
Copyright © 2011-2022 走看看