ZSD_PAYER_NEW(创建付款方) .

转载 2013年12月05日 16:41:58
*&---------------------------------------------------------------------*
*& Report  ZSD_PAYER_NEW
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSD_PAYER_NEW.

DATA BEGIN OF t_bdcdata OCCURS 0.
        INCLUDE STRUCTURE bdcdata.
DATA END OF t_bdcdata.
DATA opt TYPE ctu_params.
datack_test.
databegin of t_custm occurs 0,
       kunnr(10),
       bukrs(4),
       ktokd(4),
       anred(10)"15c
       name1(35),
       name2(35),
       name4(35),
       sorts(20),
       stras(60),
       pstlz(10),
       ort01(35),
       land1(3),
       regio(3),
       spras(1),
       telf1(16),
       telfx(16),
       email(80),
       banks(2),
       banka(60),
       bankl(15),
       bankn(18),
       akont(10),
       sortk(4),
       zterm(4),
       zahls(1),
       con_persn(10),
       con_telef(16),
      end of t_custm.
data:i_kna1 like kna1,
     i_knb1 like knb1,
     i_add1 like BAPIADDR1,
     i_add2 like bapiaddr2,
     i_knvv like knvv,
     t_knbk like fknbk occurs with header line,
     t_knvi like fknvi occurs with header line,
     t_knvk like fknvk occurs with header line,
     t_xknvp like fknvp occurs with header line,
     t_yknvp like fknvp occurs with header line.

DATAsubrc LIKE sy-subrc,
credit_control_flag LIKE bapikna108-x_flag value 'X',
postflag LIKE wdl_flag-xflag.

data:     E_KUNNR LIKE  KNA1-KUNNR,
          O_KNA1  LIKE  KNA1,
          RETURN  LIKE  BAPIRETURN1.

databegin of i_upld occurs 0,
*      anred    like   kna1-anred,   "Title
      ktokd    like   kna1-ktokd,   "Accout Group
      kunnr    like   kna1-kunnr,   "Customer No.
      bukrs    like   knb1-bukrs,   "Company Code
      vkorg    like   knvv-vkorg,   "Sales Org
      vtweg    like   knvv-vtweg,   "Distribution
      spart    like   knvv-spart,   "Division

      name1    like   kna1-name1,   "Name1
      name4    like   kna1-name4,   "Name1
      sortl    like   kna1-mcod1,   "Search term1
      land1    like   kna1-land1,   "Country

      akont    like   knb1-akont,   "Reconciliation

      ktgrd    like   knvv-ktgrd,   "Assign Group

      zterm    like   knb1-zterm,   "Payment term
      aland    like   knvi-aland,   "Taxes
      tatyp    like   knvi-tatyp,   "Tax Category
      taxkd    like   knvi-taxkd,   "Classification

end of i_upld.


parametersp_file LIKE rlgrap-filename OBLIGATORY   default 'D:\payer_new.txt'.

at selection-screen on value-request for p_file.

  perform select_file.

form select_file .

  call function 'WS_FILENAME_GET'

    exporting

      mask             ',Text Files,*.txt,All Files,*.*.'(101)

      title            '选择文件'(100)

    importing

      filename         p_file

    exceptions

      inv_winsys       1

      no_batch         2

      selection_cancel 3

      selection_error  4

      others           5.

  if sy-subrc <> and sy-subrc <> 3.

    "message e100(zdev) with '选择文件出错!'(007).

  endif.

endform.

*selection-screen skip.
*parameters: p_term as checkbox default 'X'.

*parameters: file like FILENAME-FILEINTERN
*            default 'E:\usr\sap\MED\DVEBMGS00\work\customer.dat'.


 start-of-selection.

*   open dataset file for input in text mode.
**           encoding default.
*   if sy-subrc eq 0.
*   do.
*   clear t_custm.
*   read dataset file into t_custm.
*   if sy-subrc ne 0.
*    exit.
*   endif.
*   append t_custm.
*   enddo.
*   else.
   perform fill_temp_data.
*   endif.
   perform neu_custom.

