cancel
Showing results for 
Search instead for 
Did you mean: 

Module function to create and read pricing condition

Former Member
0 Kudos

Hello,

I am looking for an easy function module that enable us to get the pricing condition record ?

(As transaction for example VK13)

And I am looking for a function module to create pricing condition ?

(As transaction XK15 or at least VK11)

Thanks in advance,

Maxime

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

for creating try BAPI_FTR_CONDITION_CREATE (no experience with this one..)

for reading use Function SD_COND_ACCESS

consider more than one Condition Table may be involved via AccSeq for your KSCHL.

Fill KOMK and KOMP accordingly for all Tables of AccSeq for the KSCHL

Cheers

carsten

example:

&----


*& Report ZCAWA_CONDR

*&

&----


      • TESTREPORT

      • Konditionen lesen via Zugriffsfolge des eingegebenen KSCHL

      • C.Wagener, 11.02.2009

&----


REPORT zcawa_condr.

PARAMETERS:

p_kappl TYPE kappl DEFAULT 'V',

p_kschl TYPE kschl DEFAULT 'ZGRA',

p_vkorg type vkorg default '0100',

p_vtweg type vtweg default '00',

p_datum TYPE sydatum default sy-datum,

p_mlfb type YYBCEZNDR default '6MD90001AA'.

DATA: ls_komk TYPE komk.

DATA: ls_komp TYPE komp.

DATA: ls_konp TYPE konp.

DATA: lt_t682i TYPE TABLE OF t682i WITH HEADER LINE .

DATA: ls_koprt TYPE koprt.

DATA: lt_conditions TYPE TABLE OF a000 WITH HEADER LINE.

DATA: ls_sdprothead TYPE sdprothead.

ls_komk-prsdt = p_datum.

ls_komk-vkorg = p_vkorg.

ls_komk-vtweg = p_vtweg.

ls_komp-zzyybcezndr = p_mlfb.

      • Tabellen der Zugriffsolge zur Konditionsart ermitteln

SELECT * FROM t682i AS a

JOIN t685 AS b ON

akvewe EQ bkvewe AND

akappl EQ bkappl AND

akozgf EQ bkozgf

INTO CORRESPONDING FIELDS OF TABLE lt_t682i

WHERE b~kvewe EQ 'A'

AND b~kappl EQ p_kappl

AND b~kschl EQ p_kschl.

      • pro ZugFolgen-Tab-Eintrag FuBa aufrufen

LOOP AT lt_t682i.

CALL FUNCTION 'SD_COND_ACCESS'

EXPORTING

application = p_kappl

condition_type = p_kschl

date = p_datum

header_comm_area = ls_komk

position_comm_area = ls_komp

t682i_i = lt_t682i

koprt_i = ls_koprt

TABLES

condition_records = lt_conditions

EXCEPTIONS

field_is_initial = 1

not_read_unqualified = 2

read_but_not_found = 3

read_but_blocked = 4

t682z_missing = 5

t681v_missing = 6

t681z_missing = 7

mva_error = 8

OTHERS = 9.

      • und raus, wenn Treffer

READ TABLE lt_conditions INDEX 1.

IF sy-subrc EQ 0.

SELECT SINGLE * FROM konp INTO ls_konp

WHERE knumh EQ lt_conditions-knumh.

IF sy-subrc EQ 0.

IF ls_konp-konwa EQ '%'.

ls_konp-kbetr = ls_konp-kbetr / 10.

ENDIF.

WRITE ls_konp-kbetr.

EXIT.

ENDIF.

ENDIF.

ENDLOOP.