首页 > 其他分享 >ABAP-CR01工作中心批导

ABAP-CR01工作中心批导

时间:2023-05-13 16:22:59浏览次数:43  
标签:crhd kapa ABAP api01 批导 CR01 api02 crco ls

  1 FUNCTION zfm_pp_0004.
  2 *"----------------------------------------------------------------------
  3 *"*"本地接口:
  4 *"  IMPORTING
  5 *"     VALUE(IV_TEST) TYPE  CHAR1 OPTIONAL
  6 *"  EXPORTING
  7 *"     VALUE(EV_MESSAGE) TYPE  CHAR255
  8 *"     VALUE(EV_TYPE) TYPE  CHAR1
  9 *"  TABLES
 10 *"      TI_INPUT STRUCTURE  ZSPP_0004 OPTIONAL
 11 *"----------------------------------------------------------------------
 12 
 13   DATA:ls_in_crhd_api01 TYPE crhd_api01,
 14        ls_in_crhd_api02 TYPE crhd_api02,
 15        ls_in_crhd_api03 TYPE crhd_api03,
 16        ls_in_crhd_api05 TYPE crhd_api05,
 17        lt_in_crco_api01 TYPE TABLE OF crco_api01,
 18        ls_in_crco_api01 TYPE crco_api01,
 19        lt_in_kapa_api01 TYPE TABLE OF kapa_api01,
 20        ls_in_kapa_api01 TYPE kapa_api01,
 21        lt_in_crhd_api04 TYPE TABLE OF crhd_api04,
 22        ls_in_crhd_api04 TYPE crhd_api04,
 23        lt_in_kapa_api02 TYPE TABLE OF kapa_api02,
 24        ls_in_kapa_api02 TYPE kapa_api02,
 25        lt_return        TYPE bapiret2_tab,
 26        ls_return        TYPE bapiret2.
 27 
 28   CLEAR ls_in_crhd_api01 .
 29   CLEAR ls_in_crhd_api02 .
 30   CLEAR ls_in_crhd_api03 .
 31   CLEAR ls_in_crhd_api05 .
 32   REFRESH lt_in_crco_api01 .
 33   REFRESH lt_in_kapa_api01 .
 34   REFRESH lt_in_crhd_api04 .
 35   REFRESH lt_in_kapa_api02 .
 36 
 37   LOOP AT ti_input ASSIGNING FIELD-SYMBOL(<fs_data>) .
 38 
 39     ls_in_crhd_api01-arbpl = <fs_data>-arbpl .
 40     ls_in_crhd_api01-werks = <fs_data>-werks .
 41     ls_in_crhd_api01-verwe = <fs_data>-verwe .
 42     ls_in_crhd_api01-ktext = <fs_data>-ktext .
 43 
 44     ls_in_crhd_api02-vgwts = <fs_data>-vgwts .
 45     ls_in_crhd_api02-veran = <fs_data>-veran .
 46     ls_in_crhd_api02-planv = '009' ."用途
 47 
 48     ls_in_crhd_api03-steus = <fs_data>-steus .
 49 
 50     ls_in_crhd_api05-fort1 = <fs_data>-fort1 .
 51     ls_in_crhd_api05-fort2 = <fs_data>-fort2 .
 52     ls_in_crhd_api05-fort3 = <fs_data>-fort3 .
 53     ls_in_crhd_api05-kapart = <fs_data>-kapar .
 54 
 55     CLEAR ls_in_crco_api01 .
 56     ls_in_crco_api01-begda = <fs_data>-begda .
 57     ls_in_crco_api01-endda = '99991231'."结束日期
 58     ls_in_crco_api01-kostl = <fs_data>-kostl .
 59     ls_in_crco_api01-lstar1 = <fs_data>-lstar1 .
 60     ls_in_crco_api01-leinh1 = <fs_data>-leinh1 .
 61     ls_in_crco_api01-forml1 = <fs_data>-forml1 .
 62     ls_in_crco_api01-lstar2 = <fs_data>-lstar2 .
 63     ls_in_crco_api01-leinh2 = <fs_data>-leinh2 .
 64     ls_in_crco_api01-forml2 = <fs_data>-forml2 .
 65     ls_in_crco_api01-lstar3 = <fs_data>-lstar3 .
 66     ls_in_crco_api01-leinh3 = <fs_data>-leinh3 .
 67     ls_in_crco_api01-forml3 = <fs_data>-forml3 .
 68     ls_in_crco_api01-lstar4 = <fs_data>-lstar4 .
 69     ls_in_crco_api01-leinh4 = <fs_data>-leinh4 .
 70     ls_in_crco_api01-forml4 = <fs_data>-forml4 .
 71     ls_in_crco_api01-lstar5 = <fs_data>-lstar5 .
 72     ls_in_crco_api01-leinh5 = <fs_data>-leinh5 .
 73     ls_in_crco_api01-forml5 = <fs_data>-forml5 .
 74     ls_in_crco_api01-lstar6 = <fs_data>-lstar6 .
 75     ls_in_crco_api01-leinh6 = <fs_data>-leinh6 .
 76     ls_in_crco_api01-forml6 = <fs_data>-forml6 .
 77     APPEND ls_in_crco_api01 TO lt_in_crco_api01 .
 78 
 79     CLEAR ls_in_kapa_api01 .
 80     ls_in_kapa_api01-kapart = <fs_data>-kapar .
 81     ls_in_kapa_api01-ktext = <fs_data>-ktext .
 82     ls_in_kapa_api01-werks = <fs_data>-werks .
 83     APPEND ls_in_kapa_api01 TO lt_in_kapa_api01 .
 84 
 85     CLEAR ls_in_crhd_api04 .
 86     ls_in_crhd_api04-fork1 = <fs_data>-fork1 .
 87     ls_in_crhd_api04-fork2 = <fs_data>-fork2 .
 88     ls_in_crhd_api04-fork3 = <fs_data>-fork3 .
 89     APPEND ls_in_crhd_api04 TO lt_in_crhd_api04 .
 90 
 91     CLEAR ls_in_kapa_api02 .
 92     ls_in_kapa_api02-planr = <fs_data>-planr .
 93     ls_in_kapa_api02-kalid = <fs_data>-kalid .
 94     ls_in_kapa_api02-versa = <fs_data>-versa .
 95     ls_in_kapa_api02-kapeh = <fs_data>-kapeh .
 96     ls_in_kapa_api02-begzt = <fs_data>-begzt+0(2) && <fs_data>-begzt+3(2) && <fs_data>-begzt+6(2) .
 97     ls_in_kapa_api02-endzt = <fs_data>-endzt+0(2) && <fs_data>-endzt+3(2) && <fs_data>-endzt+6(2) .
 98     ls_in_kapa_api02-pause = <fs_data>-pause+0(2) && <fs_data>-pause+3(2) && <fs_data>-pause+6(2) .
 99     ls_in_kapa_api02-ngrad = <fs_data>-ngrad .