*&---------------------------------------------------------------------*
*&      Form  neu_custom
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM neu_custom.
     loop at i_upld.
      clear:i_kna1,i_knb1,i_knvv,i_add1,i_add2,
            t_knbk,t_knvk,t_xknvpt_yknvp.
      refresh:t_knbk,t_knvk,t_xknvp,t_yknvp,t_knvi.

      i_kna1-ktokd i_upld-ktokd.
      i_kna1-kunnr i_upld-kunnr.
      i_knb1-bukrs i_upld-bukrs.
      i_knvv-vkorg i_upld-vkorg.
      i_knvv-vtweg i_upld-vtweg.
      i_knvv-spart i_upld-spart.

      i_kna1-name1 i_upld-name1.
      i_kna1-name4 i_upld-name4.
      i_kna1-sortl i_upld-sortl.
      i_kna1-land1 i_upld-land1.

      i_knb1-kunnr i_upld-kunnr.
      i_knb1-akont i_upld-akont.

      i_knvv-kunnr       i_upld-kunnr.
      i_knvv-ktgrd       i_upld-ktgrd.   "Assign Group

      i_add1-name        i_upld-name1.
      i_add1-name_4       i_upld-name4.
      i_add1-sort1       i_upld-sortl.
      i_add1-country     i_upld-land1.


      i_kna1-spras '1'.       "i_upld-spras.
      i_add1-LANGU       =  '1'.     "i_upld-spras.


      i_knb1-zterm       i_upld-zterm.
      i_knvv-zterm       i_upld-zterm.   "Payment Term
      t_knvi-kunnr       i_upld-kunnr.
      t_knvi-aland       i_upld-aland.
      t_knvi-tatyp       i_upld-tatyp.
      t_knvi-taxkd       i_upld-taxkd.
      t_knvi-KZ          'U'.
      if t_knvi is not initial.
        append t_knvi.
      endif.

      postflag 'X'.
      CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
       EXPORTING
        i_kna1      i_kna1
        i_knb1      i_knb1
        i_knvv      i_knvv
        I_BAPIADDR1 i_add1
*        I_BAPIADDR2 = i_add2
*        I_MAINTAIN_ADDRESS_BY_KNA1 = 'X'
        PI_CAM_CHANGED 'X'
        pi_postflag postflag
       IMPORTING
        e_kunnr e_kunnr
        o_kna1  o_kna1
       TABLES
*        T_XKNAS =
*        T_XKNBK = t_knbk
*        T_XKNB5 =
*        T_XKNEX =
*        T_XKNVA =
*        T_XKNVD =
        T_XKNVI t_knvi
*        T_XKNVK = t_knvk
*        T_XKNVL =
*        T_XKNVP = t_xknvp
*        T_YKNVP = t_yknvp
*        T_XKNZA =
       EXCEPTIONS
        client_error 1
        kna1_incomplete 2
        knb1_incomplete 3
        knb5_incomplete 4
        knvv_incomplete 5
        kunnr_not_unique 6
        sales_area_not_unique 7
        sales_area_not_valid 8
        insert_update_conflict 9
        number_assignment_error 10
        number_not_in_range 11
        number_range_not_extern 12
        number_range_not_intern 13
        account_group_not_valid 14
        parnr_invalid 15
        bank_address_invalid 16
        tax_data_not_valid 17
        no_authority 18
        company_code_not_unique 19
        dunning_data_not_valid 20
        knb1_reference_invalid 21
        cam_error 22
        OTHERS 23
        .

        subrc sy-subrc.
        CLEAR sy-subrc.

        PERFORM returnsubrc_1
        in program saplv02d
        USING    subrc
                 e_kunnr
        CHANGING e_kunnr
                 return.

        IF subrc 0.
        if postflag eq 'X'.
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*         CALL FUNCTION 'BAPI_CUSTOMER_CHANGEFROMDATA'
*           EXPORTING
*             PI_ADDRESS          = i_add1
*             PI_SALESORG         = i_upld-vkorg
*             PI_DISTR_CHAN       = i_upld-vtweg
*             PI_DIVISION         = i_upld-spart
*             CUSTOMERNO          = o_kna1-kunnr
**          IMPORTING
**            PE_ADDRESS          =
**            RETURN              =
*                   .
*         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        endif.

           write:/ o_kna1-kunnr'was created!'.
        else.
*        elseif postflag eq 'X'.
         CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
*           write:/ i_kna1-kunnr,
*                   'hasn''t created successfully!'.
           write:return-type,
                   return-id,
                   return-message,
                   return-message_v1,
                   return-message_v2,
                   return-message_v3,
                   return-message_v4.
        ENDIF.

CLEARi_kna1,
       i_knb1,
       i_knvv,
       i_add1,
       i_add2.

       clear i_upld.
     endloop.
ENDFORM.                    " neu_custom
*&---------------------------------------------------------------------*
*&      Form  fill_temp_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM fill_temp_data.
  datatemp type string.

     temp p_file.
     CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
         FILENAME                      temp
*        FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           'X'
*        HEADER_LENGTH                 = 0
*        READ_BY_LINE                  = 'X'
*        DAT_MODE                      = ' '
*        CODEPAGE                      = '8400'
*        IGNORE_CERR                   = ABAP_TRUE
         REPLACEMENT                   '&'
