ABAP怎么把传入的参数刷新到内表里面呢?

2024-06-24 13:28

本文主要是介绍ABAP怎么把传入的参数刷新到内表里面呢?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.在执行相关的功能操作之前,优先执行这一段代码,把输入的数据更新入内表里面

 DATA: lo_guid TYPE REF TO cl_gui_alv_grid.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = lo_guid.CALL METHOD lo_guid->check_changed_data.CALL METHOD lo_guid->refresh_table_display.

2.2.附上信息记录查询报表的代码

*&---------------------------------------------------------------------*
*& Report ZPURCHA_INFRECORD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zpurcha_infrecord.TABLES:a017,konp,konm,eina,eine,mara,marc,plpo,mapl,t023t ,equp.TYPE-POOLS: slis,truxs.
DATA: w_repid     LIKE sy-repid,wa_variant  LIKE disvariant,wa_layout   TYPE slis_layout_alv,wa_fieldcat TYPE slis_fieldcat_alv,it_fieldcat TYPE TABLE OF slis_fieldcat_alv,it_events   TYPE slis_t_event.
DATA:it_marc TYPE TABLE OF marc .
DATA:wa_marc TYPE  marc .
DATA lt_exfcode TYPE TABLE OF sy-ucomm.DATA :gv_print TYPE c.
DATA: lt_extab TYPE TABLE OF sy-ucomm WITH HEADER LINE.DATA: ls_fieldcat_sub TYPE slis_fieldcat_alv,lt_fieldcat_sub TYPE slis_t_fieldcat_alv.
DATA:lt_events   TYPE slis_t_event.*----ALV变量
DATA : cl_cnt    TYPE REF TO cl_gui_custom_container, "类--存放alv的容器cl_alv    TYPE REF TO cl_gui_alv_grid, "alv网格gt_fld    TYPE lvc_t_fcat, "存放字段目录内表gs_fld    TYPE lvc_s_fcat, "存放字段工作区gs_layout TYPE lvc_s_layo. "布局结构
.DATA:w_fmodule      TYPE rs38l_fnam,w_cparam       TYPE ssfctrlop,w_outoptions   TYPE ssfcompop,w_bin_filesize TYPE i,w_filename     TYPE string,w_file_path    TYPE string,z_check_matnr  TYPE eina-matnr, "2023年10月12日--PAN  目的:检查配额是否正常。z_check_price  TYPE ekpo-netpr, "2023年10月12日--PAN  目的:检查配额是否正常。z_check_werks  TYPE eine-werks, "工厂z_check_esokz  TYPE eine-esokz, "2023年10月13日-PAN 目的:修复BUG,一种物料存在多个不同信息类别的采购信息记录w_full_path    TYPE string.DATA:t_otf         TYPE itcoo OCCURS 0 WITH HEADER LINE,t_otf_from_fm TYPE ssfcrescl,t_pdf_tab     LIKE tline OCCURS 0 WITH HEADER LINE.DATA  d_ucomm LIKE sy-ucomm.
DATA:suilv LIKE eine-netpr.
TYPES:BEGIN OF t_out,infnr       LIKE eine-infnr, "采购信息记录号matnr       LIKE eina-matnr, "物料编码maktx       LIKE makt-maktx, "物料描述lifnr       LIKE eina-lifnr, "供应商name1       LIKE lfa1-name1, ""供应商名matkl       LIKE eina-matkl, "物料组wgbez       LIKE t023t-wgbez, "物料组描述ekorg       LIKE eine-ekorg, "采购组织esokz       LIKE eine-esokz, "信息类别werks       LIKE eine-werks, "工厂ekgrp       LIKE eine-ekgrp, "采购组aplfz       LIKE eine-aplfz, "计划交货时间minbm       LIKE eine-minbm, "最小订单数量meins       LIKE eina-meins, "基本单位netpr       LIKE eine-netpr, "净价waers       LIKE eine-waers, "货币peinh       LIKE eine-peinh, "每bprme       LIKE eine-bprme, "订单价格单位bpumn       LIKE eine-bpumn,  "分母D20210818bpumz       LIKE eine-bpumz,  "分子z_bpum      LIKE eine-minbm,   "单个重量datab       LIKE a017-datab, "有效期从prdat       LIKE eine-prdat, "有效期至mwskz       LIKE eine-mwskz, "税码z_netpr     LIKE eine-netpr, "含税净价bstyp       LIKE eine-bstyp, "采购凭证类型ebeln       LIKE eine-ebeln, "采购订单号ebelp       LIKE eine-ebelp, "项目netpr_po    LIKE ekpo-netpr, ""净价peinh_po    LIKE ekpo-peinh, "每erdat       LIKE eine-erdat, "创建日期ernam       LIKE eine-ernam, "创建者knumh       LIKE a017-knumh, "条件号mtart       LIKE mara-mtart, "物料类型zeinr       LIKE mara-zeinr, "图号beskz       LIKE marc-beskz, "采购类型kschl       LIKE a017-kschl, "条件类型kschl_a     LIKE a017-kschl, "促销折扣kschl_b     LIKE a017-kschl, "促销折扣消除loekz       LIKE eine-loekz, "采购组织删除标志loekz_a     LIKE eina-loekz, "完整信息记录删除标志plnnr       LIKE plpo-plnnr, "组zaehl       LIKE plpo-zaehl, "计算器prdat_last  LIKE eine-prdat, ""最后有效日期至ztxt1       TYPE char200, "增加文本字段LuD20220808ztxt2       TYPE char200, "增加文本字段LuD20220808mmsta       TYPE marc-mmsta, "特定工厂的物料状态 --PAN 2023年10月12日quote       TYPE equp-quote, "配额 --PAN 2023年10月12日ztxt3       TYPE char200, "检查配额是否正常 -PAN--2023年10月12日ztxt4       TYPE char200, "信息记录是否是复制 -PAN--2023年10月12日"2024年6月11日---新增2个字段---it023input_werks TYPE zrfc_out_eina-werks,input_esokz TYPE eine-esokz , "信息记录类别input_retu  TYPE zrfc_out_eina-zmess,sel         TYPE char1, "选择标示color(4)    TYPE c, "颜色字段field_style TYPE lvc_t_styl,END OF t_out.DATA : s_data TYPE eine-prdat.
s_data = sy-datum.
DATA:it_out       TYPE TABLE OF t_out,wa_out       TYPE t_out,it_out_input TYPE TABLE OF t_out,wa_out_input TYPE  t_out,it_out_ls    TYPE TABLE OF t_out,wa_out_ls    TYPE t_out.DATA:it_info_create TYPE TABLE OF  zrfc_get_eina,wa_info_create TYPE   zrfc_get_eina.DATA:it_info_out TYPE TABLE OF  zrfc_out_eina,wa_info_out TYPE   zrfc_out_eina.TYPES:BEGIN OF t_a017,kschl LIKE a017-kschl,lifnr LIKE a017-lifnr,matnr LIKE a017-matnr,ekorg LIKE a017-ekorg,werks LIKE a017-werks,esokz LIKE a017-esokz,datbi LIKE a017-datbi,datab LIKE a017-datab,knumh LIKE a017-knumh,END OF t_a017.
DATA:it_a017 TYPE TABLE OF t_a017,wa_a017 TYPE t_a017.SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:s_werks FOR  eine-werks OBLIGATORY, "工厂s_erdat FOR  eina-erdat MODIF ID  md3,"创建日期s_matnr FOR  eina-matnr , "物料编码s_lifnr FOR  eina-lifnr MODIF ID  md1, "供应商s_infnr FOR  eine-infnr MODIF ID  md3, "采购信息记录号s_matkl FOR  eina-matkl , "物料组
*               s_werks FOR  eine-werks , "工厂s_ekorg FOR  eine-ekorg , "采购组织s_ekgrp FOR  eine-ekgrp , "采购组
*               s_quote  FOR eine-ekgrp,  "配额是否正常s_esokz FOR  eine-esokz MODIF ID  md3, "信息类别s_mtart FOR  mara-mtart MODIF ID  md2."物料类型PARAMETERS:  s_quote TYPE i.SELECTION-SCREEN END OF BLOCK block1.SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS :yj RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND  u1 .
SELECTION-SCREEN COMMENT 2(8) comm1 FOR FIELD yj .
SELECTION-SCREEN POSITION 12.
PARAMETERS : ww RADIOBUTTON GROUP rad2 .
SELECTION-SCREEN COMMENT 14(8) comm2 FOR FIELD ww.
SELECTION-SCREEN POSITION 24.
PARAMETERS : wj RADIOBUTTON GROUP rad2 .
SELECTION-SCREEN COMMENT 25(8) comm3 FOR FIELD wj.SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END   OF BLOCK block2.SELECTION-SCREEN BEGIN OF BLOCK block3 WITH FRAME TITLE TEXT-003.
PARAMETERS : shanchu AS CHECKBOX   MODIF ID  md3.
SELECTION-SCREEN END   OF BLOCK block3.AT SELECTION-SCREEN OUTPUT.LOOP AT SCREEN.IF  wj EQ 'X'.IF screen-group1  EQ 'MD3' OR  screen-group1  EQ 'MD1'.screen-input = 0.ENDIF.ENDIF.IF  yj EQ 'X'.IF screen-group1  EQ 'MD2' .screen-input = 0.ENDIF.ENDIF.IF  ww EQ 'X'.IF screen-group1  EQ 'MD3' OR screen-group1  EQ 'MD2'.screen-input = 0.ENDIF.ENDIF.MODIFY SCREEN.ENDLOOP.INITIALIZATION.comm1 = '显示有价物料'.comm2 = '显示委外物料'.comm3 = '显示无价物料'.PERFORM init_variant.FORM init_variant .CLEAR: wa_variant.w_repid              = sy-repid.wa_variant-report    = w_repid.wa_variant-username  = sy-uname.
ENDFORM.AT SELECTION-SCREEN.START-OF-SELECTION.PERFORM frm_check_auth."权限控制 add D20190926PERFORM get_data.PERFORM frm_event_bulid.PERFORM frm_alv_set_events.PERFORM alv.END-OF-SELECTION.FORM pf_status_set USING rt_extab TYPE slis_t_extab."权限检查--2024年6月13日AUTHORITY-CHECK OBJECT 'ZINFO_AUTH'ID 'ZINFO_AUTH' FIELD '01'.IF sy-subrc = 0.gv_print = 'X'.ENDIF." 无打印权限时隐藏打印按钮IF gv_print IS INITIAL.APPEND '&COPY_INFO' TO lt_exfcode.ENDIF.SET PF-STATUS '0100' EXCLUDING lt_exfcode..*  SET PF-STATUS '0100' .
ENDFORM.FORM pf_status_set_l USING rt_extab TYPE slis_t_extab."权限检查--2024年6月13日AUTHORITY-CHECK OBJECT 'ZINFO_AUTH'ID 'ZINFO_AUTH' FIELD '01'.IF sy-subrc = 0.gv_print = 'X'.ENDIF." 无打印权限时隐藏打印按钮IF gv_print IS INITIAL.APPEND '&COPY_INFO' TO lt_exfcode.ENDIF.*  SET PF-STATUS 'STANDARD' EXCLUDING lt_exfcode.SET PF-STATUS '0200' EXCLUDING lt_exfcode..
ENDFORM.FORM frm_event_bulid .CALL FUNCTION 'REUSE_ALV_EVENTS_GET'EXPORTINGi_list_type = 0IMPORTINGet_events   = it_events.ENDFORM.
FORM get_data .IF yj = 'X'.DATA: lv_tdname TYPE thead-tdname.IF sy-uname = 'PP014'.MESSAGE e910(z01) WITH '你没有权限'.ROLLBACK WORK .ELSE.IF shanchu IS  INITIAL.SELECT * FROM eine INNER JOIN eina ON eine~infnr = eina~infnr INTO CORRESPONDING FIELDS OF TABLE it_outWHERE eina~matnr IN s_matnr AND eina~lifnr IN s_lifnr AND eine~infnr IN s_infnr  AND eine~werks IN s_werksAND  eine~ekorg IN s_ekorg  AND  eine~ekgrp IN  s_ekgrp  AND  eine~esokz IN s_esokz AND  eina~erdat IN s_erdat AND eina~loekz <> 'X' AND eine~loekz <> 'X'AND eine~werks <> '' AND eine~ekorg <> ''.DELETE it_out WHERE ekorg IS INITIAL.DELETE it_out WHERE werks IS INITIAL.ELSE.SELECT * FROM eine INNER JOIN eina ON eine~infnr = eina~infnr INTO CORRESPONDING FIELDS OF TABLE it_outWHERE eina~matnr IN s_matnr AND eina~lifnr IN s_lifnr AND eine~infnr IN s_infnr AND  eine~werks IN s_werksAND  eine~ekorg IN s_ekorg  AND  eine~ekgrp IN  s_ekgrp  AND  eine~esokz IN s_esokz AND  eina~erdat IN s_erdat AND ( eina~loekz = 'X' OR eine~loekz = 'X').ENDIF.LOOP AT it_out INTO wa_out.SELECT SINGLE * FROM a017   WHERE lifnr = wa_out-lifnr AND matnr = wa_out-matnr AND ekorg = wa_out-ekorg AND werks = wa_out-werks AND kschl = 'PB00'AND datab <=  sy-datum  AND datbi >= sy-datum  AND kappl = 'M'.IF sy-subrc = 0.wa_out-kschl = 'PB00'.ENDIF.SELECT SINGLE * FROM a017   WHERE lifnr = wa_out-lifnr AND matnr = wa_out-matnr AND ekorg = wa_out-ekorg AND werks = wa_out-werks AND kschl = 'RA02'AND datab <=  sy-datum  AND datbi >= sy-datum  AND kappl = 'M'.IF sy-subrc = 0.wa_out-kschl_a = 'RA02'.ENDIF.SELECT SINGLE * FROM a017   WHERE lifnr = wa_out-lifnr AND matnr = wa_out-matnr AND ekorg = wa_out-ekorg AND werks = wa_out-werks AND kschl = 'RA04'AND datab <=  sy-datum  AND datbi >= sy-datum AND kappl = 'M'.IF sy-subrc = 0.wa_out-kschl_b = 'RA04'.ENDIF.SELECT SINGLE  matkl FROM mara INTO  wa_out-matkl  WHERE matnr = wa_out-matnr.SELECT SINGLE  zeinr FROM mara INTO  wa_out-zeinr  WHERE matnr = wa_out-matnr.SELECT SINGLE loekz  FROM eina INTO  wa_out-loekz_a   WHERE infnr = wa_out-infnr.SELECT SINGLE loekz  FROM eine INTO  wa_out-loekz   WHERE infnr = wa_out-infnr AND ekorg = wa_out-ekorg AND  esokz = wa_out-esokz AND  werks = wa_out-werks ."增加读取采购信息记录文本add byLuD20220808CLEAR lv_tdname .lv_tdname  = wa_out-infnr .PERFORM frm_read_text USING lv_tdname  CHANGING wa_out-ztxt1 wa_out-ztxt2  wa_out-ztxt4.MODIFY it_out FROM wa_out.CLEAR wa_out.ENDLOOP.IF  s_matkl IS NOT INITIAL.LOOP AT it_out INTO wa_out.IF wa_out-matkl NOT IN s_matkl.DELETE it_out.ENDIF.CLEAR wa_out.ENDLOOP.ENDIF.ENDIF.ENDIF.IF ww = 'X'.IF sy-uname = 'PP014'.MESSAGE e910(z01) WITH '你没有权限'.ROLLBACK WORK .ELSE.SELECT * FROM plpo INNER JOIN mapl ON plpo~plnnr = mapl~plnnrINTO CORRESPONDING FIELDS OF TABLE it_outWHERE mapl~matnr IN s_matnr AND mapl~werks IN s_werks AND mapl~plnty = 'N' AND  plpo~steus = 'HTT2' AND  plpo~lifnr IN s_lifnr AND plpo~ekorg IN s_ekorgAND plpo~ekgrp IN s_ekgrp AND plpo~matkl IN s_matkl.LOOP AT it_out INTO wa_out.SELECT SINGLE lifnr FROM plpo INTO wa_out-lifnr WHERE steus = 'HTT2' AND plnty = 'N' AND  plnnr = wa_out-plnnr .SELECT SINGLE plifz FROM plpo INTO wa_out-aplfz WHERE steus = 'HTT2' AND plnty = 'N' AND  plnnr = wa_out-plnnr .SELECT SINGLE preis FROM plpo INTO wa_out-netpr WHERE steus = 'HTT2' AND plnty = 'N' AND  plnnr = wa_out-plnnr .SELECT SINGLE  peinh FROM plpo INTO wa_out-peinh WHERE steus = 'HTT2' AND plnty = 'N' AND  plnnr = wa_out-plnnr .SELECT SINGLE  meinh FROM plpo INTO wa_out-bprme WHERE steus = 'HTT2' AND plnty = 'N' AND  plnnr = wa_out-plnnr .SELECT SINGLE meins  FROM mara INTO wa_out-meins WHERE matnr = wa_out-matnr.SELECT SINGLE mtart FROM mara INTO  wa_out-mtart WHERE  matnr  = wa_out-matnr.SELECT SINGLE  name1  FROM  lfa1   INTO wa_out-name1 WHERE lifnr = wa_out-lifnr.SELECT SINGLE beskz FROM marc INTO  wa_out-beskz WHERE  matnr  = wa_out-matnr.SELECT SINGLE  maktx   FROM  makt INTO wa_out-maktx WHERE matnr = wa_out-matnr.SELECT SINGLE  wgbez   FROM  t023t INTO wa_out-wgbez WHERE matkl = wa_out-matkl.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_out-matnrIMPORTINGoutput = wa_out-matnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_out-lifnrIMPORTINGoutput = wa_out-lifnr.MODIFY it_out FROM wa_out.CLEAR wa_out.ENDLOOP.ENDIF.ENDIF.IF wj = 'X'.SELECT * FROM a017 INTO CORRESPONDING FIELDS OF TABLE it_a017.SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_out  WHERE werks IN s_werks  AND  beskz <> 'E'  .LOOP AT it_out INTO wa_out.SELECT SINGLE mtart FROM mara INTO  wa_out-mtart WHERE  matnr  = wa_out-matnr.MODIFY it_out FROM wa_out.CLEAR wa_out.ENDLOOP.IF s_mtart IS NOT INITIAL.DELETE it_out WHERE mtart NOT IN s_mtart.ENDIF.SORT it_a017 BY matnr.SORT it_out BY matnr.LOOP AT it_out INTO wa_out.READ TABLE it_a017 INTO wa_a017 WITH KEY  matnr = wa_out-matnr.IF sy-subrc = 0.DELETE it_out .ENDIF.CLEAR wa_out.ENDLOOP.ENDIF.IF ww <> 'X'.SELECT a017~kschl  a017~lifnr a017~matnr   a017~ekorg a017~werks  a017~esokz a017~datbi   a017~datab  a017~knumh "*INTO CORRESPONDING FIELDS OF TABLE it_a017 FROM a017JOIN konp ON a017~knumh = konp~knumhFOR ALL ENTRIES IN it_out WHERE a017~kappl = 'M' AND a017~lifnr = it_out-lifnrAND a017~matnr = it_out-matnr AND a017~ekorg = it_out-ekorg AND a017~werks = it_out-werks AND a017~esokz =  it_out-esokz AND konp~loevm_ko <> 'X'.LOOP AT it_a017 INTO  wa_a017.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_a017-matnrIMPORTINGoutput = wa_a017-matnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_a017-lifnrIMPORTINGoutput = wa_a017-lifnr.MODIFY it_a017 FROM  wa_a017.CLEAR  wa_a017.ENDLOOP.LOOP AT it_out INTO wa_out.CLEAR:wa_out-datab , wa_out-prdat.SELECT SINGLE  datab FROM a017 INTO  wa_out-datab  WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND werks = wa_out-werks ANDekorg = wa_out-ekorg AND esokz = wa_out-esokz AND kschl = 'PB00' AND kappl = 'M' AND datab <= sy-datum AND datbi >= sy-datum.SELECT SINGLE  datbi  FROM a017 INTO  wa_out-prdat  WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND werks = wa_out-werks ANDekorg = wa_out-ekorg AND esokz = wa_out-esokz AND kschl = 'PB00' AND kappl = 'M' AND datab <= sy-datum AND datbi >= sy-datum.SELECT SINGLE  knumh FROM a017 INTO  wa_out-knumh  WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND werks = wa_out-werks ANDekorg = wa_out-ekorg AND esokz = wa_out-esokz AND kschl = 'PB00' AND kappl = 'M' AND datab <= sy-datum AND datbi >= sy-datum.SELECT SINGLE  kbetr FROM  konp INTO wa_out-netpr WHERE knumh = wa_out-knumh AND loevm_ko <> 'X' .IF sy-subrc = 0.ELSE.wa_out-netpr = 0.ENDIF.SELECT SINGLE  kpein FROM  konp INTO wa_out-peinh WHERE knumh = wa_out-knumh.SELECT SINGLE  kumne FROM  konp INTO wa_out-bpumn WHERE knumh = wa_out-knumh. "D20210818SELECT SINGLE  kumza FROM  konp INTO wa_out-bpumz WHERE knumh = wa_out-knumh.SELECT SINGLE  kmein FROM  konp INTO wa_out-bprme WHERE knumh = wa_out-knumh.SELECT SINGLE  maktx   FROM  makt INTO wa_out-maktx WHERE matnr = wa_out-matnr.SELECT SINGLE  name1  FROM  lfa1   INTO wa_out-name1 WHERE lifnr = wa_out-lifnr.SELECT SINGLE  wgbez   FROM  t023t INTO wa_out-wgbez WHERE matkl = wa_out-matkl.SELECT SINGLE mtart FROM mara INTO  wa_out-mtart WHERE  matnr  = wa_out-matnr.SELECT SINGLE beskz FROM marc INTO  wa_out-beskz WHERE  matnr  = wa_out-matnr."2023年10月12日--新增 工厂特定的物料状态字段--PANSELECT SINGLE  mmsta FROM marc INTO  wa_out-mmsta WHERE  matnr  = wa_out-matnr AND werks = wa_out-werks."2023年10月12日--新增 配额字段SELECT SINGLE  quote FROM equpJOIN equk ON equk~qunum = equp~qunumINTO  wa_out-quoteWHERE equk~matnr  = wa_out-matnrAND equk~werks = wa_out-werksAND equp~lifnr = wa_out-lifnrAND equk~bdatu > s_dataAND  equk~vdatu  < s_data."2023年10月12日-PAN-检查配额是否合理
*      IF wa_out-quote  = 0.
*        wa_out-ztxt3 = '1'.
*      ENDIF.IF wa_out-netpr  = 0.wa_out-ztxt3 = '1'.ENDIF.IF wa_out-mmsta  = '04'.wa_out-ztxt3 = '1'.ENDIF.IF contains( val =  wa_out-lifnr regex = 'HTT' ).wa_out-ztxt3 = '1'.ENDIF.SELECT SINGLE netpr FROM ekpo INTO  wa_out-netpr_po WHERE  ebeln  = wa_out-ebeln AND ebelp = wa_out-ebelp.SELECT SINGLE peinh FROM ekpo INTO  wa_out-peinh_po WHERE  ebeln  = wa_out-ebeln AND ebelp = wa_out-ebelp.wa_out-z_bpum = wa_out-bpumz / wa_out-bpumn.CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'EXPORTINGinput    = wa_out-meinslanguage = '1'IMPORTINGoutput   = wa_out-meins.CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'EXPORTINGinput    = wa_out-bprmelanguage = '1'IMPORTINGoutput   = wa_out-bprme.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_out-matnrIMPORTINGoutput = wa_out-matnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_out-lifnrIMPORTINGoutput = wa_out-lifnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = wa_out-ebelpIMPORTINGoutput = wa_out-ebelp.SELECT SINGLE prdat FROM eine INTO wa_out-prdat_last WHERE infnr = wa_out-infnr.IF wa_out-mwskz IS NOT INITIAL.  "txx20211008IF wa_out-mwskz = 'J0'.wa_out-z_netpr = wa_out-netpr.ENDIF.IF wa_out-mwskz = 'J1'.suilv = '1.17'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.IF wa_out-mwskz = 'J2'.suilv = '1.13'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.IF wa_out-mwskz = 'J3'.suilv = '1.06'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.IF wa_out-mwskz = 'J4'.suilv = '1.03'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.IF wa_out-mwskz = 'J6'.suilv = '1.16'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.IF wa_out-mwskz = 'J7'."2023年4月14日增加税码J7suilv = '1.01'.wa_out-z_netpr = wa_out-netpr * suilv.ENDIF.ENDIF.*      wa_out-color =  'C110'."设置行的颜色MODIFY it_out FROM wa_out.CLEAR wa_out.ENDLOOP."价格记录排除了Konp表删除的,由于有按价格期间删除的操作,排除记录LuD20221107
*    DELETE it_out WHERE netpr = 0.LOOP AT it_out INTO wa_out.MOVE-CORRESPONDING wa_out TO wa_out_ls.APPEND   wa_out_ls TO it_out_ls .CLEAR  wa_out_ls .ENDLOOP."2023年10月12日--PAN--检查配额是否正常SORT it_out BY  matnr esokz  netpr.CLEAR wa_out.IF it_out IS NOT INITIAL.LOOP AT it_out INTO wa_out . "取价格最低,且不为0的记录IF wa_out-netpr <> '0'  AND   wa_out-mmsta  <> '04' AND NOT contains( val =  wa_out-lifnr regex = 'HTT' ).z_check_matnr  = wa_out-matnr.z_check_price  = wa_out-netpr.z_check_esokz  = wa_out-esokz.EXIT.ENDIF.ENDLOOP.ENDIF."2023年11月7日--修正BUG点,如果只存在两条记录的情况,一个配额为0的是1,但是配额100的是2的情况CLEAR wa_out.LOOP AT it_out INTO wa_out.IF  wa_out-netpr <> 0   AND  wa_out-mmsta  <> '04' AND  wa_out-ztxt3 IS INITIAL ."wa_out-quote  <>  0wa_out-ztxt3 = '1'.IF wa_out-matnr  = z_check_matnr AND wa_out-esokz =  z_check_esokz AND wa_out-netpr <> z_check_price AND wa_out-netpr <> '0' ." AND wa_out-quote <> 0.IF wa_out-quote <> 0.wa_out-ztxt3 = '2'.ELSE.wa_out-ztxt3 = '1'.ENDIF.MODIFY it_out FROM wa_out TRANSPORTING ztxt3 WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND netpr  = wa_out-netpr.ELSE.IF wa_out-matnr <> z_check_matnr .z_check_matnr  = wa_out-matnr.z_check_price  = wa_out-netpr.z_check_esokz  = wa_out-esokz.ENDIF.ENDIF.MODIFY it_out FROM wa_out TRANSPORTING ztxt3 WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND netpr  = wa_out-netpr.ENDIF.CLEAR:wa_out.ENDLOOP."如果配额是2的话,那么物料 + 和工厂维度全部替换为2CLEAR:z_check_matnr , z_check_werks.SORT it_out BY matnr  werks ztxt3 DESCENDING.LOOP AT  it_out  INTO  wa_out.IF wa_out-ztxt3  = '2'.z_check_matnr = wa_out-matnr.z_check_werks = wa_out-werks.ELSE.IF z_check_matnr = wa_out-matnr AND z_check_werks = wa_out-werks.wa_out-ztxt3 = '2'.MODIFY it_out FROM wa_out TRANSPORTING ztxt3 WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND netpr  = wa_out-netpr.ENDIF.ENDIF.CLEAR:wa_out.ENDLOOP."条件查询,删除全部的不符合的条件IF s_quote IS NOT INITIAL .DELETE  it_out  WHERE  ztxt3 <> s_quote.ENDIF."-----------------------------------------------------SORT it_out BY  lifnr matnr ekorg werks esokz.SORT it_a017 BY  lifnr matnr ekorg werks esokz.LOOP AT it_a017 INTO  wa_a017.READ TABLE it_out INTO wa_out WITH KEY lifnr = wa_a017-lifnr  matnr = wa_a017-matnr  ekorg = wa_a017-ekorg  werks = wa_a017-werks  esokz = wa_a017-esokz .IF sy-subrc = 0.MOVE-CORRESPONDING wa_out TO wa_out_ls.IF wa_a017-knumh <> wa_out-knumh  AND wa_a017-kschl = 'PB00'.wa_out_ls-knumh  = wa_a017-knumh.wa_out_ls-datab = wa_a017-datab.wa_out_ls-prdat = wa_a017-datbi.SELECT SINGLE kbetr INTO wa_out_ls-netpr  FROM konp WHERE knumh = wa_out_ls-knumh. "净价SELECT SINGLE konwa INTO wa_out_ls-waers  FROM konp WHERE knumh = wa_out_ls-knumh.  "货币SELECT SINGLE kpein INTO  wa_out_ls-peinh FROM konp WHERE knumh = wa_out_ls-knumh.  "每SELECT SINGLE kumne INTO  wa_out_ls-bpumn FROM konp WHERE knumh = wa_out_ls-knumh. "D20210818SELECT SINGLE kumza INTO  wa_out_ls-bpumz FROM konp WHERE knumh = wa_out_ls-knumh.SELECT SINGLE kmein INTO  wa_out_ls-bprme FROM konp WHERE knumh = wa_out_ls-knumh.  "订单价格单位APPEND   wa_out_ls TO it_out_ls .ELSE.IF wa_a017-datbi  <>  wa_out-prdat AND wa_a017-kschl = 'PB00'.wa_out_ls-knumh  = wa_a017-knumh.wa_out_ls-datab = wa_a017-datab.wa_out_ls-prdat = wa_a017-datbi.SELECT SINGLE kbetr INTO wa_out_ls-netpr  FROM konp WHERE knumh = wa_out_ls-knumh. "净价SELECT SINGLE konwa INTO wa_out_ls-waers  FROM konp WHERE knumh = wa_out_ls-knumh.  "货币SELECT SINGLE kpein INTO  wa_out_ls-peinh FROM konp WHERE knumh = wa_out_ls-knumh.  "每SELECT SINGLE kumne INTO  wa_out_ls-bpumn FROM konp WHERE knumh = wa_out_ls-knumh. "D20210818SELECT SINGLE kumza INTO  wa_out_ls-bpumz FROM konp WHERE knumh = wa_out_ls-knumh.SELECT SINGLE kmein INTO  wa_out_ls-bprme FROM konp WHERE knumh = wa_out_ls-knumh.  "订单价格单位APPEND   wa_out_ls TO it_out_ls .ENDIF.IF wa_a017-kschl <> 'PB00'.wa_out_ls-kschl  = wa_a017-kschl.wa_out_ls-knumh  = wa_a017-knumh.wa_out_ls-datab = wa_a017-datab.wa_out_ls-prdat = wa_a017-datbi.SELECT SINGLE kbetr INTO wa_out_ls-netpr  FROM konp WHERE knumh = wa_out_ls-knumh. "净价SELECT SINGLE konwa INTO wa_out_ls-waers  FROM konp WHERE knumh = wa_out_ls-knumh.  "货币SELECT SINGLE kpein INTO  wa_out_ls-peinh FROM konp WHERE knumh = wa_out_ls-knumh.  "每SELECT SINGLE kumne INTO  wa_out_ls-bpumn FROM konp WHERE knumh = wa_out_ls-knumh. "D20210818SELECT SINGLE kumza INTO  wa_out_ls-bpumz FROM konp WHERE knumh = wa_out_ls-knumh.SELECT SINGLE kmein INTO  wa_out_ls-bprme FROM konp WHERE knumh = wa_out_ls-knumh.  "订单价格单位APPEND   wa_out_ls TO it_out_ls .ENDIF.ENDIF.ENDIF.CLEAR  wa_a017.ENDLOOP.LOOP AT  it_out_ls INTO wa_out_ls.SELECT SINGLE kschl INTO wa_out_ls-kschl  FROM konp WHERE knumh = wa_out_ls-knumh. "净价IF wa_out_ls-mwskz IS NOT INITIAL.  "txx20211008IF wa_out_ls-mwskz = 'J0'.wa_out_ls-z_netpr = wa_out_ls-netpr.ENDIF.IF wa_out_ls-mwskz = 'J1'.suilv = '1.17'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.IF wa_out_ls-mwskz = 'J2'.suilv = '1.13'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.IF wa_out_ls-mwskz = 'J3'.suilv = '1.06'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.IF wa_out_ls-mwskz = 'J4'.suilv = '1.03'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.IF wa_out_ls-mwskz = 'J6'.suilv = '1.16'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.IF wa_out_ls-mwskz = 'J7'."2023年4月14日增加税码J7suilv = '1.01'.wa_out_ls-z_netpr = wa_out_ls-netpr * suilv.ENDIF.ENDIF.MODIFY it_out_ls FROM wa_out_ls.CLEAR wa_out_ls.ENDLOOP.SORT it_out_ls BY  lifnr matnr ekorg werks esokz.ENDIF.
ENDFORM.FORM frm_user_command  USING r_ucomm LIKE sy-ucommrs_selfield TYPE slis_selfield.DATA: lo_guid TYPE REF TO cl_gui_alv_grid.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = lo_guid.CALL METHOD lo_guid->check_changed_data.CALL METHOD lo_guid->refresh_table_display.CASE r_ucomm.WHEN '&LS'.IF ww IS NOT INITIAL.ELSE.PERFORM alv_ls.ENDIF.WHEN '&EX_CAL'.PERFORM ex_cal.WHEN'&COPY_INFO'."获取全部的选中的行,并写入到一个内表中CLEAR:wa_out.LOOP AT it_out INTO wa_out WHERE sel = 'X'.*        "优先剔除掉以前的数据先。IF wa_out-input_retu IS NOT  INITIAL.wa_out-input_retu  = ''.ENDIF.
*
*        "校验用户输入的数据IF wa_out-input_werks IS INITIAL.wa_out-input_retu = '工厂不允许为空'.wa_out_input-input_retu = '工厂不允许为空'.wa_out-color =  'C610'."设置行的颜色ENDIF.
*IF wa_out-input_esokz IS INITIAL.wa_out-input_retu = '信息记录的类别不允许为空'.wa_out_input-input_retu = '信息记录的类别不允许为空'.wa_out-color =  'C610'."设置行的颜色ELSE.IF wa_out-input_esokz ='0'OR  wa_out-input_esokz ='2' OR wa_out-input_esokz ='3'.ELSE.wa_out-input_retu = '信息类别异常,请检查'.wa_out_input-input_retu = '信息类别异常,请检查'.wa_out-color =  'C610'."设置行的颜色ENDIF.ENDIF.*        IF wa_out-input_esokz IS NOT INITIAL AND  wa_out-input_werks  IS NOT INITIAL.
*          SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_marc WHERE werks = wa_out-input_werks  AND matnr =  wa_out-matnr.
*          IF sy-subrc <> 0.
*            wa_out-input_retu = '物料在该扩展工厂没有维护,请先扩展'.
*            wa_out_input-input_retu = '物料在该扩展工厂没有维护,请先扩展'.
*          ENDIF.
*        ENDIF.MODIFY  it_out FROM  wa_out TRANSPORTING  input_retu color WHERE matnr = wa_out-matnr AND lifnr = wa_out-lifnr AND werks = wa_out-werks AND esokz = wa_out-esokz AND ekorg = wa_out-ekorg .APPEND wa_out TO it_out_input.CLEAR wa_out.ENDLOOP."处理复制信息记录PERFORM copy_infomation .ENDCASE.rs_selfield-refresh = 'X'.rs_selfield-col_stable = 'X'.rs_selfield-row_stable = 'X'.ENDFORM.FORM frm_user_command_l  USING r_ucomm LIKE sy-ucommrs_selfield TYPE slis_selfield.DATA: lo_guid TYPE REF TO cl_gui_alv_grid.*------------将ALV上修改的内容保存到内表---------------------------------*CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = lo_guid.CALL METHOD lo_guid->check_changed_data.rs_selfield-refresh = 'X'.CALL METHOD lo_guid->refresh_table_display.CASE r_ucomm.WHEN '&XY'.IF ww IS NOT INITIAL.ELSE.PERFORM alv.ENDIF.WHEN '&EX_CAL'.PERFORM ex_cal.ENDCASE.rs_selfield-refresh = 'X'.rs_selfield-col_stable = 'X'.rs_selfield-row_stable = 'X'.
ENDFORM.FORM alv.DATA: w_repid     LIKE sy-repid,wa_variant  LIKE disvariant,wa_layout   TYPE slis_layout_alv,wa_fieldcat TYPE slis_fieldcat_alv,it_fieldcat TYPE TABLE OF slis_fieldcat_alv,it_events   TYPE slis_t_event.
*  DATA: gs_layout TYPE slis_layout_alv. "布局结构DATA: f_title TYPE lvc_title.f_title = '采购信息记录报表'.DATA col_pos TYPE i.gs_layout-zebra                = 'X'.w_repid                        = sy-repid.
*  gs_layout-no_vline             = space.
*  gs_layout-detail_initial_lines = 'X'.
*  wa_layout-box_fieldname        = 'FLAG'.
*  gs_layout-colwidth_optimize    = 'X'.DEFINE hout.*    col_pos = col_pos + 1.
*    wa_fieldcat-tabname     = 'it_out[]'.
*    wa_fieldcat-fieldname = '&1'.
*    wa_fieldcat-seltext_m =  &2.
*    wa_fieldcat-col_pos   =  col_pos.
*    wa_fieldcat-outputlen =  &3.
*    wa_fieldcat-datatype  = '&4'.
*    wa_fieldcat-edit    = '&5'.
*
*
*
*    wa_fieldcat-lzero     = 'X'.
*    wa_fieldcat-no_zero   = ''.
*    wa_fieldcat-no_sign   = ''.
*    wa_fieldcat-icon      = ''.
*
*
*    APPEND wa_fieldcat TO it_fieldcat.col_pos = col_pos + 1.
gs_fld-tabname     = 'it_out[]'.
gs_fld-fieldname = '&1'.
gs_fld-coltext = gs_fld-scrtext_l = gs_fld-scrtext_m = gs_fld-scrtext_s = &2."字段名称
gs_fld-col_pos   =  col_pos.
gs_fld-outputlen =  '&3'.
gs_fld-datatype  = '&4'.
gs_fld-edit    = &5.
gs_fld-f4availabl = &6.gs_fld-lzero     = 'X'.
gs_fld-no_zero   = ''.
gs_fld-no_sign   = ''.
gs_fld-icon      = ''.*  IF gs_fld-fieldname = 'input_esokz'.
*    gs_fld-ref_field = 'ESOKZ'.
*    gs_fld-ref_table = 'EINE'.
*    gs_fld-edit  = 'X'.
*  ENDIF.APPEND gs_fld TO gt_fld.wa_layout-zebra                = 'X'.w_repid                        = sy-repid.
*  wa_layout-no_vline             = space.
*  wa_layout-detail_initial_lines = 'X'.
*  wa_layout-box_fieldname        = 'FLAG'.
*  wa_layout-colwidth_optimize    = 'X'.gs_layout-info_fname = 'COLOR'.gs_layout-zebra         = 'X'.gs_layout-cwidth_opt    = 'X'.gs_layout-box_fname = 'SEL'.  "指定这个字段为【选择块】END-OF-DEFINITION.IF yj = 'X'.hout  infnr     '采购信息记录'       10       char  '' ''.ENDIF.hout  matnr     '物料编码'           18       char  ''  ''.hout  maktx     '物料编码描述'       40       char '' ''.hout  werks     '工厂'               10       char '' ''.IF yj = 'X'.hout  esokz     '信息类别'           6       char ''  ''.ENDIF.AUTHORITY-CHECK OBJECT 'ZINFO_AUTH'ID 'ZINFO_AUTH' FIELD '01'.IF sy-subrc = 0.hout  input_werks     '新增信息记录的工厂'      6       char 'X' ''.hout  input_esokz     '信息记录的类别'      40       char 'X' 'X'.hout  input_retu     '复制结果'       40       char  '' ''.ENDIF.IF yj = 'X' OR ww = 'X'.hout  matkl     '物料组'             9       char '' ''.hout  wgbez     '物料组描述'             16       char '' ''.hout  lifnr     '供应商'             10       char '' ''.hout  name1     '供应商名称'         35       char '' ''.hout  ekorg     '采购组织'           4       char '' ''.ENDIF.hout  mtart     '物料类型'            8       char ''  ''.hout  beskz     '采购类型'            10       char ''  ''.hout  zeinr     '图号'            10       char  ''  '' .hout  mmsta     '工厂特定的物料状态' 12 char ''  ''."2023年10月12日-PAN-新增hout  quote    '配额' 12 char ''  ''."2023年10月12日-PAN-新增hout  ztxt3    '配额标记' 12 char ''  ''."2023年10月12日-PAN-新增hout  ekgrp     '采购组'             10       char  ''  ''.IF yj = 'X' OR ww = 'X'.hout  aplfz     '计划交货时间'        10      dec '' ''.IF yj = 'X'.hout  minbm     '最小订单数量'        13       quan ''  ''.ENDIF.hout  meins     '基本单位'            6       unit ''  ''.hout  netpr     '净价'               12       curr ''  ''.hout  z_netpr     '含税单价'               12       curr ''  ''.hout  waers     '货币'               4       char ''  ''.hout  peinh     '每'           8        unit '' ''.hout  bprme     '订单价格单位'       10       unit  ''   ''.hout  z_bpum     '单个重量'       10       unit '' '' .     "20210818IF yj = 'X'.hout  datab     '有效期从'           12       dats ''  ''.hout  prdat     '有效期至'           12       dats '' ''.hout  mwskz     '税码'               4       char '' ''.
*    hout  bstyp     '采购凭证类型'       10       char .
*    hout  ebeln     '采购订单号'         10       char .
*    hout  ebelp     '项目'              4       char .
*    hout  netpr_po   'PO净价'            12       curr .
*    hout  peinh_po     'PO每'              8        unit .hout  kschl_a   '促销率'          4       char '' ''.hout  kschl_b   '促销减免价'      8      char '' ''.hout  ztxt1   '文本'      20      char '' ''."增加读取采购信息记录文本add byLuD20220808hout  ztxt2   '姓名'      20      char '' ''."增加读取采购信息记录文本add byLuD20220808hout  ztxt4   '是否复制'      20      char '' ''."增加读取采购信息记录文本add byLuD20220808hout  erdat     '创建日期'          12       dats '' ''.hout  ernam     '创建者'            10       char '' ''.hout  loekz      '采购组织删除标志'  12      char  '' ''.hout  loekz_a    '完整信息删除标志'  12      char  '' ''.hout  prdat_last  '最后有效期至'           12       dats '' ''.ENDIF.ENDIF.*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*    EXPORTING
*      i_callback_program       = w_repid
*      i_callback_pf_status_set = 'PF_STATUS_SET'
*      i_callback_user_command  = 'FRM_USER_COMMAND'
*      i_grid_title             = f_title
*      is_layout                = wa_layout
*      it_fieldcat              = it_fieldcat[]
*      i_default                = 'X'
*      i_save                   = 'A'
*      is_variant               = wa_variant
*      it_events                = it_events
*    TABLES
*      t_outtab                 = it_out[].CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'EXPORTINGi_callback_program       = sy-repidi_callback_pf_status_set = 'PF_STATUS_SET'i_callback_user_command  = 'FRM_USER_COMMAND'is_layout_lvc            = gs_layoutit_fieldcat_lvc          = gt_fldit_events                = lt_eventsTABLESt_outtab                 = it_out
*     t_outtab                 = lt_alvsEXCEPTIONSprogram_error            = 1OTHERS                   = 2.ENDFORM.
*&---------------------------------------------------------------------*
*& Form ALV_LS
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM alv_ls .DATA: gs_layout TYPE lvc_s_layo.DATA: f_title TYPE lvc_title.f_title = '采购信息记录历史报表'.DATA col_pos TYPE i.wa_layout-zebra                = 'X'.w_repid                        = sy-repid.
*  wa_layout-no_vline             = space.
*  wa_layout-detail_initial_lines = 'X'.
*  wa_layout-box_fieldname        = 'FLAG'.
*  wa_layout-colwidth_optimize    = 'X'.gs_layout-info_fname = 'COLOR'.gs_layout-zebra         = 'X'.gs_layout-cwidth_opt    = 'X'.gs_layout-box_fname = 'SEL'.  "指定这个字段为【选择块】DEFINE hout.col_pos = col_pos + 1.wa_fieldcat-tabname     = 'it_out_ls[]'.wa_fieldcat-fieldname = '&1'.wa_fieldcat-seltext_m =  &2.wa_fieldcat-col_pos   =  col_pos.wa_fieldcat-outputlen =  &3.wa_fieldcat-datatype  = '&4'.
*    wa_fieldcat-do_sum    = '&5'.wa_fieldcat-lzero     = 'X'.wa_fieldcat-no_zero   = ''.wa_fieldcat-no_sign   = ''.wa_fieldcat-icon      = ''.APPEND wa_fieldcat TO it_fieldcat.END-OF-DEFINITION.IF yj = 'X'.hout  infnr     '采购信息记录'       10       char .ENDIF.hout  matnr     '物料编码'           40       char .hout  maktx     '物料编码描述'       40       char .IF yj = 'X'.hout  matkl     '物料组'             9       char .hout  wgbez     '物料组描述'             16       char .hout  lifnr     '供应商'             10       char .hout  name1     '供应商名称'         35       char .hout  ekorg     '采购组织'           4       char .hout  esokz     '信息类别'           6       char .ENDIF.hout  mtart     '物料类型'            8       char .hout  beskz     '采购类型'            10       char .hout  werks     '工厂'               10       char .hout  ekgrp     '采购组'             10       char .IF yj = 'X'.hout  aplfz     '计划交货时间'        10      dec .hout  minbm     '最小订单数量'        13       quan .hout  meins     '基本单位'            6       unit .hout  kschl      '条件类型'           10       char .hout  netpr     '净价'               12       curr .hout  z_netpr     '含税单价'               12       curr .hout  waers     '货币'               4       char .hout  peinh     '每'           8        unit .hout  bprme     '订单价格单位'       10       unit .hout  z_bpum     '转换数量'       10       unit .           "20210818hout  meins     '转换单位'            6       unit .hout  datab     '有效期从'           12       dats .hout  prdat     '有效期至'           12       dats .hout  mwskz     '税码'               4       char .
*    hout  bstyp     '采购凭证类型'       10       char .
*    hout  ebeln     '采购订单号'         10       char .
*    hout  ebelp     '项目'              4       char .
*    hout  netpr_po   'PO净价'            12       curr .
*    hout  peinh_po     'PO每'              8        unit .hout  kschl_a   '促销率'          4       char .hout  kschl_b   '促销减免价格'      8      char .hout  erdat     '创建日期'          12       dats .hout  ernam     '创建者'            10       char .ENDIF.*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*    EXPORTING
*      i_callback_program       = w_repid
*      i_callback_pf_status_set = 'PF_STATUS_SET_L'
*      i_callback_user_command  = 'FRM_USER_COMMAND_L'
*      i_grid_title             = f_title
*      is_layout                = wa_layout
*      it_fieldcat              = it_fieldcat[]
*      i_default                = 'X'
*      i_save                   = 'A'
*      is_variant               = wa_variant
*      it_events                = it_events
*    TABLES
*      t_outtab                 = it_out_ls[].CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'EXPORTINGi_callback_program       = sy-repidi_callback_pf_status_set = 'PF_STATUS_SET'i_callback_user_command  = 'FRM_USER_COMMAND'is_layout_lvc            = gs_layoutit_fieldcat_lvc          = gt_fldit_events                = lt_eventsTABLESt_outtab                 = it_out
*     t_outtab                 = lt_alvsEXCEPTIONSprogram_error            = 1OTHERS                   = 2.ENDFORM.
*&---------------------------------------------------------------------*
*& Form EX_CAL
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM ex_cal .DATA t_rsparams TYPE TABLE OF rsparams.REFRESH t_rsparams.CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'EXPORTINGcurr_report     = sy-repidTABLESselection_table = t_rsparamsEXCEPTIONSnot_found       = 1no_report       = 2OTHERS          = 3.SUBMIT zpurcha_infrecord WITH SELECTION-TABLE t_rsparams VIA SELECTION-SCREEN.ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_AUTH
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_check_auth .
*authority check 权限控制 add D20190926TYPES:BEGIN OF ty_werks,werks TYPE t001w-werks,END OF ty_werks.DATA:lt_werks TYPE STANDARD TABLE OF  ty_werks,lw_werks TYPE ty_werks.SELECT werksFROM t001wINTO CORRESPONDING FIELDS OF TABLE lt_werksWHERE werks IN s_werks AND land1 EQ 'CN'.LOOP AT lt_werks INTO lw_werks.AUTHORITY-CHECK OBJECT 'ZMM_WERKS'ID  'WERKS' FIELD  lw_werks-werksID  'ACTVT' FIELD '03'.IF sy-subrc NE 0.MESSAGE i398(00) WITH '无工厂' lw_werks-werks  '的权限!' .STOP.ENDIF.ENDLOOP.ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_READ_TEXT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*      -->P_LV_TDNAME  text
*      <--P_WA_OUT_ZTXT  text
*&---------------------------------------------------------------------*
FORM frm_read_text  USING    p_lv_tdnameCHANGING p_wa_out_ztxt1p_wa_out_ztxt2  p_wa_out_ztxt4.DATA: lt_lines LIKE  TABLE OF tline,lw_lines LIKE  tline.DATA:lv_tdname TYPE stxh-tdname.CLEAR:lv_tdname.SELECT SINGLE tdname FROM stxh INTO lv_tdname WHERE tdobject = 'EINA' AND tdname = p_lv_tdname.IF lv_tdname IS NOT INITIAL .CALL FUNCTION 'READ_TEXT'EXPORTING
*       CLIENT   = SY-MANDTid       = 'AT'language = sy-languname     = p_lv_tdnameobject   = 'EINA'
*       ARCHIVE_HANDLE                = 0
*       LOCAL_CAT                     = ' '
*   IMPORTING
*       HEADER   =
*       OLD_LINE_COUNTER              =TABLESlines    = lt_lines
*   EXCEPTIONS
*       ID       = 1
*       LANGUAGE = 2
*       NAME     = 3
*       NOT_FOUND                     = 4
*       OBJECT   = 5
*       REFERENCE_CHECK               = 6
*       WRONG_ACCESS_TO_ARCHIVE       = 7
*       OTHERS   = 8.IF sy-subrc <> 0.
* Implement suitable error handling hereENDIF.*    LOOP AT lt_lines INTO lw_lines  .
*      CONCATENATE p_wa_out_ztxt lw_lines-tdline INTO p_wa_out_ztxt.
*    ENDLOOP.CLEAR:lw_lines.READ TABLE lt_lines INTO lw_lines  INDEX 1.p_wa_out_ztxt1 = lw_lines-tdline .CLEAR:lw_lines.READ TABLE lt_lines INTO lw_lines  INDEX 2.p_wa_out_ztxt2 = lw_lines-tdline .READ TABLE lt_lines INTO lw_lines  INDEX 3.IF sy-subrc = 0.p_wa_out_ztxt4 = lw_lines-tdline .ENDIF.ENDIF.ENDFORM.FORM copy_infomation .CLEAR: it_info_create[] ,  it_info_out[].LOOP AT it_out_input INTO  wa_out_input  WHERE input_retu IS INITIAL..wa_info_create-lifnr = wa_out_input-lifnr.wa_info_create-matnr = wa_out_input-matnr.wa_info_create-ekorg = wa_out_input-ekorg.wa_info_create-werks = wa_out_input-input_werks."IT023改,用户自己传入的工厂wa_info_create-esokz = wa_out_input-input_esokz."IT023改,信息类别让用户自己填写 2024年6月19日17点13分wa_info_create-ekgrp = wa_out_input-ekgrp.wa_info_create-aplfz = wa_out_input-aplfz.wa_info_create-minbm = wa_out_input-minbm.wa_info_create-mwskz = wa_out_input-mwskz.
*    wa_info_create-VERID = wa_out_input-VERID.
*    wa_info_create-LMEIN = wa_out_input-LMEIN.wa_info_create-meins = wa_out_input-meins.wa_info_create-netpr = wa_out_input-netpr.wa_info_create-waers = wa_out_input-waers.wa_info_create-peinh = wa_out_input-peinh.wa_info_create-bprme = wa_out_input-bprme.wa_info_create-erdat = wa_out_input-erdat.wa_info_create-prdat = wa_out_input-prdat.
*    wa_info_create-HID = wa_out_input-HID.
*    wa_info_create-TEXT1 = wa_out_input-TEXT1.wa_info_create-text3 = 'SAP复制'.APPEND wa_info_create TO it_info_create .CLEAR:wa_info_create.ENDLOOP.*  CLEAR:wa_out_input."调用BAPI复制信息记录CALL FUNCTION 'ZRFC_INCHA_INFORECORD'EXPORTINGp_me       = 'A'
* IMPORTING
*     LV_REPORTHEAD       =
*     V_SUBRC    =
*     V_MESSAGE  =TABLESit_tab     = it_info_createit_tab_out = it_info_out.LOOP AT it_info_out ASSIGNING FIELD-SYMBOL(<fs_it_info_out>).IF  sy-subrc = 0.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = <fs_it_info_out>-matnrIMPORTINGoutput = <fs_it_info_out>-matnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = <fs_it_info_out>-lifnrIMPORTINGoutput = <fs_it_info_out>-lifnr.READ TABLE it_out ASSIGNING FIELD-SYMBOL(<fs_it_out>) WITH  KEY lifnr = <fs_it_info_out>-lifnr  matnr  = <fs_it_info_out>-matnr input_werks = <fs_it_info_out>-werks   ekorg  = <fs_it_info_out>-ekorg  input_esokz =  <fs_it_info_out>-esokz.IF sy-subrc = 0.IF <fs_it_info_out>-zlx  ='E' .<fs_it_out>-input_retu  =  <fs_it_info_out>-zmess.<fs_it_out>-color =  'C610'."设置行的颜色ELSE.<fs_it_out>-input_retu  =  <fs_it_info_out>-zmess.<fs_it_out>-color =  ''."设置行的颜色ENDIF.ENDIF.ENDIF.ENDLOOP.*  READ TABLE  it_out_input INTO wa_out_input WITH  KEY input_retu LIKE  '%1%' .
*  IF sy-subrc <> 0.*    "调用BAPI复制信息记录
*    CALL FUNCTION 'ZRFC_INCHA_INFORECORD'
*      EXPORTING
*        p_me       = 'A'
** IMPORTING
**       LV_REPORTHEAD       =
**       V_SUBRC    =
**       V_MESSAGE  =
*      TABLES
*        it_tab     = it_info_create
*        it_tab_out = it_info_out.
*
*    LOOP AT it_info_out ASSIGNING FIELD-SYMBOL(<fs_it_info_out>).
*      IF  sy-subrc = 0.
*        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
*          EXPORTING
*            input  = <fs_it_info_out>-matnr
*          IMPORTING
*            output = <fs_it_info_out>-matnr.
*
*
*        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
*          EXPORTING
*            input  = <fs_it_info_out>-lifnr
*          IMPORTING
*            output = <fs_it_info_out>-lifnr.
*
*
*
*        READ TABLE it_out ASSIGNING FIELD-SYMBOL(<fs_it_out>) WITH  KEY lifnr = <fs_it_info_out>-lifnr  matnr  = <fs_it_info_out>-matnr input_werks = <fs_it_info_out>-werks   ekorg  = <fs_it_info_out>-ekorg  input_esokz =  <fs_it_info_out>-esokz.
*        IF sy-subrc = 0.
*          <fs_it_out>-input_retu  =  <fs_it_info_out>-zmess.
*        ENDIF.
*      ENDIF.
*    ENDLOOP.*  ENDIF.*  DATA LS_STBL      TYPE LVC_S_STBL.
*  DATA: LO_GRID TYPE REF TO CL_GUI_ALV_GRID.
*  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
*    IMPORTING
*      E_GRID = LO_GRID.
*  "稳定刷新
*  LS_STBL-ROW = 'X'." 基于行的稳定刷新
*  LS_STBL-COL = 'X'." 基于列稳定刷新
*  IF LO_GRID IS NOT INITIAL.
*    CALL METHOD LO_GRID->REFRESH_TABLE_DISPLAY
*      EXPORTING
*        IS_STABLE = LS_STBL.
*  ENDIF.CLEAR: it_info_create[] ,  it_info_out[],it_info_create ,  it_info_out  ,it_out_input ,it_out_input[].
*  FREE:it_info_create[] ,  it_info_out[],it_out_input[].ENDFORM."输出的内表里面的搜索帮助---IT023-----2024年6月20日*GS_FCAT-F4AVAILABL = 'X'.*&---------------------------------------------------------------------*
*& Form FRM_ALV_SET_EVENTS
*&---------------------------------------------------------------------*
*& ALV事件注册
*&---------------------------------------------------------------------*
FORM frm_alv_set_events .DATA: ls_events TYPE slis_alv_event.ls_events-name = 'CALLER_EXIT' .ls_events-form =  'FRM_CALLER_EXIT'.APPEND ls_events TO lt_events.
ENDFORM.*&---------------------------------------------------------------------*
*& 包含               ZHYR_202308_HF04_CLASS
*&---------------------------------------------------------------------*
DATA: go_grid TYPE REF TO cl_gui_alv_grid.
*&-----------------------------------------------------------------*
*&  类定义
*&-----------------------------------------------------------------*
CLASS   lcl_event_receiver DEFINITION.PUBLIC SECTION.METHODS: handle_f4FOR EVENT onf4 OF cl_gui_alv_gridIMPORTING e_fieldname      "字段名称es_row_no        "行号,注意这是个结构er_event_data .  "事件数据
ENDCLASS.*&-----------------------------------------------------------------*
*&  类实现
*&-----------------------------------------------------------------*
CLASS: lcl_event_receiver IMPLEMENTATION.METHOD handle_f4.DATA: ls_stable TYPE lvc_s_stbl.   "定义基于稳定的刷新 所需要参数。ls_stable-row = 'X'.    "行固定ls_stable-col = 'X'.   "列固定IF e_fieldname = 'INPUT_ESOKZ'.   "又是小写的问题,一定要注意PERFORM f4_help_zxm USING e_fieldname    "字段名称es_row_no       "行号,注意这是个结构er_event_data .    "事件数据ENDIF.
****使用类:CL_GUI_ALV_GRID的实例的方法,稳定刷新CALL METHOD go_grid->refresh_table_displayEXPORTINGis_stable = ls_stable.ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Form F4_HELP_ZXM
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> E_FIELDNAME
*&      --> ES_ROW_NO
*&      --> ER_EVENT_DATA
*&---------------------------------------------------------------------*
FORM f4_help_zxm  USING    p_e_fieldname   TYPE lvc_fname   "输入的: 列名称p_es_row_no     TYPE lvc_s_roid   "输入的: 行号p_er_event_data TYPE REF TO cl_alv_event_data.DATA: lt_return_tab TYPE STANDARD TABLE OF ddshretval,ls_return_tab TYPE ddshretval.READ TABLE it_out INTO wa_out INDEX p_es_row_no-row_id.SELECT  ernam , esokzINTO TABLE @DATA(lt_f4_help)FROM eine.SORT lt_f4_help BY esokz.DELETE ADJACENT DUPLICATES FROM lt_f4_help COMPARING esokz.LOOP AT lt_f4_help ASSIGNING FIELD-SYMBOL(<fs_lt_f4_help>).IF sy-subrc = 0.IF  <fs_lt_f4_help>-esokz = '0'.<fs_lt_f4_help>-ernam  = '标准'.ENDIF.IF  <fs_lt_f4_help>-esokz = '2'.<fs_lt_f4_help>-ernam  = '寄售'.ENDIF.IF  <fs_lt_f4_help>-esokz = '3'.<fs_lt_f4_help>-ernam  = '委外'.ENDIF.ENDIF.ENDLOOP.CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGretfield         = 'INPUT_ESOKZ' "搜索帮助表:GT_F4_HELP 里的字段:ZXMdynpprog         = sy-repid    " 当前程序dynpnr           = sy-dynnr     "当前屏幕号value_org        = 'S'           "默认为C但是此处不用S不行callback_program = sy-repid     "回诘程序,也为当前程序TABLESvalue_tab        = lt_f4_help   " F4 搜索帮助表 (说明:函数对这个表参照类型并未做规定,但返回表的类型是定死的为:DDSHRETVALreturn_tab       = lt_return_tab   "选择后,返回表值:已经选的值。准备用来回写到ALV表对应字段上EXCEPTIONSparameter_error  = 1no_values_found  = 2OTHERS           = 3.IF sy-subrc = 0.READ TABLE lt_return_tab INTO ls_return_tab INDEX 1.IF ls_return_tab-fieldval IS NOT INITIAL.wa_out-input_esokz = ls_return_tab-fieldval.ENDIF.MODIFY it_out FROM wa_out INDEX p_es_row_no-row_id TRANSPORTING input_esokz. "注意工作区内唯一发生改变的是PLANETYPE 字段
****X表示事件已经处理,不会去调取系统标准搜索帮助p_er_event_data->m_event_handled = 'X'.ENDIF."刷新数据回写
*  DATA: lo_guid TYPE REF TO cl_gui_alv_grid.
*  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
*    IMPORTING
*      e_grid = lo_guid.
*  CALL METHOD lo_guid->check_changed_data.
*  CALL METHOD lo_guid->refresh_table_display.ENDFORM.*&---------------------------------------------------------------------*
*& Form FRM_CALLER_EXIT
*&---------------------------------------------------------------------*
*& CALLER_EXIT响应
*&---------------------------------------------------------------------*
FORM frm_caller_exit USING e_grid TYPE slis_data_caller_exit.DATA: lo_event_receiver TYPE REF TO lcl_event_receiver,lt_f4             TYPE lvc_t_f4 WITH HEADER LINE.IF go_grid IS INITIAL.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = go_grid.ENDIF.**注册ALV事件-单元格修改CALL METHOD go_grid->register_edit_eventEXPORTINGi_event_id = cl_gui_alv_grid=>mc_evt_enterEXCEPTIONSerror      = 1OTHERS     = 2.**指定OOALV 中F4字段lt_f4-fieldname = 'INPUT_ESOKZ'.   "指定字段'PLANE'有搜索帮助lt_f4-register  = 'X'.lt_f4-getbefore = 'X'.lt_f4-chngeafter  = 'X'.APPEND lt_f4.CALL METHOD go_grid->register_f4_for_fieldsEXPORTINGit_f4 = lt_f4[].
**** 注册F4 搜索帮助处理方法CREATE OBJECT lo_event_receiver.SET HANDLER lo_event_receiver->handle_f4 FOR go_grid.
ENDFORM.

这篇关于ABAP怎么把传入的参数刷新到内表里面呢?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1090279

相关文章

Ubuntu 怎么启用 Universe 和 Multiverse 软件源?

《Ubuntu怎么启用Universe和Multiverse软件源?》在Ubuntu中,软件源是用于获取和安装软件的服务器,通过设置和管理软件源,您可以确保系统能够从可靠的来源获取最新的软件... Ubuntu 是一款广受认可且声誉良好的开源操作系统,允许用户通过其庞大的软件包来定制和增强计算体验。这些软件

Ubuntu 24.04 LTS怎么关闭 Ubuntu Pro 更新提示弹窗?

《Ubuntu24.04LTS怎么关闭UbuntuPro更新提示弹窗?》Ubuntu每次开机都会弹窗提示安全更新,设置里最多只能取消自动下载,自动更新,但无法做到直接让自动更新的弹窗不出现,... 如果你正在使用 Ubuntu 24.04 LTS,可能会注意到——在使用「软件更新器」或运行 APT 命令时,

TP-LINK/水星和hasivo交换机怎么选? 三款网管交换机系统功能对比

《TP-LINK/水星和hasivo交换机怎么选?三款网管交换机系统功能对比》今天选了三款都是”8+1″的2.5G网管交换机,分别是TP-LINK水星和hasivo交换机,该怎么选呢?这些交换机功... TP-LINK、水星和hasivo这三台交换机都是”8+1″的2.5G网管交换机,我手里的China编程has

详解Spring Boot接收参数的19种方式

《详解SpringBoot接收参数的19种方式》SpringBoot提供了多种注解来接收不同类型的参数,本文给大家介绍SpringBoot接收参数的19种方式,感兴趣的朋友跟随小编一起看看吧... 目录SpringBoot接受参数相关@PathVariable注解@RequestHeader注解@Reque

Java向kettle8.0传递参数的方式总结

《Java向kettle8.0传递参数的方式总结》介绍了如何在Kettle中传递参数到转换和作业中,包括设置全局properties、使用TransMeta和JobMeta的parameterValu... 目录1.传递参数到转换中2.传递参数到作业中总结1.传递参数到转换中1.1. 通过设置Trans的

java如何调用kettle设置变量和参数

《java如何调用kettle设置变量和参数》文章简要介绍了如何在Java中调用Kettle,并重点讨论了变量和参数的区别,以及在Java代码中如何正确设置和使用这些变量,避免覆盖Kettle中已设置... 目录Java调用kettle设置变量和参数java代码中变量会覆盖kettle里面设置的变量总结ja

spring 参数校验Validation示例详解

《spring参数校验Validation示例详解》Spring提供了Validation工具类来实现对客户端传来的请求参数的有效校验,本文给大家介绍spring参数校验Validation示例详... 目录前言一、Validation常见的校验注解二、Validation的简单应用三、分组校验四、自定义校

SpringBoot中Get请求和POST请求接收参数示例详解

《SpringBoot中Get请求和POST请求接收参数示例详解》文章详细介绍了SpringBoot中Get请求和POST请求的参数接收方式,包括方法形参接收参数、实体类接收参数、HttpServle... 目录1、Get请求1.1 方法形参接收参数 这种方式一般适用参数比较少的情况,并且前后端参数名称必须

AI绘图怎么变现?想做点副业的小白必看!

在科技飞速发展的今天,AI绘图作为一种新兴技术,不仅改变了艺术创作的方式,也为创作者提供了多种变现途径。本文将详细探讨几种常见的AI绘图变现方式,帮助创作者更好地利用这一技术实现经济收益。 更多实操教程和AI绘画工具,可以扫描下方,免费获取 定制服务:个性化的创意商机 个性化定制 AI绘图技术能够根据用户需求生成个性化的头像、壁纸、插画等作品。例如,姓氏头像在电商平台上非常受欢迎,

W外链微信推广短连接怎么做?

制作微信推广链接的难点分析 一、内容创作难度 制作微信推广链接时,首先需要创作有吸引力的内容。这不仅要求内容本身有趣、有价值,还要能够激起人们的分享欲望。对于许多企业和个人来说,尤其是那些缺乏创意和写作能力的人来说,这是制作微信推广链接的一大难点。 二、精准定位难度 微信用户群体庞大,不同用户的需求和兴趣各异。因此,制作推广链接时需要精准定位目标受众,以便更有效地吸引他们点击并分享链接