09-28-2010 3:12 PM
Hi ,
I am inserting a new condition type(say ZXX ) along with its amount in the table control of ME12 as the last row and saving it ,(Say i have saved the new as last row - 7 row);
Now when i am going back and checking it it is showing ZXX as 3r row in the table control screen.
But in KONP it shows as last item.
I am doing teh BDC of the transaction . Not sure how to take care of it.
ANy one has any idea!!
plz suggest me any FM/BAPI that will give me the details of the pricing items(condtion types, amounts ) as shown in the sequence of ME12 not as KONP .
09-28-2010 4:49 PM
Here is some code from a Z class I have.
The MT_KONP table is straight from the KONP table. The PRICING_SCHEME function module orders them properly.
method ORDER_CONDITION_ITEMS.
data: ls_komk type komk,
ls_komp type komp,
lt_komv type STANDARD TABLE OF komv,
ls_komv type komv,
ls_konp type konp,
lt_konp type STANDARD TABLE OF konp.
* populate KOMK.
ls_komk-kappl = ms_zkomg-kappl.
select SINGLE kalsm into ls_komk-kalsm
FROM t685a
WHERE kappl = ms_zkomg-kappl
and kschl = ms_zkomg-kschl.
* populate KOMP
ls_komp-kposn = '000001'.
* populate internal table TKOMV.
loop at mt_konp into ls_konp.
ls_komv-kappl = ls_konp-kappl.
ls_komv-kposn = '000001'.
ls_komv-kschl = ls_konp-kschl.
APPEND ls_komv to lt_komv.
endloop.
* get the correct order for these
CALL FUNCTION 'PRICING_SCHEME'
EXPORTING
CALCULATION_TYPE = 'A'
comm_head_i = ls_komk
comm_item_i = ls_komp
* IMPORTING
* COMM_HEAD_E =
* COMM_ITEM_E =
tables
tkomv = lt_komv.
* apply the order to KONP
loop at lt_komv into ls_komv.
clear ls_konp.
READ TABLE mt_konp into ls_konp with key kschl = ls_komv-kschl.
IF sy-subrc <> 0.
zcx_base=>raise( message = 'Condition & not found in LT_KONP'(e01)
mvar1 = ls_komv-kschl ).
ENDIF.
APPEND ls_konp to lt_konp.
endloop.
refresh mt_konp.
mt_konp[] = lt_konp[].
endmethod.
11-13-2010 2:22 PM