好吧,前提要说一下,信贷是到客户的信贷范围级别的。
FUNCTION zfm_credit. *"---------------------------------------------------------------------- *"*"本地接口: *" TABLES *" T_TAB STRUCTURE ZJKS001 OPTIONAL *" T_TAB_I STRUCTURE ZJKS002 OPTIONAL *"---------------------------------------------------------------------- DATA:gs_zsds001 TYPE zsds001. DATA:gs_zsds002 TYPE zsds002. DATA:lv_func TYPE char50."结构ID DATA:s_tab TYPE zjks001."表头结构 DATA:s_tab_i TYPE zjks002."表体结构 DATA:gt_table TYPE ddfields, gs_table TYPE dfies. DATA:gs_knka TYPE knka, gs_knkk TYPE knkk, gv_knka TYPE knka, gv_knkk TYPE knkk, gv_upd TYPE cdpos-chngind. DATA:gv_name1 TYPE kna1-name1. DATA:gt_kna1 TYPE TABLE OF zsknb1, gs_kna1 TYPE zsknb1. DATA:lv_line TYPE i. DATA:gs_zsds003 TYPE zsds003. DATA:gt_message TYPE TABLE OF bdcmsgcoll. DATA:gs_message TYPE bdcmsgcoll. DATA:lv_str TYPE string. DATA:lv_int TYPE i. FIELD-SYMBOLS: <dyn_wa>,"表头 <dyn_la>,"表体 <dyn_field>."字段 DATA lv_col_sting TYPE string . DEFINE mesgadd."返回消息赋值 S_TAB-FIELDNAME = &1. S_TAB-VALUE = &2. IF &2 is not INITIAL . APPEND S_TAB TO T_TAB. ENDIF. END-OF-DEFINITION. DEFINE mesgaddi."返回消息赋值 lv_col_sting = &1 . CONCATENATE &2 lv_col_sting into S_TAB_I-FIELDNAME . SHIFT S_TAB_I-FIELDNAME RIGHT DELETING TRAILING space. CONDENSE S_TAB_I-FIELDNAME NO-GAPS. S_TAB_I-VALUE = &3. CONDENSE S_TAB_I-VALUE NO-GAPS. APPEND S_TAB_I TO T_TAB_I. END-OF-DEFINITION. CLEAR:gs_zsds001,gs_zsds002,lv_func,s_tab,gt_table[],gs_zsds003,lv_str,gt_message. READ TABLE t_tab INTO s_tab WITH KEY fieldname = 'FUNCTION'. IF sy-subrc = 0. lv_func = s_tab-value. ELSE. REFRESH:t_tab. mesgadd:'RETURN' 'E', 'MESSAGE' '未指定函数!'. RETURN. ENDIF. CASE lv_func. WHEN 'CREDIT02'. ASSIGN gs_zsds003 TO <dyn_wa>."表头结构 WHEN OTHERS. ENDCASE. LOOP AT t_tab INTO s_tab."表头数据装换 ASSIGN COMPONENT s_tab-fieldname OF STRUCTURE <dyn_wa> TO <dyn_field>. IF sy-subrc = 0. <dyn_field> = s_tab-value. IF s_tab-fieldname = 'KLIMK'. lv_int = s_tab-value. gs_zsds003-klimk = lv_int. ENDIF. ENDIF. ENDLOOP. REFRESH:t_tab."清空表头 CASE lv_func. WHEN 'CREDIT02'. IF gs_zsds003-ctlpc IS INITIAL. gs_zsds003-ctlpc = 'Z01'. ENDIF. CONCATENATE 'Z' gs_zsds003-kkber INTO gs_zsds003-kkber. CONDENSE gs_zsds003-kkber NO-GAPS. IF gs_zsds003-waers IS INITIAL. gs_zsds003-waers = 'CNY'. ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = gs_zsds003-kunnr IMPORTING output = gs_zsds003-kunnr. SELECT SINGLE * INTO CORRESPONDING FIELDS OF gs_knkk FROM knkk WHERE kunnr = gs_zsds003-kunnr AND kkber = gs_zsds003-kkber. IF sy-subrc = 0. gv_upd = 'U'. ELSE. gv_upd = 'I'. ENDIF. SELECT SINGLE * INTO CORRESPONDING FIELDS OF gs_knka FROM knka WHERE kunnr = gs_zsds003-kunnr. gs_knkk-kunnr = gs_zsds003-kunnr. gs_knkk-knkli = gs_zsds003-kunnr. gs_knkk-kkber = gs_zsds003-kkber. gs_knkk-klimk = gs_zsds003-klimk. gs_knkk-erdat = sy-uname. gs_knkk-ctlpc = gs_zsds003-ctlpc. CALL FUNCTION 'CREDITLIMIT_CHANGE' EXPORTING i_knka = gs_knka i_knkk = gs_knkk upd_knka = '0' upd_knkk = gv_upd * XNEUA = ' ' * XREFL = ' ' yknka = gv_knka yknkk = gv_knkk. IF sy-subrc = 0. mesgadd:'RETURN' 'S', 'MESSAGE' '信贷更新成功!'. ELSE. mesgadd:'RETURN' 'E', 'MESSAGE' '信贷更新失败!'. ENDIF. WHEN OTHERS. ENDCASE. ENDFUNCTION.
结构,自己参考那几个表就晓得了。。。主要说的是这个函数的用法
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/18648.html