100     ls_in_kapa_api02-aznor = <fs_data>-aznor .
101     ls_in_kapa_api02-meins = <fs_data>-meins .
102     ls_in_kapa_api02-kapter = <fs_data>-kapter .
103     ls_in_kapa_api02-kaplpl = <fs_data>-kaplpl .
104     APPEND ls_in_kapa_api02 TO lt_in_kapa_api02 .
105 
106   ENDLOOP .
107 
108   CLEAR lt_return.
109 
110   DATA: gv_extnum  TYPE balhdr-extnumber,
111         lv_guid_22 TYPE sysuuid_22,
112         lv_comment TYPE crtx-ktext.
113   CLEAR gv_extnum .
114   CLEAR lv_guid_22 .
115   CLEAR lv_comment .
116   lv_guid_22 = cl_system_uuid=>if_system_uuid_static~create_uuid_c22( ).
117   gv_extnum  = lv_guid_22.
118   TRANSLATE  gv_extnum  TO UPPER CASE.
119   lv_comment = gv_extnum.
120 
121   CALL FUNCTION 'CRAP_WKC_CLR_APPL_LOG_EXTRNLID'.
122   CALL FUNCTION 'CRAP_WORKCENTER_CREATE'
123     EXPORTING
124       in_crhd_api01 = ls_in_crhd_api01
125       in_crhd_api02 = ls_in_crhd_api02
126 *     IN_CRHD_API03 =
127       in_crhd_api05 = ls_in_crhd_api05
128       comment       = lv_comment
129       test          = ''
130 *     IN_CRHD_API07 =
131 *     IN_CRHD_API08 =
132 *     IV_NO_COMMIT  =
133 *     IV_LANGU      =
134     TABLES
135       in_kapa_api01 = lt_in_kapa_api01
136       in_kapa_api02 = lt_in_kapa_api02
137       in_crhd_api04 = lt_in_crhd_api04
138       in_crco_api01 = lt_in_crco_api01
139 *     IN_KAZY_API01 =
140 *     IN_KAPA_API04 =
141 *     IN_CRHD_API09 =
142 *     IN_KAKT_API01 =
143 *     IN_KAPA_API05 =
144     .
145 
146   DATA:lt_message TYPE TABLE OF balm,
147        ls_message TYPE balm,
148        lv_message TYPE string.
149 
150   REFRESH lt_message .
151 
152   CALL FUNCTION 'APPL_LOG_READ_DB'
153     EXPORTING
154       object          = 'CRAP'
155       subobject       = '*'
156       external_number = gv_extnum
157 *     DATE_FROM       = '00000000'
158 *     DATE_TO         = SY-DATUM
159 *     TIME_FROM       = '000000'
160 *     TIME_TO         = SY-UZEIT
161 *     LOG_CLASS       = '4'
162 *     PROGRAM_NAME    = '*'
163 *     TRANSACTION_CODE         = '*'
164 *     USER_ID         = ' '
165 *     MODE            = '+'
166 *     PUT_INTO_MEMORY = ' '
167 *   IMPORTING
168 *     NUMBER_OF_LOGS  =
169     TABLES
170 *     HEADER_DATA     =
171 *     HEADER_PARAMETERS        =
172       messages        = lt_message
173 *     MESSAGE_PARAMETERS       =
174 *     CONTEXTS        =
175 *     T_EXCEPTIONS    =
176     .
177 
178   IF line_exists( lt_message[ msgty = 'E' ] ) .
179 
180     LOOP AT lt_message INTO ls_message WHERE msgty = 'E' .
181 
182       CALL FUNCTION 'MESSAGE_TEXT_BUILD'
183         EXPORTING
184           msgid               = ls_message-msgid
185           msgnr               = ls_message-msgno
186           msgv1               = ls_message-msgv1
187           msgv2               = ls_message-msgv2
188           msgv3               = ls_message-msgv3
189           msgv4               = ls_message-msgv4
190         IMPORTING
191           message_text_output = lv_message.
192 
193       ev_message = lv_message && ';' && ev_message .
194 
195     ENDLOOP .
196 
197     ev_type = 'E' .
198 
199   ELSE .
200 
201     ev_type = 'S' .
202 
203   ENDIF .
204 
205 ENDFUNCTION.

