Urgent : Link b/w MKPF and BKPF and BSIS
Hi,
I am making a report in which i have to display the vendor payment status.
In table BKPF there is a field called AWKEY and AWTYP and i want to reterive data form it and after that in BSIS table there is a field called XREF3 which is similar to the AWKEY in the BKPF table.
plzz tel me how to make the realtion b/w these tables as help will be deifnately rewarded.
hi,
i am able to reterive data from now but i want to have this method also which u had told.
i am doing inner join concept but accorind to tyou :-
pass the first 10 characters of AWKEY to MBLNR of MKPF.
how should i use this concept?
Edited by: abaper2008 on May 24, 2008 8:48 AM
Similar Messages
-
Urgent: Problem in making Link b/w MKPF and BKPF
Hi,
I am making a report in which i have to make a relationship b/w BKPF and MKPF through AWKEY present in the BKPF with the MBLNR field in MKPF.
Plzzz help me how to do dis as i am having the select statement like dis: -
SELECT AMBLNR AXBLNR BBELNR BBUDAT BGJAHR BAWKEY FROM MKPF AS A INNER JOIN BKPF AS B ON BXBLNR = AXBLNR INTO TABLE ITBSAK WHERE AXBLNR > 0 AND BBELNR IN P_BELNR.
plzz help me out how to reterive data as in dis statement i am not using the AWKEY concept .plzz help me how do i do this as help will be definately rewarded.Hi check this sample code:
form get_data.
*************----------- VARIABLES ---------------**************
data: vl_addrnum type t499s-addrnum,
vl_city1 type adrc-city1.
*************----------- Constants ---------------------**************
constants:cl_ca01(4) value 'CA01'.
***********---------Field symbols ----------------------************
field-symbols: <fs_mseg> type t_mseg.
select a~mblnr a~mjahr a~zeile a~werks a~matnr a~bwart
a~lifnr a~menge a~meins a~lgort a~grund a~sakto
a~ps_psp_pnr a~ablad a~rsnum a~rspos a~kostl
a~umlgo a~wempf a~ebeln a~ebelp a~bukrs a~belnr
a~buzei a~sobkz
b~budat b~xblnr b~bktxt b~xabln b~frbnr b~cputm
c~matkl a~kzvbr a~shkzg
from mseg as a
join mkpf as b
on a~mblnr = b~mblnr and
a~mjahr = b~mjahr
join mara as c
on c~matnr = a~matnr
into table i_mseg
where a~werks in s_werks and
a~bwart in s_bwart and
a~lifnr in s_lifnr and
a~umwrk in s_umwrk and
a~wempf in s_scar and
a~ablad in s_ablad and
a~ebeln in s_ebeln and
a~sjahr in s_yyyy and
b~budat in s_date and
b~cputm in s_time and
b~mjahr in s_yyyy.
if not i_mseg[] is initial.
select pspnr fkokr fkstl posid stort
from prps
into table i_prps
for all entries in i_mseg
where pspnr eq i_mseg-ps_psp_pnr.
select bwart sobkz btext from t156t
into table i_text
for all entries in i_mseg
where bwart eq i_mseg-bwart
and spras eq v_lan
and sobkz eq i_mseg-sobkz
and kzvbr eq i_mseg-kzvbr.
select lifnr name1 from lfa1
into table i_lfa1
for all entries in i_mseg
where lifnr eq i_mseg-lifnr.
endif.
*Awkey is the combination of MBLNR and MJAHR
loop at i_mseg assigning <fs_mseg>.
concatenate <fs_mseg>-mblnr <fs_mseg>-mjahr into <fs_mseg>-awkey.
*To get the Vertex Catagory
move <fs_mseg>-matnr to w_ztfi_product-matnr.
move <fs_mseg>-matkl to w_ztfi_product-matkl.
select single prdtc
from ztfi_product
into w_ztfi_product-prdtc
where matkl eq w_ztfi_product-matkl.
append w_ztfi_product to i_ztfi_product.
endloop.
if not i_mseg[] is initial.
select bukrs belnr gjahr awkey waers
from bkpf
into table i_bkpf
for all entries in i_mseg
where gjahr = i_mseg-mjahr
and bukrs = i_mseg-bukrs
and budat = i_mseg-budat
and awkey = i_mseg-awkey.
select matnr maktx from makt
into table i_makt
for all entries in i_mseg
where matnr = i_mseg-matnr
and spras = v_lan.
endif.
if not i_bkpf[] is initial.
select bukrs " Company Code
belnr " Document Number
gjahr " Fiscal Year
buzei " Line Item
shkzg " Debit / Credit indicator
wrbtr " Amount
sgtxt " Line Item Text
vbund " Trading Partner
kostl " Cost Center
hkont " Account
matnr " Material Number
werks " Plants
txjcd " Tax Jurisdiction
projk " WBS Element
into table i_bseg
from bseg
for all entries in i_bkpf
where bukrs eq i_bkpf-bukrs and
belnr eq i_bkpf-belnr and
gjahr eq i_bkpf-gjahr.
endif.
sort: i_prps by pspnr,
i_bkpf by bukrs awkey gjahr,
i_makt by matnr,
i_bseg by bukrs belnr gjahr,
i_text by bwart sobkz.
*Move to output table
loop at i_mseg into w_mseg.
move-corresponding w_mseg to w_output.
if not w_mseg-lifnr is initial.
select single name1 from lfa1
into w_output-name1
where lifnr = w_mseg-lifnr.
endif.
read table i_prps into w_prps with key pspnr = w_mseg-ps_psp_pnr
binary search.
if sy-subrc eq 0.
move-corresponding w_prps to w_output.
if not w_prps-fkstl is initial and not w_prps-fkokr is initial.
select single ktext from cskt
into w_output-ktext
where spras = sy-langu
and kokrs = w_prps-fkokr
and kostl = w_prps-fkstl
and datbi ge sy-datum.
endif.
select single addrnum from t499s into vl_addrnum
where stand = w_prps-stort.
select single city1 from adrc into vl_city1
where addrnumber = vl_addrnum
and addr_group = cl_ca01.
w_output-city1 = vl_city1.
endif.
read table i_text into w_text with key bwart = w_mseg-bwart
sobkz = w_mseg-sobkz
binary search.
if sy-subrc eq 0.
w_output-btext = w_text-btext.
endif.
read table i_makt into w_makt with key matnr = w_mseg-matnr
binary search.
if sy-subrc eq 0.
w_output-maktx = w_makt-maktx.
endif.
read table i_bkpf into w_bkpf with key bukrs = w_mseg-bukrs
awkey = w_mseg-awkey
gjahr = w_mseg-mjahr
binary search.
if sy-subrc eq 0.
move-corresponding w_bkpf to w_output.
read table i_bseg into w_bseg with key bukrs = w_bkpf-bukrs
belnr = w_bkpf-belnr
gjahr = w_bkpf-gjahr
binary search.
if sy-subrc eq 0.
move-corresponding w_bseg to w_output.
w_output-matnr = w_mseg-matnr.
w_output-werks = w_mseg-werks.
if w_mseg-shkzg = 'H'. " checking the mseg value.
w_output-wrbtr = - w_bseg-wrbtr.
w_output-menge = - w_output-menge.
endif.
perform cal_vertex_tax using w_bseg changing w_output-wmwst.
endif.
endif.
perform format_output using w_output-matnr
w_output-wrbtr w_output-budat
w_output-rsnum w_output-rspos.
append w_output to i_output.
clear: w_output, vl_city1, w_prps,vl_addrnum, w_text, w_makt,
w_bkpf, w_bseg.
endloop.
endform. " get_data -
URGENT: REALTION b/w MKPF ,BKPF AND BSAK
Hi,
what would be the common fields among the MKPF,BKPF and BSAK so that data can be reterived.. plzz tell me as it really urgent to me.Hi,
MKPF table stores material document related data.BKPF stores accounting related data.In order to get the accounting document related to the material document in BKPF table we have 2 fields.
AWTYP : give the value as MKPF
AWKEY: concatenate material document number with year and paas it to this field.
Regards,
Shafi -
Link between AUFK and BKPF table
Hi all,
Can anyone tell me the link between AUFK and BKPF table.
Thanks in advance
Regards
Neha Kapoorhi neha ,
1.first u have to get MBLNR from AUFM for that order
2.Next u have to call FM
<b>AC_DOCUMENT_RECORD</b>
I_AWTYP MKPF--->Constant
I_AWREF 4900003215--->MBLNR
I_AWORG 2004--->Year
I_AWSYS
I_AWTYP_INCL
I_AWTYP_EXCL
I_BUKRS
I_VALUTYP 0
X_DIALOG X
then u will get the Accounting Documents.
regards
prabhu -
JOIN for BSEG, BSIS, BSAS, MSEG, BKPF and MKPF
I am developing a report related to G/L . i am using the Tables BSEG BSIS BSAS MSEG BKPF MKPF ............please give me the Joinings of these tables.......how exactly we can join and get the prefect Data....
Thank U waiting for ur replies....
Title edited by: Alvaro Tejada Galindo on Jun 3, 2008 3:41 PMI have given the tables, internal tables and the select queries which can give you the join conditions of your requirement.
tables: bsis,
bsas,
bkpf,
bseg,
ekbe,
mkpf,
mseg.
select-options: s_hkont for bseg-hkont,
s_bldat for bkpf-budat,
s_budat for bkpf-bldat obligatory,
s_lifnr for bseg-lifnr,
s_lfbnr for ekbe-lfbnr no intervals no-extension.
data: begin of i_bsis_bsas occurs 0,
bukrs like bsis-bukrs,
hkont like bsis-hkont,
gjahr like bsis-gjahr,
belnr like bsis-belnr,
budat like bsis-budat,
bldat like bsis-bldat,
xblnr like bsis-xblnr,
wrbtr like bsis-wrbtr,
buzei like bsis-buzei,
end of i_bsis_bsas,
begin of i_bkpf occurs 0,
bukrs like bsis-bukrs,
belnr like bsis-belnr,
gjahr like bsis-gjahr,
xblnr like bkpf-xblnr,
stblg like bkpf-stblg,
awtyp like bkpf-awtyp,
tcode like bkpf-tcode,
end of i_bkpf,
begin of i_bseg occurs 0,
bukrs like bsis-bukrs,
belnr like bsis-belnr,
gjahr like bsis-gjahr,
buzei like bseg-buzei,
buzid like bseg-buzid,
koart like bseg-koart,
zuonr like bseg-zuonr,
hkont like bseg-hkont,
lifnr like bseg-lifnr,
sgtxt like bseg-sgtxt,
ebeln like bseg-ebeln,
ebelp like bseg-ebelp,
wrbtr like bseg-wrbtr,
end of i_bseg,
begin of i_ekbe occurs 0,
ebeln like ekbe-ebeln,
ebelp like ekbe-ebelp,
gjahr like ekbe-gjahr,
belnr like ekbe-belnr,
buzei like ekbe-buzei,
lfgja like ekbe-lfgja,
lfbnr like ekbe-lfbnr,
lfpos like ekbe-lfpos,
matnr like ekbe-matnr,
end of i_ekbe,
begin of i_mkpf_mseg occurs 0,
mblnr like mkpf-mblnr,
mjahr like mkpf-mjahr,
bktxt like mkpf-bktxt,
xblnr like mkpf-xblnr,
frbnr like mkpf-frbnr,
zeile like mseg-zeile,
matnr like mseg-matnr,
erfmg like mseg-erfmg,
end of i_mkpf_mseg.
*data: wa_ekbe like i_ekbe.
select bukrs
hkont
gjahr
belnr
budat
bldat
xblnr
wrbtr
buzei appending corresponding fields of table i_bsis_bsas
from bsis
where bukrs eq p_bukrs
and hkont in s_hkont
and gjahr eq p_gjahr
and budat in s_budat
and shkzg eq 'S'.
select bukrs
hkont
gjahr
belnr
budat
bldat
xblnr
wrbtr appending corresponding fields of table i_bsis_bsas
from bsas
where bukrs eq p_bukrs
and hkont in s_hkont
and gjahr eq p_gjahr
and budat in s_budat
and shkzg eq 'S'.
endform. " f_get_bsis_bsas_data
*& Form f_get_bkpf_bseg_data
Subroutine to get BKPF and BSEG data
form f_get_bkpf_bseg_data.
check not i_bsis_bsas[] is initial.
select bukrs
belnr
gjahr
xblnr
stblg
awtyp
tcode into table i_bkpf
from bkpf
for all entries in i_bsis_bsas
where bukrs eq i_bsis_bsas-bukrs
and belnr eq i_bsis_bsas-belnr
and gjahr eq i_bsis_bsas-gjahr.
and awtyp = 'BKPFF'
and tcode = 'J1IE'.
check not i_bkpf[] is initial.
select bukrs
belnr
gjahr
buzei
buzid
koart
zuonr
hkont
lifnr
sgtxt
ebeln
ebelp
wrbtr into corresponding fields of table i_bseg
from bseg
for all entries in i_bsis_bsas
where bukrs eq i_bsis_bsas-bukrs
and belnr eq i_bsis_bsas-belnr
and gjahr eq i_bsis_bsas-gjahr.
and buzei eq i_bsis_bsas-buzei
and hkont eq i_bsis_bsas-hkont.
delete i_bseg where not hkont in s_hkont.
endform. " f_get_bkpf_bseg_data
*& Form f_get_ekbe_data
Subroutine to get EKBE data
form f_get_ekbe_data.
data: $i_bseg like i_bseg occurs 0 with header line.
$i_bseg[] = i_bseg[].
delete $i_bseg where ebeln is initial.
check not $i_bseg[] is initial.
select ebeln
ebelp
gjahr
belnr
buzei
lfgja
lfbnr
lfpos
matnr into table i_ekbe
from ekbe
for all entries in $i_bseg
where ebeln eq $i_bseg-ebeln
and ebelp eq $i_bseg-ebelp
and gjahr eq $i_bseg-gjahr
and bwart = '101'.
and belnr eq $i_bseg-belnr.
check not i_ekbe[] is initial.
select a~mblnr
a~mjahr
a~bktxt
a~xblnr
a~frbnr
b~zeile
b~matnr
b~werks
b~erfmg into table i_mkpf_mseg
from mkpf as a inner join
mseg as b on amblnr eq bmblnr
and amjahr eq bmjahr
for all entries in i_ekbe
where a~mblnr eq i_ekbe-lfbnr
and a~mjahr eq i_ekbe-gjahr
and b~zeile eq i_ekbe-lfpos
and b~werks eq p_werks.
<REMOVED BY MODERATOR>
Edited by: Srikanth Kadiyala on Jun 3, 2008 7:24 AM
Edited by: Alvaro Tejada Galindo on Jun 3, 2008 3:40 PM -
Relation between BKPF and MKPF
I want relation between BKPF and MKPF,
because i want account document number on storage location basis.
if anyone know the solution or any standard report pl. tell me.Hi Omar,
For all tables if you wan to find the table relation shipss...
use the T-Code -->SQVI--> select table join--> enter first the table name--> enetr another tbale name..
it will show the possible relation ship between the tables
Regards,
Prabhduas -
hi gurujis,
with your kind help i am learning something, but there is problem in each step. Now i am working with FI , i have came to know about two tables,
they are BKPF and BSID i have to join them and also produce output on the basis of 4 inputs like company no, coustomer no, currency and posting date. I need your help on this, can somebody send me the code to do this.
Also i would like to know is there any FM's to join two or more tables, if yes, please send me the name of that module with an complete example.
I need this , it is very urgent.
Thanks,
KHAN.hi Khan,
SELECT bkpf~...
bsid~...
INTO TABLE ...
FROM bkpf AS bkpf
INNER JOIN bsid AS bsid
ON bkpf~bukrs EQ bsid~bukrs
AND bkpf~gjahr EQ bsid~gjahr
AND bkpf~belnr EQ bsid~belnr
WHERE bkpf~bukrs EQ p_bukrs
AND bsid~kunnr IN s_kunnr
AND bkpf~waers EQ p_waers
AND bkpf~budat EQ p_budat.
hope this helps
ec -
I need a report that will join two tables BKPF and VBRK in QuickViewer. The only field with the right character length is XBLNR but when creating the join no records are dispalyed beacuse the values of this field in both tables are not the same.
There are also other fields available in BKPF but the char length is not the appropriate.
Does anyone have any idea how I can link these two tables?
Thank youNeither of these combinations is possible with QuickViewer because the fields need to have the same length of characters in order to create the join.
VBRK - VBLEN char(10) and BKPF - AWKEY char(20)
VBRK -ZUONR char(18) BKPF- BELNR char (10)
Any other idea?
Thank you, JP -
Idoc for bsid ,bseg and bkpf tables
hi ,
i have extrated the data from 4.7 and uploading into ecc 6.0.
is there any IDOC for uploading data coming from BSID , BSEG AND BKPF tabels?
i checked bapi , i could not find some fields in bapi .pls.advise if any IDOC
As it is very urgent , pls.help me in this regard .
Regards ,
Kiran.Hi,
There is some IDOCs which related to the bseg, bkpf etc table
FIDCC1,FIDCC2.
<b>Reward with points if helpful.</b>
Regards,
Vijay -
Is there is any functional module avaibale to insert
bkpf and bseg table very urgent please
Thanks
RamkiFIUPDATE will not gnerate fi document after the updation.
I need Fi document after the it updated in the bseg and bkpf table
Thanks
regards
ramki -
Relation between BKPF and EKBE table for reversing document?
Is there any relation between BKPF and EKBE table for reversing document when STBLG is blank in BKPF.
AND
How to differentiate Old Accounting document / Reverse document / New document when in BKPF-STBLG is blank for all three document and BKPF-XBLNR are same for all.Hi Varun,
Table Document no (BKPF-BELNR) is link between Material document no (EKBE-BELNR). If you are looking for validating Material reversal document then please use following logic for your requirement.
Material Document (MBLNR) & Material Document Year (MJAHR). Pass material document (MBLNR) to MSEG-SMBLN to read MSEG-MBLNR with MSEG-MJAHR to MSEG-SJAHR, if record found delete both the documents i.e. MSEG-SMBLN & MSEG-MBLNR (donu2019t consider these documents in the logic) and display Material Document No. (MSEG-MBLNR)
Regards,
Santosh -
ABAP Query: FI Tables - BSEG and BKPF
Dear All,
I have tried to use SAPQuery - SQ01 to join 2 SAP tables (BSEG and BKPF) by creating an Infoset (SQ01 >> Environment >> Infosets >> Create)
However, there is always an error message for the table join when I generate the infoset. Tables BSEG and BKPF are joined together by conditions BSEG-BELNR & BKPF-BELNR; BKPF-BURKS & BKPF-BURKS; BSEG-GJAHR and BKPF-GJHAR.
The error message prompted is, "You cannot use comparisons with column references in pool and cluster". Is the message trying to say that BELNR, NURKS and GJAHR are column references in pool and cluster, thats why we can't join the tables?
The purpose of the infoset is to extract accounting documents. I will need to extract accounting doc data from DEV, QA and Prodcution Server. If I use SAP QuickViewer, everytime I go to a differenct server I will need to create the QuickViewer in the system before I can use it. But if i use SAP Query, i will need to create once and transport the SAP Query to another server.
Kindly advise if there is a way I can extract accountng document by using SAP Query?
Million Thanks in Advance.Hi Mark,
I appreciate your response.
Im tyring to extract information for open GL items. Thus the relevant tables would be BSIS. But I find that some fields such as Purchase Order Number; Purchase Order Line Item, Asset No.,Asset Sub-No which Im interested in do not exist in BSIS. But these fields can be found in Table BSEG?
If I have to link BSEG and BKPF, how should i go about doing it?
Kindly advise.
Thanks in Advance! -
I have the mini DisplayPort to Dual-Link DVI Adapter firmware 1.03 and I still have massive screen flickering issues on a Mac Mini 2012.
I am using a Dell 30" monitor (it's the Samsung screen just rebranded) connected to a WD 4TB Thunderbolt drive connected to the Mac Mini.
The screen is usable for the most part when I've just started the computer (although today I started having issues after a fresh restart) but if even just the screen goes to sleep, or the computer goes to sleep and I wake it later, I start to have massive flickering to black and occasionally to snow.
The effect seems to be more likely to arise when I'm on heavy graphics-intensive websites or programs (eg, Tumblr feed with lots of GIF images or working in Adobe Premiere), but once it starts shutting down those programs has no effect, the screen keeps flickering wildly.
The problem improved after the 1.03 firmware upgrade (for a while it was flickering uncontrollably ALL the time and was virtually unusable) but it has not gone away.
Any suggestions would be very welcome, either for how to fix this issue or how to get Apple to, you know, let me TELL THEM that their adapter firmware fix has NOT solved the issue, since my phone support has expired. :/I have a new Mini DisplayPort to Dual-Link DVI Adapter to allow my original Apple 30" Cinema Display to connect to the new Mac Pro. Shipped straight from Apple, it is firmware version 1.03. I've never had flickering issues, but the display will often go black (possibly after a screen power save) and not come back. when this happens I am still able to connect to and use the Mac via remote connection. But the only way to get the screen back is either to unplug the adapter and plug it back in to the Mac, or to shut down and power up the Mac. This may be a separate issue, so I'll also post it standalone...
-
Performance issue in BI due to direct query on BKPF and BSEG tables
Hi,
We had a requirement that FI document number fieldshould be extracted in BI.
Following code was written which has the correct logic but performance is bad.
It fetched just 100 records in more than 4-5 hrs.
The reason is there was a direct qury written on BSEG and BKPF tables(without WHERE clause).
Is there any way to improve this code like adding GJAHR field in where clause? I dont want to change the logic.
Following is the code:
WHEN '0CO_OM_CCA_9'." Data Source
TYPES:BEGIN OF ty_bkpf,
belnr TYPE bkpf-belnr,
xblnr TYPE bkpf-xblnr,
bktxt TYPE bkpf-bktxt,
awkey TYPE bkpf-awkey,
bukrs TYPE bkpf-bukrs,
gjahr TYPE bkpf-gjahr,
AWTYP TYPE bkpf-AWTYP,
END OF ty_bkpf.
TYPES : BEGIN OF ty_bseg1,
lifnr TYPE bseg-lifnr,
belnr TYPE bseg-belnr,
bukrs TYPE bseg-bukrs,
gjahr TYPE bseg-gjahr,
END OF ty_bseg1.
DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
wa_bkpf TYPE ty_bkpf,
it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
wa_bseg1 TYPE ty_bseg1,
l_s_icctrcsta1 TYPE icctrcsta1.
"Extract structure for Datasoure 0co_om_cca_9.
DATA: l_awkey TYPE bkpf-awkey.
DATA: l_gjahr1 TYPE gjahr.
DATA: len TYPE i,
l_cnt TYPE i.
l_cnt = 10.
tables : covp.
data : ref_no(20).
SELECT lifnr
belnr
bukrs
gjahr
FROM bseg
INTO TABLE it_bseg1.
DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
SELECT belnr
xblnr
bktxt
awkey
bukrs
gjahr
AWTYP
FROM bkpf
INTO TABLE it_bkpf.
IF sy-subrc EQ 0.
CLEAR: l_s_icctrcsta1,
wa_bkpf,
l_awkey,
wa_bseg1.
LOOP AT c_t_data INTO l_s_icctrcsta1.
MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
WHERE belnr = l_s_icctrcsta1-belnr.
if sy-subrc = 0.
if COVP-AWORG is initial.
concatenate l_s_icctrcsta1-refbn '%' into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
l_s_icctrcsta1-refbn
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
IF sy-subrc EQ 0.
MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
MODIFY c_t_data FROM l_s_icctrcsta1.
READ TABLE it_bseg1 INTO wa_bseg1
WITH KEY
belnr = wa_bkpf-belnr
bukrs = wa_bkpf-bukrs
gjahr = wa_bkpf-gjahr.
IF sy-subrc EQ 0.
MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
MODIFY c_t_data FROM l_s_icctrcsta1.
CLEAR: l_s_icctrcsta1,
wa_bseg1,
l_gjahr1.
ENDIF.
ENDIF.
ELSE. " IF AWORG IS NOT BLANK -
concatenate l_s_icctrcsta1-refbn COVP-AWORG into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(20) =
ref_no
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
IF sy-subrc EQ 0.
MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
MODIFY c_t_data FROM l_s_icctrcsta1.
READ TABLE it_bseg1 INTO wa_bseg1
WITH KEY
belnr = wa_bkpf-belnr
bukrs = wa_bkpf-bukrs
gjahr = wa_bkpf-gjahr.
IF sy-subrc EQ 0.
MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
MODIFY c_t_data FROM l_s_icctrcsta1.
CLEAR: l_s_icctrcsta1,
wa_bseg1,
l_gjahr1.
ENDIF.
ENDIF.
endif.
endif.
CLEAR: l_s_icctrcsta1.
CLEAR: COVP, REF_NO.
ENDLOOP.
ENDIF.Hello Amruta,
I was just looking at your coding:
LOOP AT c_t_data INTO l_s_icctrcsta1.
MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
WHERE belnr = l_s_icctrcsta1-belnr.
if sy-subrc = 0.
if COVP-AWORG is initial.
concatenate l_s_icctrcsta1-refbn '%' into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
l_s_icctrcsta1-refbn
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
Here you are interested in those BKPF records that are related to the contents of c_t_data internal table.
I guess that this table does not contain millions of entries. Am I right?
If yes, the the first step would be to pre-select COVP entries:
select BELNR AWORG AWTYP into lt_covp from COVP
for all entries in c_t_data
where belnr = c_t_data-belnr.
sort lt_covp by belnr.
Once having this data ready, you build an internal table for BKPF selection:
LOOP AT c_t_data INTO l_s_icctrcsta1.
clear ls_bkpf_sel.
ls_bkpf_sel-awkey(10) = l_s_icctrcsta1-refbn.
read table lt_covp with key belnr = l_s_icctrcsta1-belnr binary search.
if sy-subrc = 0.
ls_bkpf_sel-awtyp = lt_covp-awtyp.
endif.
ls_bkpf_sel-gjahr = l_s_icctrcsta1-fiscper(4).
insert ls_bkpf_sel into table lt_bkpf_sel.
ENDLOOP.
Now you have all necessary info to read BKPF:
SELECT
belnr
xblnr
bktxt
awkey
bukrs
gjahr
AWTYP
FROM bkpf
INTO TABLE it_bkpf
for all entries in lt_bkpf_sel
WHERE
awkey = lt_bkpf_sel-awkey and
awtyp = lt_bkpf_sel-awtype and
gjahr = lt_bkpf_sel-gjahr.
Then you can access BSEG with the bukrs, belnr and gjahr from the selected BKPF entries. This will be fast.
Moreover I would even try to make a join on DB level. But first try this solution.
Regards,
Yuri -
Table relations between vbrk and bkpf for Accounting Document Number
hello,
i am using 4 tables to get data into my programs.
vbrk,vbrp konv and bkpf.
i want to get belnr from bkpf.i found relation between vbrk and belnr.but in vbrk table belnr's value is initial.
can anybody tell me that how should i relate vbrk and bkpf or how to get Accounting Document Number(belnr) from bkpf for Billing Document(vbeln).
regards,
soniya s.hi,
chekc this. its working for me.
data : WA_AWKEY LIKE BKPF-AWKEY.
data : WA_BELNR LIKE BKPF-BELNR.
data : LENGTH TYPE I.
*BREAK MTABAP.
LENGTH = STRLEN( IT_VBRK-VBELN ).
if LENGTH = '10' .
MOVE it_vbrk-VBELN TO WA_AWKEY.
SELECT SINGLE BELNR FROM BKPF INTO WA_BELNR
WHERE AWKEY = WA_AWKEY
AND AWTYP = 'VBRK'
and blart = 'RV'.
it_final-acc_doc = WA_BELNR.
CLEAR WA_BELNR .
CLEAR WA_AWKEY .
else.
CONCATENATE '0' it_vbrk-vbeln INTO wa_awkey.
SELECT SINGLE BELNR FROM BKPF INTO WA_BELNR
WHERE AWKEY = WA_AWKEY
AND AWTYP = 'VBRK'
and blart = 'RV'.
it_final-acc_doc = WA_BELNR .
CLEAR WA_BELNR .
CLEAR WA_AWKEY.
endif.
Maybe you are looking for
-
Availability check in Enjoy Purchase Order & Requisition
Hi Experts, The availability check is used in 4.7E also but what is difference in Ecc 6.0 or new functionality added Can any one plz let me know Regards Pratap
-
'No data found for contact person 00764' error on Cart
Hiya. I am getting a message that pertains to 'No data found for contact person 00764' error on Cart. 00764 is the BP number. In SRM Org plan, the user check is fine. Please can you suggest. Thank you. Pooja Kaur p&g, India.
-
IWork 09 install from dmg not working
I installed iWork 09 from dmg, ran both the 9.1 and 9.2 updates. Doesn't work. When I try to open something, I get to the template chooser dialog box, then nothing opens when clicking either New Document (nothing happens) or an existing file (gives
-
Sound lag (delay) in windows 7 64bit over Bootcamp mini server 2011
I just got my new Mac mini server 2011, loaded windows 7 64 bit and noticed that there is a audio lag over hdmi (intel HD 3000), what i mean is when i delete a file from recycle bin there is no sound, i tried going to sounds in the control panel and
-
Indexing External Hard Drives Help
Hello, I'm sure this question has been asked in some for or another previously, however, a quick search didn't turn up the results I was looking for. Here's my question. In previous versions of OSX I could index certain drives, folders, etc. So how d