*        CHECK_BOM                     = ' '
*      IMPORTING
*        FILELENGTH                    =
*        HEADER                        =
       TABLES
         DATA_TAB                      i_upld
      EXCEPTIONS
        FILE_OPEN_ERROR               1
        FILE_READ_ERROR               2
        NO_BATCH                      3
        GUI_REFUSE_FILETRANSFER       4
        INVALID_TYPE                  5
        NO_AUTHORITY                  6
        UNKNOWN_ERROR                 7
        BAD_DATA_FORMAT               8
        HEADER_NOT_ALLOWED            9
        SEPARATOR_NOT_ALLOWED         10
        HEADER_TOO_LONG               11
        UNKNOWN_DP_ERROR              12
        ACCESS_DENIED                 13
        DP_OUT_OF_MEMORY              14
        DISK_FULL                     15
        DP_TIMEOUT                    16
        OTHERS                        17
               .
    if sy-subrc ne 0.
       write'File Upload Error!'.
       write:'Return Code:',sy-subrc.
       stop.
    endif.
 ENDFORM.                    " fill_temp_data

 FORM fill_bdcdata USING p_par1 p_par2 p_par3.
  CLEAR t_bdcdata.
  IF p_par3 IS INITIAL.
    t_bdcdata-fnam p_par1.
    t_bdcdata-fval p_par2.
  ELSE.
    t_bdcdata-program  p_par1.
    t_bdcdata-dynpro   p_par2.
    t_bdcdata-dynbegin p_par3.
  ENDIF.
  APPEND t_bdcdata .
ENDFORM.                    "fill_bdcdata
*&---------------------------------------------------------------------*
*&      Form  translate_zterm
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_UPLD_ZTERM2  text
*      <--P_I_KNVV_ZTERM  text
*----------------------------------------------------------------------*
FORM translate_zterm  USING    P_I_ZTERM
                      CHANGING P_O_ZTERM.
  case p_i_zterm.
    when 'A001'.
      P_o_ZTERM '0001'.
    when 'A004'.
      P_o_ZTERM '0301'.
    when 'A016'.
      P_o_ZTERM '0501'.
    when 'A018'.
      P_o_ZTERM '0601'.
    when 'A045'.
      P_o_ZTERM '0451'.
    when 'AF45'.
      P_o_ZTERM '0750'.
    when 'ZZI1'.
      P_o_ZTERM '0301'.
    when others.
    write:'DC mapping for payment exclude item:'p_i_zterm.
  endcase.


ENDFORM.                    " translate_zterm

ZSD_PAYER_NEW(创建付款方)

*&---------------------------------------------------------------------* *& Report  ZSD_PAYER_NEW ...

农民工开发布会讨薪续-施工方称民政局付款不够-讨薪-发布会-天津

农民工开发布会讨薪续:施工方称民政局付款不够|讨薪|发布会|天津   ■ “‘民工开发布会讨薪’视频走红”追踪   据中国之声《新闻纵横》报道 “农民工讨薪发布会视频”走红引发关注仍在继续。前日,...

解决支付宝“创建交易异常,请重新创建后付款”的问题

首先先说明一下,我用支付宝版本是2017年1月之前的老版本。在测试官方demo的时候遇到如下问题: 经过两天的折腾,终于把问题搞定,如图: 好了,下面是解决问题了,我把可能的问题写下来...

支付宝创建交易异常,请重新创建后再付款

今天遇到一个问题:应用中集成支付宝接口的时候,生成了正确的支付参数后,在发送给支付宝的时候,也就是调用pay方法的时候,页面跳转到支付宝支付页面,但是支付宝页面还没有刷出来的时候就报出了一下错误:“创...

android KK上,前摄,对于normal、zsd、facebeauty拍照,实现mirror

1、 normal shot. alps\mediatek\platform\mt6595\hardware\mtkcam\v1\adapter\Scenario\Shot\NormalShot\...

windows media payer 解码器

  • 2009年04月05日 11:32
  • 9.56MB
  • 下载

ZSD3110 DTU用户手册

  • 2012年03月14日 13:13
  • 864KB
  • 下载

ZSD019发票号码查询报表

来吧,一起写的。SD发票号码查询表报。做个记录:*&---------------------------------------------------------------------* *& ...

ZSD018出货明细表

出货明细表,反正都是差不多的,ALV显示呗。以后一定要记得即时写Blog。还是不多说了,直接上code *&-------------------------------------------...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ZSD_PAYER_NEW(创建付款方) .
举报原因:
原因补充:

(最多只允许输入30个字)