Report to find open items and close items for given vendor

Hi All,
What are the steps needed to write a REPORT to find out
open and close items for a given vendor.
Which are the fields i'll have to take and what are the comparisons i'll have to make.
I know,
BSIK is for open Vendor &
BSAK for closed Vendors..
what are the conditions i'll have to check.
Thanks in Advance..
Pradeep Alex

Hi Pradeep,
This report I developed is definitely useful to you.
*& Report  ZFI_PROV_IT_VENDOR
REPORT  ZFI_VENDOR.
TYPE-POOLS: slis.
tables: BKPF,
        BSEG,
        bsik,
        bsak,
        bsid,
        bsad,
        lfa1,
        t005u,           "Region Description
        J_1IMOVEND.
TYPES: BEGIN OF ty_bkpf,
        bukrs type bkpf-bukrs,
        belnr TYPE bkpf-belnr,
        gjahr type bkpf-gjahr,
        blart TYPE bkpf-blart,
        budat TYPE bkpf-budat,
       END   OF ty_bkpf.
types: begin of ty_J_1IMOVEND,
         lifnr     type lfa1-lifnr,
         J_1IPANNO type J_1IMOVEND-J_1IPANNO,
         J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
         J_1ISERN  type J_1IMOVEND-J_1ISERN,
       end   of ty_J_1IMOVEND.
TYPES: BEGIN OF ty_bseg,
        belnr TYPE bseg-belnr,
        gjahr type bseg-gjahr,
        bschl TYPE bseg-bschl,
        umskz type bseg-umskz,
        shkzg type bseg-shkzg,
        wrbtr TYPE bseg-wrbtr,
        hkont type bseg-hkont,
        lifnr TYPE bseg-lifnr,
       END   OF ty_bseg.
types: begin of ty_t005u,
        bland type t005u-bland,
        bezei type t005u-bezei,
       end   of ty_t005u.
types: begin of ty_lfa1,
        lifnr type lfa1-lifnr,
        name1 type lfa1-name1,   "35
        ort01 type lfa1-ort01,   "35
        ort02 type lfa1-ort02,   "35
        pfach type lfa1-pfach,   "10
        pstlz type lfa1-pstlz,   "10
        regio type lfa1-regio,   "3
        stras type lfa1-stras,   "35
        ktokk type lfa1-ktokk,
        telf1 type lfa1-telf1,   "16
        telf2 type lfa1-telf2,   "16
       end   of ty_lfa1.
types: begin of ty_bsik,
        bukrs type bsik-bukrs,
        lifnr type bsik-lifnr,
        augdt type bsik-augdt,
        augbl type bsik-augbl,
        belnr type bsik-belnr,
        budat type bsik-budat,
        blart type bsik-blart,
        shkzg type bsik-shkzg,
        wrbtr type bsik-wrbtr,
       end   of ty_bsik.
types: begin of ty_bsid,
        bukrs type bsid-bukrs,
        lifnr type bsid-kunnr,
        augdt type bsid-augdt,
        augbl type bsid-augbl,
        belnr type bsid-belnr,
        budat type bsid-budat,
        blart type bsid-blart,
        shkzg type bsid-shkzg,
        wrbtr type bsid-wrbtr,
       end   of ty_bsid.
types: begin of ty_out2,
        lifnr type bsik-lifnr,
        wrbtr type bsik-wrbtr,
        end  of ty_out2.
types: begin of ty_out,
        lifnr type lfa1-lifnr,
        name1 type lfa1-name1,
        addr(162) type c,
        J_1IPANNO type J_1IMOVEND-J_1IPANNO,
        J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
        J_1ISERN  type J_1IMOVEND-J_1ISERN,
        opbal  type bseg-wrbtr,
        purch type bseg-wrbtr,
        PAYM  type bseg-wrbtr,
        grdeb type bseg-wrbtr,
        othdeb type bseg-wrbtr,
        othcre type bseg-wrbtr,
        tds   type bseg-wrbtr,
        bal   type bseg-wrbtr,
        blart type bkpf-blart,
        bschl type bseg-bschl,
       end  of ty_out.
types: begin of ty_bsegtemp,
        lifnr TYPE bseg-lifnr,
       end   of ty_bsegtemp.
types: begin of ty_bsegnew,
        wrbtr TYPE bseg-wrbtr,
        lifnr TYPE bseg-lifnr,
       end   of ty_bsegnew.
data: it_bsik type table of ty_bsik with header line,
      it_bsid type table of ty_bsid with header line,
      it_bsak type table of ty_bsik with header line,
      it_out2  type table of ty_out2 with header line,
      it_out3 type table of ty_out2 with header line.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
       it_listheader TYPE slis_t_listheader,
       it_alvevent TYPE slis_t_event,
       gt_events TYPE slis_t_event WITH HEADER LINE.
DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA : wa_fieldcat TYPE slis_fieldcat_alv,
       wa_listheader TYPE slis_listheader,
       wa_alvevent TYPE slis_alv_event.
DATA: WA_SORT TYPE SLIS_SORTINFO_ALV.
DATA: ls_line TYPE slis_listheader.
DATA : g_repid  LIKE sy-repid,                  " Program ID
       g_layout TYPE slis_layout_alv.           " Layout Workarea
DEFINE m_fieldcat.
  wa_fieldcat-col_pos       = &1.               " Fieldcat column postion
  wa_fieldcat-fieldname     = &2.               " Field name
  wa_fieldcat-DO_SUM        = &3.
  wa_fieldcat-seltext_m     = &4.               " Column Text
  wa_fieldcat-outputlen    = &5.
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.
END-OF-DEFINITION.
DATA: wa_lfa1 TYPE ty_lfa1,
      wa_bkpf TYPE ty_bkpf,
      wa_bkpf1 type ty_bkpf,
      wa_bsegtemp type ty_bsegtemp,
      wa_bsegnew type ty_bsegnew,
      wa_bsegnew1 type ty_bsegnew,
      wa_J_1IMOVEND type ty_J_1IMOVEND,
      wa_t005u type ty_t005u,
      wa_bseg TYPE ty_bseg,
      wa_out    TYPE ty_out.
DATA: gt_out TYPE STANDARD TABLE OF ty_out,
      gt_out1 TYPE STANDARD TABLE OF ty_out,
      gt_lfa1 TYPE STANDARD TABLE OF ty_lfa1,
      gt_bsegtemp type standard table of ty_bsegtemp with header line,
      gt_bsegnew type standard table of ty_bsegnew with header line,
      gt_bsegnew1 type standard table of ty_bsegnew with header line,
      gt_J_1IMOVEND type standard table of ty_J_1IMOVEND,
      gt_bkpf1 TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE,
      gt_t005u type standard table of ty_t005u,
      gt_bseg TYPE STANDARD TABLE OF ty_bseg WITH HEADER LINE,
      gt_bkpf TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE.
selection-screen begin of block b1 with frame title text-001.
select-options: s_budat for bkpf-budat obligatory,
                s_ktokk for lfa1-ktokk obligatory.
               s_wrbtr for bseg-wrbtr.
parameters: p_bukrs type bkpf-bukrs obligatory default '1000'.
           p_gjahr type bkpf-gjahr obligatory.
           p_lifnr type bseg-lifnr obligatory default '300040',
           p_ktokk type lfa1-ktokk obligatory default 'Z200'.
selection-screen end   of block b1.
START-OF-SELECTION.
  PERFORM sub_fetch_data.
  PERFORM sub_process_data.
END-OF-SELECTION.
  PERFORM sub_build_fieldcat.
  PERFORM sub_build_layout.
  PERFORM eventtab_build USING gt_events[].
  PERFORM comment_build USING it_listheader[].
  PERFORM sub_disp_data.
*&      Form  SUB_BUILD_FIELDCAT
      text
-->  p1        text
<--  p2        text
FORM sub_build_fieldcat .
sort gt_out by name1.
*DEFINE M_SORT.
   ADD 1 TO WA_SORT-SPOS.
   WA_SORT-FIELDNAME = &1.
   WA_SORT-UP        = 'X'.
   WA_SORT-SUBTOT    = &2.
   APPEND WA_SORT TO I_SORT.
END-OF-DEFINITION.
*m_sort 'NAME1' 'X'.
*M_SORT 'ADDR' 'X'.
  m_fieldcat 1  'LIFNR' ' '  text-026 10.
  m_fieldcat 2  'NAME1' ' '  text-006 35.
  m_fieldcat 3  'ADDR' ' ' text-007 162.
  m_fieldcat 4  'J_1IPANNO' ''  text-008 40.
  m_fieldcat 5  'J_1ICSTNO'  '' text-009 40.
  m_fieldcat 6  'J_1ISERN'  '' text-010 40.
  m_fieldcat 7  'OPBAL'  '' text-011 18.
  m_fieldcat 8  'PURCH'    '' text-012 18.
  m_fieldcat 9  'PAYM' ''  text-013 18.
  m_fieldcat 10  'GRDEB'  '' text-014 18.
  m_fieldcat 11  'OTHDEB'  '' text-020 18.
  m_fieldcat 12  'OTHCRE'  '' text-021 18.
  m_fieldcat 13  'BAL'  '' text-023 18.
  m_fieldcat 14  'TDS'  '' text-022 18.
