on 11-29-2005 8:12 AM
Hi to all,
any one tell me that iam getting purchase order/netprice(purchase) for some material which is not having purchase order and purchase price.....can u help me to rectify the error.
TABLES: vbap,vbak, eipa, eina.
type-pools: slis.
data : BEGIN OF itabVBAK occurs 0,
VTWEG type vbak-vtweg, "distribution channel
VKORG type vbak-vkorg, "sales org
KUNNR type vbak-kunnr, "customer
AUART type vbak-auart, "sales docu type
MATNR type vbap-matnr, "material
AUDAT type vbap-audat, "sales docu date
NETPR type vbap-netpr, <b>"netprice sales</b>
ARKTX type vbap-arktx, "sales order item
VBELN type vbap-vbeln, <b>"sales order</b>
VRKME type vbap-vrkme, "sales unit
WAERK type vbap-waerk, "plant
NETWR type vbap-netwr, "netvalue
KWMENG type vbap-kwmeng, "quantity
PREIS type vbap-netpr, <b>"purchase netprice</b>
MATNR1 type vbap-MATNR, "material
INFNR type EIPA-INFNR, "record no
PREDI type VBAP-NETPR, "price diff(new field)
BEDAT type EIPA-BEDAT, "purchase docu date
EBELN type eipa-ebeln, <b>"purchase order</b>
end of itabvbak.
DATA: PREIS LIKE EIPA-PREIS ,
matnr1 like eina-matnr,
PREDI LIKE VBAP-NETPR,
EBELN like EIPA-EBELN,
BEDAT like EIPA-BEDAT.
&----
*& Form DATA_RETRIEVAL
&----
Retrieve data form VBAK table and populate itab it_VBAK
----
form data_retrieval.
data: ld_color(1) type C.
select VBAP~matnr
VBAK~VTWEG
VBAK~VKORG
VBAK~KUNNR
VBAK~AUART
VBAP~AUDAT
VBAP~NETPR
VBAP~ARKTX
VBAP~VRKME
VBAP~WAERK
VBAP~NETWR
VBAP~vbeln
VBAK~BSTNK
vbap~kwmeng
into corresponding fields of table itabvbak from VBAP
inner join VBAK
on VBAPVBELN = VBAKVBELN
where VBAK~kunnr in s_kunn1
and VBAP~AUDAT in s_AUDAT
and VBAP~MATNR in s_MATNR
and VBAK~AUART in s_AUART
and VBAK~VTWEG in s_VTWEG
and VBAK~VKORG in s_VKORG.
loop at itabvbak.
select single INFNR from eina into eina-infnr where MATNR =
itabvbak-matnr.
ITABVBAK-matnr1 = eina-matnr.
select single PREIS from eipa into eipa-preis where infnr = eina-infnr.
ITABVBAK-PREIS = eipa-preis.
select single EBELN from eipa into eipa-EBELN where infnr = eina-infnr.
ITABVBAK-EBELN = eipa-EBELN.
select single BEDAT from eipa into eipa-BEDAT where infnr = eina-infnr.
ITABVBAK-BEDAT = eipa-BEDAT.
ITABVBAK-PREDI = ITABVBAK-NETPR - ITABVBAK-PREIS.
modify itabvbak.
endloop.
endform. " DATA_RETRIEVAL
Thanks in advace.
raju.
Message was edited by: mpr raju
Hi Raju,
Are you saying that you are getting Wrong PO/Net Price for some materials though they do not have any. Then I think you are missing <b>CLEAR</b> statements in the <b>loop</b> on <b>itabvbak</b>.
See my addition in BOLD inside your loop logic,
loop at itabvbak.
<b> CLEAR: eina, eipa.</b>
select single INFNR from eina into eina-infnr where MATNR =
itabvbak-matnr.
ITABVBAK-matnr1 = eina-matnr.
select single PREIS from eipa into eipa-preis where infnr = eina-infnr.
ITABVBAK-PREIS = eipa-preis.
select single EBELN from eipa into eipa-EBELN where infnr = eina-infnr.
ITABVBAK-EBELN = eipa-EBELN.
select single BEDAT from eipa into eipa-BEDAT where infnr = eina-infnr.
ITABVBAK-BEDAT = eipa-BEDAT.
ITABVBAK-PREDI = ITABVBAK-NETPR - ITABVBAK-PREIS.
modify itabvbak.
endloop.
Hope this helps...
Sri
Message was edited by: Srikanth Pinnamaneni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After using the Itab and before using it
give Clear Itab.
and Refresh Itab.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think dont use joins in select query.
Some time it seems to be not working.
try useing another select single query.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.