EBS Importing Opening / Closing Balances
I am Importing EBS via transation FF.5 (APACS EBS), the file is importing all details except the Opening Balance and Closing Balance. I have checked Algorithm and they are set up. Using 4.7 Enterprise. Has anyone got any suggestions.
Hi,
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
Similar Messages
-
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. -
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.. -
Opening & Closing balances of 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 Dn,
That would suffice for your requirement .
Regards,
Santosh -
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 -
Mismatchin in opening & closing balance ofj2i9 & j2i6 register
Hi,
We have done utilization on 1st of Month but the posting date was entered as 31st of previous month.
Now the system showing mismatch in J2I9 & J2I6 between opening & closing balances for the previous period. The entry is missing in J2I9 but the same it is showing in J2I6 as Dr Entry. Why the system is not showing the Dr Entry in J2I9.And moreover the opening & closing balances are matching for the current and last month, but there is mismatch in the month of Dec in the same month utilization was carried out on 1st of Jan but posting date was entered as 31st Dec. What could be reason?
RgsHI !
Now that we have not maintained the values in J_2iRG1bal, so how do I correct the problem, what should I do so that the opening balance & closing balance values appear in the RG1 report.
Kindly suggest.
Regards,
DGN -
GL_DAILY_BALANCES table for daily opening/closing balance
Hi All,
I need to know something about the GL_Daily_Balances table. In eTRM, it says that the table gives the balances for a particular day. My requirement is to show the opening and closing balances on daily basis. But, I found that all the END_OF_DAY columns (END_OF_DAY1...END_OF_DAY35) are NULL.
Can anyone tell me why these columns are NULL ? Under what conditions, they are null ? How can I get the opening /closing balance then?
Thanks!
YoginiHi Yogini,
This table is populated when balance processing is enabled in the definition of each set of books, do you have it?
You can read about in the metalink note # 1072012.6
Bye -
Opening & Closing balance of RG23A part II are miss matching for SECS only
Hi Gurus,
Opening & Closing balance for the month of May & April are mismatching for SECS only. where as BED & all other values are getting matched with April closeing & May opening.
I have checked from Jan till Aprill everything is ok but after this in May i have problem.
My closeing value in April for SECS is 40K where in May opening it is showing 5K. I use J2i6 to download the register.
Plz can any one tell me how should i track this inconsistency.Its possible that some transactions are posted after you extract the report. Extract the report again (J2I5) and print them.
Have you configured different GL accounts for posting BED, ECS & HCS. From your description, it seems same GL is assigned for all three components.
Ravi. -
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 -
Getting Opening & Closing Balance in Customer Ledger Report
Hi Guys.
I am developing a report of Customer Ledger. There I have to display the Opening Balance & Closing balance of individual customers on m onthly basis.
I have date related objects
1. Fiscal Year/Period,
2. Fiscal Year Variant,
3. Posting Date,
4. Clearing Date and
5. Entry Date.I am sorry for the above posting...
Hi Guys.
I am developing a report of Customer Ledger. There I have to display the Opening Balance & Closing balance of individual customers on m onthly basis from debit amout and .credit amount.
I have date related objects
1. Fiscal Year/Period,
2. Fiscal Year Variant,
3. Posting Date,
4. Clearing Date and
5. Entry Date.
I have created a variable on posting date with "interval".
Please let me know how to restict the keyfigures to get my report to display Opening & Closing Balance.
ThanX in advance
Peter -
Daily Report of Opening closing balance & Consumption
Dear Experts,
We are implementing for dairy industry (PI) and here is requirement to develop a report which shows daily raw milk consumption ( Movement type 261) and daily opening and closing balances of raw as well as finished milk, Finished milk is produced using strategy 40 by repetitive manufacturing, please suggest me table and fields to get the data for such report.
Thanks & Regards,
Karad D D
Edited by: Devidas Karad on Jun 19, 2010 10:38 AMDear ,
We had similar kind of report called -Material Balance Report for Finished Product .I am providing you the necessary tabel which I have utlised in my functinal spec.
You can use the following table for your requirement for developing daily consumption report
MBEWH - Stock with period and year
MBEW - Stock wtih current period and year
MSEG - Material Movement data details
MKPF - Material Movement data
You can make use the below tabel and data element to fetch some of the required information for finsihed good :
AUFNR AFKO-AUFNR, "Proc. Order No.
RSNUM AFKO-RSNUM, "Reservation No.
PLNBEZ AFKO-PLNBEZ, "Header Material No.
GSTRI AFKO-GSTRI, "Actual Start Date
GLTRI AFKO-GLTRI, "Actual Finish Date
WERKS AUFK-WERKS, "Plant
BDMNG RESB-BDMNG, "Required Qty.
ENMNG RESB-ENMNG, "Quantity Withdrawn
EXTISS RESB-ENMNG, "Extra Issue
BALQTY RESB-ENMNG, "Balance Qty.
MATNR RESB-MATNR, "Component No.
MAKTX MAKT-MAKTX, "Component Description
Hope this will be useful
Regards
JH -
TABLE for Opening & closing Balance of G/L
Hi all,
I would like to know the name of the TABLE from where i can get the closing balance of previous fiscal and the opening balance of this fiscal year.(As there is a mismatch between the c/f balance.)
Thanks for your Patience & Time
Regards
SAP4MEPankaj
Thanks for the reply.
But i am not able to get the closing balance in GLT0 table.
We have the opening balance only.
My issue is that the C/F balance has not been moved properly to the new fiscal year for a particular G/L code.
Now i want to check what made the discrepancy.
If you have any other inputs,kindly provide.
Thanks for you time
Regards
SAP4ME -
Opening/Closing Balance value missing in J_3RFCASH15
Hello,
I am having a problem with the new program for printing cash journal for Russia.
When I am executing program J_3RFCASH15 and then select the KO-4 form layout the following data is missing:
- Opening Balance amount
- Closing Balance amount
- Day's total amount (sum of incoming and outgoing payments)
- Header data (as the cash account, company code)
Please, has anybody met this kind of problems when upgradin from ERP 4.7 to Ecc 6.0?
Thank you
MariaI am having problems setting up the cash journal for russia under Ecc 6.0 at all. What have you done so far as entrieds in T048b for correspondence SAPr1, SAPr2 and SAPR3 ? And what than for those reports in table TCJ_PRINT for those prrograms ? And which entries for those in T001F ?
They have deleted all three country version programms for that from 4.6 and I found no complete documentation how to set it up now.
In regards of your question: I know that one can enter standard texts into report RFCASH00 that give those texts, but I have no idea how one combines all these settings. Please fill me in if you find out something - I will add info to this thread aswell.
Kind Regards -
Opening/Closing Balance amounts missing in J_3RFCASH15
Hello,
I am having a problem with the new program for printing cash journal for Russia.
When I am executing program J_3RFCASH15 and then select the KO-4 form layout the following data is missing:
- Opening Balance amount
- Closing Balance amount
- Day's total amount (sum of incoming and outgoing payments)
- Header data (as the cash account, company code)
Please, has anybody met this kind of problems when upgradin from ERP 4.7 to Ecc 6.0?
Thank you
MariaI am having problems setting up the cash journal for russia under Ecc 6.0 at all. What have you done so far as entrieds in T048b for correspondence SAPr1, SAPr2 and SAPR3 ? And what than for those reports in table TCJ_PRINT for those prrograms ? And which entries for those in T001F ?
They have deleted all three country version programms for that from 4.6 and I found no complete documentation how to set it up now.
In regards of your question: I know that one can enter standard texts into report RFCASH00 that give those texts, but I have no idea how one combines all these settings. Please fill me in if you find out something - I will add info to this thread aswell.
Kind Regards -
Opening & Closing Balances are show diff. amounts
Hi,
One GL account showing Closing Balance for 2008 (this nothing but uploaded initial value). Is not matching with Opening Balance for 2009 @ FBL3N.
Example: Closing Balance is 10,000 (positive) for fiscal year 2008.
Opening balance is 30,000 (negative) for fiscal yar 2009.
I am not getting, the reasong why it showing amount differently. Please let me know what is the problem.
Thanks
ParthaHi,
Please check if you have posted any document in previous year after transferring the balances to the next year. if such, you need to execute faglgvtr once again so that the correct balances are carried forward.
Trust this helps much
Cheers
Maybe you are looking for
-
Hi All, I am new to patterns and have started understanding them using the Head First Series. I would like to know what all design patterns are there in JDBC? Can i say that JDBC uses a Facade design patterns as it hides the database specific details
-
iphone stuck on recovery mode,,, cannot restore due to error 21. tried all ways to solve the error, but no use... plz help
-
hi....I want to put up a slideshow of power point presentation....can some one please tell me which component of FLEX i should use for this purpose.....or is there any other solution for ppt viewing from a website using a flex client......please help
-
Airport downloading binary data instead of loading web page?
I've been having the usual problems with dropped connections for the past month since I set up my new dsl service. It didn't bother me too much since all I had to do was unplug my airport and plug it back in. This morning it happened again and I deci
-
There is an album on a smart playlist on my ipod that is not on the music section of my ipod. I am not synced to any computer. How do I delete this album from the playlist and presumably my computer? Thanks!