ENDFORM.                    " SUB_BUILD_FIELDCAT
*&      Form  SUB_BUILD_LAYOUT
      text
-->  p1        text
<--  p2        text
FORM sub_build_layout .
  g_layout-zebra             = 'X'.
  g_layout-colwidth_optimize = 'X'.
ENDFORM.                    " SUB_BUILD_LAYOUT
*&      Form  EVENTTAB_BUILD
      text
     -->P_GT_EVENTS[]  text
FORM eventtab_build  USING    gt_events TYPE slis_t_event.
  DATA: ls_event TYPE slis_alv_event.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = gt_events.
  READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
                           INTO ls_event.
  IF sy-subrc = 0.
    MOVE 'TOP_OF_PAGE' TO ls_event-form.
    APPEND ls_event TO gt_events.
  ENDIF.
ENDFORM.                    " EVENTTAB_BUILD
*&      Form  COMMENT_BUILD
      text
     -->P_IT_LISTHEADER[]  text
FORM comment_build  USING    p_it_listheader TYPE
                                        slis_t_listheader.
data: v_text(30) type c,
      v_datelow(10) type c,
      v_datehigh(10) type c,
      v_month(2) type c,
      v_day(2) type c,
      v_year(4) type c.
v_day  = s_budat-low+6(2).
v_month = s_budat-low+4(2).
v_year = s_budat-low+0(4).
concatenate v_day '.' v_month '.' v_year into v_datelow.
clear: v_day,v_month,v_year.
v_day  = s_budat-high+6(2).
v_month = s_budat-high+4(2).
v_year = s_budat-high+0(4).
concatenate v_day '.' v_month '.' v_year into v_datehigh.
clear: v_day,v_month,v_year.
concatenate 'From' v_datelow 'To' v_datehigh into v_text
                                    separated by space.
clear: v_datelow, v_datehigh.
  ls_line-typ  = 'H'.
  ls_line-info = text-116.
  APPEND ls_line TO p_it_listheader.
ls_line-typ  = 'S'.
  ls_line-key = text-090.
  ls_line-info = v_text.
  APPEND ls_line TO p_it_listheader.
ENDFORM.                    " COMMENT_BUILD
*&      Form  TOP_OF_PAGE
      text
-->  p1        text
<--  p2        text
FORM top_of_page.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = it_listheader.
ENDFORM.                    " TOP_OF_PAGE
*&      Form  SUB_DISP_DATA
      text
-->  p1        text
<--  p2        text
FORM sub_disp_data .
  g_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = g_repid
      it_fieldcat        = it_fieldcat[]
      is_layout          = g_layout
      i_save             = 'U'
      it_events          = gt_events[]
    IT_SORT             = I_SORT[]
    TABLES
      t_outtab           = gt_out1[].
ENDFORM.                    " SUB_DISP_DATA
*&      Form  sub_fetch_data
      text
-->  p1        text
<--  p2        text
form sub_fetch_data .
select bukrs
       belnr
       gjahr
       blart
       budat
       from bkpf
       into table gt_bkpf
       where budat in s_budat
       and   bukrs = p_bukrs
      and   gjahr = p_gjahr
       and   blart in ('KR','KG','KZ','RE','DK','Z1','AB','SA','KA','DZ').
select belnr
       gjahr
       bschl
       umskz
       shkzg
       wrbtr
       hkont
       lifnr
       from bseg
       into table gt_bseg
       for all entries in gt_bkpf
       where belnr = gt_bkpf-belnr
       and   gjahr = gt_bkpf-gjahr
      and gjahr = p_gjahr
       and   bschl in (21,25,29,31,50,39,38,19,35).
      and kunnr in gt_
      and lifnr = '0000300019'.
select belnr
       gjahr
       bschl
       umskz
       shkzg
       wrbtr
       hkont
       kunnr
       from bseg
       appending table gt_bseg
       for all entries in gt_bkpf
       where belnr = gt_bkpf-belnr
       and   gjahr = gt_bkpf-gjahr
      and gjahr = p_gjahr
       and   bschl in (21,25,29,31,50,39,38,19).
break manukapur.
sort gt_bseg by  lifnr bschl.
delete adjacent duplicates from gt_bseg comparing all fields.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
move: wa_bseg-lifnr to wa_bsegtemp-lifnr.
      append wa_bsegtemp to gt_bsegtemp.
      endif.
