Inventory closing balance for any period
Hi,
My client wants to view a report of closing balance of inventry stock of any perticular date (privious)
how can i solve the issue
Raghuram
hi all
1) in mb5b the value of the material is not available
2) in MC scries the stock can be analyse by month wise
3) so i need the stock for any date wise with value
plz clarify
K.Raghram
Similar Messages
-
Opening & closing balances for Vendor
Hi Experts,
I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
Please help.
Thanks
DanyHi,
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 -
Balance for open periods in a time series enabled cube
Hi,
We have a request to calculate balance for open periods in a time series enabled cube, I don’t there is any inbuilt function for this.
Any ideas on how to calculate this without adding new members/formulae in the time dimension. Currently we compute this in the report
EX:
BOY(May) = Jun+Jul + … + Dec
Thanks,You will have to add a member somewhere. Suppose you add it in scenario, then you could use sumrange for the current member range offsetting the current monthe by 1 and use null for the end month wich gives you the last month in the time dim.
-
How to calculate opening and closing balance for period
Hi all,
i have to find out opening and closing balance.
the table structure of temporary table is
select * from hwcn_xn_fa_report_temp1 where asset_id=10029400
PERIOD_COUNTER CST_OP_BAL CST_ADDITION CST_TRANSFER CST_DISPOSAL COST_CLOSING_BALANCE
24108 0 0 0
24109 12000
24110 0 0 0
24111 0 0 0
in this table cst_op_balnce and cost_closing_balace is null
i have display cost_op_bal and cost_closing_balnce
cost_closing_balance=cst_op_bal+cst_addition+cst_transfer+cst_disposal
for period 2408 op_balnce=0 closing_bal=0
for period 2409 op_balnce=0 closing_balce=1200
for period 2410 op_bal=1200 closing_bal=1200
closing balance of dec will be opening bal of jan
thanks and regards
Edited by: user10664276 on Apr 19, 2009 11:08 PM
Edited by: user10664276 on Apr 19, 2009 11:13 PMHi,
user11118871 wrote:
Can you explain what that is? Thank you if you have one example.
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING
When you use the analytic SUM (c) function, then, on each row, it returns the values of column (or expression) c from several rows in the result set added together.
Which rows? That depends.
If the analytic clause (the part in parentheses after OVER) does not include ORDER BY, then it is all rows.
If the analytic clause has an ORDER BY clause, but no windowing clause (that is, ROWS BETWEEN ... or RANGE BETWEEN ...), then the rows included in the sum are all rows up to and including the row where the function is being called (as sorted by the analytic ORDER BY).
If the analytic cluase has both ORDER BY and a windowing clause "ROWS BETWEEN x PRECEDING AND y PRECEDING", then the rows included in the sum are the rows from x to y rows before the one where the function is called.
Do some experiments with different values of x and y.
First, create a table like the one in the problem above, but simplified a little.
CREATE TABLE test_sum
( period NUMBER
, new_amt NUMBER
INSERT INTO test_sum (period, new_amt) VALUES (24108, 1);
INSERT INTO test_sum (period, new_amt) VALUES (24109, 4);
INSERT INTO test_sum (period, new_amt) VALUES (24110, 2);
INSERT INTO test_sum (period, new_amt) VALUES (24111, 8);
INSERT INTO test_sum (period, new_amt) VALUES (25001, 32);
INSERT INTO test_sum (period, new_amt) VALUES (25002, 16);
COMMIT;The original problem above used names that were meaningful for its application, and columns that have nothing to do with the SUM function. Let's simplify the former and lose the latter.
That problem involved the SUM of three columns added together. Since we just want to understand how the windowing clause works, let's simplify that to one column.
With these simplifications, my original query is:
SELECT period
, new_amt
, SUM (new_amt) OVER ( ORDER BY period
ROWS BETWEEN UNBOUNDED PRECEDING
AND 1 PRECEDING
) AS opening_balance
, SUM (new_amt) OVER ( ORDER BY period
) AS closing_balance
FROM test_sum
ORDER BY period;Given the data above, it produces these results:
. PERIOD NEW_AMT OPENING_BALANCE CLOSING_BALANCE
24108 1 1
24109 4 1 5
24110 2 5 7
24111 8 7 15
25001 32 15 47
25002 16 47 63So, for example, on the row where period=24110,
opening_balance=5, which is the total of new_amt from all rows up to but not including that row: 5=1+4, and
closing_balance=7, which is the total of new_amt from all rows up to and including that row: 7=1+4+2.
To really understand how the windowing clause works, do some experiments. Change the definition of opening_balance to include " BETWEEN x PRECEDING AND y PRECEDING". You'll find that:
(a) "UNBOUNDED PRECEDING" means the same as "n PRECEDING", where n is greater than the number of rows in your result set.
(b) "CURRENT ROW" means the same as "0 PRECEDING"
(c) x must be greater than or equal to y
(d) neither x nor y can be negative (but you can use "FOLLOWING" instead of "PRECEDING" to get the same effect).
For more, see the introduction to "Analytic Functions" in the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions001.htm#sthref972]
When you're finished, don't forget to
DROP TABLE test_sum; -
Closing Stock For Each Period in Inventory Infocube
Hello Guru's,
Can we have closing stock of each material for entire period in Invnetory Infocube ? or through any logic or transformation routine can we create this keyfigure at infocube level ?
I know that to get Closing Stock ( Opening Stock + Goods Receipt - Goods Issue), we have to have Opening Stock as well for each month. in 0IC_C03 infocube, we only have Goods Receipt Qty and Goods Issue Qty keyfigures. We don't have Opening Stock and Closing Stock keyfigures as those are calculation which works during run time of query but still we want to have this information at Infocube Level.
Do please let me know your thought as i appreciate your help in advance.
Regards,
Komik Shahhi,
I will check that t code.
thanks and regards,
Devina -
Opening balance and closing balances for discounts?
Hi all,
I have a typical sceanario where in
opening balance for discounts 10,000 (balance of last month)
actual discounts from the sales order 5,000
manual upload is from flat file 2,000
closing balance is 7,000 (which is opening balance + manual upload - actual discounts)
opening and closing balance needs to be calculated, how to calculate nor handle this on every month?
level of granularity of the data is
sku, month, rebate category and rebate amount?
ThanksHi Pooja,
can you please let us know few things about your report requirements
What is the extractor you are using?
What are the KFs ?
what are the selection parameters that you want to enter at the reporting level?
is it the report related to FI AR. do you want to display the values based on the customer -->profitcenter?
Bcoz we had a same requirement where our requirement was global recievables aging report in which the report need to display opening bal, sales,adjustment,colelction and closing balance and the aging values.
here what we did is changed the modeling of the DSO and infocube.
we had used non-cumulative KF in order to calculate closing balance and from that derived opening balance and again create a new formula to get the closing balance.
if you can be specific with your requirement hope can help you with your report. -
Opening Balances for Previous Periods
Hi Experts,
There is a client requirement of entering opening balances for GL for previous periods before going live.
eg it is required to have OB for 2006,2007 and 2008 before live transactions are entered into the system.
Please enlighten on how to carry out this.
Regards,
AsapHi Asap,
You could only have one OB for one account. If those OB for different years are for different accounts, it is ok. Otherwise, you have 2006 OB only. You may create JE to get something like OB for 2007 and 2008.
Thanks,
Gordon -
Opening & closing balance for Multiple Vendors
Hi Friends,
I have an issue. This is my code.
*& Report ZVEN_OPEN_CLOSE_BAL
REPORT ZVEN_OPEN_CLOSE_BAL.
*& Report ZVEN_OPEN_CLOSE_BAL
TABLES:lfa1,bsik.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
blart TYPE bsik-blart,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
* bal TYPE char30,
sgtxt TYPE bsik-sgtxt,
END OF ty_bsik.
TYPES: BEGIN OF ty_bsak,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsak-lifnr,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsik-dmbtr,
* shkzg1 TYPE bsak-shkzg,
sgtxt TYPE bsak-sgtxt,
END OF ty_bsak.
TYPES: BEGIN OF ty_lfc1,
lifnr TYPE lfc1-lifnr,
bukrs TYPE lfc1-bukrs,
gjahr TYPE lfc1-gjahr,
umsav TYPE lfc1-umsav,
END OF ty_lfc1.
TYPES: BEGIN OF ty_all,
lifnr TYPE bsik-lifnr,
zuonr TYPE bsik-zuonr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
hkont TYPE bseg-hkont,
blart TYPE bsik-blart,
ltext TYPE text20,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
opbal TYPE p DECIMALS 2,
deb TYPE p DECIMALS 2 ,"bsik-dmbtr,
cre TYPE p DECIMALS 2,"bsik-dmbtr,
bal TYPE p DECIMALS 2,
augbl TYPE bsik-augbl,
sgtxt TYPE bsik-sgtxt,
END OF ty_all.
TYPE-POOLS: slis.
DATA: t_layout TYPE slis_layout_alv,
s_fieldtab TYPE slis_fieldcat_alv,
t_fieldtab TYPE slis_t_fieldcat_alv,
wa_header TYPE slis_listheader,
it_header TYPE slis_t_listheader.
DATA:it_bsik TYPE TABLE OF ty_bsik,
it_bsak TYPE TABLE OF ty_bsak,
it_all TYPE TABLE OF ty_all,
it_lfc1 TYPE TABLE OF ty_lfc1,
it_t003 TYPE TABLE OF t003t,
wa_bsik TYPE ty_bsik,
wa_bsak TYPE ty_bsak,
wa_all TYPE ty_all,
wa_lfc1 TYPE ty_lfc1,
wa_t003 TYPE t003t.
DATA: gt_fldcat TYPE slis_t_fieldcat_alv,
gs_fldcat TYPE slis_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
gv_save TYPE c VALUE 'X'.
types :BEGIN OF ty_bseg,
BUKRS TYPE BUKRS,
BELNR TYPE BELNR_D,
GJAHR TYPE GJAHR,
BUZEI TYPE BUZEI,
koart type koart,
HKONT TYPE HKONT,
END OF ty_bseg.
DATA: it_bseg type TABLE OF ty_bseg,
wa_bseg type ty_bseg.
data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
s_bukrs FOR bsik-bukrs,
s_budat FOR bsik-budat OBLIGATORY.
PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process_data.
PERFORM display.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
break naidu.
SELECT bukrs
lifnr
augbl
zuonr
gjahr
xblnr
belnr
buzei
blart
bldat
budat
shkzg
dmbtr
sgtxt FROM bsik
INTO TABLE it_bsik
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
SELECT bukrs
lifnr
augbl
zuonr
gjahr
belnr
buzei
budat
bldat
xblnr
blart
shkzg
dmbtr
sgtxt FROM bsak
INTO TABLE it_bsak
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
if it_bsik is INITIAL and it_bsak is INITIAL.
*DATA v_date type budat.
*data :year(4),
* month(2),
* date(2).
* year = s_budat-low+0(4).
* date = s_budat-low+6(2).
* month = s_budat-low+4(2).
* month = month - 01.
*CONCATENATE year month date INTO v_date .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* xblnr
* belnr
* buzei
* blart
* bldat
* budat
* shkzg
* dmbtr
* sgtxt FROM bsik
* INTO TABLE it_bsik
* WHERE lifnr IN s_lifnr AND
* bukrs in s_bukrs and
* budat eq v_date AND
* gjahr = p_gjahr .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* belnr
* buzei
* budat
* bldat
* xblnr
* blart
* shkzg
* dmbtr
* sgtxt FROM bsak
* INTO TABLE it_bsak
* WHERE lifnr IN s_lifnr AND
* bukrs IN s_bukrs AND
* budat eq v_date AND
* gjahr = p_gjahr .
CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
EXPORTING
companycode = s_bukrs-low
vendor = s_lifnr-low
keydate = s_budat-low
* BALANCESPGLI = ' '
* NOTEDITEMS = ' '
* IMPORTING
* RETURN =
TABLES
keybalance = t_balence
endif.
ENDFORM. " GET_DATA
*& Form PROCESS_DATA
* text
* --> p1 text
* <-- p2 text
FORM process_data .
DATA:v_bal TYPE netpr.
LOOP AT it_bsak INTO wa_bsak.
wa_bsik-bukrs = wa_bsak-bukrs.
wa_bsik-lifnr = wa_bsak-lifnr.
wa_bsik-augbl = wa_bsak-augbl.
wa_bsik-zuonr = wa_bsak-zuonr.
wa_bsik-gjahr = wa_bsak-gjahr.
wa_bsik-belnr = wa_bsak-belnr.
wa_bsik-buzei = wa_bsak-buzei.
wa_bsik-budat = wa_bsak-budat.
wa_bsik-bldat = wa_bsak-bldat.
wa_bsik-xblnr = wa_bsak-xblnr.
wa_bsik-blart = wa_bsak-blart.
wa_bsik-shkzg = wa_bsak-shkzg.
wa_bsik-dmbtr = wa_bsak-dmbtr.
wa_bsik-sgtxt = wa_bsak-sgtxt .
APPEND wa_bsik TO it_bsik.
CLEAR:wa_bsik.
ENDLOOP.
IF it_bsik IS NOT INITIAL .
SELECT lifnr bukrs gjahr umsav
FROM lfc1
INTO TABLE it_lfc1 FOR ALL ENTRIES IN it_bsik
WHERE
lifnr EQ it_bsik-lifnr AND
bukrs EQ it_bsik-bukrs AND
gjahr EQ it_bsik-gjahr.
SELECT * FROM t003t
INTO TABLE it_t003
FOR ALL ENTRIES IN it_bsik
WHERE blart = it_bsik-blart AND
spras = 'EN'.
*&Bindu........................................
select bukrs "Company Code
belnr "Document Number
gjahr "Fiscal Year
buzei "Line item
koart "Account Type
hkont "General Ledger Account
from bseg into TABLE it_bseg
FOR ALL ENTRIES IN it_bsik
WHERE belnr eq it_bsik-belnr and
bukrs in s_bukrs and
gjahr eq p_gjahr and
BUZEI eq it_bsik-buzei.
ENDIF.
SORT it_bsik BY lifnr.
DATA:c,
l_dmbtr type p DECIMALS 2.
DATA:v1(15),
v2(3).
DATA:v_umsav(18).
DATA v_fbal TYPE umsav.
LOOP AT it_bsik INTO wa_bsik.
READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
bukrs = wa_bsik-bukrs
gjahr = wa_bsik-gjahr.
if sy-subrc = 0.
at FIRST.
v_umsav = wa_lfc1-umsav.
SPLIT v_umsav at '.' INTO v1 v2.
wa_all-LTEXT = 'Opening Balance'.
IF v2+2(1) = '-'.
wa_all-cre = wa_lfc1-umsav.
ELSE.
wa_all-deb = wa_lfc1-umsav.
ENDIF.
wa_all-bal = wa_lfc1-umsav.
v_fbal = wa_all-bal.
APPEND wa_all to it_all.
CLEAR wa_all.
endat.
endif.
AT NEW lifnr.
c = 0.
ENDAT.
wa_all-lifnr = wa_bsik-lifnr.
wa_all-zuonr = wa_bsik-zuonr.
wa_all-xblnr = wa_bsik-xblnr.
wa_all-belnr = wa_bsik-belnr.
wa_all-blart = wa_bsik-blart.
wa_all-bldat = wa_bsik-bldat.
wa_all-budat = wa_bsik-budat.
*&Bindu............
READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
buzei = wa_bsik-buzei."Bindu.......
if sy-subrc = 0.
wa_all-hkont = wa_bseg-hkont. "Bindu.....
endif.
IF wa_bsik-shkzg = 'S'.
wa_all-deb = wa_bsik-dmbtr.
ELSEIF wa_bsik-shkzg = 'H'.
wa_all-cre = wa_bsik-dmbtr.
ENDIF.
READ TABLE it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
IF sy-subrc = 0.
wa_all-ltext = wa_t003-ltext.
ENDIF.
* READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
* bukrs = wa_bsik-bukrs
* gjahr = wa_bsik-gjahr.
*break naidu.
IF sy-subrc = 0.
* IF c = 0.
* clear:l_dmbtr.
* wa_all-opbal = wa_lfc1-umsav.
* c = c + 1.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
l_dmbtr = wa_all-bal.
* ELSE.
* wa_all-bal = l_dmbtr + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
* ENDIF.
ENDIF.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
if v_fbal is NOT INITIAL.
wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
CLEAR:v_fbal.
else.
wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
ENDIF.
wa_all-augbl = wa_bsik-augbl.
wa_all-sgtxt = wa_bsik-sgtxt.
*v_balance = wa_all-bal.
APPEND wa_all TO it_all.
v_bal = wa_all-bal.
CLEAR :wa_all.
*& Closing Balence.................
at last.
wa_all-LTEXT = 'Closing Balance'.
* IF .
wa_all-BAL = v_bal.
APPEND wa_all to it_all.
CLEAR wa_all.
* ENDIF.
endat.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM display .
DATA : ls_layout TYPE slis_layout_alv.
PERFORM create_fldcat.
ls_layout-expand_all = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-expand_fieldname = 'X'.
ls_layout-zebra = 'X'.
if it_all is initial .
wa_all-LTEXT = 'Opening Balance'.
wa_all-bal = t_balence-LC_BAL.
wa_all-lifnr = s_lifnr-low.
APPEND wa_all to it_all.
ENDIF.
IF it_all IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ls_layout
it_fieldcat = gt_fldcat
i_save = 'X'
TABLES
t_outtab = it_all[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " DISPLAY
*& Form CREATE_FLDCAT
* text
* --> p1 text
* <-- p2 text
FORM create_fldcat .
PERFORM : append_val USING 'LIFNR' 'IT_ALL' 'vendor' '' '' 'X' ' '.
PERFORM : append_val USING 'HKONT' 'IT_ALL' 'G/L Acc' '' '' 'X' ' '.
PERFORM : append_val USING 'ZUONR' 'IT_ALL' 'account' '' '' '' ''.
PERFORM : append_val USING 'XBLNR' 'IT_ALL' 'number' '' '' 'X' ''.
PERFORM : append_val USING 'BELNR' 'IT_ALL' 'ref no' '' '' 'X' ''.
PERFORM : append_val USING 'BLART' 'IT_ALL' 'type' '' '' 'X' ''.
PERFORM : append_val USING 'LTEXT' 'IT_ALL' 'type text' '' '' 'X' ''.
PERFORM : append_val USING 'BLDAT' 'IT_ALL' 'doc date' '' '' 'X' ''.
PERFORM : append_val USING 'BUDAT' 'IT_ALL' 'post date' '' '' 'X' ''.
PERFORM : append_val USING 'OPBAL' 'IT_ALL' 'op balance' '' '' '' ''.
PERFORM : append_val USING 'DEB' 'IT_ALL' 'debit' '' '' '' ''.
PERFORM : append_val USING 'CRE' 'IT_ALL' 'credit' '' '' '' ''.
PERFORM : append_val USING 'BAL' 'IT_ALL' 'balance' '' '' '' ''.
PERFORM : append_val USING 'AUGBL' 'IT_ALL' 'clr doc' '' '' 'X' ''.
PERFORM : append_val USING 'SGTXT' 'IT_ALL' 'text ' '' '' 'X' ''.
ENDFORM. " CREATE_FLDCAT
*& Form APPEND_VAL
* text
* -->P_0578 text
* -->P_0579 text
* -->P_TEXT_010 text
* -->P_0581 text
* -->P_0582 text
* -->P_0583 text
FORM append_val USING p_a
p_b
p_c
p_d
p_e
p_f
p_g.
CLEAR gs_fldcat.
gs_fldcat-fieldname = p_a.
gs_fldcat-tabname = p_b.
gs_fldcat-seltext_m = p_c.
gs_fldcat-qfieldname = p_d.
gs_fldcat-datatype = p_e.
gs_fldcat-no_zero = p_f.
gs_fldcat-do_sum = p_g.
APPEND gs_fldcat TO gt_fldcat.
ENDFORM. " APPEND_VAL
This is working for single vendor.
Now my problem is Opening & closing balance should be displayed for multiple vendors.
Please suggest me.
Thanks in advance.Hi Friends,
I have an issue. This is my code.
*& Report ZVEN_OPEN_CLOSE_BAL
REPORT ZVEN_OPEN_CLOSE_BAL.
*& Report ZVEN_OPEN_CLOSE_BAL
TABLES:lfa1,bsik.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
blart TYPE bsik-blart,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
* bal TYPE char30,
sgtxt TYPE bsik-sgtxt,
END OF ty_bsik.
TYPES: BEGIN OF ty_bsak,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsak-lifnr,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsik-dmbtr,
* shkzg1 TYPE bsak-shkzg,
sgtxt TYPE bsak-sgtxt,
END OF ty_bsak.
TYPES: BEGIN OF ty_lfc1,
lifnr TYPE lfc1-lifnr,
bukrs TYPE lfc1-bukrs,
gjahr TYPE lfc1-gjahr,
umsav TYPE lfc1-umsav,
END OF ty_lfc1.
TYPES: BEGIN OF ty_all,
lifnr TYPE bsik-lifnr,
zuonr TYPE bsik-zuonr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
hkont TYPE bseg-hkont,
blart TYPE bsik-blart,
ltext TYPE text20,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
opbal TYPE p DECIMALS 2,
deb TYPE p DECIMALS 2 ,"bsik-dmbtr,
cre TYPE p DECIMALS 2,"bsik-dmbtr,
bal TYPE p DECIMALS 2,
augbl TYPE bsik-augbl,
sgtxt TYPE bsik-sgtxt,
END OF ty_all.
TYPE-POOLS: slis.
DATA: t_layout TYPE slis_layout_alv,
s_fieldtab TYPE slis_fieldcat_alv,
t_fieldtab TYPE slis_t_fieldcat_alv,
wa_header TYPE slis_listheader,
it_header TYPE slis_t_listheader.
DATA:it_bsik TYPE TABLE OF ty_bsik,
it_bsak TYPE TABLE OF ty_bsak,
it_all TYPE TABLE OF ty_all,
it_lfc1 TYPE TABLE OF ty_lfc1,
it_t003 TYPE TABLE OF t003t,
wa_bsik TYPE ty_bsik,
wa_bsak TYPE ty_bsak,
wa_all TYPE ty_all,
wa_lfc1 TYPE ty_lfc1,
wa_t003 TYPE t003t.
DATA: gt_fldcat TYPE slis_t_fieldcat_alv,
gs_fldcat TYPE slis_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
gv_save TYPE c VALUE 'X'.
types :BEGIN OF ty_bseg,
BUKRS TYPE BUKRS,
BELNR TYPE BELNR_D,
GJAHR TYPE GJAHR,
BUZEI TYPE BUZEI,
koart type koart,
HKONT TYPE HKONT,
END OF ty_bseg.
DATA: it_bseg type TABLE OF ty_bseg,
wa_bseg type ty_bseg.
data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
s_bukrs FOR bsik-bukrs,
s_budat FOR bsik-budat OBLIGATORY.
PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process_data.
PERFORM display.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
break naidu.
SELECT bukrs
lifnr
augbl
zuonr
gjahr
xblnr
belnr
buzei
blart
bldat
budat
shkzg
dmbtr
sgtxt FROM bsik
INTO TABLE it_bsik
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
SELECT bukrs
lifnr
augbl
zuonr
gjahr
belnr
buzei
budat
bldat
xblnr
blart
shkzg
dmbtr
sgtxt FROM bsak
INTO TABLE it_bsak
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
if it_bsik is INITIAL and it_bsak is INITIAL.
*DATA v_date type budat.
*data :year(4),
* month(2),
* date(2).
* year = s_budat-low+0(4).
* date = s_budat-low+6(2).
* month = s_budat-low+4(2).
* month = month - 01.
*CONCATENATE year month date INTO v_date .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* xblnr
* belnr
* buzei
* blart
* bldat
* budat
* shkzg
* dmbtr
* sgtxt FROM bsik
* INTO TABLE it_bsik
* WHERE lifnr IN s_lifnr AND
* bukrs in s_bukrs and
* budat eq v_date AND
* gjahr = p_gjahr .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* belnr
* buzei
* budat
* bldat
* xblnr
* blart
* shkzg
* dmbtr
* sgtxt FROM bsak
* INTO TABLE it_bsak
* WHERE lifnr IN s_lifnr AND
* bukrs IN s_bukrs AND
* budat eq v_date AND
* gjahr = p_gjahr .
CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
EXPORTING
companycode = s_bukrs-low
vendor = s_lifnr-low
keydate = s_budat-low
* BALANCESPGLI = ' '
* NOTEDITEMS = ' '
* IMPORTING
* RETURN =
TABLES
keybalance = t_balence
endif.
ENDFORM. " GET_DATA
*& Form PROCESS_DATA
* text
* --> p1 text
* <-- p2 text
FORM process_data .
DATA:v_bal TYPE netpr.
LOOP AT it_bsak INTO wa_bsak.
wa_bsik-bukrs = wa_bsak-bukrs.
wa_bsik-lifnr = wa_bsak-lifnr.
wa_bsik-augbl = wa_bsak-augbl.
wa_bsik-zuonr = wa_bsak-zuonr.
wa_bsik-gjahr = wa_bsak-gjahr.
wa_bsik-belnr = wa_bsak-belnr.
wa_bsik-buzei = wa_bsak-buzei.
wa_bsik-budat = wa_bsak-budat.
wa_bsik-bldat = wa_bsak-bldat.
wa_bsik-xblnr = wa_bsak-xblnr.
wa_bsik-blart = wa_bsak-blart.
wa_bsik-shkzg = wa_bsak-shkzg.
wa_bsik-dmbtr = wa_bsak-dmbtr.
wa_bsik-sgtxt = wa_bsak-sgtxt .
APPEND wa_bsik TO it_bsik.
CLEAR:wa_bsik.
ENDLOOP.
IF it_bsik IS NOT INITIAL .
SELECT lifnr bukrs gjahr umsav
FROM lfc1
INTO TABLE it_lfc1 FOR ALL ENTRIES IN it_bsik
WHERE
lifnr EQ it_bsik-lifnr AND
bukrs EQ it_bsik-bukrs AND
gjahr EQ it_bsik-gjahr.
SELECT * FROM t003t
INTO TABLE it_t003
FOR ALL ENTRIES IN it_bsik
WHERE blart = it_bsik-blart AND
spras = 'EN'.
*&Bindu........................................
select bukrs "Company Code
belnr "Document Number
gjahr "Fiscal Year
buzei "Line item
koart "Account Type
hkont "General Ledger Account
from bseg into TABLE it_bseg
FOR ALL ENTRIES IN it_bsik
WHERE belnr eq it_bsik-belnr and
bukrs in s_bukrs and
gjahr eq p_gjahr and
BUZEI eq it_bsik-buzei.
ENDIF.
SORT it_bsik BY lifnr.
DATA:c,
l_dmbtr type p DECIMALS 2.
DATA:v1(15),
v2(3).
DATA:v_umsav(18).
DATA v_fbal TYPE umsav.
LOOP AT it_bsik INTO wa_bsik.
READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
bukrs = wa_bsik-bukrs
gjahr = wa_bsik-gjahr.
if sy-subrc = 0.
at FIRST.
v_umsav = wa_lfc1-umsav.
SPLIT v_umsav at '.' INTO v1 v2.
wa_all-LTEXT = 'Opening Balance'.
IF v2+2(1) = '-'.
wa_all-cre = wa_lfc1-umsav.
ELSE.
wa_all-deb = wa_lfc1-umsav.
ENDIF.
wa_all-bal = wa_lfc1-umsav.
v_fbal = wa_all-bal.
APPEND wa_all to it_all.
CLEAR wa_all.
endat.
endif.
AT NEW lifnr.
c = 0.
ENDAT.
wa_all-lifnr = wa_bsik-lifnr.
wa_all-zuonr = wa_bsik-zuonr.
wa_all-xblnr = wa_bsik-xblnr.
wa_all-belnr = wa_bsik-belnr.
wa_all-blart = wa_bsik-blart.
wa_all-bldat = wa_bsik-bldat.
wa_all-budat = wa_bsik-budat.
*&Bindu............
READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
buzei = wa_bsik-buzei."Bindu.......
if sy-subrc = 0.
wa_all-hkont = wa_bseg-hkont. "Bindu.....
endif.
IF wa_bsik-shkzg = 'S'.
wa_all-deb = wa_bsik-dmbtr.
ELSEIF wa_bsik-shkzg = 'H'.
wa_all-cre = wa_bsik-dmbtr.
ENDIF.
READ TABLE it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
IF sy-subrc = 0.
wa_all-ltext = wa_t003-ltext.
ENDIF.
* READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
* bukrs = wa_bsik-bukrs
* gjahr = wa_bsik-gjahr.
*break naidu.
IF sy-subrc = 0.
* IF c = 0.
* clear:l_dmbtr.
* wa_all-opbal = wa_lfc1-umsav.
* c = c + 1.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
l_dmbtr = wa_all-bal.
* ELSE.
* wa_all-bal = l_dmbtr + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
* ENDIF.
ENDIF.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
if v_fbal is NOT INITIAL.
wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
CLEAR:v_fbal.
else.
wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
ENDIF.
wa_all-augbl = wa_bsik-augbl.
wa_all-sgtxt = wa_bsik-sgtxt.
*v_balance = wa_all-bal.
APPEND wa_all TO it_all.
v_bal = wa_all-bal.
CLEAR :wa_all.
*& Closing Balence.................
at last.
wa_all-LTEXT = 'Closing Balance'.
* IF .
wa_all-BAL = v_bal.
APPEND wa_all to it_all.
CLEAR wa_all.
* ENDIF.
endat.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM display .
DATA : ls_layout TYPE slis_layout_alv.
PERFORM create_fldcat.
ls_layout-expand_all = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-expand_fieldname = 'X'.
ls_layout-zebra = 'X'.
if it_all is initial .
wa_all-LTEXT = 'Opening Balance'.
wa_all-bal = t_balence-LC_BAL.
wa_all-lifnr = s_lifnr-low.
APPEND wa_all to it_all.
ENDIF.
IF it_all IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ls_layout
it_fieldcat = gt_fldcat
i_save = 'X'
TABLES
t_outtab = it_all[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " DISPLAY
*& Form CREATE_FLDCAT
* text
* --> p1 text
* <-- p2 text
FORM create_fldcat .
PERFORM : append_val USING 'LIFNR' 'IT_ALL' 'vendor' '' '' 'X' ' '.
PERFORM : append_val USING 'HKONT' 'IT_ALL' 'G/L Acc' '' '' 'X' ' '.
PERFORM : append_val USING 'ZUONR' 'IT_ALL' 'account' '' '' '' ''.
PERFORM : append_val USING 'XBLNR' 'IT_ALL' 'number' '' '' 'X' ''.
PERFORM : append_val USING 'BELNR' 'IT_ALL' 'ref no' '' '' 'X' ''.
PERFORM : append_val USING 'BLART' 'IT_ALL' 'type' '' '' 'X' ''.
PERFORM : append_val USING 'LTEXT' 'IT_ALL' 'type text' '' '' 'X' ''.
PERFORM : append_val USING 'BLDAT' 'IT_ALL' 'doc date' '' '' 'X' ''.
PERFORM : append_val USING 'BUDAT' 'IT_ALL' 'post date' '' '' 'X' ''.
PERFORM : append_val USING 'OPBAL' 'IT_ALL' 'op balance' '' '' '' ''.
PERFORM : append_val USING 'DEB' 'IT_ALL' 'debit' '' '' '' ''.
PERFORM : append_val USING 'CRE' 'IT_ALL' 'credit' '' '' '' ''.
PERFORM : append_val USING 'BAL' 'IT_ALL' 'balance' '' '' '' ''.
PERFORM : append_val USING 'AUGBL' 'IT_ALL' 'clr doc' '' '' 'X' ''.
PERFORM : append_val USING 'SGTXT' 'IT_ALL' 'text ' '' '' 'X' ''.
ENDFORM. " CREATE_FLDCAT
*& Form APPEND_VAL
* text
* -->P_0578 text
* -->P_0579 text
* -->P_TEXT_010 text
* -->P_0581 text
* -->P_0582 text
* -->P_0583 text
FORM append_val USING p_a
p_b
p_c
p_d
p_e
p_f
p_g.
CLEAR gs_fldcat.
gs_fldcat-fieldname = p_a.
gs_fldcat-tabname = p_b.
gs_fldcat-seltext_m = p_c.
gs_fldcat-qfieldname = p_d.
gs_fldcat-datatype = p_e.
gs_fldcat-no_zero = p_f.
gs_fldcat-do_sum = p_g.
APPEND gs_fldcat TO gt_fldcat.
ENDFORM. " APPEND_VAL
This is working for single vendor.
Now my problem is Opening & closing balance should be displayed for multiple vendors.
Please suggest me.
Thanks in advance. -
Closing balances for Balance sheet
Hi,
We have started enteries a our customer from 01/04/2011 with the opening balance. after audit there balance sheet is finalise in month of september ie current month.
can anyone let me know how to enter the adjustment balances if there is any diffrence in the account balances.Hi......
You can manage this difference in stock through stock reconciliation.......
Go to Inventory> Inventory Transaction> Inventory Opening Balances, Inventory Tracking, and Inventory Posting--> Inventory Tracking Tab and put the counted stock (Actual stock).
Then go to Inventory> Inventory Transaction> Inventory Opening Balances, Inventory Tracking, and Inventory Posting-->Inventory Posting. Enter the difference........
Regards,
Rahul -
Using MBP in closed mode for extended periods
I use my MBP mostly in closed lid mode as a desktop computer and only use it as a notebook when I'm on the move. I was wondering, is this a bad setup considering that when the lid is closed it's covering up vents and holding heat in?
Hi,
I just installed Leopard on to my Macbook Pro (which is attached to a 19" Samsung monitor) and cannot get Spaces to work.
I was told it is possible to have Spaces work in closed mode though. I just have some concerns about keeping the MBP closed for extended periods of time, particularly when running programs that place a heavy demand on the processors (i.e. Second Life, Photoshop etc).
Is it not possible for the computer to overheat or for the screen to somehow get damaged with the top closed ?
I really want to use Spaces but it does not appear to work with dual screen set ups.
Hannah -
Closing material for previous period (CKM3)
Hi Guys,
I have a problem, which im going to close a material for current period with status "quantities and values entered".
But system wont allowed it, because the previous period hasnt close yet, and the status also "quantites and values entered"
Logically i need to close the previous period first. But if i do that, does it comes with an inventory journal impact?
How if i just want to close for the current period only..
Regards,
BetoHi,
First of all go to t code MMRV and check what period it shows there. If its a previous period then go to MMPV and close all the periods one by one.
Secondly check if your system has been Configured for Price Change in Previous Period/Previous Year in the IMG settings under MATERIAL MANAGEMENT - VALUATION AND ACCOUNT ASSIGNMENT.
Thanks,
Atal -
Hello,
I need to take out GL balances only for the period 1st oct 08 to 31st Oct 08, profit centerwise. Which report in sap will give me this.
That is Debits Only for October and Credits only for Ocotber
Please help.
Regards
ShaileshTry out this followig report:
easy access->Accounting ->Controlling ->Profit Center Accounting ->Information System ->Reports for Profit Center Accounting ->Line Item Reports ->KE5Z - Profit Center: Actual Line Items
if works please points
thank you -
Query For Finding Yearly Opening and Closing Balance for All the Items
Hi Experts,
I am working on Query Based Report for finding the Yearly Opening and Closing Stock for all the Items
i will give yearwise selection and I want opening and closing stock in between that years
Warm Regards,
Sandip Kokate
Edited by: Sandipk on May 20, 2011 1:58 PMHi,
Declare @SDate DateTime
Declare @EDate DateTime
Declare @Whse nvarchar(10)
Set @SDate= (SELECT min(F_RefDate) FROM OFPR T1 where T1.[Name] ='[1%]' )
Set @EDate= (SELECT max(T_RefDate) FROM OFPR T1 where T1.[Name] ='[%1]' )
Set @Whse=(Select Max(s2.Warehouse) from OINM S2 Where S2.Warehouse = '[%2]')
BEGIN
Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
from( Select N1.Warehouse, N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
Where N1.DocDate < @SDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <= @EDate
and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription
Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <=@EDate and N1.OutQty > 0
and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
where a.ItemCode=I1.ItemCode
Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode
END
I hope this will work for you.
In above query you can also user OFPR.Code, OFPR, Category OFPR.Indicator instead of OFPR.Name.
Regards
Vaibhav Anharwadkar
Edited by: Vaibhav Ancharwadkar on May 24, 2011 9:23 AM -
Report for Stock Value Balances for previous periods
Hi, I would like to fing a standard report on SAP to provide the monthly stock balances per period the same way as MB5L, but with the functionality to inform the year
Hi
Try using report FS10N for all the balnces period wise for a specific year, you need to mention the G/L accounts from MB5L report.
Thanks & Regards
Kishore -
Inventory Closing Balance Report
Hi gurus,
I clients want to see Inventory value report as below:
Item Opening stock Import Qty (Received) Consumed Closing Stock
Qty. Value Qty. Value Qty. Value Qty. Value
Received indicates all incoming Qty into Inventory
Consumed: All outgoing Qty from Sub Inventory/ Org.
Is there any standard report to extract above data? there are some reports "inventory value report" but not meeting above criteria
Please advise best report from Oracle apps? and Table?
Regards
ChinnuHi gurus,
I clients want to see Inventory value report as below:
Item Opening stock Import Qty (Received) Consumed Closing Stock
Qty. Value Qty. Value Qty. Value Qty. Value
Received indicates all incoming Qty into Inventory
Consumed: All outgoing Qty from Sub Inventory/ Org.
Is there any standard report to extract above data? there are some reports "inventory value report" but not meeting above criteria
Please advise best report from Oracle apps? and Table?
Regards
Chinnu
Maybe you are looking for
-
Excel incompatible in SAP - Error
Hi Experts, When I try to execute the Tcode RRMX, it shows error message "Please Install suitable Excel version". Currently I'm having excel version 2003. Can any one give the solution. Rgds, Router Moved the post to the BI forum. Message was edited
-
Dear Experts, There is a FI PCA mismatch. transaction posted in FI but not reflecting in PCA. The following is my scenario in production. 1. User create a Bal Sheet GL X1234 in Jul-2011 2. Did not inform to assign it to 3KEH 3. Posted a few transa
-
How to delete leading zeros for amount fields
Hi all, I have problem with the leading zeros, where I am populating nearly 30 amount fileds in my statement.i want to delete leading zeros. I have tried with shift and pack. and I cannot call every time the function module *alpha_output or input. c
-
Setting up a network share [SOLVED]
I'm trying to setup a network share using NFS but get "can't read superblock" when trying to mount. This is the first time I've tryied setting a shared folder in linux. It's a new install (0.8 Voodoo) updated. The only packages I've installed are nf
-
I can't find my backup in icloud
When i go to a connected iPhone and look at my iCloud available backups, I see 1 for my ipad and 1 for my iphone. However, when i go to restore my iphone, the only backup available to choose froom is the ipad backup. It wont show the iphone backup th