BAPI_PRICES_CONDITIONS定价…

来源:互联网 发布:ios7最新软件源 编辑:程序博客网 时间:2024/05/14 16:34
原文地址:BAPI_PRICES_CONDITIONS定价条件的创建/修改作者:SAP_拖拉机

    通过BAPI_PRICES_CONDITONS函数,可以实现定价条件的创建/修改/删除等操作,下列通过一个小例子说明如何使用这个函数,例子中没有写关于等级价的创建,其实都一样,如果存在等数量级价,更新lt_bapicondit-scalebasin ='C',把相应的等级条件写入lt_bapicondqs表中,价值登记一样,不过等级类型要对照。

用到的操作码有:003 删除:信息包含删除的对象

              004  修改 :所有应寄出凭证列表

              009  原始的:关于处理的第一个信息 参见 domain MSGFN .

 REPORT ztestc .
 tables:konh .
 datalt_bapicondct  type  bapicondct occurs   "
       wa_bapicondct  type  bapicondct ,

       lt_bapicondhd  type  bapicondhd occurs   "
       wa_bapicondhd  type  bapicondhd ,

       lt_bapicondit  type  bapicondit occurs  ,
       wa_bapicondit  type  bapicondit ,

       lt_bapicondqs  type  bapicondqs occurs  ,
       wa_bapicondqs  type  bapicondqs ,

       lt_bapicondvs  type  bapicondvs occurs  ,
       wa_bapicondvs  type  bapicondvs .

datalt_bapiret2 type bapiret2 occurs .
dataret    type  bapiret2 .

datalt_bapiknumhs type bapiknumhs  occurs  .
datalt_mem_initial type  cnd_mem_initial occurs .

datah_varkey(100),
      h_cond_unit type meins .

selection-screen begin of block  bk1 with frame title text_001 .
  parameters i_kschl  like a951-kschl             "条件类型
               i_matnr  like mvke-matnr,
               i_vkorg  like mvke-vkorg,
               i_vtweg  like mvke-vtweg,
               i_kbetr  like konp-kbetr              "定价值
 select-options I_qsdat  for konh-datab            "定价的有效期范围
selection-screen end of block bk1 .


concatenate   i_vkorg  i_vtweg  i_matnr into  h_varkey .

select  single meins from mara
       into h_cond_unit  where matnr i_matnr .

 if sy-subrc <> 0.
   raise vkorgerror .
 endif.


*condition table 已条件表A951为例
wa_bapicondct-table_no '951'.
wa_bapicondct-applicatio 'V'.
wa_bapicondct-cond_usage 'A'     "条件表用途 ‘A' 定价
wa_bapicondct-cond_type i_kschl   "定价条件
*wa_bapicondct-operation '009'.     "消息功能 : 003 DEL 004 MODIFY ;005 REPLACE 009 INITIAL
wa_bapicondct-operation '004'        "更改
wa_bapicondct-varkey h_varkey.
wa_bapicondct-valid_to i_qsdat-low.
wa_bapicondct-valid_from i_qsdat-high.
*wa_bapicondct-cond_no '$000000001'.   "创建
wa_bapicondct-cond_no '0000015528'   "更改

APPEND wa_bapicondct TO lt_bapicondct.

*KONH
*wa_bapicondhd-operation '009'.
wa_bapicondhd-operation '004'.
*wa_bapicondhd-cond_no '$000000001'.
wa_bapicondhd-cond_no '0000015528'.
wa_bapicondhd-created_by sy-uname.
wa_bapicondhd-creat_date sy-datum.
wa_bapicondhd-cond_usage 'A'.
wa_bapicondhd-table_no '951'.
wa_bapicondhd-applicatio 'V'.
wa_bapicondhd-cond_type i_kschl.
wa_bapicondhd-varkey h_varkey.
wa_bapicondhd-valid_from i_qsdat-low.
wa_bapicondhd-valid_to i_qsdat-high.

append wa_bapicondhd to  lt_bapicondhd .