endloop.
delete adjacent duplicates from gt_bsegtemp comparing lifnr.
select lifnr
        name1
        ort01
        ort02
        pfach
        pstlz
        regio
        stras
        ktokk
        telf1
        telf2
        from lfa1
        into table gt_lfa1
        for all entries in gt_bseg
        where lifnr = gt_bseg-lifnr
        and ktokk in s_ktokk.
       and lifnr = '0000300030'.
select  bland
        bezei
        from t005u
        into table gt_t005u
        for all entries in gt_lfa1
        where bland = gt_lfa1-regio
        and land1 = 'IN'
        and spras = sy-langu.
select lifnr
       J_1IPANNO
       J_1ICSTNO
       J_1ISERN
       from J_1IMOVEND
       into table gt_J_1IMOVEND
       for all entries in gt_bseg
       where lifnr = gt_bseg-lifnr.
*select bukrs
      belnr
      blart
      budat
      from bkpf
      into table gt_bkpf1
      where budat < s_budat-low.
      and zfdbt < s_budat-low.
select
       wrbtr
       lifnr
       from bseg
       into table gt_bsegnew
       for all entries in gt_bkpf
       where belnr = gt_bkpf-belnr
       and xopvw = 'X' .
      and zfbdt < s_budat-low.
select bukrs
       lifnr
       augdt
       augbl
       belnr
       budat
       blart
       shkzg
       wrbtr
       from bsik
       into table it_bsik
       for all entries in gt_bseg
       where lifnr = gt_bseg-lifnr
      and   lifnr = '0000300000'
       and   bukrs = '1000'
       and   budat <= s_budat-low.
select bukrs
       lifnr
       augdt
       augbl
       belnr
       budat
       blart
       shkzg
       wrbtr
       from bsak
       appending table it_bsik
       for all entries in gt_bseg
       where bukrs = '1000'
       and   lifnr = gt_bseg-lifnr
      and   lifnr = '0000300000'
       and   budat <= s_budat-low
       and   augdt > s_budat-low.
select bukrs
       kunnr
       augdt
       augbl
       belnr
       budat
       blart
       shkzg
       wrbtr
       from bsid
       into table it_bsid
       for all entries in gt_bseg
       where bukrs = '1000'
       and   kunnr = gt_bseg-lifnr
      and   kunnr = '0000300000'
       and   budat <= s_budat-low.
select bukrs
       kunnr
       augdt
       augbl
       belnr
       budat
       blart
       shkzg
       wrbtr
       from bsad
       appending table it_bsid
       for all entries in gt_bseg
       where bukrs = '1000'
       and   kunnr = gt_bseg-lifnr
      and   kunnr = '0000300000'
       and   budat <= s_budat-low
       and   augdt > s_budat-low.
if it_bsid[] is not initial.
append lines of it_bsid to it_bsik.
endif.
*delete gt_bsegnew where lifnr  <> '0000300000'.
*break manukapur.
*sort gt_bsegnew by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*collect wa_bsegnew into gt_bsegnew1.
*endloop.
loop at it_bsik .
it_out2-lifnr = it_bsik-lifnr.
*it_out1-budat = it_bsik-budat.
*it_out1-blart = it_bsik-blart.
if it_bsik-SHKZG = 'H'.
it_out2-wrbtr = it_bsik-wrbtr.
else .
it_out2-wrbtr = it_bsik-wrbtr * -1.
endif.
append it_out2.
clear: it_out2, it_bsik.
*endif.
*clear it1.
endloop.
sort it_out2 by lifnr.
loop at it_out2.
it_out3-lifnr = it_out2-lifnr.
it_out3-wrbtr = it_out2-wrbtr.
collect it_out3.
clear: it_out3, it_out2.
endloop.
endform.
*&      Form  sub_process_data
      text
-->  p1        text
<--  p2        text
form sub_process_data .
*sort gt_bsegtemp by  lifnr .
sort gt_bseg by lifnr bschl.
sort gt_bsegnew by lifnr.
sort it_out3 by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*at end of lifnr.
*sum.
*endat.
*endloop.
sort gt_bkpf by blart.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
read table gt_lfa1 into wa_lfa1 with key lifnr = wa_bseg-lifnr.
move: wa_lfa1-name1 to wa_out-name1,
     wa_lfa1-lifnr to wa_out-lifnr.
read table gt_t005u into wa_t005u with key bland = wa_lfa1-regio.
concatenate wa_lfa1-stras ',' wa_lfa1-ort01 ','
            wa_lfa1-ort02 ',' wa_t005u-bezei ','
            wa_lfa1-pfach ','
            wa_lfa1-pstlz ',' 'Ph:'
            wa_lfa1-telf1 ','
            wa_lfa1-telf2
            into wa_out-addr separated by space.
