SAP’de Malzemenin Satıcıdaki Fiyatı Nasıl Bulunur

Bu iş için, ME_READ_INFORECORD adlı fonksiyonu kullanabilirsiniz. Aşağıda bir kullanım örneği bulunmaktadır:

* Düzenli satıcının bulunması
CLEAR s_lifnr.
SELECT SINGLE infnr lifnr INTO (lv_infnr, s_lifnr)
FROM eina
WHERE matnr = f_matbw-matnr
AND relif = ‘X’
AND loekz = ”.

IF s_lifnr EQ ” AND f_matbw-werks NE ‘2000’.
MESSAGE ID ‘ZPCP’ TYPE ‘I’ NUMBER 001 WITH f_matbw-matnr.
ENDIF.

IF s_lifnr NE ”.

* Malzemeye ait TÖB ve PEINH
SELECT SINGLE meins INTO m_meins
FROM mara
WHERE matnr = f_matbw-matnr.

SELECT SINGLE peinh INTO lv_peinh
FROM mbew
WHERE matnr EQ f_matbw-matnr
AND bwkey EQ f_matbw-werks.

*———————————*
* Bilgi kaydından fiyat bulunması *
*———————————*

lf_meico-infnr = lv_infnr.
lf_meico-werks = f_matbw-werks.
SELECT SINGLE esokz ekorg INTO CORRESPONDING FIELDS OF lf_meico
FROM eine
WHERE infnr EQ lv_infnr
AND werks EQ f_matbw-werks
AND loekz EQ ”.

lf_meprck-simng = lv_peinh.
lf_meprck-simme = m_meins.
lf_meprck-sidat = f_matbw-bwdat.
lf_meprck-bwsv1 = ‘5’.

CALL FUNCTION ‘ME_READ_INFORECORD’
EXPORTING
incom = lf_meico
inpreissim = lf_meprck
IMPORTING
einedaten = lf_eine
EXCEPTIONS
bad_comin = 1
bad_material = 2
bad_materialclass = 3
bad_supplier = 4
not_found = 5
OTHERS = 6.

IF sy-subrc EQ 0.
exp_preis = lf_eine-effpr.
exp_peinh = lf_eine-peinh.
exp_waers = lf_eine-waers.
EXIT.
ENDIF.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s