*KONP
wa_bapicondit-operation '004'  ”修改
*wa_bapicondit-operation '009'.“创建
*wa_bapicondit-cond_no '$000000001'.
wa_bapicondit-cond_no '0000015528'.
wa_bapicondit-cond_count '01'    "条件序列号
wa_bapicondit-applicatio 'V'.
wa_bapicondit-cond_type  i_kschl      "条件类型
wa_bapicondit-scaletype 'A'      "STFKZ Staffelsoort
wa_bapicondit-scalebasin ''     "KZBZG Teken:rekeneenheid  wa_bapicondit-scalebasin 'C'. 存在数量等级
wa_bapicondit-scale_qty '1'      "KSTBM Conditiestaffelbasis hoeveelheid
wa_bapicondit-cond_p_unt '1'     "KPEIN prijseenheid
wa_bapicondit-cond_unit h_cond_unit     "KMEIN Conditie-hoeveelheidseenheid
wa_bapicondit-calctypcon 'C'     "KRECH Conditie-rekenregel
wa_bapicondit-cond_value i_kbetr.
wa_bapicondit-condcurr 'CNY'.

APPEND  wa_bapicondit  to lt_bapicondit  .


CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
EXPORTING
  PI_INITIALMODE             '
  PI_BLOCKNUMBER             =
  PI_PHYSICAL_DELETION       =
  TABLES
    ti_bapicondct              lt_bapicondct
    ti_bapicondhd              lt_bapicondhd
    ti_bapicondit              lt_bapicondit
    ti_bapicondqs              lt_bapicondqs
    ti_bapicondvs              lt_bapicondvs
    to_bapiret2                lt_bapiret2
    to_bapiknumhs              lt_bapiknumhs
    to_mem_initial             lt_mem_initial
  EXCEPTIONS
    UPDATE_ERROR               1
    OTHERS                     2
          .

break-point.
IF sy-subrc <> 0.
  write  'SOMETHING UNEXCEPTED HAPPENDS!' .
ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
  WAIT          =
 IMPORTING
   RETURN        RET
          .

 

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 约她她每次都找借口怎么办? 遇到总是找借口不还钱的人怎么办 装修好了业主找借口不给钱怎么办 荒野行动手机换了帐号登不上怎么办 换新手机后微信头像都没有了怎么办 苹果系统维护换不了微信头像怎么办 系统通知栏不显示qq图标怎么办 快递号码写错了而且发货了怎么办 包裹遗忘在郑州东站安检口了怎么办 锁书包的锁头钥匙全掉了怎么办 平板电脑恢复出厂设置变英语怎么办 给国外银行汇款账号写错账号怎么办 顺丰快递暴力运输产品坏了怎么办 亚航订机票名字少写一个字母怎么办 如果淘宝付款七天内不发货怎么办 浪琴手表调了一下日期不走了怎么办 收件人号码写错快递柜已签收怎么办 医院名字写错了怎么办保险报销 电脑在使用中出现了英文字慕怎么办 下雨天了怎么办我好想你是什么歌 安卓手机不支持微信运动怎么办 装系统时无法跳过密匙怎么办 在msdn里下的系统没有网怎么办 w7电脑更新后系统没法激活怎么办 手机使用加速器后网速变卡怎么办 奥特曼ol分解了迪迦石像怎么办 左右棋牌游戏兑换总说系统护怎么办 四季海棠扦插以后黄叶卷叶怎么办 竹节海棠浇水多了叶子蔫了怎么办 社保停缴了里面的钱怎么办 王者荣耀英雄释放技能有延迟怎么办 买的桑拿木板颜色太深了怎么办 万一填写了奔跑吧诈骗信息该怎么办 深圳限行时段堵在路上怎么办 开车堵在路上到了限行时间怎么办 兄妹之间都不想照顾母亲我该怎么办 小孩扁体发炎睡觉呼吸声沉重怎么办 客所思pk3老驱动有杂音怎么办 手机打不开解压包密码怎么办 在香港专柜买东西柜员少给货怎么办 恶魔猎手第二神器任务没选择怎么办