read table gt_J_1IMOVEND into wa_J_1IMOVEND with key lifnr = wa_bseg-lifnr.
move: wa_J_1IMOVEND-J_1IPANNO to wa_out-J_1IPANNO,
      wa_J_1IMOVEND-J_1ICSTNO to wa_out-J_1ICSTNO,
      wa_J_1IMOVEND-J_1ISERN  to wa_out-J_1ISERN.
      read table gt_bkpf into wa_bkpf with key belnr = wa_bseg-belnr.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 31 or
wa_bkpf-blart = 'KR' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KR' and wa_bseg-bschl = 50.
*wa_out-tds = wa_out-tds + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr * -1.
endif.
endif.
*wa_out-tds = wa_bseg-wrbtr.
endif.
if wa_bkpf-blart = 'KG' and wa_bseg-bschl = 21.
*wa_out-grdeb =  wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 21.
*wa_out-grdeb =  wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 25
*or wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29
**and wa_bseg-umskz = 'A'
or wa_bkpf-blart = 'SA' and wa_bseg-bschl = 25.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DK' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'SA' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 38.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DZ' and wa_bseg-bschl = 19
and wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 39
and wa_bseg-umskz = 'G' or
       wa_bseg-umskz = 'H' or
       wa_bseg-umskz = 'J' or
       wa_bseg-umskz = 'L' OR
       wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 35.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if ( wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29 )
   and wa_bseg-umskz = 'A' or
       wa_bseg-umskz = 'B' or
       wa_bseg-umskz = 'I' or
       wa_bseg-umskz = 'M' or
       wa_bseg-umskz = 'O' or
       wa_bseg-umskz = 'V'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21 .
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
**if wa_bseg-shkzg = 'H'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr.
**else.
**if wa_bseg-shkzg = 'S'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr * -1.
**endif.
**endif.
**endif.
***if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
      wa_out-othdeb =  wa_bseg-wrbtr.
***endif.
***if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21.
      wa_out-othdeb =  wa_bseg-wrbtr.
***endif.
read table it_out3 with key lifnr = wa_bseg-lifnr binary search.
on change of wa_bseg-lifnr.
*move: wa_lfa1-name1 to wa_out-name1,
    wa_lfa1-lifnr to wa_out-lifnr.
wa_out-opbal = it_out3-wrbtr.
endon.
*if wa_out-opbal is not initial.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
**else.
*wa_out-bal = wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
*endif.
wa_out-bal = wa_out-opbal + wa_out-purch + wa_out-paym + wa_out-grdeb + wa_out-othdeb + wa_out-othcre.
at end of lifnr.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
append wa_out to gt_out.
*collect wa_out into gt_out.
clear wa_out.
clear it_out3.
clear wa_bsegnew1.
endat.
endif.
clear: wa_bseg, wa_bkpf, wa_J_1IMOVEND.
endloop.
loop at gt_out into wa_out.
collect wa_out into gt_out1.
endloop.
endform.                    " sub_process_data
Regards,
Santosh Kumar M.

