Closing balance field in FBL1N transaction
Hi experts,
In FBL1N transaction, what is the field for closing balance at final display.
venkey
Hi
Please give query little explanatory.Please check FK10N you can see the closing blance month wise
Regards
Similar Messages
-
No value in Purchasing Document field in FBL1N Transaction
Hi All,
While executing a report RFITEMAP (Transaction FBL1N), Purchasing Document field is blank while I can see the corresponding Purchasing Document in BSEG table. I have a requirement to show the same in the output. Do we have some settings or ABAP code changes to achieve it?
Any kind of input would be helpful to me.
Rgds,
KhanshiHi,
Please read note 152335
You can achieve it via OSS note 112312, but you need to program the BTE as per your business requirements, as stated in the note there is no standard functionality for this.
You may refer to the following wiki page, it has an example, but in the example, another field was used, maybe it can be useful for you.
http://wiki.sdn.sap.com/wiki/x/fg3cCw
regards
Waman -
Opening and Closing balances in RG1 register
Hi,
We are facing one issue in RG1 register. When we update and extract the RG1 register from system, its showing Sales Qty and Excise duties properly. But opening and closing balances are not coming, its showing zero there. I checked J_2IRG1BAL table and found that it is also not getting updated. Material comes into stock with 561(initial stock) and 101(from production) movement types but opening/closing balances not coming in either case. Both movement types are activated for RG1 also.
Seeking your help in this regard.....
Regards,
Satyendra SoniHi Satyendra ,
For initial upload in RG1 there are 2 tables you need to manually update. J_2IRG1BAL from CIN or SD side. And Accounts to be updated for Balance in J_2IACCBAL.
There are 2 ways for updating balance tables
On last day of month enter Balance in Closing balance field.
OR enter opening balance on 1 st day of month.
Also check Material form P ,can be maintained in user exit for permanent effect.
After updating balances ,
perform any one transaction on system.
and then Extract the Rg1 table .
Ask FI consultant to put in FI JV after balance upload in ACCBAL table.
If you have not done table entries before performing transaction and extraction of RG1 then balances will not appear .
Check with your senior there and use table edit in such case (I hope you are not on production server at the moment) .Then again perform Extraction and check once.
SD FI and ABAP to be present and take decision accordingly. -
General Ledger report with Op Bal , Trans Line Items and Closing Balance
Hi Experts,
My clients needs a General Ledger report which should show Opening balance and all transactions line items with closing figure in a single report for a fiscal year in the given date range wise. Can I get a report in standard sap. Waiting for your reply.
Thanks in Advance,
Arabinda ParidaHi Parida,
There is no such report in SAP. Basically all standard report gives line items not with opening and closing balances. Anyway check mentioned transaction which may help to you.
S_ALR_87012309....It is cash journal report. Anyway you can enter GL account get opening and closing balances with all relavent transactions.
Regards
Suma -
Dear All,
I have an requirement for getting the closing balance as running total. Means I have the following fields as
Debit Credit Balance ( Not there but want a calculation or formula from crystal reports )
100 0 100
200 0 300
0 50 250
0 100 150
500 0 650
Basically I want a closing Balance field. How to achieve please advise
Regards,
DepikaAre you using a running total, or a sum? Are the options for the running total set correctly (in particular when it is reset to zero)?
Anyway, you can do this with global variables as well (basic syntax):
global balance as number
if PreviousValue({group field}) <> {group field} then
balance = 0
end if
balance = balance + {debit} - {credit}
formula = balance
Where {group field} is whatever field you need to trigger a reset of the balance. Put this field where you ant the balance displayed.
HTH,
Carl -
Table Field of Opening Balance & Closing Balance
Hi,
I want the table field of Opening Balance & Closing Balance for G/L Account Balance (ref. t. code FS10N).....
From where i can get these field...
ThanksHi,
Activate SQL trace (ST05), and run the transaction to create a new entry or change the value of an existing, then deactivate the trace.
we can see the tables that updating the transaction.
Hope this will help you....
Regards,
Pavan -
Performance Issue For Opening And Closing Balance In FBL1N/3N/5N
Dear experts,
I Am Having Requirement to Bring Opening And Closing Balance In FBL1N, FBL3N, FBL5N.
For This requirement I Used BADI : FI_ITEMS_CH_DATA~CHANGE_ITEMS, below is my Code For FBL1N, And I've Done the same For 3N/5N...With Related BAPI
* IF SY-TCODE = 'FBL1N'.
* LOOP AT ct_items INTO gs_items.
* CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
* EXPORTING
* date = gs_items-budat
* days = '01'
* months = '00'
* signum = '-'
* years = '00'
* IMPORTING
* calc_date = lv_date.
* CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
* EXPORTING
* companycode = gs_items-bukrs
* vendor = gs_items-konto
* keydate = lv_date
** BALANCESPGLI = ' '
** NOTEDITEMS = ' '
** IMPORTING
** RETURN =
* TABLES
* keybalance = lv_obal.
* CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
* EXPORTING
* companycode = gs_items-bukrs
* vendor = gs_items-konto
* keydate = gs_items-budat
** BALANCESPGLI = ' '
** NOTEDITEMS = ' '
** IMPORTING
** RETURN =
* TABLES
* keybalance = lv_cbal
* READ TABLE lv_cbal INTO gs_cbal INDEX 1.
* gs_items-cbal = gs_cbal-lc_bal.
* READ TABLE lv_obal INTO gs_obal INDEX 1.
* gs_items-obal = gs_obal-lc_bal.
* MODIFY ct_items FROM gs_items TRANSPORTING obal cbal.
* CLEAR: gs_items,gs_obal,gs_cbal.
* ENDLOOP.
* ENDIF.
So, Above Code Causing Me the Performance Issue, Kindly Suggest Me the Solution..
Regards,
uday.Hi Uday,
I am sending you the code i used for the creation a Zreport based on FBL5N. Please check if it can of any help.
*& Report ZFBL5N *
REPORT zfbl5n_new .
TABLES : bsid,knc1,lfc1.
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_bsid,
bukrs TYPE bsid-bukrs,
kunnr TYPE bsid-kunnr,
belnr TYPE bsid-belnr,
buzei TYPE bsid-buzei,
bldat TYPE bsid-bldat,
blart TYPE bsid-blart,
bschl TYPE bsid-bschl,
shkzg TYPE bsid-shkzg,
dmbtr TYPE bsid-dmbtr,
augdt TYPE bsid-augdt,
augbl TYPE bsid-augbl,
zuonr TYPE bsid-zuonr,
sgtxt TYPE bsid-sgtxt,
zfbdt TYPE bsid-zfbdt,
zterm TYPE bsid-zterm,
zbd1t TYPE bsid-zbd1t,
zbd2t TYPE bsid-zbd2t,
zbd3t TYPE bsid-zbd3t,
kkber TYPE bsid-kkber,
bstat TYPE bsid-bstat,
umskz TYPE bsid-umskz,
END OF ty_bsid.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
bldat TYPE bsik-bldat,
blart TYPE bsik-blart,
bschl TYPE bsik-bschl,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
sgtxt TYPE bsik-sgtxt,
zfbdt TYPE bsik-zfbdt,
* KKBER TYPE bsik-kkber,
zterm TYPE bsik-zterm,
zbd1t TYPE bsik-zbd1t,
zbd2t TYPE bsik-zbd2t,
zbd3t TYPE bsik-zbd3t,
bstat TYPE bsid-bstat,
umskz TYPE bsid-umskz,
END OF ty_bsik.
TYPES: BEGIN OF ty_final,
belnr TYPE bsid-belnr,
* buzei TYPE bsak-buzei,
bldat TYPE bsid-bldat,
blart TYPE bsid-blart,
chq TYPE bsid-zuonr,
debit TYPE bsid-dmbtr,
credit TYPE bsid-dmbtr,
txt TYPE bsid-sgtxt,
date TYPE bsid-zfbdt,
kkber TYPE bsid-kkber,
zterm TYPE bsid-zterm,
augbl TYPE bsid-augbl,
augdt TYPE bsid-augdt,
flag TYPE c,
END OF ty_final.
TYPES : BEGIN OF gs_openbal,
bukrs TYPE bapi3007_2-comp_code,
kunnr TYPE bapi3007_2-customer,
dmbtr TYPE bapi3007_2-lc_amount,
END OF gs_openbal.
DATA: it_bsid TYPE STANDARD TABLE OF ty_bsid,
it_bsik TYPE STANDARD TABLE OF ty_bsik,
it_final TYPE STANDARD TABLE OF ty_final.
DATA: wa_bsid TYPE ty_bsid,
wa_bsik TYPE ty_bsik,
wa_final TYPE ty_final.
DATA: w_days TYPE t5a4a-dlydy,
w_month TYPE t5a4a-dlymo,
w_year TYPE t5a4a-dlyyr,
w_date TYPE p0001-begda,
w_name1 TYPE kna1-name1,
w_ort01 TYPE kna1-ort01,
w_lifnr TYPE kna1-lifnr,
w_dmbtr1 TYPE bsid-dmbtr,
w_dmbtr2 TYPE bsid-dmbtr,
w_dmbtr3 TYPE bsad-dmbtr,
w_dmbtr4 TYPE bsad-dmbtr,
w_opbal TYPE bsid-dmbtr,
w_credit TYPE bsik-dmbtr,
w_debit TYPE bsik-dmbtr,
w_clobal TYPE bsik-dmbtr,
w_credit1 TYPE bsik-dmbtr,
w_debit1 TYPE bsik-dmbtr,
w_clobal1 TYPE bsik-dmbtr.
DATA: ld_yrper LIKE rwcoom-fiscper,
kunnr LIKE kna1-kunnr,
x_norm TYPE c,
x_park,
x_apar,
x_merk,
ok_code(4),
wa_x001 LIKE x001,
return LIKE bapireturn,
line_count LIKE sy-loopc,
number_of_records TYPE i,
xindex LIKE sy-tabix,
open LIKE knc1-um01s,
temp(20),
close LIKE knc1-um01s,
gjahr LIKE bsid-gjahr,
period LIKE bkpf-monat,
f(1),
v_char(2),
closec(20),
openc(20),
debit LIKE bapi3007_2-lc_amount,
credit LIKE debit.
DATA : v_dmbtr LIKE bsid-dmbtr.
*DATA : tot_debit LIKE t_ar-debit,
* tot_credit LIKE t_ar-credit.
DATA : t_kna1 LIKE kna1 OCCURS 1 WITH HEADER LINE,
t_knb1 LIKE knb1 OCCURS 10 WITH HEADER LINE.
DATA ibsid LIKE bsid OCCURS 0 WITH HEADER LINE.
DATA ibsad LIKE bsad OCCURS 0 WITH HEADER LINE.
DATA ibsik LIKE bsik OCCURS 0 WITH HEADER LINE.
DATA ibsak LIKE bsak OCCURS 0 WITH HEADER LINE.
DATA : it_fieldcat_alv TYPE slis_t_fieldcat_alv,
wa_fieldcat_alv TYPE slis_fieldcat_alv,
is_layout_alv TYPE slis_layout_alv,
wa_layout_alv TYPE slis_layout_alv,
it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
wa_events TYPE LINE OF slis_t_event.
DATA : BEGIN OF ibukrs OCCURS 0,
bukrs LIKE t001-bukrs,
END OF ibukrs.
DATA : BEGIN OF ikunnr1 OCCURS 0,
kunnr LIKE knc1-kunnr,
END OF ikunnr1.
DATA : BEGIN OF ikunnr OCCURS 0,
kunnr LIKE knc1-kunnr,
bukrs LIKE t001-bukrs,
lifnr LIKE lfc1-lifnr,
END OF ikunnr.
DATA: it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
DATA: r_bschl TYPE RANGE OF bschl,
wa_bschl LIKE LINE OF r_bschl.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_kunnr TYPE bsid-kunnr OBLIGATORY,
p_bukrs TYPE bsid-bukrs OBLIGATORY.
SELECT-OPTIONS: so_budat FOR bsid-budat .
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : p_normal AS CHECKBOX,
p_spl AS CHECKBOX,
p_vendor AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.
PERFORM get_data.
PERFORM process_data.
*PERFORM calculate_openbal. " Commented by anish
PERFORM calculate_open_bal.
PERFORM calculate_closing_bal.
PERFORM build_catalog_sort USING it_sort.
PERFORM reuse_alv_events_get .
PERFORM display_data.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
SELECT bukrs kunnr belnr buzei bldat blart bschl shkzg dmbtr augdt augbl zuonr sgtxt zfbdt zterm zbd1t zbd2t zbd3t kkber
bstat umskz FROM bsid
INTO TABLE it_bsid
WHERE bukrs = p_bukrs
AND kunnr = p_kunnr
AND budat IN so_budat.
SELECT bukrs kunnr belnr buzei bldat blart bschl shkzg dmbtr augdt augbl zuonr sgtxt zfbdt zterm zbd1t zbd2t zbd3t kkber
bstat umskz FROM bsad
APPENDING TABLE it_bsid
WHERE bukrs = p_bukrs
AND kunnr = p_kunnr
AND budat IN so_budat.
SELECT SINGLE name1 ort01 lifnr FROM kna1
INTO (w_name1 , w_ort01 , w_lifnr)
WHERE kunnr = p_kunnr.
IF p_vendor IS NOT INITIAL.
SELECT bukrs lifnr belnr buzei bldat blart bschl shkzg dmbtr augdt augbl zuonr sgtxt zfbdt zterm zbd1t zbd2t zbd3t
bstat umskz FROM bsik
APPENDING TABLE it_bsik
WHERE bukrs = p_bukrs
AND lifnr = w_lifnr
AND budat IN so_budat.
SELECT bukrs lifnr belnr buzei bldat blart bschl shkzg dmbtr augdt augbl zuonr sgtxt zfbdt zterm zbd1t zbd2t zbd3t
bstat umskz FROM bsak
APPENDING TABLE it_bsik
WHERE bukrs = p_bukrs
AND lifnr = w_lifnr
AND budat IN so_budat.
ENDIF.
SORT it_bsid BY bschl.
DELETE it_bsid WHERE bschl = '04'.
DELETE it_bsid WHERE bschl = '07'.
DELETE it_bsid WHERE bschl = '17'.
DELETE it_bsid WHERE bschl = '34'.
DELETE it_bsid WHERE bschl = '27'.
DELETE it_bsid WHERE bschl = '37'.
SORT it_bsik BY bschl.
DELETE it_bsik WHERE bschl = '04'.
DELETE it_bsik WHERE bschl = '07'.
DELETE it_bsik WHERE bschl = '17'.
DELETE it_bsik WHERE bschl = '34'.
DELETE it_bsik WHERE bschl = '27'.
DELETE it_bsik WHERE bschl = '37'.
ENDFORM. " GET_DATA
*& Form PROCESS_DATA
* text
* --> p1 text
* <-- p2 text
FORM process_data .
DATA:okay TYPE c VALUE space.
w_month = '00'.
w_year = '00'.
SORT it_bsid BY bldat .
LOOP AT it_bsid INTO wa_bsid.
PERFORM check_item_ok USING p_normal
p_spl
p_vendor
* x_park
wa_bsid
CHANGING okay.
CHECK okay = 'X'.
wa_final-belnr = wa_bsid-belnr.
wa_final-bldat = wa_bsid-bldat.
wa_final-blart = wa_bsid-blart.
wa_final-txt = wa_bsid-sgtxt.
wa_final-kkber = wa_bsid-kkber.
wa_final-zterm = wa_bsid-zterm.
wa_final-augbl = wa_bsid-augbl.
wa_final-augdt = wa_bsid-augdt.
wa_final-flag = 'C'.
IF wa_bsid-blart = 'DZ'.
wa_final-chq = wa_bsid-zuonr.
ENDIF.
IF wa_bsid-shkzg = 'S'.
wa_final-debit = wa_bsid-dmbtr.
ELSEIF wa_bsid-shkzg = 'H'.
wa_final-credit = wa_bsid-dmbtr.
ENDIF.
w_credit = w_credit + wa_final-credit.
w_debit = w_debit + wa_final-debit.
****** Net due date
IF wa_bsid-zbd1t IS NOT INITIAL.
w_days = wa_bsid-zbd1t.
ELSEIF wa_bsid-zbd2t IS NOT INITIAL.
w_days = wa_bsid-zbd2t.
ELSEIF wa_bsid-zbd3t IS NOT INITIAL.
w_days = wa_bsid-zbd3t.
ENDIF.
IF w_days IS INITIAL.
wa_final-date = wa_bsid-zfbdt.
ELSE.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = wa_bsid-zfbdt
days = w_days
months = w_month
signum = '+'
years = w_year
IMPORTING
calc_date = w_date.
wa_final-date = w_date.
ENDIF.
APPEND wa_final TO it_final.
CLEAR: w_days , w_date , wa_final .
ENDLOOP.
IF it_bsik IS NOT INITIAL.
CLEAR: w_days , w_date.
SORT it_bsik BY bldat.
LOOP AT it_bsik INTO wa_bsik.
wa_final-belnr = wa_bsik-belnr.
wa_final-bldat = wa_bsik-bldat.
wa_final-blart = wa_bsik-blart.
wa_final-txt = wa_bsik-sgtxt.
* wa_final-kkber = wa_bsik-kkber.
wa_final-zterm = wa_bsik-zterm.
wa_final-augbl = wa_bsik-augbl.
wa_final-augdt = wa_bsik-augdt.
wa_final-flag = 'V'.
IF wa_bsik-blart = 'DZ'.
wa_final-chq = wa_bsik-zuonr.
ENDIF.
IF wa_bsik-shkzg = 'S'.
wa_final-debit = wa_bsik-dmbtr.
ELSEIF wa_bsik-shkzg = 'H'.
wa_final-credit = wa_bsik-dmbtr.
ENDIF.
w_credit1 = w_credit1 + wa_final-credit.
w_debit1 = w_debit1 + wa_final-debit.
******* Net Due date
IF wa_bsik-zbd1t IS NOT INITIAL.
w_days = wa_bsik-zbd1t.
ELSEIF wa_bsik-zbd2t IS NOT INITIAL.
w_days = wa_bsik-zbd2t.
ELSEIF wa_bsik-zbd3t IS NOT INITIAL.
w_days = wa_bsik-zbd3t.
ENDIF.
IF w_days IS INITIAL.
wa_final-date = wa_bsik-zfbdt.
ELSE.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = wa_bsik-zfbdt
days = w_days
months = w_month
signum = '+'
years = w_year
IMPORTING
calc_date = w_date.
ENDIF.
wa_final-date = w_date.
APPEND wa_final TO it_final.
CLEAR: wa_final.
ENDLOOP.
ENDIF.
ENDFORM. " PROCESS_DATA
*& Form DISPLAY_DATA
* text
* --> p1 text
* <-- p2 text
FORM display_data .
wa_fieldcat_alv-fieldname = 'BELNR'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-003.
wa_fieldcat_alv-outputlen = '11'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'BLDAT'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-004.
wa_fieldcat_alv-outputlen = '13'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'BLART'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-005.
wa_fieldcat_alv-outputlen = '02'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'CHQ'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-006.
wa_fieldcat_alv-outputlen = '09'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'DEBIT'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-007.
wa_fieldcat_alv-outputlen = '15'.
wa_fieldcat_alv-do_sum = 'X'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'CREDIT'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-008.
wa_fieldcat_alv-outputlen = '15'.
wa_fieldcat_alv-do_sum = 'X'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'TXT'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-009.
wa_fieldcat_alv-outputlen = '50'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'DATE'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-010.
wa_fieldcat_alv-outputlen = '12'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'KKBER'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-011.
wa_fieldcat_alv-outputlen = '04'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'ZTERM'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-012.
wa_fieldcat_alv-outputlen = '13'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'AUGBL'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-013.
wa_fieldcat_alv-outputlen = '15'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'AUGDT'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-seltext_l = text-014.
wa_fieldcat_alv-outputlen = '17'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
wa_fieldcat_alv-fieldname = 'FLAG'.
wa_fieldcat_alv-tabname = 'IT_FINAL'.
wa_fieldcat_alv-tech = 'X'.
APPEND wa_fieldcat_alv TO it_fieldcat_alv.
CLEAR wa_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = wa_layout_alv
it_fieldcat = it_fieldcat_alv
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort
it_events = it_events
i_save = 'A'
TABLES
t_outtab = it_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.
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* i_callback_program = sy-repid
* i_callback_top_of_page = 'TOP_OF_PAGE'
* is_layout = wa_layout_alv
* it_fieldcat = it_fieldcat_alv
* it_sort = it_sort
*** I_DEFAULT = 'X'
** i_save = 'A'
*** IT_EVENTS =
* TABLES
* t_outtab = it_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_DATA
*& Form TOP_OF_PAGE
* Header at top of page.
FORM top_of_page.
SKIP 1.
WRITE: AT 35 'Account Statement from' , so_budat-low , 'to' , so_budat-high.
SKIP 2.
WRITE: AT /5 'CUSTOMER:' , p_kunnr.
WRITE: AT 35 'Name:' , w_name1.
WRITE: AT /5 'Company:' , p_bukrs.
WRITE: AT 35 'City:' , w_ort01.
SKIP 1.
WRITE: AT /5 'Opening Balance as on' , so_budat-low , ' ' , w_opbal LEFT-JUSTIFIED.
SKIP 2.
ENDFORM. "TOP_OF_PAGE
*& Form END_OF_PAGE
* Footer at End of page.
FORM end_of_page.
SKIP 2.
IF so_budat-high IS NOT INITIAL.
WRITE: AT 5 'Closing Balance as on' , so_budat-high , ' ' , w_clobal LEFT-JUSTIFIED.
ELSE.
WRITE: AT 5 'Closing Balance ' , w_clobal LEFT-JUSTIFIED.
ENDIF.
ENDFORM. "end_of_page
*& Form CALCULATE_OPENBAL
* text
* --> p1 text
* <-- p2 text
FORM calculate_openbal .
DATA:v_gjahr TYPE bsid-gjahr.
DATA: v_period LIKE t009b-poper,v_monat LIKE t001-periv.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
i_budat = so_budat-low
i_bukrs = p_bukrs
* I_PERIV = ' '
* I_GJAHR = 0000
* I_MONAT = 00
* X_XMO16 = ' '
IMPORTING
e_gjahr = v_gjahr
* e_monat = v_monat
e_poper = v_period.
IF sy-subrc NE 0.
ENDIF.
DATA: f_date LIKE sy-datum.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = v_gjahr
i_monmit = 00
i_periv = 'V3'
i_poper = v_period
IMPORTING
e_date = f_date.
period = v_period - 1.
gjahr = v_gjahr.
DATA wa_kna1 LIKE kna1.
CALL FUNCTION 'READ_KNA1'
EXPORTING
xkunnr = p_kunnr
IMPORTING
xkna1 = wa_kna1
EXCEPTIONS
key_incomplete = 1
not_authorized = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE w023(zwww).
CALL SCREEN 0010.
ENDIF.
MOVE-CORRESPONDING wa_kna1 TO t_kna1.
APPEND t_kna1.
SELECT kunnr FROM kna1 INTO TABLE ikunnr1
WHERE kunnr = p_kunnr.
SELECT bukrs FROM t001 INTO TABLE ibukrs
FOR ALL ENTRIES IN t_knb1
WHERE bukrs = t_knb1-bukrs.
LOOP AT ikunnr1.
LOOP AT ibukrs.
ikunnr-kunnr = ikunnr1-kunnr.
ikunnr-bukrs = ibukrs-bukrs.
READ TABLE t_kna1 WITH KEY kunnr = ikunnr1-kunnr.
ikunnr-lifnr = t_kna1-lifnr.
APPEND ikunnr.
ENDLOOP.
ENDLOOP.
DELETE ikunnr WHERE bukrs NE p_bukrs.
LOOP AT ikunnr.
CLEAR: knc1,lfc1,f.
IF NOT ( ikunnr-kunnr IS INITIAL ) AND NOT ( p_vendor IS INITIAL ).
SELECT SINGLE * FROM lfc1
WHERE gjahr = gjahr AND bukrs = ikunnr-bukrs
AND lifnr = ikunnr-lifnr.
ENDIF.
SELECT SINGLE * FROM knc1
WHERE gjahr = gjahr AND bukrs = p_bukrs
AND kunnr = p_kunnr.
IF sy-subrc = 0.
CASE period .
WHEN 12.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h + knc1-um08s - knc1-um08h +
knc1-um09s - knc1-um09h + knc1-um10s - knc1-um10h +
knc1-um11s - knc1-um11h + knc1-um12s - knc1-um12h.
IF NOT ( lfc1 IS INITIAL ).
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um05h + lfc1-um06s - lfc1-um06h +
lfc1-um07s - lfc1-um07h + lfc1-um08s - lfc1-um08h +
lfc1-um09s - lfc1-um09h + lfc1-um10s - lfc1-um10h +
lfc1-um11s - lfc1-um11h + lfc1-um12s - lfc1-um12h.
ENDIF.
WHEN 11.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h + knc1-um08s - knc1-um08h +
knc1-um09s - knc1-um09h + knc1-um10s - knc1-um10h +
knc1-um11s - knc1-um11h.
IF NOT ( lfc1 IS INITIAL ) .
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um05h + lfc1-um06s - lfc1-um06h +
lfc1-um07s - lfc1-um07h + lfc1-um08s - lfc1-um08h +
lfc1-um09s - lfc1-um09h + lfc1-um10s - lfc1-um10h +
lfc1-um11s - lfc1-um11h.
ENDIF.
WHEN 10.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h + knc1-um08s - knc1-um08h +
knc1-um09s - knc1-um09h + knc1-um10s - knc1-um10h .
IF NOT ( lfc1 IS INITIAL ) .
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um05h + lfc1-um06s - lfc1-um06h +
lfc1-um07s - lfc1-um07h + lfc1-um08s - lfc1-um08h +
lfc1-um09s - lfc1-um09h + lfc1-um10s - lfc1-um10h.
ENDIF.
WHEN 9.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h + knc1-um08s - knc1-um08h +
knc1-um09s - knc1-um09h .
IF NOT ( lfc1 IS INITIAL ) .
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um05h + lfc1-um06s - lfc1-um06h +
lfc1-um07s - lfc1-um07h + lfc1-um08s - lfc1-um08h +
lfc1-um09s - lfc1-um09h.
ENDIF.
WHEN 8.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h + knc1-um08s - knc1-um08h.
IF NOT ( lfc1 IS INITIAL ) .
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um05h + lfc1-um06s - lfc1-um06h +
lfc1-um07s - lfc1-um07h + lfc1-um08s - lfc1-um08h .
ENDIF.
WHEN 7.
open = knc1-umsav +
knc1-um01s - knc1-um01h + knc1-um02s - knc1-um02h +
knc1-um03s - knc1-um03h + knc1-um04s - knc1-um04h +
knc1-um05s - knc1-um05h + knc1-um06s - knc1-um06h +
knc1-um07s - knc1-um07h .
IF NOT ( lfc1 IS INITIAL ) .
open = open + lfc1-umsav +
lfc1-um01s - lfc1-um01h + lfc1-um02s - lfc1-um02h +
lfc1-um03s - lfc1-um03h + lfc1-um04s - lfc1-um04h +
lfc1-um05s - lfc1-um -
Opening Balance - Transactions - Closing Balance in FD10N & FK10N
Hi All,
I need to see the report in following format for FD10N & FK10N
1. Opening Balance
2. (+/-) Transactions
3. Closing Balance
FD10N and FK10N show the period balance and drilling into the balance shows the detail view of transactions posted in the period. But I need to see the above 3 items (Opening Balance, Transactions & Closing Balance) in 1 report.
ThanksThere is no such report to show the opening balance then your transactions and then your closing balance. (something similar to personal bank statement)
However, you may see the following reports may suffice your requirement (there is no drilldown available)
S_ALR_87012172 (for customers)
S_ALR_87012082 (for vendors)
Regards,
Ravi -
Add field 'ebeln' in selection-screen of FBL1N transaction
Hi Experts,
Is there a way to display the field 'ebeln' in transaction FBL1N for certain document types and company code only..?
I have already tried this steps below..But the problem is, this changes below is applicable to all document types.
1. Trans. SE36, indicate logical database KDF. <- Logical database for FBL1N transaction
2. Details > Selection views
3. Update the standard SAP view
4. Select table BSIK
5. Include field ebeln.
Regards,
EkitzvDear,
Please kindly note that field BSEG-EBELN is not possible for being shown
with a value in FBL1N (and FBL5N).
Since Release 3.0, several purchase orders can be offset in one invoice.
As a result, different purchasing document numbers (BSEG-EBELN) can be
contained in the different G/L account line items..
As a result, it is no longer possible to enter a unique purchasing
document number in the customer/vendor line item.Field BSEG-EBELN is not
filled in the vendor line item and therefore cannot be displayed in the
line item display for customers/vendors.
You could reference note 152335 to find a more detailed explanation and
possible solution of the issue.
It is only possible to view the purchase order number(EBELN) in FBL3N.
As a workaround, you may branch from vendor line item display to
'Document overview' and you will see the PO number for the respective
accounting document in other G/L account line items.
What You are doing is to insert the field EBELN into the Dynamic selection of the FBL1N but this does not mean to have it available into the FBL1N layout.
I hope the System behaviour is clerer.
Mauri -
Opening Balance and closing Balance - Crystal Report
Hi,
We have a report with account number, date , opening balance , closing balance and transaction amount. we had grouped the report by account. User will run the report with set of date range and we need to find the minimum date to find the opening balance and maximum date to find the closing balance and display them in the account group header for each account.
WhilePrintingRecords;
NumberVar CBal;
If {Command.VALUEDATE}= Maximum({Command.VALUEDATE}) then
CBal= {Command.CLOSINGBALANCE};
+CBal;
It is showing the closing balance and opening balance in the account group footer. but we could not able to show in the account group header.
Regards,
SreeniThe easiest way to do this is NOT use variables.
Sort the data in date order ascending.
Then simple place the date field in Group header, details and footer.
Header will now show first date and Footer last date.
Ian -
Calculating Opening & Closing Balances
Hi Experts.
I want to know how to calculate Opening & closing Balances of stock Like MB5B transaction using reports.
I am giving Material N0, Posting date,Plant as Input
& want to extract Material Document Number, Quantity, Issues & receipts seperately, Opening & Closing Balance of Stock.Also it should be performed day wise.
This report should be a normal report without using ALV's.
Can Some Body Help me. Also let me know which tables & fields are being used.
Thanks.
Ravi SHi,
There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
Regards,
Vinod -
Repots( closing balance of a vendor)
hi.
i want to show the closing balnace of a vendor. in my report opening balance is coming. but if today i am displaying the report then it should be display the vendor's yesterday closing balance .
means at which date i will display the report the previous date colsing balance should be display.
pls give me some details.
my code is.
REPORT ZTEST12 NO STANDARD PAGE HEADING LINE-SIZE 191
LINE-COUNT 65
MESSAGE-ID zfimsg.
*-- table declarations
TABLES: bkpf,
bseg,
t001,
lfa1,
t003t,
payr.
*-- internal table declarations
DATA:BEGIN OF i_lfa1 OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
opbal LIKE bseg-dmbtr,
END OF i_lfa1.
DATA:BEGIN OF i_bkpf OCCURS 0,
belnr LIKE bkpf-belnr,
blart LIKE bkpf-blart,
gjahr LIKE bkpf-gjahr,
budat LIKE bkpf-budat,
bldat LIKE bkpf-bldat,
xblnr LIKE bkpf-xblnr,
END OF i_bkpf.
DATA:BEGIN OF i_bseg OCCURS 0,
belnr LIKE bseg-belnr, " Document no
koart LIKE bseg-koart, " Account type
shkzg LIKE bseg-shkzg, " Debit/Credit Indicator
ktosl LIKE bseg-ktosl, " Transaction
hkont LIKE bseg-hkont, " GL Account
sgtxt LIKE bseg-sgtxt, " Item Text
lifnr like bseg-lifnr,
dmbtr like bseg-dmbtr,
bupla like bseg-bupla,
END OF i_bseg.
DATA:BEGIN OF i_t003t OCCURS 0,
spras LIKE t003t-spras,
blart LIKE t003t-blart, " Document Type
ltext LIKE t003t-ltext, " Doc Type Desc
END OF i_t003t,
BEGIN OF i_skat OCCURS 0,
saknr LIKE skat-saknr, " gl account
txt20 LIKE skat-txt20, " gl account text
END OF i_skat,
BEGIN OF i_payr OCCURS 0,
zbukr like payr-zbukr,
vblnr LIKE payr-vblnr,
chect LIKE payr-chect,
laufd LIKE payr-laufd,
END OF i_payr,
BEGIN OF itab OCCURS 0,
bukrs LIKE bkpf-bukrs,
gjahr LIKE bkpf-gjahr,
lifnr LIKE lfa1-lifnr,
budat LIKE bkpf-budat,
name1 LIKE lfa1-name1,
opbal LIKE bseg-dmbtr,
belnr LIKE bkpf-belnr,
blart LIKE bkpf-blart,
debit LIKE bseg-dmbtr,
credit LIKE bseg-dmbtr,
sgtxt LIKE bseg-sgtxt,
bldat LIKE bkpf-bldat,
xblnr LIKE bkpf-xblnr,
wt_qbshh LIKE with_item-wt_qbshh,
ltext LIKE t003t-ltext,
chect LIKE payr-chect,
laufd LIKE payr-laufd,
txt20 like skat-txt20,
saknr like skat-saknr,
balance like bseg-dmbtr,
hkont like bseg-hkont,
bupla like bseg-bupla,
END OF itab.
DATA:BEGIN OF i_witem OCCURS 0,
belnr TYPE with_item-belnr,
buzei TYPE with_item-buzei,
wt_qbshh TYPE with_item-wt_qbshh,
END OF i_witem.
DATA:itab_key_bal LIKE bapi3007_3 OCCURS 0 WITH HEADER LINE.
DATA:ibal LIKE itab_key_bal OCCURS 0 WITH HEADER LINE.
DATA : v_butxt LIKE t001-butxt.
*-- work variables
DATA: w_gjahr1 LIKE bkpf-gjahr,
w_gjahr2 LIKE bkpf-gjahr, "#EC *
w_pdate LIKE bkpf-budat,
w_name1 LIKE lfa1-name1,
w_opbal LIKE bseg-dmbtr,
w_cbal LIKE bseg-dmbtr,
w_cfbal LIKE bseg-dmbtr,
w_sbal LIKE bseg-dmbtr,
w_ftotal LIKE bseg-dmbtr,
w_cftotal LIKE bseg-dmbtr,
w_ctot LIKE bseg-dmbtr,
w_dtot LIKE bseg-dmbtr,
balance like bseg-dmbtr,
total like bseg-dmbtr.
*-- selection screen
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE tit.
PARAMETERS: p_bukrs LIKE bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr OBLIGATORY,
s_belnr FOR bkpf-belnr.
CHANGE CODE -
SELECT-OPTIONS : S_PRCTR FOR BSEG-PRCTR,
S_BUPLA FOR BSEG-BUPLA.
*--END CHANGE--
parameters: p_gjahr like bkpf-gjahr OBLIGATORY.
SELECT-OPTIONS: s_budat FOR bkpf-budat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk.
*-- initialization
INITIALIZATION.
tit = 'Selection Block'.
*-- at selection screen
AT SELECTION-SCREEN ON s_budat.
CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
EXPORTING
companycodeid = p_bukrs
posting_date = s_budat-low
IMPORTING
fiscal_year = w_gjahr1
FISCAL_PERIOD =
RETURN =
CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
EXPORTING
companycodeid = p_bukrs
posting_date = s_budat-high
IMPORTING
fiscal_year = w_gjahr2
FISCAL_PERIOD =
RETURN =
IF p_gjahr NE '' AND p_gjahr NE w_gjahr1.
MESSAGE e000 WITH 'Enter valid dates'. "#EC *
ENDIF.
*-- start of selection
START-OF-SELECTION.
*data: burks type p_burks.
SELECT single butxt
FROM t001
INTO v_butxt
WHERE bukrs = p_bukrs.
if sy-subrc = 0.
SELECT lifnr name1
FROM lfa1
INTO CORRESPONDING FIELDS OF TABLE i_lfa1
WHERE lifnr IN s_lifnr.
endif.
*-- getting the opening balances for all vendors
PERFORM openingbalances.
select belnr
gjahr
budat
blart
BLDAT
XBLNR
from bkpf
into corresponding fields of table i_bkpf
where gjahr = p_gjahr and
budat in s_budat and
bukrs = p_bukrs and
belnr in s_belnr and
blart = 'KZ' and
bstat = ''.
IF NOT I_BKPF[] IS INITIAL.
SELECT BELNR
koart
shkzg
ktosl
hkont
sgtxt
BUPLA
LIFNR
DMBTR
FROM bseg into corresponding fields of table i_bseg
for all entries in i_bkpf
WHERE belnr = i_bkpf-belnr AND
gjahr = i_bkpf-gjahr AND
bukrs = p_bukrs AND
PRCTR IN S_PRCTR
AND BUPLA IN S_BUPLA
and koart = 'K' AND
lifnr IN s_lifnr.
if sy-subrc <> 0.
message 'value not found' type 'E'.
endif.
ENDIF.
IF NOT I_BSEG[] IS INITIAL.
select BELNR
BUZEI
WT_QBSHH
from with_item
into table i_witem
for all entries in i_bkpf
where belnr = i_bkpf-belnr AND
GJAHR = I_BKPF-GJAHR.
ENDIF.
IF NOT I_BKPF[] IS INITIAL.
select zbukr
vblnr
chect
laufd
from payr
into table i_payr
for all entries in i_bkpf
where zbukr = p_bukrs and
vblnr = i_bkpf-belnr.
ENDIF.
picking GL Account Details
IF NOT I_BSEG[] IS INITIAL.
SELECT saknr
txt20
FROM skat
INTO TABLE i_skat
FOR ALL ENTRIES IN i_bseg
WHERE saknr EQ i_bseg-hkont
AND spras EQ sy-langu
AND ktopl EQ p_bukrs.
ENDIF.
picking Document Details
IF NOT I_BKPF[] IS INITIAL.
SELECT spras
blart
ltext
FROM t003t
INTO TABLE i_t003t
FOR ALL ENTRIES IN i_bkpf
WHERE blart = i_bkpf-blart
AND spras = 'EN'.
ENDIF.
loop at i_bseg .
read table i_bkpf with key belnr = i_bseg-belnr.
itab-bukrs = p_bukrs.
itab-gjahr = i_bkpf-gjahr.
itab-lifnr = i_bseg-lifnr.
itab-bldat = i_bkpf-bldat.
itab-xblnr = i_bkpf-xblnr.
itab-bupla = i_bseg-bupla.
READ TABLE i_witem INTO i_witem WITH KEY belnr = i_bkpf-belnr.
IF sy-subrc IS INITIAL.
itab-wt_qbshh = i_witem-wt_qbshh.
ENDIF.
READ TABLE i_lfa1 WITH KEY lifnr = i_bseg-lifnr.
IF sy-subrc = 0.
itab-name1 = i_lfa1-name1.
itab-opbal = i_lfa1-opbal.
ENDIF.
itab-budat = i_bkpf-budat.
itab-belnr = i_bkpf-belnr.
itab-blart = i_bkpf-blart.
IF i_bseg-shkzg = 'S'.
itab-debit = i_bseg-dmbtr.
itab-credit = 0.
ELSEIF i_bseg-shkzg = 'H'.
itab-credit = i_bseg-dmbtr.
itab-debit = 0.
ENDIF.
itab-sgtxt = i_bseg-sgtxt.
to move GL Account details to final internal table
READ TABLE i_skat INTO i_skat WITH KEY saknr = i_bseg-hkont.
IF sy-subrc IS INITIAL.
itab-txt20 = i_skat-txt20.
itab-saknr = i_skat-saknr.
MOVE i_skat-txt20 TO itab-txt20. " Bank Name
MOVE i_skat-saknr TO itab-saknr.
ENDIF. "IF sy-subrc IS INITIAL
read table i_t003t into i_t003t with key blart = i_bkpf-blart.
itab-ltext = i_t003t-ltext.
*--to move doc number of the payment doc.
READ TABLE i_payr INTO i_payr WITH KEY vblnr = i_bkpf-belnr.
IF sy-subrc IS INITIAL.
itab-chect = i_payr-chect.
itab-laufd = i_payr-laufd.
ENDIF.
APPEND itab.
CLEAR itab.
ENDSELECT.
ENDLOOP.
LOOP AT i_lfa1.
READ TABLE itab WITH KEY lifnr = i_lfa1-lifnr.
IF sy-subrc NE 0.
itab-bukrs = p_bukrs.
itab-gjahr = p_gjahr.
itab-lifnr = i_lfa1-lifnr.
itab-name1 = i_lfa1-name1.
itab-opbal = i_lfa1-opbal.
APPEND itab.
CLEAR itab.
ENDIF.
ENDLOOP.
sort itab by bukrs gjahr lifnr budat.
LOOP AT itab.
w_name1 = itab-name1.
w_opbal = itab-opbal.
w_cbal = w_opbal * -1.
itab-debit = itab-debit + itab-wt_qbshh.
w_ctot = w_ctot + itab-credit.
w_dtot = w_dtot + itab-debit.
itab-balance = itab-credit.
if w_dtot is not initial.
itab-balance = itab-balance + w_dtot.
endif.
if w_ctot is not initial.
itab-balance = itab-balance - w_ctot.
endif.
clear itab-balance.
AT new lifnr.
on change of s_lifnr.
w_cfbal = w_opbal.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
IF w_opbal GE 0.
WRITE:/01 sy-vline,
02 'Vendor:',
12(10) itab-lifnr,
26 w_name1,
177 sy-vline.
175 sy-vLINE.
WRITE:/01 sy-vline,
02 'Opening Balance:',
131(13) w_opbal, "#EC *
177 sy-vline.
175 sy-vLINE.
ELSEIF w_opbal LT 0.
WRITE:/01 sy-vline,
02 'Vendor:',
12(10) itab-lifnr,
26 w_name1,
177 sy-vline.
175 sy-vline.
WRITE:/01 sy-vline,
02 'Opening Balance:',
148(13) w_opbal, "#EC *
177 sy-vline.
175 sy-vline.
ENDIF.
FORMAT COLOR OFF.
ENDAT.
total = itab-balance .
if w_ctot ge 0 and w_dtot ge 0.
itab-balance = w_opbal + w_dtot - w_ctot.
itab-balance = itab-balance - w_ctot.
endif.
if w_ctot is not initial and w_dtot le 0.
itab-balance = w_opbal - w_dtot - w_ctot.
endif.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/01 sy-vline,
02(10) itab-belnr CENTERED,
15 sy-vline,
16(10) itab-budat CENTERED,
27 sy-vline,
28(18) itab-ltext LEFT-JUSTIFIED,
45 sy-vline,
47(20) itab-txt20 CENTERED,
70 sy-vline,
46(9) itab-bupla centered,
55 sy-vline,
56(50) itab-sgtxt LEFT-JUSTIFIED,
115 sy-vline,
116(15) itab-xblnr centered,
130 sy-vline,
131(16) itab-debit centered,
145 sy-vline,
146(16) itab-credit centered,
160 sy-vline,
161(13) itab-balance left-JUSTIFIED,
175 sy-vline.
164(14) itab-balance left-justified,
177 sy-vline.
FORMAT COLOR OFF.
AT END OF lifnr.
IF w_opbal LT 0.
w_ctot = w_ctot + w_cbal .
ELSEIF w_opbal GE 0.
w_dtot = w_dtot + w_opbal .
ENDIF.
CLEAR w_cbal.
CLEAR w_opbal.
CLEAR w_name1.
CLEAR w_ftotal.
CLEAR w_cftotal.
clear itab-balance.
SUM.
ULINE (177).
ULINE (175).
if itab-credit ge 0 and w_dtot ge 0.
w_ftotal = w_cfbal + w_dtot - itab-credit.
endif.
if itab-credit is not initial and w_dtot le 0.
w_ftotal = w_cfbal - w_dtot - itab-credit.
endif.
FORMAT COLOR COL_TOTAL ON.
WRITE:/01 sy-vline,
02 'Total:',
130(13) w_dtot right-justified, "#EC *
143(16) w_ctot, "#EC *
159(16) w_ftotal,
177 sy-vline.
175 sy-vline.
ULINE.
CLEAR: w_ctot,w_dtot.
w_ftotal = w_cfbal + itab-debit - itab-credit.
w_cftotal = w_ftotal * -1.
clear w_ctot.
clear w_dtot.
ENDAT.
ENDLOOP.
*-- top of page
TOP-OF-PAGE.
WRITE:/48 v_butxt. " COLOR COL_GROUP.
WRITE:/45 '----
WRITE:/48 'Creditors Ledger'. " COLOR COL_KEY.
WRITE:/45 '----
SKIP 1.
WRITE:/2 'Company Code:',16 p_bukrs,
108 'Page No :', sy-pagno.
WRITE:/2 'Fiscal Year :',16 p_gjahr.
WRITE:/2 'Period :', s_budat-low,'to', s_budat-high.
ULINE (177).
ULINE (175).
FORMAT COLOR COL_HEADING ON.
WRITE:/01 sy-vline,
02(12) 'Document No' CENTERED,
15 sy-vline,
16(10) 'PDate' CENTERED,
27 sy-vline,
28(20) 'Voucher Type' LEFT-JUSTIFIED,
45 sy-vline,
46(9) 'Bis Place' CENTERED,
70 sy-vline,
55 sy-vline,
56(12) 'Narration' CENTERED,
115 sy-vline,
116(12) 'Cheque / Bill No' CENTERED,
130 sy-vline,
131(16) 'Debit' CENTERED,
145 sy-vline,
146(16) 'Credit' CENTERED,
160 sy-vline,
161(10) 'Balance' CENTERED,
175 sy-vline.
164(14) 'Balance' left-justified,
177 sy-vline.
***endcode
FORMAT COLOR OFF.
ULINE (177).
ULINE (15).
*& Form openingbalances
text
--> p1 text
<-- p2 text
FORM openingbalances.
w_pdate = s_budat-low - 1.
LOOP AT i_lfa1.
CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
EXPORTING
companycode = p_bukrs
vendor = i_lfa1-lifnr
keydate = w_pdate
balancespgli = 'X'
NOTEDITEMS = ' '
IMPORTING
RETURN =
TABLES
keybalance = itab_key_bal
REFRESH ibal.
CLEAR ibal.
CLEAR w_sbal.
APPEND LINES OF itab_key_bal TO ibal.
REFRESH itab_key_bal.
CLEAR itab_key_bal.
LOOP AT ibal.
ibal-lc_bal = ibal-lc_bal / 100.
w_sbal = w_sbal + ibal-lc_bal.
ENDLOOP.
i_lfa1-opbal = w_sbal.
MODIFY i_lfa1.
CLEAR i_lfa1.
REFRESH ibal.
CLEAR ibal.
CLEAR w_sbal.
ENDLOOP.
ENDFORM. " openingbalancesHi,
Instead of using BSEG use BSIK, which contains all open items. Use BUDAT to get all open records as of a particular date. You have already got the o/p balance, so add/Sub ( depending on BSAK-SHKZG = 'S' or 'H' )amounts from all records selected ffrom BSIK for a particular Vendor to arrive at the closiong balance.
I hope this helps,
Regards
Raju chitale -
RG1 Register : opening & closing balance does not match with actual Stock
Hi
I am working on SAP AFS 6.0.
The RG1 register for a particular month displays data of only those materials which have been transacted in that month. I checked the tables J_1IRG1 and J_2IRG1BAL found that system retrives all records of the given period from the table J_1IRG1 and picks opening balance of these records from the table J_2IRG1BAL. The records of those materials which have closing balance in J_2IRG1BAL but was not transacted in the given period are not considered in RG1 register.
I want RG1 register to show opening balance of all materials which have closing balance in J_2IRG1BAL but have not been transacted in the subsequent periods.
Regards
NirajHI
Yes it is mandatory to update the table J_2IRG1BAL with material form and opening stock etc. for all the new materials
EXGRP: Excise group of the material
DATUM: Date from which you want RG1 report i.e. 01.01.2004
MATNR: Material
FORM: P for packed, L for loose. note that the same material cannot be maintained as both packed and loose.
WERKS: Leave it blank
Maintain all relevant opening balance fields. These fields start with OP
Note 951955 - CIN: General clarifications for RG1 goods*
check the above note
regards
Prashanth -
HOW TO CARRY FORWARD RG1 CLOSING BALANCE TO OPENING BALANCE FOR NEW FISCAL
Hi Experts
How to carry forward the RG1 closing stock at the year end to opening balance of Rg1 for new year.
Wt are the steps required for closing activity of RG1 and carry forward closing balance of last year to opening balance of new year.
ThanksHi Rohan,
For RG1 and RG23 A Part I and RG23 C Part I
Go to SE16, here enter Table Name - J_2IRG1BAL and Click on "Create" button in initial screen, it will give the maintenance screen. Here mainatin following;
For each of these materials, you have maintained the material form in table J_2IRG1BAL as below. Do not make any entries in fields that are not listed below:
EXGRP - Materialu2019s excise group
DATUM - Date from which RG1 report is required, normally the date of going live
MATNR - Material
FORM - Enter P (Packed) or L (Loose). Do not leave this field blank.
WERKS - Leave this field blank.
OP FN UOM, OP BN UOM, CB FN UOM - Leave these fields blank. All quantities in this table are updated in the base unit of measure of the material
USNAM - User ID of the person filling out the table.
CPUDT - Date of entry
CPUTM - Time of entry
Note: - This is to be done before J1I5, J2I5.
Also refer link;
Update of Registers RG 1 and RG 23 (Part I)
For RG23 A Part II, RG23 C Part II and PLA
Go to SE16, here enter Table Name - J_2IACCBAL and Click on "Create" button in initial screen, it will give the maintenance screen. And maintain following;
Excise Group
Data element for Register names
Date
Plant
Basic duty (OP BAL)
Basic duty (CL BAL)
Basic duty (EXAMT)
Extract Indicator
User name
Entry Date
Entered at
Note: -
1. Enter OP BAL, CL BAL and EXAMT all as same as opening balance. For e.g. opening balance for RG23ABED is 1400 then this value is to be entered in all the 3 fields.
2. You have to enter separate line items for all the accounts;
RG23ABED
RG23ASED
RG23AAED
RG23CBED
RG23CSED
RG23CAED
PLABED
PLASED
PLAAED
PLACESS
RG23AECS
RG23CECS
PLAECS
RG23AAT1
RG23CAT1
PLAAT1
3. Enter Date is one day before of the opening. For e.g. if opening date is 01.04.2008 then enter it in 31.03.2008
Then go for J2I5 - Extract and J2I6 - Print Utility
use following
http://help.sap.com/bp_bblibrary/470/Documentation/J33_BPP_32_CHEM_EN_IN.doc
http://help.sap.com/saphelp_erp60_sp/helpdata/en/18/8e113999724854e10000000a11405a/content.htm
Reefer this link for complete Excise transactions
http://help.sap.com/saphelp_erp60_sp/helpdata/en/09/ebf138cdd78a4be10000000a114084/frameset.htm
Re: Excise -initial upload
Hopefully this will helpfull to resolve your answer.
Thanks & regards,
Pankaj Mahajan -
GL account opening/closing balances by day
Hi All.
I wish to list day by day opening and closing balances of G/L account by restricting the result to a time interval.
Anyone know how to write the query for G/L account opening & closing balances by day?
I found this in the forum and modify it to below:
declare @fr char(10)
declare @to char(10)
set @fr=convert (char(10),[%0],20)
set @to=convert (char(10),[%1],20)
declare @PrCl dec(19,6)
declare @de dec(19,6)
declare @cr dec(19,6)
declare @acc char(20)
declare @Pracc char(20)
Create table #W
(M char(10), Acc char(20), Me char(100), Tid char(10), Br char(10), TT char(30), Op dec(19,6),De dec(19,6),Cr dec(19,6),Cl dec(19,6) )
Insert into #W (M,Acc,Me,Tid,Br,TT,Op,De,Cr,Cl)
SELECT convert (char(10),T1.[RefDate],20)Mo, T1.[Account],T0.Memo, T0.TransId, T0.BaseRef, CASE
WHEN T0.TransType = 13 THEN 'AR Inv'
WHEN T0.TransType = 14 THEN 'AR CN'
WHEN T0.TransType = 18 THEN 'AP Inv'
WHEN T0.TransType = 19 THEN 'AP CN'
WHEN T0.TransType = 24 THEN 'Incoming Payment'
WHEN T0.TransType = 30 THEN 'JE'
WHEN T0.TransType = 46 THEN 'Outgoing Payment'
ELSE 'Other'
END AS 'Trans Type',
0,T1.[Debit] De , T1.[Credit] Cr,0
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
Group by T1.[Account],convert (char(10),T1.[RefDate],20),T0.Memo, T0.TransId, T0.BaseRef, T0.TransType, T1.Debit, T1.Credit
Order By T1.[Account],convert (char(10),T1.[RefDate],20)
Declare cu cursor for
Select acc,de,cr from #W
for update
set @PrAcc=''
Open cu
Fetch next from cu into @acc,@de,@cr
While @@FETCH_STATUS = 0
Begin
If @acc!=@PrAcc set @PrCl=0
Update #W
set op=@PrCl,
cl=@PrCl-@Cr+@de
where current of cu
set @PrCl=@PrCl-@Cr+@de
set @PrAcc=@acc
Fetch next from cu into @acc,@de,@cr
End
deallocate cu
Select * from #w
Where M between @fr and @to
Drop table #W
but some of the rows are missing from the result. e.g. row with the same value of debit/credit ( same TransId and BaseRef) will come out once only in the result.
Please guide me on the above issue.
Thanks & Best Regards,
LengHi,
You have to make use of many tables for this purpose.
1. You have to claculate the previuos period and finscal year for the given date..
2. You have to calculate the G/L balances for this period for the given G/L account from table GLT0.(You can use some of the standard function modules for the same)
3. You have get the line items from the various tables like BSIS,BSAS,BSIK, BASK, BSID and BSAD for the dates from the begining of the month to the given date-1. sum upthis amount with the amount retrieved from step 2 .This will be the opening balance for the given date.
4.retrieve the data from he same tables like step 3 for the given date. This will the transactions of the given date.
5. sum up the amounts from step 4 with step 3. this will be the closing balance for that date.
let me know id you want any further info..
Reward the points if i answered your question..
Maybe you are looking for
-
Hi Experts, My req, is I have to check billing date with order date/ delivery date while creating the invoice in VF01. For that I have done codig in user exit RV60AFZZ, so it gives error ,but the billing date field get disable. & this invoice no. als
-
My original iTunes account is on a computer operating a Windows Xp system. My iPad2 cannot access that music library. Is there any way the iTunes app on my iPad can access my iTunes music library without using that computer? I have tried downloading
-
Hi All, In IT 0001(Org Assignmnt ), Client need s to bring "Mangers" name in Administrator field, Can we bring with a customization or need write a code..? SD
-
How to Update Business Place & Sec.Code Field in Posted Document
Dear All, Pls suggest how to update Business Place & Section Code field in documents which are posted without entering Business Place & Section Code. Pls tell me how to achieve this without using Validations & Substitutions. Any table entries can be
-
IControl has bugs since the last OS update
I've been using iControl from m-audio for the last 2 years without any problems, but since I made the latest system update the icontrol goes crazy for no apparent reason. Tracks get soloed or muted without me touching the track buttons. Is there some