标签:crhd,kapa,ABAP,api01,批导,CR01,api02,crco,ls
From: https://www.cnblogs.com/TigerMan/p/17397586.html

相关文章

  • ABAP-CS01BOM批导
    1FUNCTIONzfm_pp_0002.2*"----------------------------------------------------------------------3*"*"本地接口:4*"IMPORTING5*"VALUE(IV_TEST)TYPECHAR1OPTIONAL6*"EXPORTING7*"VALUE(EV_......
  • ABAP read_text 使用 快速开始
    DATA : lv_name TYPE thead-tdname.PERFORM frm_read_text USING '0001' lv_name 'RBKP' CHANGING <fs_itab>-zfpdz. *&---------------------------------------------------------------------**& Form frm_read_text*&----------......
  • ABAP 根据批次特性获取描述 快速开始
    TYPES:BEGIN OF ty_inob,        matnr TYPE mara-matnr,        charg TYPE mchb-charg,        objek TYPE inob-objek,        cuobj TYPE inob-cuobj,      END OF ty_inob. DATA:gt_inob TYPE TABLE OF ty_inob, ......
  • ABAP save_text 使用 快速开始
    业务背景,保存MIR7的注释字段   PERFORM frm_save_note USING lv_invno lv_year  <fs_itab>-zfpdz. *&---------------------------------------------------------------------**& Form frm_save_note*&------------------------------------------------------......
  • ABAP创建OA流程,日期格式问题
    1.代码:DATA:lv_dateTYPEd.DATA:lv_datestringTYPEstring."传到OA的日期,如2023-01-09lv_date=sy-datum.CONCATENATElv_date+0(4)lv_date+4(2)lv_date+6(2)INTOlv_datestringSEPARATEDBY'-'.ls_main1-field_name='CJSJ'.ls_main1-......
  • ABAP 遍历内表数据的时候,加上前端筛选条件
    1.前端查询条件*----------------------------------------------------------------------**选择屏幕*----------------------------------------------------------------------*SELECTION-SCREENBEGINOFBLOCKb1WITHFRAMETITLETEXT-001.SELECT-OPTIONS:"PARA......
  • ABAP_搜索帮助
    ALV引用标准搜索帮助ls_fieldcat-ref_table ='EKKO'.ls_fieldcat-ref_field ='BSART'.ls_fieldcat-edit ='X'  这样就行了,但是有时候会出现校验值不存在的报错这时给ls_fieldcat-no_init_ch ='A'加一个就行了   ......
  • 关于ABAP索引
    1、什么是索引如果把数据库表看做一本书,索引就可以看做书的检索目录。目录中包含书中的大小标题(部分字段数据),并且有对应的数据表条目的页码(指针),可以快速的访问数据库表中对应行的所有字段内容一个表中包含一个主索引和多个二级索引主索引:是系统根据表关键字自动创建的,用户不需要创......
  • ABAP:EKBE采购凭证历史更新增强
    EKBE采购凭证历史更新增强:函数:ME_UPDATE_GOODS_RECEIPT使用隐式增强更新tekbe表字段~ ......
  • ABAP查询界面日期范围未选择值,则查询前一天的数据
    包含TOP的查询条件:SELECT-OPTIONS:p_bldatFORekbe-bldat."凭证日期包含FORM的代码:RANGES:date_rangeFORekbe-bldat.IFp_bldat[]ISINITIAL.date_range-sign='I'.date_range-option='BT'.date_range-low=sy-datum-1.da......