Similar Messages

  • Find open invoices and A/R for Customers in R/3 system

    Hello Experts,
    I have a requirement to identify the Open Invoices and A/R for the particular customer.
    Please loet me know in which table I can find the same?
    Thanks

    Hi,
    Good Day,
    For Open Invoice use Transaction FBL5N or FBL6N
    Table Name BSID.
    Best Regards,
    KSK

  • How to find open item in bsik table

    anyone can tell me how to find open items for vendor in bsik table or it will store only open item.
    i debug the tcode fbl1n to see . but not able to find
    Kumar

    Hi
    There is no specific field name for open item in the table BSIK.Yes BSIK include a structure named ABSIK_PSO and which is a "IS-PS: Data appendix of open items vendors".
    Yes there is a field name
    BUZEI - Line Item
    EBELP - Item
    You check with your requirement again and try to use these fields,if you still facing some probs than write back to me,i will try to give the appropriate solutions.
    Thanks
    Mrutyunjaya Tripathy

  • A/R report u0096 Customer open items based on due date

    Hi all,
    Can anyone tell me if there is a standard report on AR side that gives me invoices due between certain dates, meaning I should be able to select due dates between 11/15/2006 and 11/30/2006 in the selection and the report should get me the customers with invoices that are due between the above dates for a company code.
    Thanks in advance
    Kumar

    Hi Kumar,
    there is no standard report which give you selection citeria to select range of due date. Since due date is calculated based on function module where it calculate Bline date+ terms of payment days.
    other std reports are:
    S_ALR_87012175 Open Items - Customer Due Date Forecast
    S_ALR_87012178 Customer Open Item Analysis by Balance of Overdue Items
    S_ALR_87012168 Due Date Analysis for Open Items
    Hope this helps.
    Please assign points as way to say thanks

  • Re:- How to see customer/vendor open items for profit center wise

    any one help me regarding : How to see customer/vendor open items for profit center wise. That is possiable or not please suggest to me. I am using 4.6c version .

    Run the report from Tcode FBL1N for vendor open item and from FBL5N fron Customer open items.
    When you get the report, click on Change Layout icon ( or press Control + F8 from keyboard), search Profit Center fron the Table of Hidden fields on the right hand side. Move that field to the Left hand side table. Click ok, now you should be able to see the Profit Center column in your report.
    You can save this layout by clicking on the Save Layout icon ( or press Control + F12 from keyboard)
    Next time you can choose the saved layout by clicking on the Select Layout icon ( or press Control + F9 from keyboard)
    Regards
    Dharmveer

  • Collapsible Panels - Links to open one, and close others

    Hi,
    I am new to Dreamweaver and have been creating my site by
    learning as I go along. I have already read through all the other
    related topics associated with Collapsible Panels on this blog and
    have still not found an answer. I have been able to open and close
    Collapsible Panels by using links - but unfortunately, I need more
    than just opening and closing.
    On my site i have approximately 5 pages, all with the same
    header and Menu bar. The Information (that i have presented in
    numerous Collapsible Panels) does however vary from page to page.
    What I need to try and figure out is:
    How can I open one collapsible panel and close all others? I
    have seen the one example which leads to my next question:
    How can I group Panels? Some examples of how to open one and
    close all others use this grouping. Is there any other way of
    opening one and closing all others without grouping?
    Lastly, is it possible to set up a link that can be viewed on
    one page which when clicked opens the relevant page and collapsible
    panel? i.e. on my About Us page there is a link (using the Menu
    bar) for one of my several services on the services drop down menu
    (but services is on a different page with the same setup). When a
    viewer clicks on the specific service, is it possible to get the
    site to open the services page, and open the relevant collapsible
    panel (with all other Panels closed)?
    Any assistance would be greatly appreciated - I have been
    searching for days now and cannot seem to find any
    answers/directions in laymans terms.
    Kind regards,
    John

    wlsjoh013 wrote:
    > Hi,
    >
    > I am new to Dreamweaver and have been creating my site
    by learning as I go
    > along. I have already read through all the other related
    topics associated
    > with Collapsible Panels on this blog and have still not
    found an answer. I
    > have been able to open and close Collapsible Panels by
    using links - but
    > unfortunately, I need more than just opening and
    closing.
    >
    > On my site i have approximately 5 pages, all with the
    same header and Menu
    > bar. The Information (that i have presented in numerous
    Collapsible Panels)
    > does however vary from page to page. What I need to try
    and figure out is:
    >
    > How can I open one collapsible panel and close all
    others? I have seen the one
    > example which leads to my next question:
    This page has an example that has a link that can open and
    close a panel:
    http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/collapsible_panel_sample. htm
    One way to do this would be to have a single link that would
    open one of your panels using the code, but then add to it code
    that closes each of the other panels, for example:
    <a href="#"
    onclick="CollapsiblePanel4.open();CollapsiblePanel5.close();CollapsiblePanel6.close();">O pen
    4, close 5 and 6</a>
    To make this work, you'll need to look that the panel
    constructors at the bottom of your page and make sure to match up
    the panel variable names i.e. "var CollapsiblePanel1 =...." the
    variable is CollapsiblePanel1.
    You could also write a function that gathers together the
    various panels you have on the page and then pass to it only the
    panel that you want kept open. For now, though, it might be best to
    use the above method, given your expertise. And taking that even
    further, you could apply the function call unobtrusively. Both the
    function call and the unobtrusive part you can work on later to get
    this working for now.
    > How can I group Panels? Some examples of how to open one
    and close all others
    > use this grouping. Is there any other way of opening one
    and closing all
    > others without grouping?
    This is a little confusing, on one hand you ask about how to
    group, but then ask how not to group. There is a concept of a
    collapsible panel group:
    http://labs.adobe.com/technologies/spry/samples/collapsiblepanel/CollapsiblePanelGroupSamp le.html
    But there is another type of group, that may be more what
    you're looking for, and that's an Accordion panel, which is similar
    to the collapsible panel group, with the exception that it can only
    have one panel open at a time.
    > Lastly, is it possible to set up a link that can be
    viewed on one page which
    > when clicked opens the relevant page and collapsible
    panel? i.e. on my About Us
    > page there is a link (using the Menu bar) for one of my
    several services on the
    > services drop down menu (but services is on a different
    page with the same
    > setup). When a viewer clicks on the specific service, is
    it possible to get
    > the site to open the services page, and open the
    relevant collapsible panel
    > (with all other Panels closed)?
    Probably the easiest way to do this particular one would be
    to make sure that you have all of the panels set to be closed when
    the page loads, and then take a look at the code for the last
    example on this page:
    http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html
    That example uses a tabbed panel, but the concept is the
    same, use a URL parameter to determine what to show. You'll need to
    link in the SpryURLUtils file in the Spry download package (look in
    the includes folder):
    http://labs.adobe.com/technologies/spry/home.html
    Essentially, your link will look similar to:
    sample.html?panel=1
    Then your code could look something like:
    var params = Spry.Utils.getLocationParamsAsObject();
    var CollapsiblePanel1 = new
    Spry.Widget.CollapsiblePanel("CollapsiblePanel1",
    {contentIsOpen:(params.panel==1 )} );
    var CollapsiblePanel2 = new
    Spry.Widget.CollapsiblePanel("CollapsiblePanel2",
    {contentIsOpen:(params.panel==2 )} );
    Basically what this is doing is creating an object from the
    URL parameters. Then for each of the panels the constructor has
    code that determines whether or not to expand the panel when the
    page loads. So it checks the value of params.panel to see if it
    matches 1 (for the first one), if it does, then that means that
    contentIsOpen is set to true, if it is some other number or is not
    present at all, then that means that the panel is closed. This
    would then be repeated down the line for how ever many panels you
    want to operate like that.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Automatically open, save and close excel?

    I need import data from Excel to SQL.
    Now, I use tSQL to directly read the excel files and transform to the SQL table.
    As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
    Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
    However, this will make the data in the excel double and result a large excel file.
    I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
    Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
    Then I can directly use this excel for data import.
    Is there any simple way to do so? I don't know marco much...
    Ivan

    No formula could do this (Automatically open, save and close excel).
    You need to recode a marco or write a macro. Why donot you ask in msdn?
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    example:
    Sub auto_open()
    Application.OnTime Now + TimeValue("00:01:00"), "wswx"
    End Sub
    Sub
    wswx() If Not ThisWorkbook.Saved
    Then ThisWorkbook.Save
    ThisWorkbook.Close
    End Sub
    KR

  • Vendor Open Items for each Segment ?

    Hi all,
    What is the most effective way to grouped the all Vendor Open Items for each Segment ?
    I think i should use tables BSIK and (BSEG or FAGLFLEXA).
    Field BSEG-SEGMENT does not always have a value (often is empty), so it is likely to be used FAGLFLEXA-SEGMENT.
    Thanks in advance
    Serena

    .

  • Open dataset and close dataset

    Hi
    I need to write log file in fileshare.
    I am using the following FM to create the file.
    Z_FILE_OPEN_OUT_UNICODE'
    I have following qns
    1. do i need to use open dataset and close dataset stmts, even I create the files with the FM?

    Hi,
    you can fill in the name of the FM in transaction SE37, then click 'Display' and look at the source code and the 'Tables' tab.
    It's a custom build FM, so you might have to look at the import parameters it needs... ( Tab 'Import' and 'Tables' ).
    To answer your question, as the name of the FM suggests it will write the file for you, so no open/close dataset. Please doublecheck tab 'Source code' and you might find these statements there...
    hope that helps,
    Rolf

  • Interest calculation only for open item for customers

    Hi, do you know how to calculate Interest calculation only for open item for customers?I do not want to see cleared   items. I have problem with customization.
    Best Regards
    Tom

    In the item interest calculation, you can tick the  'open items' for calculation of interest and also select the 'no cleared items'.
    Regards

  • Switch on open items for ECC 6.0

    Hi gurus: With reference to SAP OSSNote 175960 - RFSEPA02/03 not supported as of Release 4.5A.....
    We have ECC6.0 here, with active new GL as well as document splitting. I want to switch on open items for an account that has postings in it.
    I copied RFSEPA02 to ZFSEPA02 and changed coding per note 175960. I checked the program and it has table GLT0 referenced in the code. It was my understanding the GLT0 is not populated if you activate the new GL.
    When I execute ZFSEPA02, it comes up with an error message "Line items do not match totals"....When debugging, it appears that SAP is looking at GLT0 to get a total balance. If it doesnt match with the line items SAP generates the same error message.
    The note also says that "This note applies ONLY WITH RESTRICTIONS to Release ERP 2004 or ERP 2005 with activated New General Ledger and activated document splitting. In these releases, it is not currently possible to subsequently activate the open item management under the specified conditions. The only option currently available is to set up a new account with open item management and to use this instead of the original account. "
    What do I do? I dont want to create a separate GL account..Should I change the code to refer to table FAGLFLEXT instead of GLT0?
    thanks so much
    Brian

    Hi Andy,
    Thanks for the reply.
    Other than BSP screens what are the other substitutes.
    Please share your ideas.
    Regards,
    Sairam.

  • Standard program to transfer open items from one vendor to another

    Hello to you all,
    Does anyone know of a standard program to transfer open items from one vendor to another,
    Thanks
    Yoav

    Hi,
    i dont know whether there is any program but there is one t.code which is meant for one of this purpose.
    We can do the same through F-51 also. First specify the document header information. for the first line item specify the customer debit or credit posting key, vendor number, and special gl if you want (Here you have to give vendor number to whom you want to transfer) press enter
    in this screen specify the amount. and go to Choose open items new screen will come
    Specify the vendor number and in additional selections choose document number and then click enter. the one line item only appear here then go for simulate. if required specify the narration by double clicking on the line item.
    hope this is clear,
    Regards,
    Sankar

  • How to see open items for vendor.

    Hi,
    What condition I should put to select values from Bseg to select open item amount for vendor.
    Regards
    Mave

    Hi,
      to select open items for vendor you should read from table BSIK.
    After this you can read table BSEG with BSIK-BUKRS, BSIK-BELNR, BSIK-GJAHR.
    ( Bseg is a cluster table and selections for vendor are slower than bsik)
    for example:
      select * from bsik
      where bukrs = company_code
      and lifnr = vendor_no
      select * from bseg
      where bukrs = bsik-bukrs
      and belnr = bsik-belnr
      and gjahr = bsik-gjahr
    Regards, Manuel

  • How to clear the open item for non-leading ledger?

    Hi, Experts,
    I have two valuation area VA001 and VA004 and two accouting principle GAAP and IFRS.
    Then I assign VA001 to GAAP (post to leading ledger) and VA004 assgin to IFRS (Post to non-leading ledger "IF").
    There are two ledger group ,one is  0L and the other is IF.
    When i run TBB1, system generate 2 FI documentes.
    Then  I run F13E to clear the GL account, because some GL is open item management.
    But only ledger 0L is cleared, the other non-leading ledger "IF" is not cleared.
    I don't know is there any possiblity that system will clear open item for leading ledger and non-leading ledger together?
    TKS a lot.

    Hi Louise,
    you do posting in TRM, but clearing is done in FI, so I moved the thread.
    BR, Tomislav

  • Selection of open item for payment

    Hi
    I understand that in the automatic payment program, the selection of the open items for payment is partly determined by the "documents entered up to date" and the "Next payment" run date. Would like to confirm if the posting date specified will affect the open items selected.
    I have a vendor with 3 open items - 2 invoices and 1 credit memo. The payment date for all 3 documents are 13.9.2007.
    Only the 2 invoices were selected for payment when I specify
    Posting date : 12.9.2007
    Doc entered up till and next payment date : 14.9.2007
    Only when we change the posting date to a later date was the credit memo selected as well. Why is this so?
    Hope someone could advise me on this.
    Thank you.

    Hi
    Thanks for responding.
                           Baseline date               Payment terms
    Invoice                14.08.2007                14 days
    Credit memo       13.09.2007                 -
    Regards.

