BAPI_ACC_INVOICE_RECEIPT_POST with bschl
Hi
How to create an invoice by FM BAPI with parameter Posting key?
hi
hope it will help you.
<REMOVED BY MODERATOR>
BAPI_ACC_GL_POSTING_CHECK
CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
EXPORTING
documentheader = w_documentheader
TABLES
accountgl = it_accountgl
currencyamount = it_currencyamount
return = it_return.
Populate the corresponding tables with the data you have.
For the Date do convert it.
PERFORM convert_date USING it_header-bldat
CHANGING w_documentheader-doc_date.
w_documentheader-comp_code = 'z998'
w_documentheader-doc_type = 'SA'
"and fill the respective tables this way .
<b>
BAPI_ACC_GL_POSTING_POST
</b>
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = doc_header
IMPORTING
OBJ_TYPE = l_objtype
* OBJ_KEY =
* OBJ_SYS =
tables
accountgl = t_accountgl
currencyamount = t_curramt
return = t_return
* EXTENSION1 =
Edited by: Alvaro Tejada Galindo on Feb 7, 2008 9:51 AM
Similar Messages
-
How to populate PERNR while posting with BAPI_ACC_INVOICE_RECEIPT_POST
HI,
I am not able to pass Personal Number(PERNR) while posting with BAPI_ACC_INVOICE_RECEIPT_POST. Is there any enhancement which will help to solve this.
<< Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
Regards,
Sini
Edited by: Rob Burbank on Nov 2, 2011 12:04 PMHi,
I am faceing this problem in standard program which is sa AirPlus Invoice Record (LARS).
NEME:RPR_AIRP_LRS_TO_FI.
Please help on this..
Regards,
Srini -
BAPI_ACC_INVOICE_RECEIPT_POST problem with Business place
Hi Experts,
I'm using the the BAPI "BAPI_ACC_INVOICE_RECEIPT_POST" for the F-43 posting, it's working fine. But I have a little problem here, Even though I pass the correct values to the fields "Valuation type" and "Business place" in the posted document I could see only "?".
Could you please some one help me in finding what might be the problem.
Thanks
Nivashhi
hope it will help you.
<REMOVED BY MODERATOR>
BAPI_ACC_GL_POSTING_CHECK
CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
EXPORTING
documentheader = w_documentheader
TABLES
accountgl = it_accountgl
currencyamount = it_currencyamount
return = it_return.
Populate the corresponding tables with the data you have.
For the Date do convert it.
PERFORM convert_date USING it_header-bldat
CHANGING w_documentheader-doc_date.
w_documentheader-comp_code = 'z998'
w_documentheader-doc_type = 'SA'
"and fill the respective tables this way .
<b>
BAPI_ACC_GL_POSTING_POST
</b>
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = doc_header
IMPORTING
OBJ_TYPE = l_objtype
* OBJ_KEY =
* OBJ_SYS =
tables
accountgl = t_accountgl
currencyamount = t_curramt
return = t_return
* EXTENSION1 =
Edited by: Alvaro Tejada Galindo on Feb 7, 2008 9:51 AM -
Uploading Vendor invoices with BAPI_ACC_INVOICE_RECEIPT_POST
I am working on putting together a program that will allow users to upload invoices from a spreadsheet into SAP using BAPI_ACC_INVOICE_RECEIPT_POST. I realize that I will have to calculate the tax before feeding the information into the BAPI. My problem is that we have 3 currencies that the FI document is posted in: document, local, and group. I am putting this program together for our Europe office so the the document and local currencies are EUR but the group currency is USD. When I try to use the BAPI and feed the information in to it I get a message that states "Foreign currency translation not supported for tax calculation". Have you run in to this error message before(F5681)? If so, is there a way around it? If not how have you been able to upload vendor invoices into SAP?
Hi Ron,
I think it is better to post this question in the abap forum. But anyway, it sounds like you need to customize the currency translations for that specific calculation type.
regards
Siggi -
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.. -
Problem with subroutine- need urgrnt help
hai all,
need help in subroutine.
in a report program,
i had calculated to get the total collection amount and need to generate a list for every day.
on next day that collection amount must come as a poeninig balance at the top of the list.
this i had done using two subroutines.
i have to call the subroutine for opening balance for previous day's collection first. after that in have to calculate the todays collection.
how can i have this please give me a suggession.
thanks in advance.
this is my report.
i want the 'Progressive Total C/O ' from subroutine form f002_item_data. of today to be come in
'Progressive Total B/F -
' ,106 w_total_bf. of the subroutine form f001_progressive_total on next day..
here is the code.....
*& Report ZVR023_COLL_STATEMENT *
report zvr023_coll_statement no standard page heading .
MODULE. MSD *
Objective : *
Program : Updates Tables ( ) Downloads data ( ) *
Outputs List ( X ) *
Date Created *
Author *
Location *
LDB ..... *
External Dependencies *
Amendment History *
Who Change ID Reason *
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
XXXXXXXXX AADDMMYYYY Where XXXX = Developers Name................. *
AA- Developers Initial ................................ *
Includes *
*INCLUDE : *
Tables *
tables : vbak,bsid,kna1,t001,adrc,vbrk,knvv.
Types Begin with TY_ *
types : begin of ty_cust,
belnr type bseg-belnr,
wrbtr type bseg-wrbtr,
xref1 type bseg-xref1,
kunnr type kna1-kunnr, " sarang
bschl type bseg-bschl,
hkont type bseg-hkont,
end of ty_cust.
types : begin of ty_bp,
kunnr type vbak-kunnr,
bukrs type bseg-bukrs,
budat type bkpf-budat,
end of ty_bp.
types : begin of ty_kna1,
kunnr type kna1-kunnr,
name1 type kna1-name1,
ort01 type kna1-ort01,
end of ty_kna1.
types : begin of ty_lst,
vbeln type vbrk-vbeln, " INVOICE NO
fkart type vbrk-fkart,
posnr type vbrp-posnr ,
fkimg type vbrp-fkimg , " qty
fkdat type vbrk-fkdat, " date
vkorg type vbrk-vkorg, " sales org
vtweg type vbrk-vtweg, " division
spart type vbrk-spart, " distribution
knumv type vbrk-knumv, " Number of the document condition
matnr type vbrp-matnr ,
med_prod type jptmg0-med_prod,
kunrg type vbrk-kunrg,
kwert type konv-kwert,
kbetr type konv-kbetr,
netwr type vbrk-netwr,
Address Details
KUNRG type vbrk-KUNRG,
name1 type kna1-name1,
stras type kna1-stras,
pstlz type kna1-pstlz,
***Added For Billing
bukrs type vbrk-bukrs, " Company code
xblnr type vbrk-xblnr, " Bill Ref
ismpublication type mara-ismpublication,
Condition Type
kschl_zj01 type konv-kschl,
kschl_zdis type konv-kschl,
kschl_znet type konv-kschl,
kwert_zj01 type konv-kawrt, " Base Condition
kwert_zdis type konv-kawrt,
kwert_znet type konv-kawrt,
adrnr type kna1-adrnr,
end of ty_lst.
types : begin of ty_lst1,
vbeln type vbrk-vbeln, " INVOICE NO
fkart type vbrk-fkart,
fkdat type vbrk-fkdat, " date
fkimg type vbrp-fkimg, " qty
kunrg type vbrk-kunrg, " Payer
fkimg_1 type vbrp-fkimg, " qty
fkimg_2 type vbrp-fkimg, " qty
fkimg_3 type vbrp-fkimg, " qty
fkimg_4 type vbrp-fkimg, " qty
fkimg_5 type vbrp-fkimg, " qty
matnr type vbrp-matnr,
med_prod type jptmg0-med_prod,
kwert type konv-kwert,
kbetr type konv-kbetr,
netwr type vbrk-netwr,
Address Details
KUNRG type vbrk-KUNRG,
name1 type kna1-name1,
stras type kna1-stras,
pstlz type kna1-pstlz,
***Added For Billing
bukrs type vbrk-bukrs ,
xblnr type vbrk-xblnr,
ismpublication type mara-ismpublication,
****SPLIT FOR RATE
kbetr_1 type konv-kbetr,
kbetr_2 type konv-kbetr,
kbetr_3 type konv-kbetr,
Condition Type
kschl_zj01 type konv-kschl,
kschl_zdis type konv-kschl,
kschl_znet type konv-kschl,
kwert_zj01 type konv-kawrt, " Base Condition
kwert_zdis type konv-kawrt,
kwert_znet type konv-kawrt,
end of ty_lst1.
types : begin of ty_condition,
kschl type konv-kschl, " Condition Type
kwert type konv-kwert, " Condition Value
knumv type konv-knumv, " Document Condi
kposn type konv-kposn,
kbetr type konv-kbetr, " Condition Rate
end of ty_condition.
types : begin of ty_bkpf ,
belnr type bkpf-belnr,
gjahr type bkpf-gjahr,
bukrs type bkpf-bukrs,
end of ty_bkpf.
Constants Begin with C_ *
*CONSTANTS: *
Data Begin with W_ *
data : w_cnt type i .
*DATA : W_DMBTR TYPE BSID-DMBTR. " Open Value
*DATA : W_KWERT TYPE VBRP-FKIMG. " Invoice Value
*DATA : W_QTY_CON TYPE VBRP-FKIMG. " QTY
*DATA : W_TO_QTY_CON TYPE VBRP-FKIMG. " QTY
*DATA : W_DIFF TYPE BSID-DMBTR. " W_DIFF Bt Open & Invoice
*DATA : W_DMBTR_CR TYPE BSID-DMBTR. " Cr Value
*DATA : W_DMBTR_DR TYPE BSID-DMBTR. " Dr Value
*DATA : W_DMBTR_TO TYPE BSID-DMBTR. " Total Value
*DATA : W_KDGRP(2) .
*DATA : W_CNT_IS TYPE I.
*DATA : W_CNT_IS1 TYPE I.
*DATA : W_CNT_IS2 TYPE I.
*DATA : W_CNT_FIRST TYPE I.
*DATA : W_CNT_ITAB TYPE I.
*DATA : W_CNT_FIRST1(2).
*DATA : W_CNT_TAB(62),
W_CNT_TAB_HEA(62),
*data: W_CNT_POS TYPE I.
Variable for balance window
data : w_open_bal type dmshb_x8,
w_total_bf type dmshb_x8,
w_sub_tot type dmshb_x8,
w_total_co type dmshb_x8,
w_bill_bal type dmshb_x8,
w_drn_bal type dmshb_x8,
w_othr_chr type dmshb_x8,
w_total_bal type dmshb_x8,
w_coll_bal type dmshb_x8,
w_unsd_cr type dmshb_x8, "Unsold Credit
w_inceve type dmshb_x8, "Incentive
w_cr_nt type dmshb_x8. "Cr Note
data : w_pos type bseg-wrbtr. " Total Value
data : w_neg type bseg-wrbtr. " Total Value
data : w_du_start_date like sy-datum,
w_du_end_date like sy-datum .
**vARIABLE DEFINED FOR CONSOLIDATED WINDOW
data : w_prod_cnt type i .
data : w_prod_ch(2) .
data : w_prod_rate type i .
Infotypes ( HR Module Specific) *
*INFOTYPES : *
Internal tables Begin with IT_ *
data : it_bp type table of ty_bp with header line,
it_bp1 type table of ty_bp with header line,
it_bp2 type table of ty_bp with header line,
it_bp3 type table of ty_bp with header line,
it_kna1 type table of ty_kna1 with header line,
it_cust type table of ty_cust with header line,
it_cust1 type table of ty_cust with header line,
it_bkpf type table of ty_bkpf with header line,
it_cust2 type table of ty_cust with header line,
it_cust3 type table of ty_cust with header line.
data : it_pos like rfposxext occurs 1 with header line,
it_check like rfposxext occurs 1 with header line,
it_pos_bc1 like rfposxext occurs 1 with header line,
it_pos_bc like rfposxext occurs 1 with header line,
it_pos_nc like rfposxext occurs 1 with header line,
it_pos1 like rfposxext occurs 1 with header line,
it_sec like rfposxext occurs 1 with header line.
data : it_bal like rfposxext occurs 1 with header line.
data : w_text(100) type c.
data : w_cnt1(3).
data : l_date like mara-ismpublperiod .
data : p_date1 like jkpaz-jkpavon.
data : l_day_c(2).
data : l_month_c(2).
data : l_base_yr_c(4).
data : w_text1(100) type c.
data : w_text2(100) type c.
Field Symbols Begin with FS_ *
*FIELD-SYMBOLS: *
field-symbols: type ty_condition.
Insert *
*INSERT : *
Select Options Begin with SO_ *
selection-screen skip 1.
selection-screen: begin of block b1 with frame title text-001.
select-options : so_bukrs for vbrk-bukrs no intervals no-extension obligatory .
select-options : so_kunrg for vbrk-vkorg no intervals no-extension obligatory,
so_vkbur for knvv-vkbur no intervals no-extension ,
so_fkdat for bsid-budat no-extension obligatory ,
so_bdat1 for bsid-budat no-display ,
so_bdat3 for bsid-budat no-display ,
so_kunnr for kna1-kunnr no-display.
selection-screen: end of block b1.
Parameters Begin with PR_ *
*PARAMETERS : *
selection-screen begin of block b3 with frame title text-003.
parameters pr_3 radiobutton group rad1.
parameters pr_4 radiobutton group rad1.
selection-screen end of block b3.
selection-screen begin of block b2 with frame title text-002.
parameters pr_1 radiobutton group rad.
parameters pr_2 radiobutton group rad.
selection-screen end of block b2.
*INITIALISATION :
At selection-screen *
*AT SELECTION-SCREEN.
S T A R T O F S E L E C T I O N *
start-of-selection.
if pr_3 is not initial.
Code commented/added by Praveen on 20.07.2006
SELECT kunnr INTO CORRESPONDING FIELDS OF TABLE it_bp1 FROM knvv
WHERE vkorg IN so_kunrg
AND kunnr GE '0004000000'
AND kunnr LE '0004999999'.
select kunnr into corresponding fields of table it_bp1 from knvv
where vkorg in so_kunrg
and aufsd <> '01'
and kunnr ge '0004000000'
and kunnr le '0004999999' .
and
PLTYP ne 'HB'.
*ends here
endif.
if pr_4 is not initial.
clear so_kunnr[].
clear so_kunnr.
so_kunnr-sign = 'I'.
so_kunnr-option = 'BT'.
so_kunnr-low = '0001000000'.
so_kunnr-high = '0001999999'.
append so_kunnr.
so_kunnr-sign = 'I'.
so_kunnr-option = 'BT'.
so_kunnr-low = '0002000000'.
so_kunnr-high = '0002999999'.
append so_kunnr.
so_kunnr-sign = 'I'.
so_kunnr-option = 'BT'.
so_kunnr-low = '0007000000'.
so_kunnr-high = '0007999999'.
append so_kunnr.
Code commented/added by Praveen on 20.07.2006
select kunnr into corresponding fields of table it_bp1 from knvv
where vkorg in so_kunrg and
kunnr in so_kunnr and
vkbur in so_vkbur.
AND kunnr GE '0001000000'
AND kunnr LE '0001999999' .
select kunnr into corresponding fields of table it_bp1 from knvv
where vkorg in so_kunrg and
aufsd <> '01' and
kunnr in so_kunnr and
vkbur in so_vkbur.
AND kunnr GE '0001000000'
AND kunnr LE '0001999999' .
ends here
endif.
if pr_1 = 'X'.
perform cust_prog.
perform cust_line.
perform f001_progressive_total.
perform f002_item_data.
elseif pr_2 = 'X'.
perform cust_line.
perform f002_item_data.
endif.
*& Form cust_prog
text
form cust_prog.
clear it_bp3[].
p_date1 = so_fkdat-low.
call function 'Z_VF053_DATE_GET_YEAR_MONTH'
exporting
i_date = p_date1
importing
e_dd = l_day_c
e_month = l_month_c
e_year = l_base_yr_c.
ranges so_bdat2 for bsid-budat.
clear : so_bdat3[].
if l_day_c > 01.
l_day_c = '01'.
concatenate l_base_yr_c l_month_c l_day_c into l_date.
so_bdat2-low = l_date.
so_bdat2-high = so_fkdat-low - 1.
else.
so_bdat2-low = '00000000'.
so_bdat2-high = '00000000'.
endif.
so_bdat2-sign = 'I'.
so_bdat2-option = 'BT'.
append so_bdat2 to so_bdat3.
select kunnr bukrs budat into corresponding fields of table it_bp3 from bsid
for all entries in it_bp1
where bukrs in so_bukrs
and kunnr = it_bp1-kunnr
and budat in so_bdat3.
select kunnr bukrs budat
appending corresponding fields of table it_bp3
from bsad
for all entries in it_bp1
where bukrs in so_bukrs
and kunnr = it_bp1-kunnr
and budat in so_bdat3.
sort it_bp3 by kunnr .
delete adjacent duplicates from it_bp3 comparing kunnr.
sort it_bp3 by kunnr .
clear w_total_bf.
endform. "cust_prog
*& Form cust_line
text
form cust_line.
clear it_bp[].
select kunnr bukrs budat
into corresponding fields of table it_bp
from bsid
for all entries in it_bp1
where bukrs in so_bukrs
and kunnr = it_bp1-kunnr
and budat in so_fkdat.
select kunnr bukrs budat
appending corresponding fields of table it_bp
from bsad
for all entries in it_bp1
where bukrs in so_bukrs
and kunnr = it_bp1-kunnr
And budat in so_fkdat.
sort it_bp by kunnr .
delete adjacent duplicates from it_bp comparing kunnr.
sort it_bp by kunnr .
endform. "cust_line
*& Form f001_progressive_total
text
form f001_progressive_total.
if not it_bp3[] is initial.
clear : w_text ,w_cnt,p_date1,l_base_yr_c, l_month_c,l_day_c,l_date.
w_cnt1 = sy-tabix .
CONCATENATE w_cnt1 ' Feaching Data ' INTO w_text.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = w_text.
ranges so_bdat2 for bsid-bldat.
clear : so_bdat1[].
p_date1 = so_fkdat-low.
call function 'Z_VF053_DATE_GET_YEAR_MONTH'
exporting
i_date = p_date1
importing
e_dd = l_day_c
e_month = l_month_c
e_year = l_base_yr_c.
if l_day_c > 01.
l_day_c = '01'.
concatenate l_base_yr_c l_month_c l_day_c into l_date.
so_bdat2-low = l_date.
so_bdat2-high = so_fkdat-low - 1.
else.
l_day_c = so_fkdat-low.
so_bdat2-low = l_date.
so_bdat2-high = '00000000'.
endif.
so_bdat2-sign = 'I'.
so_bdat2-option = 'BT'.
append so_bdat2 to so_bdat1.
export so_bdat1 to memory id 'DATE1'.
export it_bp3 to memory id 'IT_BP3'.
clear : so_bdat1, it_bp3.
submit z_rfitemar1
with x_aisel = 'X'
with x_norm = 'X'
with dd_bukrs-low = so_bukrs-low "#EC *
and return.
clear : it_pos[], it_pos .
import it_pos from memory id 'zit_pos'.
free memory id 'zit_pos'.
delete it_pos where blart <> 'DZ'.
Here Plz Clear all the varible to avoid overlap
clear : w_open_bal,w_du_start_date,w_du_end_date.
select belnr bukrs gjahr into corresponding fields of table it_bkpf
from bkpf for all entries in it_pos where belnr = it_pos-belnr and gjahr = it_pos-gjahr
and bukrs = it_pos-bukrs and xreversal = ' '.
endif.
loop at it_pos.
clear it_bkpf.
read table it_bkpf with key bukrs = it_pos-bukrs belnr = it_pos-belnr gjahr = it_pos-gjahr.
if sy-subrc eq 0.
append it_pos to it_check.
endif.
endloop.
it_pos[] = it_check[].
***opening bal
since runtime error is coming while summing the alternate way is being used ... done by jayakumar on 11 10 06
LOOP AT it_pos .
SUM .
w_open_bal = it_pos-dmshb .
EXIT .
ENDLOOP .
loop at it_pos .
read table it_cust3 with key belnr = it_pos-belnr.
it_pos-dmshb = it_cust3-wrbtr.
w_open_bal = w_open_bal + it_pos-dmshb .
endloop .
if w_open_bal < 0 .
w_open_bal = w_open_bal * -1.
endif.
w_total_bf = w_total_bf + w_open_bal.
endif.
write :20 'Progressive Total B/F -
' ,106 w_total_bf.
skip 1 .
endform. "f001_progressive_total
*& Form f002_item_data
text
form f002_item_data.
if not it_bp[] is initial.
select * into corresponding fields of table it_kna1 from kna1
for all entries in it_bp
where kunnr = it_bp-kunnr .
export so_fkdat to memory id 'DATE'.
export it_bp to memory id 'IT_BP'.
clear : so_fkdat, it_bp.
submit z_rfitemar1
with x_aisel = 'X'
with x_norm = 'X'
with dd_bukrs-low = so_bukrs-low "#EC *
and return.
DELETE it_pos WHERE u_xreversal <> ' '.
clear : it_pos[], it_pos .
import it_pos from memory id 'zit_pos'.
free memory id 'zit_pos'.
delete it_pos where blart <> 'DZ'.
sort it_pos by belnr.
APPEND LINES OF it_pos TO it_pos1.
DELETE ADJACENT DUPLICATES FROM it_pos COMPARING belnr." commented by sarang
clear : it_cust[], it_cust.
if not it_pos[] is initial.
select belnr wrbtr xref1 kunnr bschl
into corresponding fields of table it_cust
from bseg
for all entries in it_pos
where belnr = it_pos-belnr
and bukrs = it_pos-bukrs
and gjahr = it_pos-gjahr
and bschl in ('15','40') .
it_cust2[] = it_cust[].
delete it_cust where bschl ne 15.
delete it_cust2 where bschl ne 40.
sort it_pos by konto.
else.
write : 20 '**No Transaction to Display**'.
endif.
DELETE it_pos WHERE u_xreversal = 'X'.
tables bkpf.
loop at it_pos.
select single * from bkpf where belnr = it_pos-belnr and bukrs = it_pos-bukrs and gjahr = it_pos-gjahr and xreversal = ' '.
if sy-subrc = 0.
append it_pos to it_pos_bc1.
endif.
endloop.
clear it_pos.
it_pos[] = it_pos_bc1[].
sort it_pos by konto belnr xref3.
loop at it_pos.
read table it_cust2 with key belnr = it_pos-belnr.
on change of it_pos-konto or "IT_CUST2-xref1 or
it_pos-belnr.
it_pos_bc[] = it_pos[].
delete it_pos_bc[] where konto ne it_pos-konto.
delete it_pos_bc[] where belnr ne it_pos-belnr.
loop at it_pos_bc.
sum.
exit.
endloop.
append it_pos_bc to it_pos_nc.
endon.
endloop.
free it_pos.
it_pos[] = it_pos_nc[].
data : w_amt1 type bseg-dmbtr,
w_amt2 type bseg-dmbtr.
clear : w_amt1 , w_amt2.
sort it_pos by budat belnr konto.
data : w_ch(5) type c,
w_i type i.
w_i = 0.
loop at it_pos where shkzg = 'H' .
clear w_text.
w_i = w_i + 1 .
w_ch = w_i.
read table it_cust with key belnr = it_pos-belnr kunnr = it_pos-konto.
read table it_kna1 with key kunnr = it_pos-konto .
CONCATENATE it_kna1-name1 INTO w_text.
w_text = it_kna1-name1.
CONDENSE w_text NO-GAPS.
write : / w_ch left-justified , 07 it_pos-budat ,20 it_pos-belnr(10) ,31 it_pos-konto(10),42 w_text(60).
read table it_cust2 with key belnr = it_pos-belnr.
if it_cust2-xref1 = 'Cash Payment' or it_cust2-xref1 = 'Cash'.
if it_pos-dmshb < 0 .
it_pos-dmshb = it_pos-dmshb * -1 .
it_pos-dmshb = it_cust2-wrbtr.
else. "+PM28072006
it_pos-dmshb = it_pos-dmshb * -1 . "+PM28072006
it_pos-dmshb = it_cust2-wrbtr.
endif.
write : 72 it_pos-dmshb.
w_amt1 = w_amt1 + it_pos-dmshb.
else.
if it_pos-dmshb < 0 .
it_pos-dmshb = it_pos-dmshb * -1 .
it_pos-dmshb = it_cust2-wrbtr.
else. "+PM28072006
it_pos-dmshb = it_pos-dmshb * -1."+PM28072006
it_pos-dmshb = it_cust2-wrbtr.
endif.
write : 87 it_pos-dmshb.
w_amt2 = w_amt2 + it_pos-dmshb.
endif .
endloop .
else.
write : 20 '**No Transaction to Display**'.
endif.
clear : it_cust1[] ,w_pos .
it_cust1[] = it_cust[] .
sort it_cust1 by wrbtr.
delete it_cust1 where xref1 <> 'Cash Payment' .
delete it_cust1 where xref1 <> 'Cash' .
loop at it_cust1.
sum .
w_pos = it_cust1-wrbtr .
exit .
endloop .
clear :it_cust1[],w_neg .
it_cust1[] = it_cust[] .
sort it_cust1 by wrbtr.
delete it_cust1 where xref1 = 'Cash Payment' .
delete it_cust1 where xref1 = 'Cash' .
loop at it_cust1.
sum .
w_neg = it_cust1-wrbtr .
exit .
endloop .
if w_pos < 0.
w_pos = w_pos * -1 .
else. "+PM28072006
w_pos = w_pos * -1. "+PM28072006
endif.
if w_neg < 0.
w_neg = w_neg * -1 .
else. "+PM28072006
w_neg = w_neg * -1. "+PM28072006
endif.
write sy-uline(125) .
write : /20 'Total Collection Amount -
>'.
write : 76 w_amt1 ,91 w_amt2.
w_sub_tot = w_amt1 + w_amt2.
if w_sub_tot < 0.
w_sub_tot = w_sub_tot * -1.
endif.
write : 106 w_sub_tot.
if pr_1 = 'X'.
w_total_co = w_total_bf + w_sub_tot.
if w_total_co < 0.
w_total_co = w_total_co * -1.
endif.
write : /20 'Progressive Total C/O -
>'.
write : 106 w_total_co.
endif.
write sy-uline(125) .
endform. "f002_item_data
ENDIF .
*END-OF-SELECTION.
E N D O F S E L E C T I O N *
At line selection *
*AT LINE-SELECTION.
User Command Processing *
*AT USER-COMMAND.
Top Of Page *
top-of-page.
select single * from t001 where bukrs = so_bukrs-low .
select single * from adrc where addrnumber = t001-adrnr . "EC *
write : /05 t001-butxt.
CONCATENATE adrc-house_num1 '-' adrc-street INTO w_text1.
CONCATENATE adrc-city1 '-' adrc-post_code1 INTO w_text2.
WRITE : /05 w_text1 .
WRITE : /05 w_text2 .
write : /05 'Sales Organisation:', so_kunrg-low.
write : /05 'Sales Office:', so_vkbur-low.
skip 1.
if pr_3 = 'X'.
write : /05 'Agent Circulation Collection Statement From ' , so_fkdat-low , ' to ' ,so_fkdat-high .
else.
write : /05 'Advertisement Collection Statement From ' , so_fkdat-low , ' to ' ,so_fkdat-high .
endif.
if pr_3 = 'X'.
write :/ sy-uline(125) .
write :/07 'Date' ,20 'Doc No',31 'Code' ,42 'Agent Name & Place',84 'BY CASH' ,97 'BY CHQ/DD' ,115 'Prog. Total'.
write :/ sy-uline(125) .
else.
write :/ sy-uline(125) .
write :/07 'Date' ,20 'Doc No',31 'Code' ,42 'Advertisers Name' , 84 'BY CASH' ,97 'BY CHQ/DD' ,115 'Prog. Total'.
write :/ sy-uline(125) .
endif .
End Of Page *
END-OF-PAGE.END-OF-PAGE.Hello Selvi
There is no need to use two subroutine. Actually, this would be bad programming. Instead use a switch for your subroutine which determines whether the calculation should be done for the actual and the previous day, e.g.:
PERFORM do_calculation
USING 'X' " 'X' = calculate for previous day as well
USING p_date " current date
CHANGING gt_list. " itab with list data
And that's how the subroutine could look like:
FORM do_calculation
USING VALUE(ud_calculate_previous_day) TYPE c
VALUE(ud_date) TYPE d
CHANGING ct_list TYPE <table type>.
* define local data
DATA:
ld_date_prev TYPE d,
lt_list_prev TYPE <table type>. " list for previous day
* Do the calculations for the current day
IF ( ud_calculate_previous_day = 'X' ).
ld_date_prev = ud_date - 1.
PERFORM do_calculation
USING ' ' " ' ' = no calculation for previous day
ld_date_prev
CHANGING lt_list_prev. " itab with list data
ENDIF.
* Post-processing after calculation for both days
ENDFORM.
Regards
Uwe -
Please Help me with this Logic.....
Seniors , Please Help me with this Requirment
BUKRS _____________________
GJAHR ____________________
LIFNR _____________________
MONAT _____________________
LIFNR NAME1 GSBER GJAHR HBAL SBAL ACCUMBAL
1001 ABB BUSS1 2005 300 00
ABB BUSS1 2005 00 100
300 100 (300-100)=200
ABB BUSS1 2006 200 00
ABB BUSS1 2006 200 00
400 00 (400-00)+ 200 =
600
ABB BUSS2 2005 300 00
ABB BUSS2 2005 00 100
300 100 ( 300-100) =200
ABB BUSS2 2006 400 00
ABB BUSS2 2006 00 100
400 100 (400-100)+200 =
500 ****************************************************************************
1400 300 (1400-300) **********************************************************************************************************
Same for the Next Vendor also...
This is the report for this Requirment i am working on....Please Help me in the Logic..How to Go on with it....
*& Report ZVENDOR_RECONCILLATION
REPORT ZVENDOR_RECONCILLATION.
TABLES : BSAK , BSIK , LFC1 , LFC3 , LFA1.
*ALV
TYPE-POOLS: SLIS.
*TYPE-POOLS icon.
DATA: It_SORT TYPE SLIS_T_SORTINFO_ALV ."WITH HEADER LINE.
DATA: TOP TYPE slis_t_listheader,
END TYPE slis_t_listheader,
EVENTS TYPE slis_t_event.
DATA : T_KEY TYPE SLIS_KEYINFO_ALV.
DATA : FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV OCCURS 1 WITH HEADER LINE ,
LCAT TYPE SLIS_FIELDCAT_ALV.
*INTERNAL TABLE
DATA: BEGIN OF sd_bsak,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
END OF sd_bsak.
DATA: BEGIN OF sd_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
END OF sd_bsik.
DATA: BEGIN OF it_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF it_lfa1.
*FINAL INTERNAL TABLE DECLARATION
DATA: BEGIN OF IT_FINAL,
lifnr TYPE bsak-lifnr,
gsber TYPE bsak-gsber,
bukrs TYPE bsak-bukrs,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
DMBTR_S TYPE BSAK-DMBTR,
DMBTR_H TYPE BSAK-DMBTR,
DS TYPE P DECIMALS 2,
DH TYPE P DECIMALS 2,
SUB TYPE P DECIMALS 2,
ADD TYPE P DECIMALS 2,
BAL TYPE P DECIMALS 2,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF IT_FINAL.
DATA: BEGIN OF SD_FINAL,
gsber TYPE bsak-gsber,
lifnr TYPE bsak-lifnr,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
line_color(4) TYPE c,
END OF SD_FINAL.
DATA IT_STD_BSAK LIKE TABLE OF SD_BSAK WITH HEADER LINE.
DATA IT_STD_BSIK LIKE TABLE OF SD_BSIK WITH HEADER LINE.
DATA IT_STD_LFA1 LIKE TABLE OF IT_LFA1 WITH HEADER LINE.
DATA IT_STD_FINAL LIKE TABLE OF IT_FINAL WITH HEADER LINE.
DATA IT_FINAL_DISPLAY LIKE TABLE OF SD_FINAL WITH HEADER LINE.
*SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK HEADER WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BSAK-BUKRS OBLIGATORY.
SELECT-OPTIONS : S_GJAHR FOR BSAK-GJAHR.
SELECT-OPTIONS: S_LIFNR FOR BSAK-LIFNR.
SELECT-OPTIONS: S_MONAT FOR BSAK-MONAT.
SELECTION-SCREEN END OF BLOCK HEADER.
START-OF-SELECTION.
SET PF-STATUS 'STATUS'.
PERFORM DATA_RETRIVAL.
PERFORM FIELD.
PERFORM EVENTS USING EVENTS.
PERFORM EVENTS_1 USING EVENTS.
PERFORM HEADER USING TOP.
PERFORM LAYOUT.
PERFORM DISPLAY.
END-OF-PAGE.
*& Form DATA_RETRIVAL
text
--> p1 text
<-- p2 text
FORM DATA_RETRIVAL .
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR BLART
MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT
FROM BSAK INTO TABLE IT_STD_BSAK
WHERE BUKRS = P_BUKRS
AND GJAHR IN S_GJAHR
AND LIFNR IN S_LIFNR
AND MONAT IN S_MONAT.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR
BLART MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT ZLSCH
FROM BSIK INTO TABLE IT_STD_BSIK FOR ALL ENTRIES IN IT_STD_BSAK
WHERE BUKRS = IT_STD_BSAK-BUKRS AND LIFNR = IT_STD_BSAK-LIFNR AND GJAHR = IT_STD_BSAK-GJAHR .
ENDIF.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT LIFNR NAME1
FROM LFA1 INTO TABLE IT_STD_LFA1 FOR ALL ENTRIES IN IT_STD_BSAK
WHERE LIFNR = IT_STD_BSAK-LIFNR.
ENDIF.
LOOP AT IT_STD_BSAK.
IT_STD_FINAL-BUKRS = IT_STD_BSAK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSAK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSAK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSAK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSAK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSAK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSAK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSAK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSAK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSAK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSAK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSAK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSAK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSAK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSAK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSAK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSAK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSAK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSAK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSAK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSAK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSAK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSAK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSAK-HKONT.
READ TABLE IT_STD_LFA1 WITH KEY LIFNR = IT_STD_FINAL-LIFNR.
IF SY-SUBRC = 0.
IT_STD_FINAL-NAME1 = IT_STD_LFA1-NAME1.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_BSIK.
IF SY-SUBRC = 0.
IT_STD_FINAL-BUKRS = IT_STD_BSIK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSIK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSIK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSIK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSIK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSIK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSIK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSIK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSIK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSIK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSIK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSIK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSIK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSIK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSIK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSIK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSIK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSIK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSIK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSIK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSIK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSIK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSIK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSIK-HKONT.
IT_STD_FINAL-ZLSCH = IT_STD_BSIK-ZLSCH.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_FINAL.
IF IT_STD_FINAL-SHKZG = 'S'.
IT_STD_FINAL-DMBTR_S = IT_STD_FINAL-DMBTR.
ELSE.
IF IT_STD_FINAL-SHKZG = 'H'.
IT_STD_FINAL-DMBTR_H = IT_STD_FINAL-DMBTR.
ENDIF.
ENDIF.
IT_STD_FINAL-DMBTR = ''.
MODIFY IT_STD_FINAL INDEX SY-TABIX TRANSPORTING DMBTR_H DMBTR_S DMBTR.
"VAR.
CLEAR IT_STD_FINAL.
ENDLOOP.
SORT IT_STD_FINAL BY LIFNR GSBER GJAHR.
ENDFORM. " DATA_RETRIVAL
*& Form FIELD
text
--> p1 text
<-- p2 text
form FIELD .
LCAT-FIELDNAME = 'LIFNR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor No'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'NAME1'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor Name'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GJAHR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Fiscal Year'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GSBER'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'BussArea'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_S'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Debit Balanace'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_H'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Credit Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'BAL'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Accumulated Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
endform. " FIELD
*& Form DISPLAY
text
--> p1 text
<-- p2 text
form DISPLAY .
CLEAR: IT_STD_BSAK,IT_STD_BSIK, IT_STD_LFA1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_CHARG
t_outtab = IT_STD_FINAL[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "DISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
form EVENTS USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'TOP_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
endform. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP.
ENDFORM. "TOP_OF_PAGE
*& Form LAYOUT
text
--> p1 text
<-- p2 text
form LAYOUT .
LAYOUT-ZEBRA = 'X'.
LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
APPEND LAYOUT." TO LAYOUT.
endform. " LAYOUT
*& Form EVENTS_1
text
-->P_EVENTS text
FORM EVENTS_1 USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
WRITE: SY-UNAME.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'END_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
ENDFORM. " EVENTS_1Seniors , Please Help me with this Requirment
BUKRS _____________________
GJAHR ____________________
LIFNR _____________________
MONAT _____________________
LIFNR NAME1 GSBER GJAHR HBAL SBAL ACCUMBAL
1001 ABB BUSS1 2005 300 00
ABB BUSS1 2005 00 100
300 100 (300-100)=200
ABB BUSS1 2006 200 00
ABB BUSS1 2006 200 00
400 00 (400-00)+ 200 =
600
ABB BUSS2 2005 300 00
ABB BUSS2 2005 00 100
300 100 ( 300-100) =200
ABB BUSS2 2006 400 00
ABB BUSS2 2006 00 100
400 100 (400-100)+200 =
500 ****************************************************************************
1400 300 (1400-300) **********************************************************************************************************
Same for the Next Vendor also...
This is the report for this Requirment i am working on....Please Help me in the Logic..How to Go on with it....
*& Report ZVENDOR_RECONCILLATION
REPORT ZVENDOR_RECONCILLATION.
TABLES : BSAK , BSIK , LFC1 , LFC3 , LFA1.
*ALV
TYPE-POOLS: SLIS.
*TYPE-POOLS icon.
DATA: It_SORT TYPE SLIS_T_SORTINFO_ALV ."WITH HEADER LINE.
DATA: TOP TYPE slis_t_listheader,
END TYPE slis_t_listheader,
EVENTS TYPE slis_t_event.
DATA : T_KEY TYPE SLIS_KEYINFO_ALV.
DATA : FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV OCCURS 1 WITH HEADER LINE ,
LCAT TYPE SLIS_FIELDCAT_ALV.
*INTERNAL TABLE
DATA: BEGIN OF sd_bsak,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
END OF sd_bsak.
DATA: BEGIN OF sd_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
END OF sd_bsik.
DATA: BEGIN OF it_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF it_lfa1.
*FINAL INTERNAL TABLE DECLARATION
DATA: BEGIN OF IT_FINAL,
lifnr TYPE bsak-lifnr,
gsber TYPE bsak-gsber,
bukrs TYPE bsak-bukrs,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
DMBTR_S TYPE BSAK-DMBTR,
DMBTR_H TYPE BSAK-DMBTR,
DS TYPE P DECIMALS 2,
DH TYPE P DECIMALS 2,
SUB TYPE P DECIMALS 2,
ADD TYPE P DECIMALS 2,
BAL TYPE P DECIMALS 2,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF IT_FINAL.
DATA: BEGIN OF SD_FINAL,
gsber TYPE bsak-gsber,
lifnr TYPE bsak-lifnr,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
line_color(4) TYPE c,
END OF SD_FINAL.
DATA IT_STD_BSAK LIKE TABLE OF SD_BSAK WITH HEADER LINE.
DATA IT_STD_BSIK LIKE TABLE OF SD_BSIK WITH HEADER LINE.
DATA IT_STD_LFA1 LIKE TABLE OF IT_LFA1 WITH HEADER LINE.
DATA IT_STD_FINAL LIKE TABLE OF IT_FINAL WITH HEADER LINE.
DATA IT_FINAL_DISPLAY LIKE TABLE OF SD_FINAL WITH HEADER LINE.
*SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK HEADER WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BSAK-BUKRS OBLIGATORY.
SELECT-OPTIONS : S_GJAHR FOR BSAK-GJAHR.
SELECT-OPTIONS: S_LIFNR FOR BSAK-LIFNR.
SELECT-OPTIONS: S_MONAT FOR BSAK-MONAT.
SELECTION-SCREEN END OF BLOCK HEADER.
START-OF-SELECTION.
SET PF-STATUS 'STATUS'.
PERFORM DATA_RETRIVAL.
PERFORM FIELD.
PERFORM EVENTS USING EVENTS.
PERFORM EVENTS_1 USING EVENTS.
PERFORM HEADER USING TOP.
PERFORM LAYOUT.
PERFORM DISPLAY.
END-OF-PAGE.
*& Form DATA_RETRIVAL
text
--> p1 text
<-- p2 text
FORM DATA_RETRIVAL .
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR BLART
MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT
FROM BSAK INTO TABLE IT_STD_BSAK
WHERE BUKRS = P_BUKRS
AND GJAHR IN S_GJAHR
AND LIFNR IN S_LIFNR
AND MONAT IN S_MONAT.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR
BLART MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT ZLSCH
FROM BSIK INTO TABLE IT_STD_BSIK FOR ALL ENTRIES IN IT_STD_BSAK
WHERE BUKRS = IT_STD_BSAK-BUKRS AND LIFNR = IT_STD_BSAK-LIFNR AND GJAHR = IT_STD_BSAK-GJAHR .
ENDIF.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT LIFNR NAME1
FROM LFA1 INTO TABLE IT_STD_LFA1 FOR ALL ENTRIES IN IT_STD_BSAK
WHERE LIFNR = IT_STD_BSAK-LIFNR.
ENDIF.
LOOP AT IT_STD_BSAK.
IT_STD_FINAL-BUKRS = IT_STD_BSAK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSAK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSAK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSAK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSAK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSAK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSAK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSAK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSAK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSAK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSAK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSAK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSAK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSAK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSAK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSAK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSAK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSAK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSAK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSAK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSAK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSAK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSAK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSAK-HKONT.
READ TABLE IT_STD_LFA1 WITH KEY LIFNR = IT_STD_FINAL-LIFNR.
IF SY-SUBRC = 0.
IT_STD_FINAL-NAME1 = IT_STD_LFA1-NAME1.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_BSIK.
IF SY-SUBRC = 0.
IT_STD_FINAL-BUKRS = IT_STD_BSIK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSIK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSIK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSIK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSIK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSIK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSIK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSIK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSIK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSIK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSIK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSIK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSIK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSIK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSIK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSIK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSIK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSIK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSIK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSIK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSIK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSIK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSIK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSIK-HKONT.
IT_STD_FINAL-ZLSCH = IT_STD_BSIK-ZLSCH.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_FINAL.
IF IT_STD_FINAL-SHKZG = 'S'.
IT_STD_FINAL-DMBTR_S = IT_STD_FINAL-DMBTR.
ELSE.
IF IT_STD_FINAL-SHKZG = 'H'.
IT_STD_FINAL-DMBTR_H = IT_STD_FINAL-DMBTR.
ENDIF.
ENDIF.
IT_STD_FINAL-DMBTR = ''.
MODIFY IT_STD_FINAL INDEX SY-TABIX TRANSPORTING DMBTR_H DMBTR_S DMBTR.
"VAR.
CLEAR IT_STD_FINAL.
ENDLOOP.
SORT IT_STD_FINAL BY LIFNR GSBER GJAHR.
ENDFORM. " DATA_RETRIVAL
*& Form FIELD
text
--> p1 text
<-- p2 text
form FIELD .
LCAT-FIELDNAME = 'LIFNR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor No'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'NAME1'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor Name'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GJAHR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Fiscal Year'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GSBER'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'BussArea'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_S'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Debit Balanace'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_H'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Credit Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'BAL'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Accumulated Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
endform. " FIELD
*& Form DISPLAY
text
--> p1 text
<-- p2 text
form DISPLAY .
CLEAR: IT_STD_BSAK,IT_STD_BSIK, IT_STD_LFA1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_CHARG
t_outtab = IT_STD_FINAL[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "DISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
form EVENTS USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'TOP_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
endform. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP.
ENDFORM. "TOP_OF_PAGE
*& Form LAYOUT
text
--> p1 text
<-- p2 text
form LAYOUT .
LAYOUT-ZEBRA = 'X'.
LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
APPEND LAYOUT." TO LAYOUT.
endform. " LAYOUT
*& Form EVENTS_1
text
-->P_EVENTS text
FORM EVENTS_1 USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
WRITE: SY-UNAME.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'END_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
ENDFORM. " EVENTS_1 -
Generate 2 line items with posting keys in same table while using FM .
Dear Expert ,
For T-code f-65 ,I have to park a FI Document .i tried with PRELIMINARY_POSTING_FB01 for parked Document . But i am not successfully park the document .
with the help of F-65 the data Segregate between Tables VBSEGS and VBSEGD with respecting Posting key . but with this Fm entire entry is displaying in table VBSEGS .For example it generated two line items with posting keys '15' and '40' and these both are displayed in VBSEGS whereas posting key '15' has to be displayed in VBSEGD.
when i check this Document in FBV0 Error reflect " G/L Account 0012000 1001 Does not Exist ".
Here my code -
DATA: XT_BKPF LIKE BKPF OCCURS 0 WITH HEADER LINE ,
XT_BSEG LIKE BSEG OCCURS 0 WITH HEADER LINE ,
XT_BSEG1 LIKE BSEG OCCURS 0 WITH HEADER LINE ,
XT_BSEC LIKE BSEC OCCURS 0 WITH HEADER LINE ,
XT_BSET LIKE BSET OCCURS 0 WITH HEADER LINE ,
XT_BSEZ LIKE BSEZ OCCURS 0 WITH HEADER LINE ,
XT_BKORM LIKE BKORM OCCURS 0 WITH HEADER LINE ,
XT_THEAD LIKE THEAD OCCURS 0 WITH HEADER LINE ,
XT_SPLTTAB LIKE ACSPLT OCCURS 0 WITH HEADER LINE ,
XT_SPLTWT LIKE WITH_ITEMX OCCURS 0 WITH HEADER LINE .
DATA : XTEXT_UPDATE LIKE BOOLE-BOOLE VALUE SPACE,
XTEXT_ITEM_UPDATE LIKE BOOLE-BOOLE VALUE SPACE,
XI_UF05A LIKE UF05A,
XI_XCMPL TYPE XFELD VALUE 'X',
XFS006_FB01 LIKE FS006 ,
XI_TCODE LIKE T020-TCODE VALUE 'F-65',
XI_PARGB LIKE RF05A-PARGB ,
XI_TCODE_INT TYPE TCODE .
DATA P_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
XT_BKPF-BUKRS = 'CP01'.
XT_BKPF-GJAHR = 2011.
XT_BKPF-BLART = 'DZ'.
XT_BKPF-BLDAT = SY-DATUM.
XT_BKPF-BUDAT = SY-DATUM.
XT_BKPF-MONAT = '06'.
XT_BKPF-CPUDT = SY-DATUM.
XT_BKPF-WWERT = SY-DATUM.
XT_BKPF-USNAM = 'ABAPER'.
XT_BKPF-TCODE = 'F-65'.
APPEND XT_BKPF.
XT_BSEG-BUKRS = 'CP01'.
XT_BSEG-GJAHR = '2011'.
XT_BSEG-BUZEI = '001'.
XT_BSEG-BSCHL = '40'.
XT_BSEG-KOART = 'S'.
XT_BSEG-SHKZG = 'S' .
XT_BSEG-GSBER = 'CPLN'.
XT_BSEG-BUPLA = 'CP01'.
XT_BSEG-WRBTR = 10000.
XT_BSEG-PSWSL = 'INR'.
XT_BSEG-ZUONR = 'CH. 123456'.
XT_BSEG-HKONT = '241000'.
APPEND XT_BSEG .
CLEAR XT_BSEG.
Vendor line item - required even for header only - BSEG table
XT_BSEG-BUKRS = 'CP01'.
XT_BSEG-GJAHR = '2011'.
XT_BSEG-BUZEI = '002'.
XT_BSEG-BSCHL = '15'.
XT_BSEG-KOART = 'S'.
XT_BSEG-SHKZG = 'H' .
XT_BSEG-GSBER = 'CPLN'.
XT_BSEG-BUPLA = 'CP01'.
XT_BSEG-WRBTR = 10000.
XT_BSEG-PSWSL = 'INR'.
XT_BSEG-ZUONR = 'CH. 123456'.
XT_BSEG-HKONT = 'PC04000001'.
APPEND XT_BSEG .
CLEAR XT_BSEG.
CALL FUNCTION 'PRELIMINARY_POSTING_FB01'
EXPORTING
TEXT_UPDATE = XTEXT_UPDATE
TEXT_ITEM_UPDATE = XTEXT_ITEM_UPDATE
I_UF05A =
I_XCMPL = XI_XCMPL
FS006_FB01 =
I_TCODE = XI_TCODE
I_PARGB =
I_TCODE_INT =
IMPORTING
XEPBBP = CHECK_A
TABLES
T_BKPF = XT_BKPF
T_BSEG = XT_BSEG
T_BSEC = XT_BSEC
T_BSET = XT_BSET
T_BSEZ = XT_BSEZ
T_BKORM =
T_THEAD =
T_SPLTTAB =
T_SPLTWT =
EXCEPTIONS
ERROR_MESSAGE = 1.
P_RETURN-ID = SY-MSGID.
P_RETURN-TYPE = SY-MSGTY.
P_RETURN-NUMBER = SY-MSGNO.
APPEND P_RETURN.
p_return-MESSAGE_V1 = XSYMSGV.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
WRITE :/ sy-subrc , sy-MSGV1 .
Thanks ,
Ashish GuptaHi Raghuram,
I found a very important SAP Note 103051, details are below.
An IDoc processed by function module IDOC_INPUT_INVOIC_MM (of category INVOIC01) must not refer to the same purchase order item in several invoice items. This is also valid if for a goods receipt-related invoice verification several delivery notes belong to the same purchase order item.
Depending on the system settings and the situation, various error messages can occur (for example, FD240 'Order item ... selected more than once' or M8050 'Balance not zero: & debits: & credits: &').
In this situation module IDOC_INPUT_INVOIC_MRM generates error message M8321 'Document contains same order item more than once'.
For example, this situation occurs if you work with individual batch valuation and the SD billing document executes a batch split for different batches which belong to the same purchase order item and delivery.
Other terms
INVOIC, SAPLIEDI, M8047, M8, 321
Reason and Prerequisites
This is because of the program design.
Solution
There is no solution for IDOC_INPUT_INVOIC_MM.
Module IDOC_INPUT_INVOIC_MRM (only as of Release 4.0) for the logistics invoice verification can distinguish different goods receipts by means of the delivery note number. For this purpose, GR-related invoice verification must be active.
Owing to this symptom, billing documents for single batch valuation with batch split cannot be settled in MM-EDI inbound processing. The settlement generates exactly the situation described (several invoice items for the same purchase order item). In this case, the only solution is to deactivate the billing of the batch sub-items in SD Customizing and to calculate the main item only.
Hope this helps.
Reward if helpful.
Thanks -
Clearing Vendor : Header data - Posting with assignment problem
Hi,
I would like to write a program or if possible would like to use a BAPI to post Clearing vendor data in t-code F-44 with assignment option.
I looked at to bapi BAPI_ACC_INVOICE_RECEIPT_POST and BAPI_ACC_DOCUMENT_POST, but both of them needs tax key and in F-44 we do not use it. as an other example we'd like to clear it with the acc. document and Line Item of acc. doc .(BSEG-BUZEI)
Is there any idea about how to do this?
Kind Regards.Hi,
my suggested method :
1) works
2) is very simple
sample:
* 0 initialization
xbkpf = bbkpf.
*1 header - fill xbkpf
MOVE: 'FB05' TO xbkpf-tcode.
MOVE itab-bukrs TO xbkpf-bukrs.
MOVE '90' TO xbkpf-blart.
CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum(4)
INTO xbkpf-bldat.
CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum(4)
INTO xbkpf-budat.
MOVE itab-waers TO xbkpf-waers.
xbkpf-auglv = 'UMBUCHNG'.
TRANSFER xbkpf TO file.
*2 fill bselk
xselk = bselk.
xselk-agkon = itab-lifnr.
xselk-agbuk = itab-bukrs.
xselk-agkoa = 'K'.
xselk-xnops = 'X'.
TRANSFER xselk TO file_si.
*3 fill bselp (clearing criterion)
xselp = bselp.
xselp-feldn_1 = 'SGTXT'.
MOVE itab-sgtxt TO xselp-slvon_1.
TRANSFER xselp TO file_si.
regards Andreas -
Error F5 702 for bapi_acc_invoice_receipt_post
Hello,
I am using bapi_acc_invoice_receipt_post to post vendor invoices. I am getting this error ' Balance in transaction currency F5 702'
The credit and debit entries match and zero out. I am unable to figure out why this is happening. Please Suggest.Rob,
I filled in the tax line items with gl account and tax code its asking for account determination key and condition key. I don't know if i have to pass these for tax exempt invoices and I entered amount in tax items as '0' , the error still shows up.. Am I missing something? -
Tax Data calculation using BAPI_ACC_INVOICE_RECEIPT_POST
Hi,
We are creating invoices using BAPI_ACC_INVOICE_RECEIPT_POST. However Tax is not getting calculated for the line items even if we pass the tax data through the field u201CTAX_CODEu201D in the table u201CACCOUNTGLu201D. The Tax value is to be updated in table BSEG and BSET, which is not happening after the IDOC posting. Please advice whether we need to pass the parameter (table) u201CACCOUNTTAXu201D (with data filled) in order to calculate the tax for the line items.
We are passing the following parameters presently and IDOCS are getting posted successfully even though tax amounts are not getting calculated.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
exporting
DOCUMENTHEADER = DOCUMENTHEADER (With data)
CUSTOMERCPD = CUSTOMERCPD (blank)
importing
OBJ_TYPE = OBJ_TYPE (blank)
OBJ_KEY = OBJ_KEY (blank)
OBJ_SYS = OBJ_SYS (blank)
tables
ACCOUNTPAYABLE = ACCOUNTPAYABLE (Filled with data)
ACCOUNTGL = ACCOUNTGL (Filled with data)
ACCOUNTTAX = ACCOUNTTAX (blank)
CURRENCYAMOUNT = CURRENCYAMOUNT (Filled with data)
PURCHASEORDER = PURCHASEORDER (blank)
PURCHASEAMOUNT = PURCHASEAMOUNT (blank)
RETURN = RETURN
CRITERIA = CRITERIA
VALUEFIELD = VALUEFIELD
EXTENSION1 = EXTENSION1
exceptions
OTHERS = 1
Regards,
Gaurav.hiiii
go throgh following link..it will solve your problem..
make BAPI_ACC_DOCUMENT_POST calculate tax.
regards
twinkal -
Hi experts!!
I am using BAPI_ACC_INVOICE_RECEIPT_POST to post a document. When I post a document through the t-code FB01 or F-43, it's being posted by even updating the table WITH_ITEM. When I post through BAPI_ACC_INVOICE_RECEIPT_POST, it's posting document and updating WITH_ITEM table also, but the values being updated are wrong. Below is a brief explanation on my problem:
When I give VAT entry, then QSSHB in BSEG will be the result after the VAT is deducted (DMBTR of the header entry subtracted DMBTR under VAT entry). And the same value will also be updated in WITH_ITEM field WT_QSSHB.
When I use this bapi, it is not being calculated bu the same DMBTR under header entry is coming as WT_QSSHB, which is wrong.
The way to solve this is to calculate by some logic, but I am not sure whether this is the correct way to approach. I couldn't find any calculation done in standard FB01, though I debugged it.
Can anyone help me out? Or any other bapi which meets my requirement will also be so helpful.
Thanks a lot.
Edited by: abapdev on Jun 1, 2009 10:38 AMHi,
once the document posted thru bapi, check with fb03 whether a new line item is created for with holding tax. And check the tax amount is deducted from vendor line item.
Regards,
Ravi. -
Bapi BAPI_ACC_INVOICE_RECEIPT_POST
Hi,
I want to be able to use the bapi with tax. I have the following code which gives me the result: E FF 747 Tax amount must not be greater than the tax base.
Its not clear to me what i do wrong when filling the tables for the bapi. Any help will be appreciated.
FORM FILL_INTERNAL_TABLES.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
OWN_LOGICAL_SYSTEM = GD_DOCUMENTHEADER-OBJ_SYS.
fill header
GD_DOCUMENTHEADER-OBJ_TYPE = 'BKPFF'.
GD_DOCUMENTHEADER-OBJ_KEY = REF_KEY.
GD_DOCUMENTHEADER-USERNAME = SY-UNAME.
GD_DOCUMENTHEADER-HEADER_TXT = 'AHJD BAPI Test'.
GD_DOCUMENTHEADER-COMP_CODE = 'A14'.
GD_DOCUMENTHEADER-DOC_DATE = '20050927'.
GD_DOCUMENTHEADER-PSTNG_DATE = '20050927'.
GD_DOCUMENTHEADER-DOC_TYPE = 'KR'.
fill AP (line 1)
IT_ACCOUNTPAYABLE-ITEMNO_ACC = 1.
IT_ACCOUNTPAYABLE-VENDOR_NO = '0000001001'.
IT_ACCOUNTPAYABLE-PMNTTRMS = '30'.
IT_ACCOUNTPAYABLE-ITEM_TEXT = 'AP BAPI Test'.
APPEND IT_ACCOUNTPAYABLE.
IT_CURRENCYAMOUNT-ITEMNO_ACC = 1.
IT_CURRENCYAMOUNT-CURR_TYPE = '00'.
IT_CURRENCYAMOUNT-CURRENCY = 'EUR'.
IT_CURRENCYAMOUNT-AMT_DOCCUR = -119.
APPEND IT_CURRENCYAMOUNT.
fill GL (line 2)
IT_ACCOUNTGL-ITEMNO_ACC = 2.
IT_ACCOUNTGL-GL_ACCOUNT = '0043419002'.
IT_ACCOUNTGL-ITEM_TEXT = 'GL BAPI Test'.
IT_ACCOUNTGL-COSTCENTER = '0000514200'.
APPEND IT_ACCOUNTGL.
IT_CURRENCYAMOUNT-ITEMNO_ACC = 2.
IT_CURRENCYAMOUNT-CURR_TYPE = '00'.
IT_CURRENCYAMOUNT-CURRENCY = 'EUR'.
IT_CURRENCYAMOUNT-AMT_DOCCUR = 100.
APPEND IT_CURRENCYAMOUNT.
fill tax
IT_ACCOUNTTAX-ITEMNO_ACC = 3.
IT_ACCOUNTTAX-TAX_CODE = 'BA'.
APPEND IT_ACCOUNTTAX.
IT_CURRENCYAMOUNT-ITEMNO_ACC = 3.
IT_CURRENCYAMOUNT-CURR_TYPE = '00'.
IT_CURRENCYAMOUNT-CURRENCY = 'EUR'.
IT_CURRENCYAMOUNT-AMT_DOCCUR = 19.
IT_CURRENCYAMOUNT-AMT_BASE = 100.
APPEND IT_CURRENCYAMOUNT.Hi all, And thanks in advance,
We have been reading about this bapi to make an INVOICE. We use it and the table "return" , returns OK, so we supposed the invoice was created with its own invoice number, that´s to say BELNR (this number is inside the range than we have defined for the doc. type ). After that, when we access the BKPF table, the invoice is not there, we can´t find it. Can anyone tell me what´s going wrong?.
REPORT ztestbapi01 .
TABLES bkpf.
PARAMETERS: bukrs LIKE lfb1-bukrs DEFAULT 'PS01' OBLIGATORY.
DATA: header LIKE bapiache03,
acc_pay LIKE bapiacap03 OCCURS 0 WITH HEADER LINE,
acc_tgl LIKE bapiacgl03 OCCURS 0 WITH HEADER LINE,
acc_tax LIKE bapiactx01 OCCURS 0 WITH HEADER LINE,
cur_amo LIKE bapiaccr01 OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
porder LIKE bapiacpo00 OCCURS 0 WITH HEADER LINE,
ext_doc LIKE bapiacdockey OCCURS 0 WITH HEADER LINE,
obj_type LIKE bapiache03-obj_type,
obj_key LIKE bapiache03-obj_key,
obj_sys LIKE bapiache03-obj_sys.
START-OF-SELECTION.
FORM fill_header USING head STRUCTURE bapiache03.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = head-obj_sys
EXCEPTIONS
own_logical_system_not_defined = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
head-username = sy-uname.
head-header_txt = 'Prueba de App Cont Bapi'.
head-comp_code = bukrs.
head-fisc_year = '2005'.
head-doc_date = sy-datum.
head-pstng_date = sy-datum.
head-fis_period = '11'.
head-doc_type = 'HM'.
head-obj_type = 'BKPFF '.
head-obj_key = '100000036PS012005'.
head-ac_doc_no = '1000000036'.
ENDFORM. " fill_header
FORM fill_acc_tgl.
acc_tgl-itemno_acc = '002'.
acc_tgl-gl_account = '0000606000'.
acc_tgl-comp_code = bukrs.
acc_tgl-tax_code = 'SC'.
APPEND acc_tgl.
ENDFORM. " fill_acc_tgl
FORM fill_cur_amo.
cur_amo-itemno_acc = '001'.
cur_amo-currency = cur_amo-currency_iso = 'EUR'.
cur_amo-curr_type = '00'.
cur_amo-amt_doccur = 69.
cur_amo-amt_base = 69.
APPEND cur_amo.
cur_amo-itemno_acc = '002'.
cur_amo-currency = cur_amo-currency_iso = 'EUR'.
cur_amo-curr_type = '00'.
cur_amo-amt_doccur = 69.
cur_amo-amt_base = 69.
APPEND cur_amo.
ENDFORM. " fill_cur_amo
FORM fill_acc_pay.
acc_pay-itemno_acc = '001'.
acc_pay-vendor_no = '0007759049'.
acc_pay-gl_account = '0000400004'.
acc_pay-pmnttrms = '0001'.
acc_pay-bline_date = sy-datum.
acc_pay-pymt_meth = 'W'.
acc_pay-pmnt_block = 'A'.
acc_pay-alloc_nmbr = '20051102'.
APPEND acc_pay.
ENDFORM. " fill_acc_pay
PERFORM fill_header USING header.
PERFORM fill_acc_pay.
PERFORM fill_acc_tgl.
PERFORM fill_cur_amo.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_CHECK'
EXPORTING
documentheader = header
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountpayable = acc_pay
accountgl = acc_tgl
accounttax = acc_tax
currencyamount = cur_amo
return = return.
LOOP AT return.
WRITE: / return-type, return-id, return-number, return-message.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = header
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountpayable = acc_pay
accountgl = acc_tgl
accounttax = acc_tax
currencyamount = cur_amo
return = return.
LOOP AT return.
WRITE: / return-type, return-id, return-number, return-message.
ENDLOOP.
REFRESH return. CLEAR return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = return.
LOOP AT return.
WRITE: / return-type, return-id, return-number, return-message.
ENDLOOP. -
BAPI_ACC_INVOICE_RECEIPT_POST extension1
Hi Friends,
I need some help for the bapi above.
Is it possible to force tha BAPI to calculate the Tax by itself.
I mean, in FB60 I see the checkbox 'Calculate Tax?' and when I tick it, it does so.
But I could not find any field in the BAPI Structures to transfer the information.
How can I achieve that in the BAPI.
Thank you very much
Rg. JimbobNote 626235 - Tax postings with accounting BAPIs
Symptom
This note provides an example of how you can map tax postings using accounting BAPIs.
Other terms
Accounting, interface, non-deductible distributable input tax (NVV tax), BAPI
BAPI_ACC_BILLING_POST / CHECK
BAPI_ACC_INVOICE_RECEIPT_POST / CHECK
BAPI_ACC_GOODS_MOVEMENT_POST / CHECK
BAPI_ACC_EMPLOYEE_EXP_POST / CHECK
BAPI_ACC_EMPLOYEE_PAY_POST / CHECK
BAPI_ACC_EMPLOYEE_REC_POST / CHECK
BAPI_ACC_DOCUMENT_POST / CHECK
Reason and Prerequisites
This is a consulting note.
Solution 1. Example configuration of a tax code in transaction FTXP: You do not use any external tax system.
Country key US
Tax code U1
Procedure TAXUSJ
Tax type V (Input tax)
Jurisdiction Code PA0011000
Tax type Acct Key TaxPercRate Level FromLevel Cond.Type Location
Base Amount 100 0 BASB
Subtotal 120 0
A/P Sales Tax 1 Inv. NVV 5,000 210 120 JP1I PA0000000
A/P Sales Tax 2 Inv. NVV 2,000 220 120 JP2I PA0010000
A/P Sales Tax 3 Inv. NVV 1,000 230 120 JP3I PA0011000
A/P Sales Tax 1 Use MW1 100,000- 410 210 JP1U PA0000000
A/P Sales Tax 2 Use MW2 100,000- 420 220 JP2U PA0010000
A/P Sales Tax 3 Use MW3 100,000- 430 230 JP3U PA0011000
Business transaction:
You want to post an invoice.
You post the gross invoice amount of USD 100 with a total of USD 108 as expense according to the calculation procedure. On the other side there are tax line items with amounts of USD 5, 2 and 1. The posting record appears as follows:
Expense account 108 USD (debit)
To vendor -100 USD (credit)
To input tax -5 USD (Credit)
To input tax -2 USD (Credit)
To input tax -1 USD (Credit)
Structure of the tax-relevant BAPI lines:
AccountGL-Itemno_acc = '0000000002'.
AccountGL-GL_Account = '0000400000'.
AccountGL-Tax_Code = 'U1'.
AccountGL-Taxjurcode = 'PA0011000'.
CurrencyAmount-Itemno_acc = '0000000002'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '108'.
*Input tax
AccountTax-Itemno_Acc = '0000000003'.
AccountTax-Tax_Code = 'U1'.
AccountTax-Acct_Key = 'MW1'.
AccountTax-Cond_Key = 'JP1U'.
AccountTax-Taxjurcode = 'PA0000000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '1'.
CurrencyAmount-Itemno_acc = '0000000003'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '5-'.
CurrencyAmount-Amt_Base = '100-'.
AccountTax-Itemno_Acc = '0000000004'.
AccountTax-Tax_Code = 'U1'.
AccountTax-Acct_Key = 'MW2'.
AccountTax-Cond_Key = 'JP2U'.
AccountTax-Taxjurcode = 'PA0010000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '2'.
CurrencyAmount-Itemno_acc = '0000000004'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '2-'.
CurrencyAmount-Amt_Base = '100-'.
AccountTax-Itemno_Acc = '0000000005'.
AccountTax-Tax_Code = 'U1'.
AccountTax-Acct_Key = 'MW3'.
AccountTax-Cond_Key = 'JP3U'.
AccountTax-Taxjurcode = 'PA0011000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '3'.
CurrencyAmount-Itemno_acc = '0000000005'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '1-'.
CurrencyAmount-Amt_Base = '100-'.
*NVV
AccountTax-Itemno_Acc = '0000000006'.
AccountTax-Tax_Code = 'U1'.
AccountTax-Acct_Key = 'NVV'.
AccountTax-Cond_Key = 'JP1I'.
AccountTax-Taxjurcode = 'PA0000000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '1'.
AccountTax-Stat_Con = 'X'.
CurrencyAmount-Itemno_acc = '0000000006'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '5'.
CurrencyAmount-Amt_Base = '100'.
AccountTax-Itemno_Acc = '0000000007'.
AccountTax-Tax_Code = 'U1'.
AccountTax-Acct_Key = 'NVV'.
AccountTax-Cond_Key = 'JP2I'.
AccountTax-Taxjurcode = 'PA0010000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '2'.
AccountTax-Stat_Con = 'X'.
CurrencyAmount-Itemno_acc = '0000000007'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '2'.
CurrencyAmount-Amt_Base = '100'.
AccountTax-Itemno_Acc = '0000000008'.
AccountTax-Tax_Code = 'U1'.OBC
AccountTax-Acct_Key = 'NVV'.
AccountTax-Cond_Key = 'JP3I'.
AccountTax-Taxjurcode = 'PA0011000'.
accounttax-taxjurcode_deep = 'PA0011000'.
accounttax-taxjurcode_level = '3'.
AccountTax-Stat_Con = 'X'.
CurrencyAmount-Itemno_acc = '0000000008'.
CurrencyAmount-Curr_Type = '00'.
CurrencyAmount-Currency = 'USD'.
CurrencyAmount-Amt_Doccur = '1'.
CurrencyAmount-Amt_Base = '100'.
2. Example configuration of a tax code in transaction FTXP: You use an external tax system. You made Customizing settings (transaction OBCO) to ensure that the system determines tax amounts line by line.
Country key US
Tax code U1
Schema TAXUSX
Tax type V (Input tax)
Tax type Acct Key TaxPercRate Level FromLevel Cond.Type
Base Amount 100 0 BASB
Subtotal 120 0
A/P Sales Tax 1 Inv. NVV 100,000 210 100 XP1I
A/P Sales Tax 2 Inv. NVV 100,000 220 100 XP2I
A/P Sales Tax 3 Inv. NVV 100,000 230 100 XP3I
A/P Sales Tax 4 Inv. NVV 100,000 240 100 XP4I
A/P Sales Tax 5 Inv. NVV 100,000 250 100 XP5I
A/P Sales Tax 3 Inv. NVV 100,000 260 100 XP6I
A/P Sales Tax 1 Use MW1 100,000- 410 210 XP1U
A/P Sales Tax 2 Use MW2 100,000- 420 220 XP2U
A/P Sales Tax 3 Use MW3 100,000- 430 230 XP3U
A/P Sales Tax 4 Use MW4 100,000- 440 240 XP4U
A/P Sales Tax 5 Use MW4 100,000- 450 250 XP5U
A/P Sales Tax 6 Use MW4 100,000- 460 260 XP6U
Geschäftsvorfall:
Es soll eine Rechnung gebucht werden.
You post the gross invoice amount of USD 100 with a total of USD 108.25 as expense according to the calculation procedure. On the other side there are tax line items with amounts of USD 6, 1.25 and 1. The posting record appears as follows:
Expense account 108.25 USD (debit)
To vendor -100.00 USD (credit)
To input tax -6.00 USD (Credit)
To input tax -1.25 USD (Credit)
To input tax -1.00 USD (Credit)
Structure of the tax-relevant BAPI lines:
accountgl-itemno_acc = '20'.
accountgl-gl_account = '0000400000'.
accountgl-tax_code = 'U1'.
accountgl-taxjurcode = '0508525201'.
currencyamount-itemno_acc = '20'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '108.25'.
*Input tax
CLEAR accounttax.
CLEAR currencyamount.
accounttax-itemno_acc = '30'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW1'.
accounttax-cond_key = 'XP1U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050000000'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '1'.
currencyamount-itemno_acc = '30'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '6-'.
currencyamount-amt_base = '100-'.
accounttax-itemno_acc = '40'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW2'.
accounttax-cond_key = 'XP2U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050850000'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '2'.
currencyamount-itemno_acc = '40'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '1.25-'.
currencyamount-amt_base = '100-'.
accounttax-itemno_acc = '50'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW3'.
accounttax-cond_key = 'XP3U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '3'.
currencyamount-itemno_acc = '50'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100-'.
accounttax-itemno_acc = '60'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW4'.
accounttax-cond_key = 'XP4U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '4'.
currencyamount-itemno_acc = '60'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '1-'.
currencyamount-amt_base = '100-'.
accounttax-itemno_acc = '70'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW4'.
accounttax-cond_key = 'XP5U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '5'.
currencyamount-itemno_acc = '70'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100-'.
accounttax-itemno_acc = '80'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'MW4'.
accounttax-cond_key = 'XP6U'.
accounttax-tax_rate = '100-'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '6'.
currencyamount-itemno_acc = '80'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100-'.
*NVV
accounttax-itemno_acc = '90'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP1I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050000000'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '1'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '90'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '6'.
currencyamount-amt_base = '100'.
accounttax-itemno_acc = '100'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP2I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050850000'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '2'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '100'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '1.25'.
currencyamount-amt_base = '100'.
accounttax-itemno_acc = '110'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP3I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '3'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '110'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100'.
accounttax-itemno_acc = '120'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP4I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '4'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '120'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '1'.
currencyamount-amt_base = '100'.
accounttax-itemno_acc = '130'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP5I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '5'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '130'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100'.
accounttax-itemno_acc = '140'.
accounttax-itemno_tax = '20'.
accounttax-tax_code = 'U1'.
accounttax-acct_key = 'NVV'.
accounttax-cond_key = 'XP6I'.
accounttax-tax_rate = '100'.
accounttax-taxjurcode = '050852520'.
accounttax-taxjurcode_deep = '0508525201'.
accounttax-taxjurcode_level = '6'.
accounttax-stat_con = 'X'.
currencyamount-itemno_acc = '140'.
currencyamount-curr_type = '00'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '0'.
currencyamount-amt_base = '100'.
Special case:
There is no AccountTax-Stat_Con field for the BAPIs BAPI_ACC_DOCUMENT_POST / CHECK. Therefore, it cannot be set in this case.
The program derives it automatically. -
BAPI_ACC_INVOICE_RECEIPT_POST balance error
Hi.
I've read all the posts I can find about this BAPI. I want to post an invoice, but seem to be a problem somewhere.. Is there anyone who had such a problem or can help me please? Thanks.
The header is like this:
gd_documentheader-obj_type = 'BKPFF'.
gd_documentheader-obj_key = ref_key.
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'HD BAPI Test'.
gd_documentheader-comp_code = '4020'.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-ref_doc_no = 'ttt'.
where i generate a random key for ref_key.
The account payable is like with corresponding currency amount:
it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no = '2000001010'.
it_accountpayable-item_text = 'Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount.
The account is:
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0064414401'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'Test'.
it_accountgl-orderid = '405200BE0800'.
it_accountgl-fisc_year = '2005'.
it_accountgl-fis_period = '07'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
And the tax:
it_accounttax-itemno_acc = 3.
it_accounttax-gl_account = '0062212201'.
it_accounttax-tax_code = 'GQ'.
it_accounttax-acct_key = 'VST'.
it_currencyamount-itemno_acc = 3.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
The bapi will keep giving me the "Balance in current transaction" error, unless I remove the doc type KR in the header.
Many thanks in advance.
Tiago.Thank you Arjan!
But I've got the same message when using the "AMT_BASE" instead of "AMT_DOCCUR".
I can post, but in a strange way..
If i do this, then i have 2 documents posted. A KR and an AB. But then, when i try to pass the BSCHL with the extends section in the BAPI i get wrong bschl error in the bapi...
it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no = '2000001075'.
it_accountpayable-item_text = 'AP BAPI Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount.
it_accountpayable-itemno_acc = 3.
it_accountpayable-vendor_no = '2000001075'.
it_accountpayable-item_text = 'AP BAPI Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 3.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
fill GL (line 2)
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0062212201'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'GL BAPI Test'.
it_accountgl-orderid = '402500VE0800'.
it_accountgl-fisc_year = '2005'.
it_accountgl-fis_period = '07'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
it_accountgl-itemno_acc = 4.
it_accountgl-gl_account = '0062212201'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'GL BAPI Test'.
it_accountgl-orderid = '402500VE0800'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 4.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount.
Maybe you are looking for
-
Comparing and Combining 2 Excel Sheets
Hi there, I have Microsoft Office 2008 (also Office 2007 on Windows - Using Parallel). Is there a software out there for Mac or PC where I can compare and combine two excel sheets? Each excel sheet has at least 12,000 rows. One column on each spreads
-
PI7.0: Problem about openning alert configuration in RMB
Hi experts, I encounter a problem about alert configuration. I have defined the alert catogory in WAS ABAP and use the report RSALERTTEST to test it. It's OK. Then I logon RWB and click u201CAlert configurationu201D,system popup a login window.
-
Newbie having problems with image on form
In Design, I use both the "image" and "image field" tools to place a JPG image on my form, but the image does not show up on the form (the placement is there for the image, but not the image). How can I correct this problem?
-
Adobe Reader Restrictions - deletePages()
Hi, I'm new to scripting in Acrobat and I've run into a problem. I'm creating an order form that uses JavaScript to prompt the user with a question, asking them how many pages are in their order (The range is from 1 to 10). The original document is t
-
Portege Z830 - "No HDD Recovery Area" any more
Hi, today I wanted to make recovery USB key with Toshiba Recovery media Creator. For this purpose I bought 16 GB 3/10 MB/s Verbatim key. I tried several times with no success. Every time I tried Toshiba Recovery media Creator noticed error: *Error co