ABAP-VLPOD保存自动开票增强
1.增强点
1 *一代增强 2 *包含文件MV50AFZ1 3 *子例程USEREXIT_SAVE_DOCUMENT 4 IF sy-tcode = 'VLPOD' AND sy-ucomm = 'SICH_T' . 5 6 READ TABLE xlikp INDEX 1 . 7 IF xlikp-lfart = 'LF' AND xlikp-pdstk = 'C' . 8 9 DATA: lv_jobnum TYPE btcjobcnt, 10 gv_jobname TYPE btcjob VALUE 'ZSDE04'. "后台作业名称 11 12 CALL FUNCTION 'JOB_OPEN' 13 EXPORTING 14 jobname = gv_jobname 15 IMPORTING 16 jobcount = lv_jobnum 17 EXCEPTIONS 18 cant_create_job = 1 19 invalid_job_data = 2 20 jobname_missing = 3 21 OTHERS = 4. 22 IF sy-subrc = 0. 23 24 SUBMIT zsdf_zdkp WITH p_vbeln = likp-vbeln 25 WITH p_vkorg = likp-vkorg 26 WITH p_aedat = likp-podat 27 VIA JOB gv_jobname NUMBER lv_jobnum AND RETURN . 28 IF sy-subrc = 0 . 29 30 CALL FUNCTION 'JOB_CLOSE' 31 EXPORTING 32 jobcount = lv_jobnum 33 jobname = gv_jobname 34 strtimmed = 'X' 35 EXCEPTIONS 36 cant_start_immediate = 1 37 invalid_startdate = 2 38 jobname_missing = 3 39 job_close_failed = 4 40 job_nosteps = 5 41 job_notex = 6 42 lock_failed = 7 43 invalid_target = 8 44 invalid_time_zone = 9 45 OTHERS = 10. 46 47 ENDIF . 48 49 ENDIF. 50 ENDIF . 51 52 ENDIF .
2.自开发程序
1 REPORT zsdf_zdkp. 2 RANGES: rt_vbeln FOR vbco7-vbeln. 3 4 PARAMETERS: p_vbeln TYPE likp-vbeln. 5 PARAMETERS: p_vkorg TYPE vbco7-vkorg. 6 PARAMETERS: p_aedat TYPE likp-aedat. 7 8 DATA:lv_vbeln TYPE likp-vbeln . 9 DATA: lv_garg TYPE seqg3-garg. 10 DATA: lt_enq TYPE TABLE OF seqg3. 11 DATA:lv_date TYPE likp-fkdat . 12 13 CLEAR lv_garg . 14 CLEAR lv_vbeln . 15 REFRESH lt_enq . 16 17 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' 18 EXPORTING 19 input = p_vbeln 20 IMPORTING 21 output = lv_vbeln. 22 23 CLEAR lv_date . 24 25 SELECT SINGLE fkdat 26 INTO @lv_date 27 FROM likp 28 WHERE vbeln = @lv_vbeln . 29 30 CONCATENATE sy-mandt lv_vbeln INTO lv_garg. 31 32 DO 10 TIMES . 33 34 CALL FUNCTION 'ENQUEUE_READ' 35 EXPORTING 36 gclient = sy-mandt 37 gname = 'LIKP' 38 garg = lv_garg 39 guname = '' 40 TABLES 41 enq = lt_enq 42 EXCEPTIONS 43 communication_failure = 1 44 system_failure = 2 45 OTHERS = 3. 46 IF lt_enq[] IS INITIAL . 47 48 EXIT . 49 50 ELSE . 51 52 WAIT UP TO '0.5' SECONDS. 53 54 ENDIF . 55 56 ENDDO . 57 58 CHECK p_vbeln IS NOT INITIAL. 59 ** 触发自动开票的job 60 rt_vbeln-sign = 'I'. 61 rt_vbeln-option = 'EQ'. 62 rt_vbeln-low = p_vbeln. 63 APPEND rt_vbeln. 64 65 cl_salv_bs_runtime_info=>set( display = '' 66 metadata = '' 67 data = 'X' ). 68 SUBMIT rv60sbat WITH vkor1 = p_vkorg 69 WITH x_vbeln IN rt_vbeln 70 WITH allel = 'X' 71 WITH exdate = sy-datum 72 WITH extime = sy-uzeit 73 WITH immedi = 'X' 74 WITH fkdab = lv_date 75 WITH vfkda = p_aedat AND RETURN. 76 CALL METHOD cl_salv_bs_runtime_info=>clear_all.