Maybe you are looking for

  • Blue screen error question

    Can I determine thecause of a bluescreen problem from the info given?  Only happened twice. Thanks in advance. Problem signature:   Problem Event Name:    BlueScreen   OS Version:    6.1.7601.2.1.0.256.48   Locale ID:    1033 Additional information a

  • Downloaded the latest version (8.0) and now cannot connect. Instead I get this message: Unable to connect

    Every time you guys have an update there is a problem. Now I cn't connect! I am writing you using IE. Maybe I should just stop using Firefox! When trying to connect I get the following error message:Unable to connect Firefox can't establish a connect

  • Zen Neeon - possible to replace batte

    I am considering buying the Zen Neeon for my girlfriend for her birthday. She is primarily going to use it whilst exercising and jogging. The only concern I have is the fact that it does not appear to be possible to replace the lithium ion battery. I

  • Do you have to delete current (CS6) Illustrator preferences on Mac Os X?

    I have recently purchased the Adobe Illustrator CS6 program & Adobe CS6 Classroom in a Book. I am familiar with the Adobe InDesign & Adobe Photoshop programs, but I have never had to restore/delete default preferences. I was able to locate the Adobe

  • BSP Fundamentals

    BSP Experts, Please mail me the BSP Fundamentals document to my mail id. Email id [email protected] Thanks, vinay