Getting MATNR in BSEG
Hi,
During Intercompany Billing document (VF01), a KR is created via idoc. However, in Cost of Sales account, I get the sales order number but the material is not getting populated when I click on the More data. The material field is empty.
Any idea from where this materail field can be enabled?
je
You can have this as an optional or required field in the field status in OB41 and can use it in FB01 or for any document posting.
Thanks
Krish.
Similar Messages
-
XREF3 field not getting populated in BSEG table while posting MIRO
Hi,
I have one query in MIRO tcode.I have activated xref3 field in MIRO tcode using enhancement LMR1MF6Q.Now when i try to post document with some values in xref3 field on screen ,value is not getting populated in BSEG table.Please tell me what else needs to be done to achieve this ?
any hint on this?
Thanks & Regards,
Soniya S.Hi,
1.- According to SAP Note 904652 - MIRO: Different from FB60
https://service.sap.com/sap/support/notes/904652
MIRO is an independent Materials Management (MM) transaction that does not
claim to be the same as the accounting transactions (such as FB60 or FB01).
MIRO was developed to allow users to process vendor invoices within the
context of the MM procurement processes as simply as possible.
For this reason, among other differences, the field selection was limited
to the absolutely necessary. For example, the following fields from the
accounting document are not available in Transaction MIRO (this list is not
complete):
Reference key (BSEG-XREF1, -XREF 2, -XREF 3)
2.- SAP Note 1156325 - BAdIs in the Logistics Invoice Verification environment
https://service.sap.com/sap/support/notes/1156325
Have a look at badi MRM_ITEM_CUSTFIELDS.
This badi will create a new tab at item level in order to display the new fields.
I haven´t used this badi so i cannot talk from experience here.
Think twice before deciding.
Best regards. -
How to get general account for a billing document ( BSEG) ?
Hello,
For a billing document to a client , We need to get the general account for each item of the invoice . We based on the field XBLNR of table VBRK to select a document from BKPF with condition : VBRK-XBLNR = BKPF-vbeln . If yes we will get from table BSEG for bseg-vbeln = bkpf-vbeln and bseg-posnr = vbrk-posnr . then get HKONT.
But as you know BSEG is a cluster table, Select directly from this table is extremly long and seems impossible in our case. Could you please show me the way to do this ?
Our main purpose is to get HKONT ( General account ) for a billing document .
Thanks in advance for your helpHi Hoa Binh Xanh,
Why don't you look into tables BSAD and BSID (Transperant Tables) rather directly hitting BSEG ( Cluster Table)
Pass VBELN (Billing Document) in above two tables and get the doucment numbers and then if you need further info hit BSEG with the data you got from BSAD and BSID
OR else Pass KOART = 'D' while selecting data from BSEG it will help in improving performance
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya -
Required replace BSEG with BSAK BSIK BSIS BSAS for report performance
Hi Experts
i m optimizing a report in which data is extracting from BSEG , 5 time so i reduses the performance of report
so i want replace BSEG with BSAK BSIK BSIS BSAS for the same data what I am getting now . this is report of Purchase of item. code is here.
REPORT zmm_pur_reg_kanhe LINE-SIZE 1023.
*& Des :Purchase Tax Register Report for KANHE
*& Created on :12-07-07
*& Suggested by:Paresh Saini(MM)
*& Changes By: Lailu Philip
*& Changed On: 24.09.2007
*& Changes: New columns for G/L Code Description,VAT Amt,VAT Perc,CST Perc
*& ,SHCESS Amounts,WCT G/L Acc., WCT Amt,Tax Code
*& for Purchase Order,WCT tax code & Percentage.
*& Request No: S6DK921577
Data Declaration
*& changes: by Vincy on 12.01.2007
*& changes: display purchase order with vendor type zpsr(get_zpsr)
*& Request No: S6DK930821
TABLES:ekbe, lfa1, faglflexa.",j_1iexcdtl,lfa1,bkpf,bseg.
TYPE-POOLS: slis. "ALV Declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
DATA: it_sortcat TYPE slis_sortinfo_alv OCCURS 1,
col_pos LIKE fieldcatalog-col_pos .
TYPES :BEGIN OF wa1_ekbe,
belnr TYPE ekbe-belnr,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
matnr TYPE ekbe-matnr,
ebelp TYPE j_1iexcdtl-ritem1,
ebeln TYPE ekbe-ebeln,
gjahr TYPE ekbe-gjahr,
lfbnr TYPE ekbe-lfbnr,
lfpos TYPE ekbe-lfpos,
bldat TYPE ekbe-bldat,
REEWR TYPE REEWR,
END OF wa1_ekbe.
TYPES :BEGIN OF wa2_ekbe,
belnr TYPE ekbe-belnr,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
ebelp TYPE ekbe-ebelp,
ebeln TYPE ekbe-ebeln,
gjahr TYPE ekbe-gjahr,
lfbnr TYPE ekbe-lfbnr,
lfpos TYPE ekbe-lfpos,
bldat TYPE ekbe-bldat,
REEWR TYPE REEWR,
awkey(20) TYPE c,
MATNR TYPE MATNR,
MWSKZ TYPE EKBE-MWSKZ,
END OF wa2_ekbe.
TYPES :BEGIN OF wa1_j_1iexcdtl,
exnum TYPE j_1iexcdtl-exnum,
exdat TYPE j_1iexcdtl-exdat,
lifnr TYPE j_1iexcdtl-lifnr,
matnr TYPE j_1iexcdtl-matnr ,
maktx TYPE j_1iexcdtl-maktx ,
capind TYPE j_1iexcdtl-capind,
exbas TYPE j_1iexcdtl-exbas,
exbed TYPE j_1iexcdtl-exbed,
ecs TYPE j_1iexcdtl-ecs,
werks TYPE j_1iexcdtl-werks,
ritem1 TYPE j_1iexcdtl-ritem1,
rdoc1 TYPE j_1iexcdtl-rdoc1,
docyr TYPE j_1iexcdtl-docyr,
bedinv type J_1IBEDINV,
ecsinv type J_1IECSINV,
EXADDINV1 type J_1IEXADDINV1,
exaddtax1 TYPE j_1iexcdtl-exaddtax1,
rdoc2 TYPE j_1iexcdtl-rdoc2,
ritem2 TYPE j_1iexcdtl-ritem2,
menge TYPE j_1iexcdtl-menge,
ADDED FOR RUDRAPUR ON 08.03.2008 BY ASHOK.CH
*ENDED ON 08.02.2008
END OF wa1_j_1iexcdtl.
TYPES :BEGIN OF wa1_lfa1,
name1 TYPE lfa1-name1,
ktokk TYPE lfa1-ktokk,
werks TYPE lfa1-werks,
lifnr TYPE lfa1-lifnr,
END OF wa1_lfa1.
TYPES :BEGIN OF wa1_ekexclf,
belnr TYPE ekbe-belnr,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
ebelp TYPE ekbe-ebelp,
ebeln TYPE ekbe-ebeln,
gjahr TYPE ekbe-gjahr,
awkey(20) TYPE c,
exnum TYPE j_1iexcdtl-exnum,
exdat TYPE j_1iexcdtl-exdat,
lifnr TYPE j_1iexcdtl-lifnr,
matnr TYPE j_1iexcdtl-matnr ,
maktx TYPE j_1iexcdtl-maktx ,
capind TYPE j_1iexcdtl-capind,
exbas TYPE j_1iexcdtl-exbas,
exbed TYPE j_1iexcdtl-exbed,
ecs TYPE j_1iexcdtl-ecs,
werks TYPE j_1iexcdtl-werks,
ritem1 TYPE j_1iexcdtl-ritem1,
rdoc1 TYPE j_1iexcdtl-rdoc1,
docyr TYPE j_1iexcdtl-docyr,
name1 TYPE lfa1-name1,
ktokk TYPE lfa1-ktokk,
exaddtax1 TYPE j_1iexcdtl-exaddtax1,
added for rudrapur on 08.03.2008 by ASHOK.CH
bedinv type J_1IBEDINV,
ecsinv type J_1IECSINV,
EXADDINV1 type J_1IEXADDINV1,
END OF MODIFICATION ON 08.02.2008
END OF wa1_ekexclf.
TYPES :BEGIN OF wa1_bkpf,
bukrs TYPE bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr TYPE bkpf-gjahr,
budat TYPE bkpf-budat,
tcode TYPE bkpf-tcode,
awkey TYPE bkpf-awkey,
END OF wa1_bkpf.
TYPES :BEGIN OF wa1_bseg,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
buzei TYPE bseg-buzei,
bschl TYPE bseg-bschl,
fwbas TYPE bseg-fwbas ,
pswbt TYPE bseg-pswbt,
hkont TYPE bseg-hkont,
wrbtr TYPE bseg-wrbtr,
ktosl TYPE bseg-ktosl,
koart TYPE bseg-koart,
shkzg TYPE bseg-shkzg,
mwskz TYPE bseg-mwskz,
qsskz TYPE bsis-qsskz,
dmbtr TYPE bseg-dmbtr,
lifnr TYPE bseg-lifnr,
matnr TYPE bseg-matnr,
flag TYPE C,
flag_21 TYPE C,
END OF wa1_bseg.
TYPES :BEGIN OF wa1_tax,
belnr TYPE bseg-belnr,
fi_docno TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
bukrs TYPE bseg-bukrs,
awkey TYPE bkpf-awkey,
fwbas TYPE bseg-fwbas ,
cst_amt TYPE bseg-pswbt,
vat_amt TYPE bseg-pswbt,
shcess_amt TYPE bseg-pswbt,
gl_accnt TYPE bseg-hkont,
gl_desc TYPE skat-txt50,
wctglacc TYPE bseg-hkont,
wctamt TYPE bseg-dmbtr,
taxcode TYPE t059z-wt_withcd,
taxperc TYPE t059z-qsatz,
total_value TYPE bseg-wrbtr,
set_off TYPE bseg-wrbtr,
cond_type TYPE konv-kschl,
description(20) TYPE c,
service_tax TYPE bseg-wrbtr,
service_ecess TYPE bseg-wrbtr,
service_shcess TYPE bseg-wrbtr, "vincy on 31.01.08
ebelp TYPE ekbe-ebelp, " on 15.04.08
flag TYPE c,
mwskz TYPE bseg-mwskz,
END OF wa1_tax.
DATA:BEGIN OF itab_skat,
saknr TYPE skat-saknr,
spras TYPE skat-spras,
txt50 TYPE skat-txt50,
END OF itab_skat.
DATA: iskat LIKE itab_skat OCCURS 0,
wa_skat LIKE itab_skat.
DATA : BEGIN OF zbsis OCCURS 0,
bukrs TYPE bsis-bukrs,
hkont TYPE bsis-hkont,
augdt TYPE bsis-augdt,
augbl TYPE bsis-augbl,
zuonr TYPE bsis-zuonr,
gjahr TYPE bsis-gjahr,
belnr TYPE bsis-belnr,
buzei TYPE bsis-buzei,
budat TYPE bsis-budat,
qsskz TYPE bsis-qsskz,
END OF zbsis.
DATA: BEGIN OF zt059z OCCURS 0,
land1 TYPE t059z-land1,
witht TYPE t059z-witht,
wt_withcd TYPE t059z-wt_withcd,
qscod TYPE t059z-qscod,
qsatz TYPE t059z-qsatz,
hkont TYPE bsis-hkont,
belnr TYPE bsis-belnr,
END OF zt059z.
DATA: BEGIN OF it_faglflexa OCCURS 0, "added by vincy
ryear TYPE faglflexa-ryear,
docnr TYPE faglflexa-docnr,
rldnr TYPE faglflexa-rldnr,
rbukrs TYPE faglflexa-rbukrs,
docln TYPE faglflexa-docln,
prctr TYPE faglflexa-prctr,
END OF it_faglflexa.
Final Table***
TYPES :BEGIN OF wa1_final,
belnr TYPE ekbe-belnr,
fi_docno TYPE bseg-belnr,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
rate TYPE konv-kbetr,
ebelp TYPE ekbe-ebelp,
ebeln TYPE ekbe-ebeln,
mwskz TYPE bseg-mwskz,
gjahr TYPE ekbe-gjahr,
awkey(20) TYPE c,
exnum TYPE j_1iexcdtl-exnum,
exdat TYPE j_1iexcdtl-exdat,
lifnr TYPE j_1iexcdtl-lifnr,
matnr TYPE j_1iexcdtl-matnr ,
maktx TYPE j_1iexcdtl-maktx ,
capind TYPE string,
exbas TYPE j_1iexcdtl-exbas,
exbed TYPE j_1iexcdtl-exbed,
ecs TYPE j_1iexcdtl-ecs,
werks TYPE j_1iexcdtl-werks,
ritem1 TYPE j_1iexcdtl-ritem1,
rdoc1 TYPE j_1iexcdtl-rdoc1,
docyr TYPE j_1iexcdtl-docyr,
name1 TYPE lfa1-name1,
ktokk TYPE lfa1-ktokk,
fwbas TYPE bseg-fwbas ,
vat_per TYPE konv-kbetr,
vat_amt TYPE bseg-pswbt,
cst_per TYPE konv-kbetr,
cst_amt TYPE bseg-pswbt,
shcess_amt TYPE bseg-pswbt,
gl_accnt TYPE bseg-hkont,
gl_desc TYPE skat-txt50,
wctglacc TYPE bseg-hkont,
wctamt TYPE bseg-dmbtr,
taxcode TYPE t059z-wt_withcd,
taxperc TYPE t059z-qsatz,
total_value TYPE bseg-wrbtr,
total_value1 TYPE bseg-wrbtr,
excise_tax TYPE bseg-wrbtr,
excise TYPE bseg-wrbtr,
set_off TYPE bseg-wrbtr,
inventorised TYPE konv-kawrt,
cond_type TYPE konv-kschl,
cond_type2 TYPE konv-kschl,
description(20) TYPE c,
service_tax TYPE bseg-wrbtr,
service_ecess TYPE bseg-wrbtr,
service_shcess TYPE bseg-wrbtr, "vincy on 31.01.08
END OF wa1_final.
DATA :it2_ekbe TYPE TABLE OF wa1_ekbe WITH HEADER LINE,
it_ekbe TYPE TABLE OF wa1_ekbe WITH HEADER LINE,
it1_ekbe TYPE TABLE OF wa2_ekbe WITH HEADER LINE WITH KEY ebelp ebeln,
it_j_1iexcdtl TYPE TABLE OF wa1_j_1iexcdtl WITH HEADER LINE WITH KEY rdoc1 ritem1,
it_lfa1 TYPE TABLE OF wa1_lfa1 WITH HEADER LINE WITH KEY lifnr,
it_lfa2 TYPE TABLE OF wa1_lfa1 WITH HEADER LINE WITH KEY lifnr,
it_bkpf TYPE TABLE OF wa1_bkpf WITH HEADER LINE,
it_bseg TYPE TABLE OF wa1_bseg WITH HEADER LINE WITH KEY
bukrs belnr gjahr ktosl shkzg koart,
it1_bseg TYPE TABLE OF wa1_bseg WITH HEADER LINE WITH KEY
bukrs belnr gjahr ktosl shkzg koart,
it_tax TYPE TABLE OF wa1_tax WITH HEADER LINE WITH KEY awkey ,
it_ekexclf TYPE TABLE OF wa1_ekexclf WITH HEADER LINE,
it_final TYPE TABLE OF wa1_final WITH HEADER LINE,
it_final1 TYPE TABLE OF wa1_final WITH HEADER LINE, "vincy
wa_ekbe TYPE wa1_ekbe,
wa1_ekbe TYPE wa2_ekbe,
wa_j_1iexcdtl TYPE wa1_j_1iexcdtl,
wa_lfa1 TYPE wa1_lfa1,
wa_lfa2 TYPE wa1_lfa1,
wa_bkpf TYPE wa1_bkpf,
wa_bseg TYPE wa1_bseg,
wa_tax TYPE wa1_tax,
wa_ekexclf TYPE wa1_ekexclf,
PLANT TYPE WERKS_D,
wa_final TYPE wa1_final.
DATA: it_konv TYPE konv OCCURS 0 WITH HEADER LINE ,
wa_konv TYPE konv,
invent TYPE p DECIMALS 4,
invent1 TYPE konv-kawrt.
DATA:d1 TYPE konv-kposn,
d2 TYPE ekbe-ebelp.
DATA: v_belnr TYPE ekbe-belnr,
v_gjahr TYPE ekbe-gjahr,
v_awkey(20) TYPE c,
idx TYPE sy-tabix.
**********by vincy on 12.01.07***********
DATA: BEGIN OF it_ekko OCCURS 0,
ebeln LIKE ekko-ebeln,
bukrs LIKE ekko-bukrs,
bsart LIKE ekko-bsart,
lifnr LIKE ekko-lifnr,
belnr LIKE ekbe-belnr,
END OF it_ekko.
DATA: BEGIN OF it_ekpo OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
txz01 LIKE ekpo-txz01,
END OF it_ekpo.
DATA: BEGIN OF it_lfa1v OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
END OF it_lfa1v.
DATA: BEGIN OF s_prctr OCCURS 0,
low LIKE faglflexa-prctr,
END OF s_prctr.
DATA: it_bsegv TYPE TABLE OF wa1_bseg WITH HEADER LINE.
DATA: it_konv1 LIKE konv OCCURS 0 WITH HEADER LINE.
DATA:cnt TYPE i,
awkey1(250).
DATA: LIFNR TYPE LIFNR,
NAME TYPE NAME1_GP,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKTX,
TAX_TOT TYPE KWERT.
***********end of changes by vincy ************
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks1 FOR ekbe-werks,
s_budat1 FOR ekbe-budat,
s_fiscal FOR ekbe-gjahr,
s_lifnr FOR lfa1-lifnr.
SELECTION-SCREEN END OF BLOCK b1.
**"changes being by nahid on 16.04.2008
PARAMETERS : excel AS CHECKBOX DEFAULT 'X'.
PARAMETERS: infile LIKE rlgrap-filename.
DATA : zfile TYPE string.
**"changes ended by nahid on 16.04.2008
AT SELECTION-SCREEN.
IF s_werks1 IS INITIAL.
MESSAGE 'Please Enter Plant details' TYPE 'E'.
ENDIF.
IF s_budat1 IS INITIAL.
MESSAGE 'Please Enter Posting date' TYPE 'E'.
ENDIF.
IF s_fiscal IS INITIAL.
MESSAGE 'Please Enter Fiscal Year' TYPE 'E'.
ENDIF.
*start change by nahid on 16.4.08
AT SELECTION-SCREEN ON VALUE-REQUEST FOR infile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = infile
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
zfile = infile.
*end change by nahid on 16.4.08
START-OF-SELECTION.
plant = s_werks1-low.
MODIFIED FOR RUDRAPUR BY ASHOK.CH ON 13.03.2008
IF PLANT NE 'RD01'.
PERFORM get_data.
PERFORM get_zpsr. "vincy
ENDIF.
IF PLANT EQ 'RD01'.
PERFORM get_data1.
ENDIF.
*END OF MODIFICATION ON 13.03.2008
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*start chng by nahid on 16.4.08
IF excel = 'X'.
IF NOT infile IS INITIAL.
PERFORM excel_data.
ELSE.
MESSAGE e000(0) WITH 'Please Enter the File Path'.
ENDIF.
ENDIF.
*end by nahid on 16.4.08
*& Form get_data
FORM get_data .
SELECT belnr budat menge matnr ebelp ebeln gjahr lfbnr lfpos bldat REEWR FROM ekbe INTO
TABLE it_ekbe
WHERE werks IN s_werks1 AND
(bewtp EQ 'Q' OR bewtp EQ 'N') AND
bewtp IN ('Q' , 'N') AND "added N by vincy on 6.07.2008
budat IN s_budat1 AND
gjahr IN s_fiscal .
IF sy-subrc = 0. "for 1st ekbe
IF it_ekbe[] IS NOT INITIAL.
SELECT exnum exdat lifnr matnr maktx capind exbas exbed ecs werks
ritem1 rdoc1 docyr bedinv ecsinv EXADDINV1 exaddtax1 rdoc2 ritem2 menge
FROM j_1iexcdtl INTO TABLE it_j_1iexcdtl FOR ALL ENTRIES IN it_ekbe
WHERE rdoc1 = it_ekbe-ebeln
AND ritem1 = it_ekbe-ebelp AND
lifnr IN s_lifnr.
ENDIF.
IF it_j_1iexcdtl[] IS NOT INITIAL.
SELECT name1 ktokk werks lifnr FROM lfa1 INTO
TABLE it_lfa1 FOR ALL ENTRIES IN it_j_1iexcdtl
WHERE lifnr = it_j_1iexcdtl-lifnr.
ENDIF.
LOOP AT it_ekbe INTO wa_ekbe.
wa1_ekbe-belnr = wa_ekbe-belnr.
wa1_ekbe-budat = wa_ekbe-budat.
wa1_ekbe-menge = wa_ekbe-menge.
wa1_ekbe-ebelp = wa_ekbe-ebelp.
wa1_ekbe-ebeln = wa_ekbe-ebeln.
wa1_ekbe-gjahr = wa_ekbe-gjahr.
wa1_ekbe-matnr = wa_ekbe-matnr.
wa1_ekbe-lfbnr = wa_ekbe-lfbnr.
wa1_ekbe-lfpos = wa_ekbe-lfpos.
wa1_ekbe-bldat = wa_ekbe-bldat.
v_belnr = wa_ekbe-belnr.
v_gjahr = wa_ekbe-gjahr.
CONCATENATE v_belnr v_gjahr INTO v_awkey.
wa1_ekbe-awkey = v_awkey.
APPEND wa1_ekbe TO it1_ekbe.
CLEAR :wa_ekbe.
ENDLOOP.
************changes by vincy on 29.05.08 for 'FB08' and 'FB60'**************
LOOP AT s_werks1.
IF s_werks1-low = 'KN01'.
s_prctr-low = 'MUKNHSTM'.
ELSEIF
s_werks1-low = 'NS01'.
s_prctr-low = 'MUNSKSTM'.
ELSEIF
s_werks1-low = 'RD01'.
s_prctr-low = 'MURDPSTM'.
ENDIF.
APPEND s_prctr.
ENDLOOP.
SELECT bukrs belnr gjahr budat tcode awkey FROM bkpf INTO TABLE it_bkpf
WHERE bukrs = 'MU51' AND
gjahr IN s_fiscal AND
budat IN s_budat1 AND
( tcode = 'FB60' OR tcode = 'FB08' ).
IF it_bkpf[] IS NOT INITIAL.
SELECT ryear docnr rldnr rbukrs docln prctr FROM faglflexa INTO TABLE it_faglflexa
FOR ALL ENTRIES IN it_bkpf WHERE rbukrs = 'MU51' AND
ryear = it_bkpf-gjahr AND
docnr = it_bkpf-belnr.
ENDIF.
LOOP AT it_faglflexa.
READ TABLE s_prctr WITH KEY low = it_faglflexa-prctr.
IF sy-subrc <> 0.
DELETE it_faglflexa.
ENDIF.
CLEAR: it_faglflexa, s_prctr.
ENDLOOP.
**************************end of change*************************************
IF it1_ekbe[] IS NOT INITIAL.
SELECT bukrs belnr gjahr budat tcode awkey FROM bkpf APPENDING
TABLE it_bkpf FOR ALL ENTRIES IN it1_ekbe
WHERE bukrs = 'MU51' AND
gjahr IN s_fiscal AND
awkey = it1_ekbe-awkey.
ENDIF.
IF sy-subrc = 0. "bkpf
IF it_bkpf[] IS NOT INITIAL.
SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
FROM bseg INTO TABLE it1_bseg FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-belnr AND
gjahr = it_bkpf-gjahr AND
bukrs = it_bkpf-bukrs AND
( bschl = '21' ) AND
lifnr IN s_lifnr. "added 21 for miro cancelation
IF it1_bseg[] IS NOT INITIAL.
SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
FROM bseg INTO TABLE it_bseg FOR ALL ENTRIES IN it1_bseg
WHERE belnr = it1_bseg-belnr AND
gjahr = it1_bseg-gjahr AND "changed it_bkpf to it1_bseg
bukrs = it1_bseg-bukrs .
LOOP AT it_bseg.
it_bseg-wrbtr = it_bseg-wrbtr * -1.
it_bseg-fwbas = it_bseg-fwbas * -1.
it_bseg-pswbt = it_bseg-pswbt * -1.
it_bseg-flag_21 = 'X'.
MODIFY it_bseg.
CLEAR it_bseg.
ENDLOOP.
SELECT name1 ktokk werks lifnr FROM lfa1 INTO
TABLE it_lfa2 FOR ALL ENTRIES IN it1_bseg
WHERE lifnr = it1_bseg-lifnr.
ENDIF.
REFRESH it1_bseg.
SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
FROM bseg INTO TABLE it1_bseg FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-belnr AND
gjahr = it_bkpf-gjahr AND
bukrs = it_bkpf-bukrs AND
( bschl = '31' ) AND "added bschl and lifnr by vincy
lifnr IN s_lifnr.
IF it1_bseg[] IS NOT INITIAL.
SELECT name1 ktokk werks lifnr FROM lfa1 APPENDING
TABLE it_lfa2 FOR ALL ENTRIES IN it1_bseg
WHERE lifnr = it1_bseg-lifnr.
SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
FROM bseg APPENDING TABLE it_bseg FOR ALL ENTRIES IN it1_bseg
WHERE belnr = it1_bseg-belnr AND
gjahr = it1_bseg-gjahr AND "changed it_bkpf to it1_bseg
bukrs = it1_bseg-bukrs AND
bschl <> '35'. "added bschl to avoid vendor paymnt
ENDIF.
SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr ktosl koart shkzg mwskz qsskz dmbtr lifnr
FROM bseg APPENDING CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-belnr AND
gjahr = it_bkpf-gjahr AND
lifnr IN s_lifnr AND
bukrs = it_bkpf-bukrs AND qsskz IN ('WI', 'WJ').
ENDIF.
ENDIF.
SORT it_bseg BY belnr buzei.
IF NOT it_bseg[] IS INITIAL.
SELECT saknr spras txt50 FROM skat
INTO TABLE iskat
FOR ALL ENTRIES IN it_bseg
WHERE saknr = it_bseg-hkont AND spras = 'EN'.
SELECT bukrs hkont augdt augbl zuonr gjahr belnr buzei budat qsskz FROM bsis
INTO TABLE zbsis
FOR ALL ENTRIES IN it_bseg
WHERE bukrs = 'MU51' AND hkont = it_bseg-hkont
AND belnr = it_bseg-belnr AND gjahr = s_fiscal
AND budat IN s_budat1.
ENDIF.
LOOP AT it_bseg.
READ TABLE zbsis WITH KEY hkont = it_bseg-hkont.
IF sy-subrc = 0.
it_bseg-qsskz = zbsis-qsskz.
MODIFY it_bseg.
ENDIF.
CLEAR: it_bseg,zbsis.
ENDLOOP.
LOOP AT zt059z.
LOOP AT it_bseg WHERE qsskz = zt059z-wt_withcd.
zt059z-hkont = it_bseg-hkont.
zt059z-belnr = it_bseg-belnr.
MODIFY zt059z.
CLEAR: it_bseg,zt059z.
ENDLOOP.
ENDLOOP.
CLEAR: wa_bkpf.
*******Filling Wa.
LOOP AT it_bkpf INTO wa_bkpf. "changes by vincy on 14.04.2008
LOOP AT it1_ekbe INTO wa1_ekbe .
READ TABLE it_bkpf INTO wa_bkpf
WITH KEY awkey = wa1_ekbe-awkey.
wa_tax-belnr = wa_bkpf-belnr.
wa_tax-gjahr = wa_bkpf-gjahr.
wa_tax-bukrs = wa_bkpf-bukrs.
wa_tax-awkey = wa_bkpf-awkey.
wa_tax-ebelp = wa1_ekbe-ebelp.
CLEAR: wa_bseg,wa_skat.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr INTO wa_bseg.
IF sy-subrc = 0.
wa_tax-fi_docno = wa_bseg-belnr.
wa_tax-mwskz = wa_bseg-mwskz.
CLEAR: wa_bseg.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'JP4' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-gl_accnt = wa_bseg-hkont.
READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
IF sy-subrc = 0.
wa_tax-gl_desc = wa_skat-txt50.
ENDIF.
wa_tax-set_off = wa_bseg-wrbtr.
wa_tax-fwbas = wa_bseg-fwbas.
wa_tax-cst_amt = wa_bseg-pswbt.
wa_tax-description = 'CST CG Sett off'.
wa_tax-cond_type = 'JVCS'.
ENDIF.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'VS1' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-fwbas = wa_bseg-fwbas.
ENDIF.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'JP7' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-gl_accnt = wa_bseg-hkont.
READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
IF sy-subrc = 0.
wa_tax-gl_desc = wa_skat-txt50.
ENDIF.
wa_tax-set_off = wa_bseg-wrbtr.
wa_tax-fwbas = wa_bseg-fwbas.
wa_tax-vat_amt = wa_bseg-pswbt.
wa_tax-description = 'VAT CG Sett off'.
wa_tax-cond_type = 'JVCD'.
ENDIF.
CLEAR wa_bseg.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'JP5' INTO wa_bseg.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
hkont = '0002868001' INTO wa_bseg. "vat changed for V0 tax code
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-gl_accnt = wa_bseg-hkont.
READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
IF sy-subrc = 0.
wa_tax-gl_desc = wa_skat-txt50.
ENDIF.
wa_tax-vat_amt = wa_bseg-pswbt.
wa_tax-set_off = wa_bseg-wrbtr.
wa_tax-cond_type = 'JVRD'.
wa_tax-fwbas = wa_bseg-fwbas.
wa_tax-description = 'VAT RM Set off'.
ENDIF.
CLEAR: wa_bseg,wa_skat.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
shkzg = 'H'
koart = 'K'
INTO wa_bseg.
IF sy-subrc = 0.
wa_tax-total_value = wa_bseg-wrbtr.
ENDIF.
START OF MODIFICATION BY ASHOK.CH ON 08.02.2008
service_tax
CLEAR wa_bseg.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'VS8' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-gl_accnt = wa_bseg-hkont.
READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
IF sy-subrc = 0.
wa_tax-gl_desc = wa_skat-txt50.
ENDIF.
wa_tax-service_tax = wa_bseg-wrbtr.
wa_tax-description = 'Service Tax'.
wa_tax-cond_type = 'JSRT'.
ENDIF.
service_ecess
CLEAR: wa_bseg,wa_skat.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'VS9' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-service_ecess = wa_bseg-wrbtr.
ENDIF.
**********changes by vincy on 31.01.08*********************
service_shcess
CLEAR: wa_bseg.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr
flag = ''
ktosl = 'VSE' INTO wa_bseg.
IF sy-subrc = 0.
wa_bseg-flag = 'X'.
MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
wa_tax-service_shcess = wa_bseg-wrbtr.
ENDIF.
*************************end of changes***********************
END OF MODIFICATION ON 08.02.2008
APPEND wa_tax TO it_tax.
ENDIF.
CLEAR :wa_tax,wa_bseg,wa_bkpf,wa_skat.
ENDLOOP.
CLEAR wa1_ekbe.
LOOP AT it1_ekbe INTO wa1_ekbe.
READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
WITH KEY rdoc1 = wa1_ekbe-ebeln
ritem1 = wa1_ekbe-ebelp.
*New query added by Nilesh
READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
WITH KEY rdoc1 = wa1_ekbe-lfbnr
ritem2 = wa1_ekbe-lfpos.
READ TABLE it_bkpf INTO wa_bkpf
WITH KEY awkey = wa1_ekbe-awkey.
IF sy-subrc = 0.
READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
belnr = wa_bkpf-belnr
gjahr = wa_bkpf-gjahr.
IF sy-subrc = 0.
wa_ekexclf-belnr = wa1_ekbe-belnr.
wa_ekexclf-budat = wa1_ekbe-budat.
wa_ekexclf-menge = wa1_ekbe-menge.
wa_ekexclf-ebelp = wa1_ekbe-ebelp.
wa_ekexclf-ebeln = wa1_ekbe-ebeln.
wa_ekexclf-gjahr = wa1_ekbe-gjahr.
wa_ekexclf-awkey = wa1_ekbe-awkey.
wa_ekexclf-lifnr = it_bseg-lifnr.
wa_ekexclf-matnr = it_bseg-matnr .
READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl "for records for which either rdoc1 or matnr
WITH KEY rdoc2 = wa1_ekbe-lfbnr "not maintained in ekbe by vincy on 16.06.08
menge = wa1_ekbe-menge.
IF sy-subrc <> 0 .
READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
WITH KEY rdoc1 = wa1_ekbe-ebeln
exdat = wa1_ekbe-bldat
matnr = wa1_ekbe-matnr
menge = wa1_ekbe-menge.
ENDIF.
READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
WITH KEY rdoc1 = wa1_ekbe-ebeln
ritem1 = wa1_ekbe-ebelp.
IF sy-subrc = 0.
wa_ekexclf-belnr = wa1_ekbe-belnr.
wa_ekexclf-budat = wa1_ekbe-budat.
wa_ekexclf-menge = wa1_ekbe-menge.
wa_ekexclf-ebelp = wa1_ekbe-ebelp.
wa_ekexclf-ebeln = wa1_ekbe-ebeln.
wa_ekexclf-gjahr = wa1_ekbe-gjahr.
wa_ekexclf-awkey = wa1_ekbe-awkey.
wa_ekexclf-exnum = wa_j_1iexcdtl-exnum.
wa_ekexclf-exdat = wa_j_1iexcdtl-exdat.
wa_ekexclf-lifnr = wa_j_1iexcdtl-lifnr.
wa_ekexclf-matnr = wa_j_1iexcdtl-matnr .
wa_ekexclf-maktx = wa_j_1iexcdtl-maktx .
wa_ekexclf-capind = wa_j_1iexcdtl-capind.
wa_ekexclf-exbas = wa_j_1iexcdtl-exbas.
wa_ekexclf-exbed = wa_j_1iexcdtl-exbed.
wa_ekexclf-ecs = wa_j_1iexcdtl-ecs.
wa_ekexclf-werks = wa_j_1iexcdtl-werks.
wa_ekexclf-ritem1 = wa_j_1iexcdtl-ritem1.
wa_ekexclf-rdoc1 = wa_j_1iexcdtl-rdoc1.
wa_ekexclf-docyr = wa_j_1iexcdtl-docyr.
wa_ekexclf-exaddtax1 = wa_j_1iexcdtl-exaddtax1.
IF it_bseg-flag_21 = 'X'.
wa_ekexclf-exbas = wa_ekexclf-exbas * -1.
ENDIF.
MODIFIED BY ASHOK.CH ON 08.03.2008
IF wa_j_1iexcdtl-WERKS NE 'RD01' .
wa_ekexclf-exbed = wa_j_1iexcdtl-exbed.
wa_ekexclf-ecs = wa_j_1iexcdtl-ecs.
wa_ekexclf-exaddtax1 = wa_j_1iexcdtl-exaddtax1.
IF it_bseg-flag_21 = 'X'.
wa_ekexclf-exbed = wa_ekexclf-exbed * -1.
wa_ekexclf-ecs = wa_ekexclf-ecs * -1.
wa_ekexclf-exaddtax1 = wa_ekexclf-exaddtax1 * -1.
ENDIF.
ELSE.
wa_ekexclf-exbed = wa_j_1iexcdtl-BEDINV.
wa_ekexclf-ecs = wa_j_1iexcdtl-ecsINV.
wa_ekexclf-exaddtax1 = wa_j_1iexcdtl-exaddINV1.
ENDIF.
END IF MODIFICATION ON 08.03.2008
APPEND wa_ekexclf TO it_ekexclf.
CLEAR :wa_lfa1,wa_j_1iexcdtl,wa1_ekbe.
ENDIF.
READ TABLE it_lfa2 INTO wa_lfa2
WITH KEY lifnr = wa_ekexclf-lifnr.
IF sy-subrc = 0.
wa_ekexclf-name1 = wa_lfa2-name1.
wa_ekexclf-ktokk = wa_lfa2-ktokk.
ENDIF.
APPEND wa_ekexclf TO it_ekexclf.
ENDIF.
ENDIF.
CLEAR :wa_lfa1,wa_j_1iexcdtl,wa1_ekbe,wa_lfa2,wa_ekexclf.
ENDLOOP.
CLEAR wa_ekexclf.
LOOP AT it_ekexclf INTO wa_ekexclf.
wa_final-belnr = wa_ekexclf-belnr.
wa_final-budat = wa_ekexclf-budat.
wa_final-menge = wa_ekexclf-menge.
wa_final-ebelp = wa_ekexclf-ebelp.
wa_final-ebeln = wa_ekexclf-ebeln.
wa_final-gjahr = wa_ekexclf-gjahr.
wa_final-awkey = wa_ekexclf-awkey.
wa_final-exnum = wa_ekexclf-exnum.
wa_final-exdat = wa_ekexclf-exdat.
wa_final-lifnr = wa_ekexclf-lifnr.
wa_final-matnr = wa_ekexclf-matnr .
wa_final-maktx = wa_ekexclf-maktx .
wa_final-shcess_amt = wa_ekexclf-exaddtax1.
IF wa_ekexclf-capind = 'C'.
wa_final-capind = 'Consumables'.
ENDIF.
IF wa_ekexclf-capind = 'A'.
wa_final-capind = 'Assets'.
ENDIF.
IF wa_ekexclf-capind = 'T'.
wa_final-capind = 'Tools'.
ENDIF.
IF wa_ekexclf-capind = ''.
wa_final-capind = 'Raw Material'.
ENDIF.
IF wa_ekexclf-capind = 'N'.
wa_final-capind = 'Non Cenvatable'.
ENDIF.
IF wa_ekexclf-capind NE 'C' AND wa_ekexclf-capind NE 'A' AND
wa_ekexclf-capind NE '' AND wa_ekexclf-capind NE 'N'.
wa_final-capind = wa_ekexclf-capind.
ENDIF.
wa_final-exbas = wa_ekexclf-exbas.
wa_final-exbed = wa_ekexclf-exbed.
wa_final-ecs = wa_ekexclf-ecs.
wa_final-werks = wa_ekexclf-werks.
wa_final-ritem1 = wa_ekexclf-ritem1.
wa_final-rdoc1 = wa_ekexclf-rdoc1.
wa_final-docyr = wa_ekexclf-docyr.
wa_final-name1 = wa_ekexclf-name1.
wa_final-ktokk = wa_ekexclf-ktokk.
wa_final-excise = wa_final-exbas + wa_final-exbed + wa_final-ecs + wa_final-shcess_amt.
CLEAR :wa_tax.Hi ,
I think you are using the redundant selects to fetch the data from BSEG.
First select all the data into an internal table based on bkpf.
Now you can distribute the data into whatever tables you want using the loop,read-binary search and append statements..
Loop at it_bseg.
read it_bseg where
xxxxx
xxxxx
binary search.
append wa to it2_bseg.
endloop
This avoid several database fetches..
Thank you.. -
How to get Material column in FBL5N
Hi Experts,
Our client has a requirement where they want to have material as a column in FBL5N report. Using the layout we are able to add material column. However, it is blank for all line items. We understand that in FBL5N, we get FI documents and billing document may have more than one line item with more than one material.
There is a SAP note in this regard, note number is 215798. This note ensures special fields in table T021S are consistent with the structure RFPOSXEXT. This setting is already available as per our technical team.
Request you to help us find what is missing.
Regards,
VijayDear,
Please check below information found on SDN. Hope this will helpful for your requirements.
In general if you want to inlude a special field to the line item display, you have tp proceed as described in the note 215798. These
fields have to be defined in transaction OBVU. Then the special field should exist in structure RFPOSXEXT. The program RFPOSXEXTEND eliminates inconsistency in RFPOSXEXT and program BALVBUFDEL eliminates buffer inconsistency.
However these fields are different from the normal special fields:
For the FBL*N you have defined the 'Material Number (BSEG-MATNR), Quantity (BSEG-MENGE) and Purchase (BSEG-EBELN)' as a special field.
Such a special field is not read from the index tables (BSIK/BSAK) like the other ones, it directly gets read from the BSEG or BKPF table. If you check all items for the Company Code xxxx now in the FB*1N nowhere is the 'Material Number, Quantity and Purchase' displayed.
But this is absolutely correct, as also in the BSEG table there is no material number, quantity and purchase updated for the 'Vendor' line items of all documents.
Reason:
Since Release 3.0, several purchase orders can be offset in one invoice. As a result, different purchasing document numbers (BSEG-EBELN) can be contained in the different G/L account line items. As a result, it is no longer possible to enter a unique purchasing document number in the customer/vendor line item. Field BSEG-EBELN is not filled in the vendor line item and therefore cannot be displayed in the line item display for customers/vendors. Please also check note 152335.
So if you check you will see that in the vendor line item none of these fields are filled so they are not in the table BSEG. That is the reason why the value is not displayed because is not filled in the table which gets read. So the values of these fields cannot be shown in FBL1N.
In the FI normally the Quantity is not a 'real' important field, as it is more related to the MM area. But in the old 'Profit Center Accounting' and the old' Special Ledger' the field has been important. As the same logic of these areas to 'store' the Quantity is also used in the NewG/L the field get only filled in the line, where it make 'sense' because only in the 'goods receipt'
lines a 'real' Quantity is posted to the system.
So as before in the PCA and SL, now also in the NewG/L the Quantity is filled in the correct and important lines and postings.
Transaction FAGLL03 shows the quantity like posted in table FAGLFLEXA. Please have a look at the note 1063198 which explains why the quantity is different in BSEG and FAGLFLEXA.
In FI as standard we would not expect to see VBEL2 populated in FBL*N as this field is not included in BSIS. The reason why SAP designs this way is that sometimes many sales orders are paid by one billing document.
The field billing document 'VBELN' is contained in table BSEG AND in table BSID but NOT in table BSIS.
Same occurs with BSEG-MATNR (material) and BSEG-MENGE (quantity).
In order to display these fields, you will need to create them as special fields:
1)Please create fields BSEG-VBEL2, BSEG-MATNR and BSEG-MENGE as special fields in transaction OBVU (FBL3N >MENU >SETTINGS >SPECIAL FIELDS);
2)SE38->program "BALVBUFDEL"->select indicator "Reset only EUINFO/LTEX" ->run
3)Create a variant in FBLN to include this field (FBLN > SETTINGS > DISPLAY VARIANT > CURRENT... Add the required fields (1-U-VBEL2...)
If they do not come up as a Special Fields in the Hidden Fields list, run RFPOSXEXTEND and wait for a few hours. 1-U-VBEL2... should then be available in the list.
Also check Notes 215798 and 373268.
Please consider that you can display sales,material document and quantity in transaction FBL*N, but only if the field is filled in.
Kindly check in tables BSEG and BSIS if they are updated. Should the same are empty in the data base tables it would be totally
correct if the fields are shown blank in FBL*N.
Regards,
Syed Hussain. -
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 -
The Famous BSEG Fetching...
Hello,
Iam working on an ALV Report which has the fields Material Number(BSEG_MATNR), Company Code(BSIS-BUKRS) and G/L account (BSIS-HKONT) on the selection screen.
Here Company code and G/L account are the mandatory fields.
When the user enters Copany code and G/L account, the program goes and fetches data from BSIS by passing BUKRS and HKONTS.(In My case , it returns around 100,000 records). And when the program goes to BSEG (with providing all the key fields it got from BSIS) for MATNR, its taking almost 5 minuts to fetch the data.
The program fetches data from BSEG using select single in a loop.(I even tried doing for all entries but it takes almost same time).
So what are my alternatinve options here to get the MATNR quickly from BSEG. Now its taking too long time even after passing the key fields. And moreover, even if user passes the MATNR on the selection screen, there is no use. It still need to fetch 100,000 records from BSIS and look for MATNR in BSEG for all those records.
whats the best way to fetch MATNR if you have records from BSIS?Hi Ramesh,
Is your requirement retreiving from day 1? Your selection is a bit unrestricted, try adding more parameters like fical year (GJAHR), Business Area (GSBER) to filter it more. Or try extracting header first (BKPF) using date parameters like document date or posting date, then use these entries to search BSEG.
Hope this helps.
Best regards,
JP -
Item text is not getting updated in Payment document generated through F110
Hi all,
After generating the payment document via Transaction Code u2013 F110, system is not updating the Text field in the payment document with the text that we have entered in the Invoice (MIRO or FI Invoice).
While processing the document via transaction code u2013 F110, in the layout shown for the Invoices to be considered for payment (screen of u201CEdit Proposalu201D), text is not getting updated. When we pressed F1 at the Text field (Which is blank) we came to know that it is a u201CItem Textu201D with u201CTable u2013 REGUEu201D / u201CField u2013 SGTXTu201D.
In BSEG (SGTXT field) as well as BSIK (SGTXT field) we are getting the Invoice document with the text maintained in it via MIRO or FI invoice.
But while processing the invoices through Tcode - F110, in the layout of Edit Proposal (Table - REGUE / Field - SGTXT) we are not getting the u201CText fieldu201D but getting the other data such as Doc. No.( Table - REGUE / Field - BELNR), Fiscal Year (Table - REGUE / Field - GJAHR) etc for processing the proposal which is getting shown in BSEG as well as BSIK.
In case of manual payment (F-53) we can input the text manually hence that will get updated in payment document but this thing is not possible with F110.
Can anybody guide me on getting the ItemText (Not Doc. Header text) in FI payment document after F110 execution?
Regards,
ShridharHi Suresh,
Thanks for the prompt reply. We will be obliged if you guide us in that respect since F110 is a Std. SAP code.
Have you refer OSS before arriving at the conclusion of developing ABAP program since the Item Text is a std. field of Std. Tcode - F110. Same should had been get updated while making the payment in reference to the Invoice which haves item text in it ?
Regards
Shridhar
FICO -
Taking time to fetch records from BSEG
Hi all,
When iam fetching wrbtr,augdt,zterm fields from BSEG table by passing VBELN and BUKRS it is taking lot of time to get.My query goes like this
select vbeln wrbtr augdt zterm from bseg into table t_bsegtab for all
entries in t_vtab where bukrs = p_bukrs and
vbeln = t_vtab-vbeln.
Is there any wrong in statement.If not what is the possible solution for that.
regards
kiranHi,
As BSEG is a cluster table and has open/close item details of Vendor, Customer & GL account, as far as possible avoid quering BSEG instead use the relevant tables to get the data, BSEG has the combination of following tables,
BSID & BSAD --> Customer Accounting details
BSIK & BSAK --> Vendor Accounting details
BSAS & BSIS --> G/L Account details
If your requirement is to get the open/close items for Vendor, access BSIK & BSAK tables by passing the key fields in the where condition.
Hope this helps, get back for further clarifications,
Rgds, -
Regarding performance tuning for BSEG & BKPF table data fetch
Hi Friends:
Plz see the below select queries. This is really impacting the performance of my report. Plz suggest the steps to increase the performance of the report.Points will be rewarded.
Thanks:
FORM GET_DATA .
Selecting the Document number from BSEG table
SELECT BELNR BUKRS FROM BSEG INTO TABLE L_DOC_NO
WHERE BUKRS IN S_BUKRS
AND GJAHR = P_GJAHR
AND HKONT IN S_SAKNR.
IF SY-SUBRC <> 0.
MESSAGE ID 'ZTFI' TYPE 'E' NUMBER 006.
ENDIF.
CLEAR L_DOC_NO.
SORT L_DOC_NO BY BELNR.
Selecting the Document Number Based on the selection-screen.
SELECT BELNR BUKRS BUDAT CPUDT BLART MONAT FROM BKPF INTO TABLE
L_BKPF
FOR ALL ENTRIES IN L_DOC_NO
WHERE BUKRS = L_DOC_NO-BUKRS AND
BELNR = L_DOC_NO-BELNR AND
GJAHR = P_GJAHR AND
BUDAT IN S_BUDAT AND
MONAT IN S_MONAT.
IF SY-SUBRC <> 0.
MESSAGE ID 'ZTFI' TYPE 'E' NUMBER 006.
ENDIF.
*Fetch the Line Items
SORT L_BKPF BY BELNR.
SELECT BELNR BUKRS BUZEI HKONT SHKZG WRBTR FROM BSEG INTO TABLE
L_BSEG
FOR ALL ENTRIES IN L_BKPF
WHERE BUKRS = L_BKPF-BUKRS
AND BELNR = L_BKPF-BELNR
AND GJAHR = P_GJAHR
AND BUZEI BETWEEN '001' AND '999'.Hi,
Let me understand your code first.
The below code (the 2 selects) gets data from BSEG first and then gets data from BKPF table.
"*Selecting the Document number from BSEG table
SELECT BELNR BUKRS FROM BSEG INTO TABLE L_DOC_NO
WHERE BUKRS IN S_BUKRS
AND GJAHR = P_GJAHR
AND HKONT IN S_SAKNR.
IF SY-SUBRC 0.
MESSAGE ID 'ZTFI' TYPE 'E' NUMBER 006.
ENDIF.
CLEAR L_DOC_NO.
SORT L_DOC_NO BY BELNR.
"*Selecting the Document Number Based on the selection-screen.
SELECT BELNR BUKRS BUDAT CPUDT BLART MONAT FROM BKPF INTO TABLE L_BKPF
FOR ALL ENTRIES IN L_DOC_NO
WHERE BUKRS = L_DOC_NO-BUKRS AND
BELNR = L_DOC_NO-BELNR AND
GJAHR = P_GJAHR AND
BUDAT IN S_BUDAT AND
MONAT IN S_MONAT.
IF SY-SUBRC 0.
MESSAGE ID 'ZTFI' TYPE 'E' NUMBER 006.
ENDIF.
The below code, can't you avoid by taking all the fields required on your 1st select on BSEG table?
*Fetch the Line Items
SORT L_BKPF BY BELNR.
SELECT BELNR BUKRS BUZEI HKONT SHKZG WRBTR FROM BSEG INTO TABLE
L_BSEG
FOR ALL ENTRIES IN L_BKPF
WHERE BUKRS = L_BKPF-BUKRS
AND BELNR = L_BKPF-BELNR
AND GJAHR = P_GJAHR
AND BUZEI BETWEEN '001' AND '999'.
Please check the below blog on "Performance of Nested Loops" by Rob Burbank which would be really helpful.
/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops
Hope this helps. Rwd points if helpful.
Thanks,
Balaji -
Link GLPCA Ref doc to BSEG (ABAP Table Logic)
Hi, We are trying to link GLPCA to BSEG via the Reference Doc No in GLPCA. This is to get the reference field in BSEG.
All seems to work well for finance documents, but when we work with GLPCA Sales Doc Types RV the REFDOC Line has the line of the sales doc and not the BSEG Finance Doc. (our Sales Doc # is the same as the invoice). So now the only way we can think of to link GLPCA to BSEG is to go to BSEG by Ref Doc No. and loop through all of the BSEG entries for the document and compare the value to get the correct BSEG line.
Can anyone think of a better way to get the BSEG Line from GLPCA when working with Sales Docs?
Thanks for any help or comments..HI
1 ) Billing Document Number (VBRK u2013 VBELN)
2 ) Accounting document Number (BKPF u2013 BELNR)
VBRK u2013 VBELN AND BKPF u2013 XBLNR BOTH ARE SAME
Rgds
SumaMani -
Hi All,
i want to fetch the KUNNR from BSEG table based on the BELNR. But if we see the BSEG table same same BELNR is having different KUNNR.
based on the KUNNR i want to dislpay the Customer name from KNA1.
so, how do proceed ?.
thanks in advance
manjusha.Lets say u get entries for BSEG in GT_BSEG with "FEBEP-BELNR with BSEG-BELNR." condition.
then 1 simple and effective way is.
sort gt_bseg by kunnr.
loop at gt_bseg into gs_bseg.
at new kunnr.
gs_kunnr-kunnr = gs_bseg-kunnr . "this gs_kunnr work areahas one field only as kunnr
append gs_kunnr to gt_kunnr. " gt_kunnr is table similar to gs_kunnr
clear: gs_kunnr.
endloop.
select kunnr
name1
from KNA1 into table gt_kna1
for all entries in gt_kunnr
where kunnr = gt_kunnr-kunnr.
or
loop at gt_bseg into gs_bseg.
gs_kunnr-kunnr = gs_bseg-kunnr . "this gs_kunnr work areahas one field only as kunnr
collect gs_kunnr to gt_kunnr. " gt_kunnr is table similar to gs_kunnr
clear: gs_kunnr.
endloop.
select kunnr
name1
from KNA1 into table gt_kna1
for all entries in gt_kunnr
where kunnr = gt_kunnr-kunnr. -
Link between bseg accounting doc and excise number in j_1iexchdr
HI All,
I have to get the excise document number(from table J_1IEXCHDR) for the accounting document nos. in BSEG. But I do not know the link between the 2 tables..
plz help me out.
Regards
NiyatiHi
Instead of that Header table use the table J_1IEXCDTL
for getting link with BSEG table
use the table J_1IEXCDTL-RDOC1 and pass BSEG-BELNR
Reward points for useful Answers
Regards
Anji -
To get Merchandise Category(MATKL) Based on Country.
Hi,
I want to get Merchandise Category(MATKL) Based on Country.
I am fetching WERKS
LAND1from t001w into IT_001w.
Getting Distinct MATNR from MARC for all entries in IT_T001w.
Now Getting MATNR
MATKL from MARA for all entries in IT_MARC.
Now looping and getting MATKL and LAND1 in one internal table.
But I have lot of WERKS in One Country so program is taking too much time.
How to Improve my programPerformance ?
Is there any other logic ?
Thanks
KumarHi Anil..
Please find below code and suggest me ...
***Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS : s_land1 FOR t005-land1 NO-EXTENSION NO INTERVALS OBLIGATORY. "Added
*PARAMETER chk AS CHECKBOX DEFAULT 'X'.
PARAMETER p_file LIKE rlgrap-filename NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
****START-OF-SELECTION.
START-OF-SELECTION.
SELECT land1 FROM t005 INTO TABLE it_log_country WHERE land1 IN s_land1.
SELECT land1
filepath FROM zcountry_file INTO TABLE it_file WHERE land1 IN s_land1.
***Get Data from T001w
IF it_file[] IS NOT INITIAL.
SELECT werks
land1 FROM t001w INTO TABLE it_t001w WHERE land1 IN s_land1.
ENDIF.
IF it_t001w[] IS NOT INITIAL.
SORT it_t001w[] BY werks.
***Get Data from MARC
SELECT DISTINCT matnr FROM marc INTO TABLE it_marc
FOR ALL ENTRIES IN it_t001w WHERE
werks = it_t001w-werks.
IF it_marc[] IS NOT INITIAL.
SORT it_marc[] BY matnr.
***Get Data from MARA
SELECT matnr
matkl FROM mara INTO TABLE it_mara FOR ALL ENTRIES IN it_marc
WHERE matnr = it_marc-matnr.
ENDIF.
ENDIF.
IF it_mara[] IS NOT INITIAL.
SORT it_mara[] BY matnr.
***Get Data from T023T
SELECT matkl
wgbez FROM t023t INTO TABLE it_t023t FOR ALL ENTRIES IN it_mara
WHERE matkl = it_mara-matkl AND spras = sy-langu.
SORT it_t023t[] BY matkl.
***Fill Table IT_ITAB based on Country Wise
LOOP AT it_mara INTO wa_mara WHERE matkl <> space.
READ TABLE it_t023t INTO wa_t023t WITH KEY matkl = wa_mara-matkl BINARY SEARCH.
IF sy-subrc = 0.
READ TABLE it_marc INTO wa_marc WITH KEY matnr = wa_mara-matnr BINARY SEARCH..
IF sy-subrc = 0.
READ TABLE it_t001w INTO wa_t001w WITH KEY werks = wa_marc-werks BINARY SEARCH..
IF sy-subrc = 0.
wa_itab-matkl = wa_t023t-matkl.
wa_itab-land1 = s_land1-low. "wa_t001w-land1.
APPEND wa_itab TO it_itab.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
IF it_itab[] IS NOT INITIAL.
SORT it_itab[] BY land1 matkl.
***Delete Duplicate Entries
DELETE ADJACENT DUPLICATES FROM it_itab[] COMPARING land1 matkl.
itab[] = it_itab[].
SORT itab[] BY land1.
***Get MC Hierarchy Levels Based on MATKL
LOOP AT itab.
REFRESH it_wgh.
***Read MC Description
READ TABLE it_t023t INTO wa_t023t WITH KEY matkl = itab-matkl BINARY SEARCH.
IF sy-subrc = 0.
itab-wgbez = wa_t023t-wgbez.
ENDIF.
***FM to Get MC Hierarchy Levels based on MC
CALL FUNCTION 'MERCHANDISE_GROUP_HIER_ART_SEL'
EXPORTING
matkl = itab-matkl
spras = sy-langu
TABLES
o_wgh01 = it_wgh
EXCEPTIONS
no_basis_mg = 1
no_mg_hier = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
**Read MC Hierarchy Levels
DESCRIBE TABLE it_wgh LINES v_lines.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch1 = it_wgh-wwgha.
itab-mchdes1 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch2 = it_wgh-wwgha.
itab-mchdes2 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch3 = it_wgh-wwgha.
itab-mchdes3 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch4 = it_wgh-wwgha.
itab-mchdes4 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch5 = it_wgh-wwgha.
itab-mchdes5 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch6 = it_wgh-wwgha.
itab-mchdes6 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch7 = it_wgh-wwgha.
itab-mchdes7 = it_wgh-wwghb.
v_lines = v_lines - 1.
IF v_lines <> 0.
READ TABLE it_wgh INDEX v_lines.
itab-mch8 = it_wgh-wwgha.
itab-mchdes8 = it_wgh-wwghb.
v_lines = v_lines - 1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
MODIFY itab.
CLEAR : v_lines,wa_t023t.
CLEAR itab.
ENDLOOP.
ENDIF.
Open Application Server & Generate CSV File
IF itab[] IS NOT INITIAL.
SORT itab[] BY land1.
LOOP AT itab .
IF itab1[] IS INITIAL.
CONCATENATE
'MCCODE'
'ARTICLE_TYPE'
'DEPARTMENT'
'DEPARTMENT_DESCRIPTION'
'CLASS'
'CLASS_DESCRIPTION'
'SUBCLASS_1'
'SUBCLASS1_DESCRIPTION'
'SUBCLASS_2'
'SUBCLASS2_DESCRIPTION'
'SUBCLASS_3'
'SUBCLASS3_DESCRIPTION'
'SUBCLASS_4'
'SUBCLASS4_DESCRIPTION'
'SUBCLASS_5'
'SUBCLASS5_DESCRIPTION'
'SUBCLASS_6'
'SUBCLASS6_DESCRIPTION'
'MC_DESCRIPTION'
'DIMENSION_TYPE'
'DIM1'
'DIM2'
'USER_DEFINE_CODE'
'Duration_Type'
'Start_Duration'
'End_Duration'
'Start_Year'
'End_Year'
'MC_Status'
'MC_Type'
'Ref MC'
INTO header SEPARATED BY ','.
MOVE header TO itab1-str.
APPEND itab1.
CLEAR itab1.
ENDIF.
CONCATENATE '"' itab-matkl '"' INTO matkl.
CONCATENATE '"' itab-arttyp '"' INTO arttyp.
CONCATENATE '"' itab-mch1 '"' INTO mch1.
CONCATENATE '"' itab-mchdes1 '"' INTO mchdes1.
CONCATENATE '"' itab-mch2 '"' INTO mch2.
CONCATENATE '"' itab-mchdes2 '"' INTO mchdes2.
CONCATENATE '"' itab-mch3 '"' INTO mch3.
CONCATENATE '"' itab-mchdes3 '"' INTO mchdes3.
CONCATENATE '"' itab-mch4 '"' INTO mch4.
CONCATENATE '"' itab-mchdes4 '"' INTO mchdes4.
CONCATENATE '"' itab-mch5 '"' INTO mch5.
CONCATENATE '"' itab-mchdes5 '"' INTO mchdes5.
CONCATENATE '"' itab-mch6 '"' INTO mch6.
CONCATENATE '"' itab-mchdes6 '"' INTO mchdes6.
CONCATENATE '"' itab-mch7 '"' INTO mch7.
CONCATENATE '"' itab-mchdes7 '"' INTO mchdes7.
CONCATENATE '"' itab-mch8 '"' INTO mch8.
CONCATENATE '"' itab-mchdes8 '"' INTO mchdes8.
CONCATENATE '"' itab-wgbez '"' INTO wgbez.
CONCATENATE '"' itab-dimtyp '"' INTO dimtyp.
CONCATENATE '"' itab-dim1 '"' INTO dim1.
CONCATENATE '"' itab-dim2 '"' INTO dim2.
CONCATENATE '"' itab-usrdc '"' INTO usrdc.
CONCATENATE '"' itab-durtyp '"' INTO durtyp.
CONCATENATE '"' itab-sdur '"' INTO sdur.
CONCATENATE '"' itab-edur '"' INTO edur.
CONCATENATE '"' itab-syr '"' INTO syr.
CONCATENATE '"' itab-eyr '"' INTO eyr.
CONCATENATE '"' itab-mcstatus '"' INTO mcstatus.
CONCATENATE '"' itab-mctyp '"' INTO mctyp.
CONCATENATE '"' itab-wwgda '"' INTO wwgda.
CONCATENATE
matkl
arttyp
mch1
mchdes1
mch2
mchdes2
mch3
mchdes3
mch4
mchdes4
mch5
mchdes5
mch6
mchdes6
mch7
mchdes7
mch8
mchdes8
wgbez
dimtyp
dim1
dim2
usrdc
durtyp
sdur
edur
syr
eyr
mcstatus
mctyp
wwgda
INTO itab1-str SEPARATED BY ','.
APPEND itab1.
CLEAR : matkl,arttyp, mch1, mchdes1,mch2,mchdes2,mch3,mchdes3,mch4,mchdes4,mch5,
mchdes5,mch6,mchdes6,mch7,mchdes7,mch8,mchdes8,wgbez,dimtyp,dim1,dim2,
usrdc,durtyp,sdur,edur,syr,eyr,mcstatus,mctyp,wwgda,itab1.
AT END OF land1.
CLEAR : wa_file,p_file,efile,v_file.
READ TABLE it_file INTO wa_file WITH KEY land1 = itab-land1.
efile = wa_file-filepath.
CONDENSE efile.
CONCATENATE efile 'Merchandise_Category'
sy-datum2(2) sy-datum4(2) sy-datum+6(2)
sy-uzeit(2) sy-uzeit+2(2) '_' itab-land1 '.txt' INTO p_file.
CONCATENATE 'Merchandise_Category'
sy-datum2(2) sy-datum4(2) sy-datum+6(2)
sy-uzeit(2) sy-uzeit+2(2) '_' itab-land1 '.txt' INTO v_file.
IF wa_file-filepath IS INITIAL.
CLEAR p_file.
ENDIF.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ '0'.
LOOP AT itab1.
IF sy-subrc = 0.
TRANSFER itab1-str TO p_file.
ENDIF.
ENDLOOP.
CLOSE DATASET p_file.
Message 'File has been Created at defined Path' type 'I'.
MESSAGE 'File has been Created' TYPE 'S'.
wa_log-land1 = itab-land1.
wa_log-filepath = wa_file-filepath.
wa_log-filename = v_file.
wa_log-flag = 'X'.
APPEND wa_log TO it_log.
CLEAR wa_log.
ELSEIF sy-subrc EQ '8'.
wa_log-land1 = itab-land1.
wa_log-filepath = wa_file-filepath.
wa_log-filename = v_file.
wa_log-flag = 'Y'.
APPEND wa_log TO it_log.
CLEAR wa_log.
ENDIF.
REFRESH itab1.
CLEAR itab1.
ENDAT.
ENDLOOP.
ENDIF.
IF it_log[] IS NOT INITIAL.
WRITE :/5 'Country', 15 'Folder Name', 40 'File Name', 90 'Status'.
LOOP AT it_log INTO wa_log WHERE flag = 'X'.
WRITE :/5 wa_log-land1, 15 wa_log-filepath, 40 wa_log-filename, 90 'Created Successfully'.
ENDLOOP.
SKIP 2.
LOOP AT it_log INTO wa_log WHERE flag = 'Y'.
WRITE :/5 wa_log-land1, 15 wa_log-filepath, 40 wa_log-filename, 90 'NOT Created'.
ENDLOOP.
ENDIF.
SKIP 2.
IF it_log_country[] IS NOT INITIAL.
LOOP AT it_log_country INTO wa_log_country.
READ TABLE itab WITH KEY land1 = wa_log_country-land1.
IF sy-subrc <> 0.
WRITE :/5 'No Data Exists For Country', 35 wa_log_country-land1.
ENDIF.
ENDLOOP.
ENDIF. -
Any functional module to get financial document based on billing document
hi all,
do we have any functional module to get accounting document (bseg-BELNR) based on billing document (bseg-VBELN)?
i have a requirement to retrieve the clearing document (bseg-augcp) & date(bseg-augdt) from BSEG with billing document.
billing document is not a key, so i would like to retrieve the accounting document from any function module and use that to get clearing document (bseg-augcp) & date(bseg-augdt).
thanks.hi all,
i got other option to get this....thanks.
select single * from bkpf
where bukrs = <data>-werks
and AWTYP = 'VBRK'
and AWKEY = billing doc.
if sy-subrc EQ 0.
select single * from bseg
where bukrs = bkpf-bukrs
and belnr = bkpf-belnr
and gjahr = bkpf-gjahr.
if sy-subrc EQ 0.
<data>-AUGDT = bseg-augdt.
<data>-AUGBL = bseg-augbl.
endif.
Maybe you are looking for
-
How can i achieve following results?
Hi Folks, I have data like the following: Doc_no Quantity Date Parent_Doc G2001 -1000 09/01/2010 G2002 -500 10/01/2010 G2003 1200 12/01/2010
-
I feel like this should be simple but it I'm just not grasping it. Say I have this query: SELECT order_number, order_date FROM orders I basically want to pull any order from the last 24 hours. Well this is fairly easy for Tue-Fri but when I run the
-
Hello BI experts, Iam making a Process chain where I need to load the data in to 2 DSOs (say B1 & B2) from DSO A . I have created Transformation and DTP between A - B1 and A - B2 . DSO B1 is required for the year of 2007 and B2 for 2008. Can any
-
Poplet Image on Small Product image
Hello. I wanted to ask if it's possible to have a poplet function on a small product image like the poplets on the large product info. My client's has images of furniture that i had to make small. It would be benefical that the small images would be
-
Hi All, I have some weird issue in which i am trying to image Esprimo C720 desktop. It is working perfectly fine if i create a standalone image via USB and build it. But when i try to PXE boot the same device, it takes ip and boots up after windows s