采购合同的条件价格取值逻辑(如ME35K/ME3M显示报表的多个日期范围的条件价格)
1、根据采购订单合同和行项目和类型(合同是M)在A016表中取值条件号,
2、根据A016的条件号在KONP中取得价格
ME35K、ME3M的增强点在子程序LMEREPI02下的 METHOD if_reader_mm~read_table. 里面
代码如下:
METHOD if_reader_mm~read_table. " DATA: l_ref_ekko TYPE REF TO data,
l_ref_ekkn TYPE REF TO data,
lt_ekpo TYPE lty_t_sorted_ekpo,
lt_outtab_acc TYPE lty_t_outtab_accounting,
lt_outtab_schedlines TYPE lty_t_outtab_schedlines,
ls_ekko TYPE ekko,
ls_ekpo TYPE ekpo,
ls_ekko_add TYPE lty_s_ekko_add,
ls_outtab_purchdoc TYPE merep_outtab_purchdoc,
ls_outtab_downpay TYPE merep_outtab_downpay, "EhP4
lt_outtab_scrap TYPE lty_t_outtab_scrap, "EhP4
ls_outtab_purchdoc_rel TYPE merep_outtab_purchdoc_rel. FIELD-SYMBOLS: <ekko> TYPE lty_t_sorted_ekko,
<ekkn> TYPE lty_t_sorted_ekkn,
<outtab> TYPE STANDARD TABLE. CALL METHOD super->if_reader_mm~read_table
EXPORTING
im_name = im_name
IMPORTING
ex_structname = ex_structname
ex_fieldcatalog = ex_fieldcatalog
ex_table_ref = ex_table_ref
EXCEPTIONS
OTHERS = .
IF NOT sy-subrc IS INITIAL.
RAISE not_found.
ENDIF. * assign output table
ASSIGN ex_table_ref->* TO <outtab>. * get table objects
my_any_ekko = my_table_manager->lookup( 'EKKO' ).
CHECK my_any_ekko IS BOUND.
my_any_ekpo = my_table_manager->lookup( 'EKPO' ).
CHECK my_any_ekpo IS BOUND.
my_any_eket = my_table_manager->lookup( 'EKET' ).
CHECK my_any_eket IS BOUND.
my_any_ekkn = my_table_manager->lookup( 'EKKN' ).
CHECK my_any_ekkn IS BOUND.
my_any_lfa1 = my_table_manager->lookup( 'LFA1' ).
CHECK my_any_lfa1 IS BOUND.
my_any_authority = my_table_manager->lookup( 'MEREP_AUTHORITY' ).
CHECK my_any_authority IS BOUND.
my_any_ekbes = my_table_manager->lookup( 'EKBES' ).
CHECK my_any_ekbes IS BOUND.
* sub-contracting component consumption
my_any_ekbe_sc = my_table_manager->lookup( 'EKBE_SC' ). "Comp. Consumption
CHECK my_any_ekbe_sc IS BOUND.
* down payments
my_any_downpay = my_table_manager->lookup( 'DOWNPAY' ).
CHECK my_any_downpay IS BOUND. * get header info
l_ref_ekko = my_any_ekko->get_table( ).
ASSIGN l_ref_ekko->* TO <ekko>. * get accounting info
l_ref_ekkn = my_any_ekkn->get_table( ).
ASSIGN l_ref_ekkn->* TO <ekkn>. IF my_struct_name EQ 'MEREP_OUTTAB_ACCOUNTING'. "
* usually we did not read the accounting info up to now so we have
* to do this here:
IF <ekkn> IS INITIAL.
<ekkn> = me->prefetch_accounting( my_any_ekpo ).
ENDIF.
ENDIF. " LOOP AT <ekko> INTO ls_ekko. * determine field 'super'
ls_ekko_add-superfield = build_superfield( ls_ekko ).
* get released value for release docu
IF ls_ekko-bstyp EQ cl_mmpur_constants=>bstyp_k. "bstyp-kont.
ls_ekko_add-ktwtr = fetch_ekab_tot_ktwtr( ls_ekko ).
ENDIF. * get item info
CLEAR lt_ekpo[].
my_any_ekpo->read_lines( EXPORTING im_key = ls_ekko-ebeln
IMPORTING ex_table = lt_ekpo ). LOOP AT lt_ekpo INTO ls_ekpo. CASE my_struct_name. WHEN 'MEREP_OUTTAB_PURCHDOC'.
* basic list
ls_outtab_purchdoc = build_base_list( im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add ).
APPEND ls_outtab_purchdoc TO <outtab>. WHEN 'MEREP_OUTTAB_PURCHDOC_REL'.
* release
ls_outtab_purchdoc = build_base_list( im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add ).
CLEAR ls_outtab_purchdoc_rel.
MOVE-CORRESPONDING ls_outtab_purchdoc TO ls_outtab_purchdoc_rel.
APPEND ls_outtab_purchdoc_rel TO <outtab>. WHEN 'MEREP_OUTTAB_SCHEDLINES'.
* schedule lines
build_schedlines_list( EXPORTING im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add
IMPORTING ex_outtab_shedl = lt_outtab_schedlines ).
APPEND LINES OF lt_outtab_schedlines TO <outtab>. WHEN 'MEREP_OUTTAB_ACCOUNTING'.
* accounting data
build_acc_list( EXPORTING im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add
im_t_ekkn = <ekkn> "
IMPORTING ex_outtab_acc = lt_outtab_acc ).
APPEND LINES OF lt_outtab_acc TO <outtab>. WHEN 'MEREP_OUTTAB_DOWNPAY'.
BREAK-POINT ID mmpur_downpay.
* down payment (extended view on basic list)
ls_outtab_downpay = build_downpay_list( im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add ).
APPEND ls_outtab_downpay TO <outtab>. WHEN 'MEREP_OUTTAB_COMPCONSUMP'.
* component consumption
IF cl_ops_switch_check=>mm_om1_sfws_sc( ) EQ cl_mmpur_constants=>yes.
ls_outtab_purchdoc = build_base_list( im_ekko = ls_ekko
im_ekpo = ls_ekpo
im_ekko_add = ls_ekko_add ).
INSERT ls_outtab_purchdoc INTO TABLE <outtab>. "#EC *
ENDIF. WHEN 'MEREP_OUTTAB_SCRAP'. "EhP 4
* build scrap overview
IF cl_ops_switch_check=>mm_om1_sfws_sc( ) EQ cl_mmpur_constants=>yes.
CLEAR lt_outtab_scrap.
build_scrap_list( EXPORTING is_ekko = ls_ekko
is_ekpo = ls_ekpo
is_ekko_add = ls_ekko_add
IMPORTING et_outtab = lt_outtab_scrap ).
INSERT LINES OF lt_outtab_scrap INTO TABLE <outtab>. "#EC *
ENDIF.
ENDCASE. ENDLOOP. " at lt_ekpo
ENDLOOP. " at <ekko> * long procurement number
TRY.
/sappspro/cl_numbers=>lookup_many( CHANGING ct_table = <outtab> ).
CATCH /sappspro/cx_number_wrong_strc. "#EC NO_HANDLER
EXIT.
ENDTRY. * call BAdIs (customer- and industry-specific) for modifying the output table
CALL FUNCTION 'MEPOBADI_CHANGE_OUTTAB'
EXPORTING
im_struct_name = my_struct_name
im_id = me->if_datablade_mm~class_id
im_handle = my_handle
im_loggroup = my_log_group
CHANGING
ch_outtab = <outtab>. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1)\PR:SAPLMEREP\TY:LCL_DATABLADE_PURCHDOC\IN:IF_READER_MM\ME:READ_TABLE\SE:END\EI A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT ZEXPORT_CHARG. "active version
*
* *增加展示合同所有区间条件价格 at 20150901 by hp_gongzg
DATA: lt_outtab_purchdoc TYPE STANDARD TABLE OF merep_outtab_purchdoc.
DATA:LT_KONP TYPE STANDARD TABLE OF KONP,
LW_KONP TYPE KONP,
LT_A016 TYPE STANDARD TABLE OF A016,
LW_A016 TYPE A016,
lv_tabix TYPE sy-tabix.
* FIELD-SYMBOLS:<fs_outtab_purchdoc_rel> TYPE merep_outtab_purchdoc_rel.
DATA:lt_outtab_purchdoc_rel TYPE STANDARD TABLE OF merep_outtab_purchdoc_rel.
DATA:lw_outtab_purchdoc_rel TYPE merep_outtab_purchdoc_rel.
IF my_struct_name = 'MEREP_OUTTAB_PURCHDOC' or my_struct_name = 'MEREP_OUTTAB_PURCHDOC_REL' . "++ 2017-2-27 LOOP AT <outtab> INTO ls_outtab_purchdoc .
CHECK ls_outtab_purchdoc-BSTYP = 'K'.
* CHECK ls_outtab_purchdoc-LOEKZ = ''.
lv_tabix = sy-tabix.
refresh: LT_A016,LT_KONP. SELECT * INTO TABLE LT_A016 FROM A016
WHERE A016~KAPPL = 'M'
AND A016~EVRTN = ls_outtab_purchdoc-ebeln
AND A016~EVRTP = ls_outtab_purchdoc-ebelp. IF SY-SUBRC = and LT_A016[] is NOT INITIAL.
SELECT * INTO TABLE LT_KONP FROM KONP
FOR ALL ENTRIES IN LT_A016
WHERE KONP~KNUMH = LT_A016-KNUMH
AND LOEVM_KO = ''.
LOOP at LT_A016 INTO LW_A016.
CLEAR:ls_outtab_purchdoc-DATBI01,
ls_outtab_purchdoc-DATAB01,
ls_outtab_purchdoc-ZKBETR01,
ls_outtab_purchdoc-ZKBETR02,
ls_outtab_purchdoc-ZKBETR03,
ls_outtab_purchdoc-ZKBETR04,
ls_outtab_purchdoc-ZKBETR05,
ls_outtab_purchdoc-NETPR.
ls_outtab_purchdoc-DATBI01 = LW_A016-DATBI.
ls_outtab_purchdoc-DATAB01 = LW_A016-DATAB.
LOOP AT LT_KONP INTO LW_KONP WHERE KNUMH = LW_A016-KNUMH.
ls_outtab_purchdoc-NETPR = ls_outtab_purchdoc-NETPR
+ LW_KONP-KBETR.
CASE LW_KONP-KSCHL.
WHEN 'ZLGP' OR 'PB00'.
ls_outtab_purchdoc-ZKBETR01 = LW_KONP-KBETR.
WHEN 'ZMP2'.
ls_outtab_purchdoc-ZKBETR02 = LW_KONP-KBETR.
WHEN 'ZTP2'.
ls_outtab_purchdoc-ZKBETR03 = LW_KONP-KBETR.
WHEN 'ZPK2'.
ls_outtab_purchdoc-ZKBETR04 = LW_KONP-KBETR.
WHEN 'ZTS2'.
ls_outtab_purchdoc-ZKBETR05 = LW_KONP-KBETR.
WHEN OTHERS.
ENDCASE. ENDLOOP.
APPEND ls_outtab_purchdoc to lt_outtab_purchdoc. ENDLOOP.
ENDIF.
delete <outtab> INDEX lv_tabix.
ENDLOOP. SORT lt_outtab_purchdoc by EBELN EBELP DATBI01.
APPEND LINES OF lt_outtab_purchdoc TO <outtab>.
* REFRESH GT_OUTTAB_PURCHDOC_TMP.
* APPEND LINES OF lt_outtab_purchdoc TO GT_OUTTAB_PURCHDOC_TMP. * ELSEIF my_struct_name = 'MEREP_OUTTAB_PURCHDOC_REL'. ** 合同审批的时候,处理
* LOOP AT <outtab> INTO lw_outtab_purchdoc_rel.
* CHECK lw_outtab_purchdoc_rel-BSTYP = 'K'.
** CHECK ls_outtab_purchdoc-LOEKZ = ''.
* lv_tabix = sy-tabix.
* REFRESH: LT_A016,LT_KONP.
*
** IF ls_outtab_purchdoc-LOEKZ <> ''.
** delete <outtab> INDEX lv_tabix.
** CONTINUE.
** ENDIF.
*
* SELECT * INTO TABLE LT_A016 FROM A016
* WHERE A016~KAPPL = 'M'
* AND A016~EVRTN = lw_outtab_purchdoc_rel-ebeln
* AND A016~EVRTP = lw_outtab_purchdoc_rel-ebelp
* AND A016~DATBI >= SY-DATUM
* AND A016~DATAB <= SY-DATUM."显示当前期间条件价格
*
* IF SY-SUBRC = 0 and LT_A016[] is NOT INITIAL.
* SELECT * INTO TABLE LT_KONP FROM KONP
* FOR ALL ENTRIES IN LT_A016
* WHERE KONP~KNUMH = LT_A016-KNUMH
* AND LOEVM_KO = ''.
** CLEAR <fs_outtab_purchdoc_rel>-NETPR.
* LOOP at LT_A016 INTO LW_A016.
* CLEAR:lw_outtab_purchdoc_rel-DATBI01,
* lw_outtab_purchdoc_rel-DATAB01,
* lw_outtab_purchdoc_rel-ZKBETR01,
* lw_outtab_purchdoc_rel-ZKBETR02,
* lw_outtab_purchdoc_rel-ZKBETR03,
* lw_outtab_purchdoc_rel-ZKBETR04,
* lw_outtab_purchdoc_rel-ZKBETR05,
* lw_outtab_purchdoc_rel-NETPR.
* lw_outtab_purchdoc_rel-DATBI01 = LW_A016-DATBI.
* lw_outtab_purchdoc_rel-DATAB01 = LW_A016-DATAB.
* LOOP AT LT_KONP INTO LW_KONP WHERE KNUMH = LW_A016-KNUMH.
* lw_outtab_purchdoc_rel-NETPR = lw_outtab_purchdoc_rel-NETPR
* + LW_KONP-KBETR.
* CASE LW_KONP-KSCHL.
* WHEN 'ZLGP' OR 'PB00'.
* lw_outtab_purchdoc_rel-ZKBETR01 = LW_KONP-KBETR.
* WHEN 'ZMP2'.
* lw_outtab_purchdoc_rel-ZKBETR02 = LW_KONP-KBETR.
* WHEN 'ZTP2'.
* lw_outtab_purchdoc_rel-ZKBETR03 = LW_KONP-KBETR.
* WHEN 'ZPK2'.
* lw_outtab_purchdoc_rel-ZKBETR04 = LW_KONP-KBETR.
* WHEN 'ZTS2'.
* lw_outtab_purchdoc_rel-ZKBETR05 = LW_KONP-KBETR.
* WHEN OTHERS.
* ENDCASE.
*
* ENDLOOP.
* APPEND lw_outtab_purchdoc_rel to lT_outtab_purchdoc_rel.
*
* ENDLOOP.
* ELSE.
* CLEAR lw_outtab_purchdoc_rel-NETPR.
* ENDIF.
** delete <outtab> INDEX lv_tabix.
* ENDLOOP.
* <outtab> = lt_outtab_purchdoc_rel.
ENDIF.
*增加展示合同所有区间条件价格 at 20150901 by hp_gongzg
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
ENDMETHOD. "if_reader_mm~read_table
采购合同的条件价格取值逻辑(如ME35K/ME3M显示报表的多个日期范围的条件价格)的更多相关文章
- 页面通过Jquery取值然后传值到后台显示underfined是怎么回事?
页面通过Jquery取值然后传值到后台显示underfined是怎么回事? 一般情况下第一个如果用jQuery取值的,末尾要用val(),如果用$符号取值的,末尾要加上val. eg: busines ...
- 动态sql中的条件判断取值来源于map 或者 model
- jsp页面通过ajax取值/展示数据及分页显示
jsp页面通过ajax从后台获取数据,在页面展示,并实现分页效果代码: [JavaScript部分代码] 1 <script> function getComposition(pageno ...
- 后端model传入前端JSP页面中的值判断后再取值
所遇到的问题后端model传入前端JSP页面中的值通过foreach循环内要满足条件才能取值给Div中,我们知道jsp页面中可以直接用EL表达式取值,格式就是${"model中传来的数据&q ...
- 输入三个double型的数据,放入到a,b,c三个变量中去,使用条件结构与交换逻辑将这三个变量中的值从小到大排列。
import java.util.Scanner; public class C8{ public static void main(String []args){ /* 8.输入三个double型的 ...
- sql-case when 条件1 then 取值1 when 条件2 then 取值2 else 取值3 end
遇到 XXX情况 就 XXX 遇不到就 XXX 结束case when …… then …… else …… end 例如一个3条件取值的字段: case when 条件1 then 取值1 when ...
- switch条件变量的取值类型
switch条件变量的取值类型主要有以下六种: 1)JDK1.5(不含JDK1.5)之前只能是byte.short.int.char类型,不能是float.double.long.boolean类型. ...
- mybatis if else if 条件判断SQL片段表达式取值和拼接
前言 最近在开发项目的时候涉及到复杂的动态条件查询,但是mybaits本身不支持if elseif类似的判断但是我们可以间接通过 chose when otherwise 去实现其中choose为一个 ...
- Java基础:8种基本数据类型,取值范围和储存字节说明。
Java中,一共有8种基本数据类型: 4种整数型:int,short,long,byte. 2种浮点型:float,double. 1种字符类型:char. 1种表示真值的类型:boolean. [S ...
随机推荐
- tps吞吐量映射的问题
tps随着时间增加,吞吐量增加,但到达一定时间,吞吐不变,出现瓶颈,可能是以下原因 1/反应宽带问题 2/连接数释放问题 3/cpu占有率超出问题 4/内存不够问题 5/数据库连接屏蔽 用jmeter ...
- SpringBoot 使用定时任务动态执行任务
import com.patient.core.adapter.CorsFilter; import org.mybatis.spring.annotation.MapperScan; import ...
- 191112Django项目常用配置
创建项目 >django-admin startproject project01 创建应用 >python manage.py startapp app01 settings.py 配置 ...
- 后盾网lavarel视频项目---vue-axios基本用法
后盾网lavarel视频项目---vue-axios基本用法 一.总结 一句话总结: 都是npm安装,然后import引入vue,然后按手册使用就好了,很简单 二.vue-axios基本用法 转自或参 ...
- spark MLlib 概念 6:ALS(Alternating Least Squares) or (ALS-WR)
Large-scale Parallel Collaborative Filtering for the Netflix Prize http://www.hpl.hp.com/personal/Ro ...
- T83310 【音乐会】二重变革
T83310 [音乐会]二重变革 题解 你看数据那么大,又是一道数学题 题面描述这么个代码肯定不能傻fufu的直接把代码提交上去 我批评我自己 观察代码当中有一行 也就是说明最后这个数列都将变成同一个 ...
- javascript - 事件详解(阻止事件冒泡+阻止事件行为)
一.事件流 1.事件流 描述的是在页面中接受事件的顺序 2.事件冒泡 由最具体的元素接收,然后逐级向上传播至最不具体的元素的节点 (最具体 –> 最不具体) 3.事件捕获 最不具体的节点先接收事 ...
- linux_Ubuntu相对路径和绝对路径
绝对路径 从/目录开始描述的路径为绝对路径,如: cd /home ls /usr 相对路径 从当前位置开始描述的路径为相对路径,如: cd ../../ ls abc/def .和.. 每个目录下都 ...
- IPython基础使用_Round2
目录 目录 前言 软件环境 Ipython的字符串处理 Ipython的魔力函数Magic lsmagic Output所有魔力函数 查看Magic的源码 env 显示系统环境变量 history 查 ...
- 阶段3 3.SpringMVC·_01.SpringMVC概述及入门案例_05.入门程序之入门代码编写
先把默认的index.jsp删掉.默认的index.jsp没有jsp的声明 ok webapp文件夹下new一个 起名叫做index.新建的页面有jsp的头 创建控制器类 java下新建一个class ...