SD--如何编程提取SD的定价信息

1、用户输入的定价条件信息读取

sap的的sd的输入的定价信息存储在定价表(AXXX),条件(抬头(KONH ),条件项目(KONV)。如果用户需要读取输入的某个条件类型的某个时间段的值,具体步骤如下:
a)程序首先从定价表(AXXX)中读取条件记录号(KNUMH)录号;
b)根据记录号从条件抬头表中(KONH ),
c)根据读取的值进行计算。
   SELECT SINGLE knumh
    INTO l_knumh
    FROM a910
    WHERE  matnr = wa_sum-matnr AND kschl = 'Z001'
    AND datab <= s_date1 AND datbi >= s_date1 .

    SELECT SINGLE kbetr kpein INTO (l_kbetr,l_kpein)
    FROM  konp WHERE knumh = l_knumh  AND kschl = 'Z001'.

    SELECT SINGLE kbetr kpein INTO (l_kbetr,l_kpein)
    FROM  konp WHERE knumh = l_knumh  AND kschl = 'Z001'.

    IF l_kpein = 0.
      wa_sum-price0 = 0.
    ELSE.
      wa_sum-price0 = l_kbetr / l_kpein.
    ENDIF.

2、单据的定价条件的信息读取
事务的定价数据存在KONV中,单据条件数(KNUMV)存在vbrk-knumv或者vbak中,代码样例

      select vbrk~fkart vbrp~posnr vbrk~sfakn vbrk~knumv  vbrp~matnr vbrp~fkimg
      into corresponding fields of wa_vbrk
      from vbrk
        inner join vbrp on vbrk~vbeln = vbrp~vbeln
      where vbrk~vbeln = wa_bkpf-awkey+0(10).
        if sy-subrc = 0.
          select single kwert into (wa_vbrk-kwert)
          from konv
          where knumv = wa_vbrk-knumv
            and kposn = wa_vbrk-posnr and kschl = 'ZPRS'."'VPRS'.

3、有关定价的数据表

posted on 2006-08-28 14:19  毛小娃  阅读(125)  评论(0编辑  收藏  举报

导航