GR/IR clearing report code with gl a/c

hi experts,
anyone have gr/ir clearing report code with gl a/c
Moderator message - Please ask a specific question. Don't just post vague requirements hoping that someone will take care of them for you - post locked
Edited by: Rob Burbank on May 22, 2009 9:37 AM

go throw below link
Re: gr/ir clearing account?

Similar Messages

  • Report code with ALV

    Hi
    Can any body provide me the code for report with selection screen using ALV.
    Thanks in advance
    Prasanna Kumar

    Hi Prasanna,
    Below is an example of ALV reporting.
    *& Report  ZVVF_MR028_STOCKLEDGER                                      *
    REPORT  ZVVF_MR028_STOCKLEDGER                  .
    *       Tables
    TABLES:      EKKO,    "PURCHASING DOC. HEADER
                 EKPO,    "PURCHASING DOC. ITEM
                 MAKT,    "MATERIAL DISCRIPTION
                 LFA1,    "VENDOR MASTER
                 RSEG,    "DOC. ITEM - INCOMING INVOICE
                 KONV,    "CONDITION (TRANSECTION DATA - CLUSTER TABLE)
                 EKPA,    "Partner Roles in Purchasing
                 MSEG,
                 t247,
                 mardh,
                 mara.
    *       Types                    Begin with TY_
    TYPE-POOLS slis.
    TYPES  :  BEGIN OF ty_head,
                  p_date TYPE dats,
                  matnr LIKE mseg-matnr,
                  maktx LIKE makt-maktx,
                  openbal LIKE mardh-labst,
                  r_po LIKE mseg-menge,
                  r_prodord LIKE mseg-menge,
                  r_byprod LIKE mseg-menge,
                  r_others LIKE mseg-menge,
                  R_TOTAL TYPE mseg-menge,
                  i_prod LIKE mseg-menge,
                  i_cust LIKE mseg-menge,
                  i_costcen LIKE mseg-menge,
                  i_scrapping LIKE mseg-menge,
                  i_subcontractor LIKE mseg-menge,
                  i_sampling LIKE mseg-menge,
                  purret LIKE mseg-menge,
                  i_total like mseg-menge,
                  stock_out LIKE mseg-menge,
                  stock_in LIKE mseg-menge,
                  stock_transit LIKE mseg-menge,
                  m_to_m_transit  LIKE mseg-menge,
                  phy_loss LIKE mseg-menge,
                  phy_gain LIKE mseg-menge,
                  closing_bal LIKE mseg-menge,
                  current_bal LIKE mseg-menge,
                  bwart like mseg-bwart,
                  werks like mseg-werks,
              END OF ty_head.
    types :  begin of ty_docs,
             matnr like mseg-matnr,  "Material
             budat like mkpf-budat,  "Posting date
             menge like mseg-menge,  "Qty
             xblnr like mkpf-xblnr,  "Ref doc
             end of ty_docs.
    data : w_cnt type I.
    data : w_chk type i.
    TYPES: BEGIN OF TY_KONV,
                 KNUMV LIKE KONV-KNUMV,
                 KBETR LIKE KONV-KBETR,
                 KSCHL LIKE KONV-KSCHL,
                 KWERT LIKE KONV-KAWRT,
           END OF TY_KONV.
    TYPES: BEGIN OF TY_KBETR,
    *              KBETR LIKE KONV-KBETR,
                  KWERT LIKE KONV-KWERT,
              END OF TY_KBETR.
    TYPES: BEGIN OF TY_RSEG,
                  EBELN LIKE RSEG-EBELN,
                  MATNR LIKE RSEG-MATNR,
                  WRBTR LIKE RSEG-WRBTR,
                  KSCHL LIKE RSEG-KSCHL,
                  LIFNR LIKE RSEG-LIFNR,
              END OF TY_RSEG.
    TYPES: BEGIN OF TY_NAME1,
                  NAME1 LIKE LFA1-NAME1,
           END OF TY_NAME1.
    ** Each Condition and their values w.r.t different docu types
    *data: begin of temp_head occurs 0,
    *        kschl  like  konv-kschl,  " Condition type
    *        kwert  like  konv-kwert,  " Condition value
    *      end of temp_head.
    *       Constants                Begin with C_
    CONSTANTS: st_formname_top_of_page TYPE slis_formname
                                  VALUE 'TOP_OF_PAGE-ALV'.
    *       Data                     Begin with W_
    *-------- Declarations for ALV Grid.
    DATA:   it_st_list_top_of_page TYPE slis_t_listheader,
            it_st_fieldcat TYPE slis_t_fieldcat_alv,
            it_st_events   TYPE slis_t_event,
            st_layout   TYPE slis_layout_alv,
            s_status TYPE slis_formname VALUE 'STANDARD_ST01',
            s_user_command TYPE slis_formname VALUE 'USER_COMMAND-ALV',
            s_repid LIKE sy-repid,
            s_save(1) TYPE c,
            s_variant LIKE disvariant,
            code LIKE disvariant-handle.
    data : begin of it_stockclose occurs 0,
           werks like s031-werks,   "Plant
           matnr like mara-matnr,   "Material
           lgort like mard-lgort,   "Storage Loc
           labst like mardh-labst,  "Unrestricted Stock
           insme like mardh-insme,  "Inspection Stock
           speme like mardh-speme,  "Safety stock
           einme like mardh-einme,  "Total stock of rest batches
           retme like mardh-retme,  "Blocked stock returns
           end of it_stockclose.
    data : begin of it_finalstock occurs 0,
           werks like mseg-werks,   "Plant
           matnr like mseg-matnr,   "Material code
           lgort like mard-lgort,   "Sto Loc
           menge like mseg-menge,   "Qty
    *       budat like mkpf-budat,   "Posting Date
           end of it_finalstock.
    data : begin of it_docs occurs 0,
           matnr like mseg-matnr,   "Material code
           budat like mkpf-budat,   "Posting date
           bwart like mseg-bwart,   "Movement type
           menge like mseg-menge,   "Quantity
           werks like mseg-werks,   "Plant
           shkzg like mseg-shkzg,   "Credit/debit
           lgort like mseg-lgort,   "Sto Loc
           maktx like makt-maktx,   "Material Discription
           end of it_docs.
    data : begin of it_mkpf occurs 0,
           budat like mkpf-budat,   "Posting date
           mblnr like mkpf-mblnr,   "Material Doc
           xblnr like mkpf-xblnr,   "Delivery ref no
           mjahr like mkpf-mjahr,   "Fiscal yr
           cpudt like mkpf-cpudt,
           end of it_mkpf.
    data : begin of it_mseg occurs 0,
           matnr like mseg-matnr,   "Material
           bwart like mseg-bwart,   "Movement type
           menge like mseg-menge,   "Qty
           werks like mseg-werks,   "Plant
           mjahr like mseg-mjahr,   "Fiscal yr
           shkzg like mseg-shkzg,   "Credit/Debit Indicator
           lgort like mard-lgort,   "Sto loc
           budat like mkpf-budat,   "Posting date
           xblnr like mkpf-xblnr,   "Delivery ref
           cpudt like mkpf-cpudt,
           end of it_mseg.
    data : begin of it_matnr occurs 0,
           matnr like mara-matnr,   "Material
           end of it_matnr.
    data : w_monat  type monat.    "Month number
    data : w_gjahr like sy-datum,    "Date
           w_date_fiscal(4) type n,  "Year
           w_date like sy-datum,     "Date
           w_buper like t009b-poper, "Posting period
           w_year like t009b-bdatj,  "Posting date
           w_datum(2) type n.        "Date
    *       Internal tables          Begin with IT_
    DATA    :  IT_HEAD TYPE STANDARD TABLE OF TY_HEAD WITH HEADER LINE.
    ***Issues and receipts
    data : it_issue type ty_docs occurs 0 with header line,
           it_receipt type ty_docs occurs 0 with header line,
           it_issue_date type ty_docs occurs 0 with header line,
           it_receipt_date type ty_docs occurs 0 with header line.
    data:   w_dval like mseg-menge,
            w_opbal like mseg-menge.
    **  WORK AREAS: Begin with WA_
    *DATA: wa_HEAD type TY_HEAD.
    *data: w_tkwert    type p decimals 2 value 0,
    *      grmenge     like ekpo-menge,
    *      w_tot_kwert type p decimals 2 value 0,
    *      w_tmp_kwert type p decimals 2 value 0,
    *      w_finalsum  type p decimals 2 value 0,                "#EC *
    *      w_finalrate type p decimals 4 value 0.                "#EC *
    *       R A N G E S
    ranges: r_loekz  for  ekko-loekz.  " Deletion Indicator
    ranges : r_movtype for mseg-bwart,   "Movement type
             r_date for sy-datum.        "Date
    *       Select Options          Begin with SO_
    SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 2.
    *SELECT-OPTIONS : SO_LIFNR FOR EKKO-LIFNR.
    *SELECT-OPTIONS : SO_EKORG FOR EKKO-EKORG .
    *SELECT-OPTIONS : SO_WERKS FOR MSEG-WERKS .
    *SELECT-OPTIONS : SO_EBELN FOR EKKO-EBELN.
    *SELECT-OPTIONS : SO_DATE for sy-datum obligatory no-extension.
    *SELECT-OPTIONS : SO_EKGRP FOR EKKO-EKGRP.
    *SELECT-OPTIONS : SO_BSART FOR EKKO-BSART DEFAULT 'NB'.
    *SELECT-OPTIONS : SO_MATKL FOR EKPO-MATKL.
    *SELECT-OPTIONS : SO_MATNR FOR MSEG-MATNR.
    select-options   : so_werks for mseg-werks default 'P001'. "Plant
    select-options   : so_lgort for mseg-lgort. " Sto. Location
    select-options   : so_matnr for mseg-matnr obligatory. "Material code
    select-options   : so_mtart for mara-mtart. "Material type
    SELECT-OPTIONS   : SO_MATKL FOR EKPO-MATKL. "Material Group
    select-options   : so_date for sy-datum obligatory no-extension.
    SELECTION-SCREEN SKIP 2.
    selection-screen: skip,
                      begin of line,
                      comment (15) text-034.
    parameters:     p_all    radiobutton group del.
    selection-screen comment 25(9) for field p_all.
    parameters:     p_del    radiobutton group del.
    selection-screen comment 45(12) for field p_del.
    parameters:     p_undel  radiobutton group del default 'X'.
    selection-screen comment 65(14) for field p_undel.
    selection-screen end of line.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN END OF BLOCK MAIN.
    *       Parameters              Begin with PR_
    *       Initialisation
    INITIALIZATION.
      s_repid = sy-repid.
      s_save = 'A'.
      perform f000_initialize_mov_type changing r_movtype[].
      PERFORM eventtab_build USING it_st_events[].
      PERFORM variant_init.
    *       S T A R T   O F   S E L E C T I O N
    START-OF-SELECTION.
      PERFORM initialize.
      perform f001_determine_fiscal_period.
      perform f002_determine_closing_stock changing it_stockclose[].
      if not so_date-low+6(2) eq '01'.
        perform f003_change_closing_stock changing  it_stockclose[].
      endif.
      perform f004_determine_mat_docs changing it_mkpf[]
                                                 it_mseg[].
      perform f005_receipts_issues using    it_mseg[]
                                     changing it_issue[]
                                              it_receipt[]
                                              it_matnr[].
    *---alv
      PERFORM comment_build USING it_st_list_top_of_page[].
      PERFORM fieldcat USING it_st_fieldcat[].
      PERFORM layout_build USING st_layout.
      PERFORM reuse_alv_list_display.
    END-OF-SELECTION.
    form initialize.
      clear:   r_loekz.
      refresh: r_loekz.
    *--- Deleted PO's only
      if p_del = 'X'.
        r_loekz-sign   = 'I'.
        r_loekz-option = 'EQ'.
        r_loekz-low    = 'L'.
        append r_loekz.
      endif.
    *--- UnDeleted PO's only
      if p_undel = 'X'.
        r_loekz-sign   = 'E'.
        r_loekz-option = 'EQ'.
        r_loekz-low    = ' '.
        append r_loekz.
      endif.
    endform.                    "initialize
    *&      Form  f000_initialize_mov_type
    *       Desc : Initialization of movement types
    form f000_initialize_mov_type  changing p_r_movtype like r_movtype[].
      data : lwa_movtype like line of p_r_movtype.
      lwa_movtype-sign = 'I'.
      lwa_movtype-option = 'EQ'.
      lwa_movtype-low = '101'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '102'.
      append lwa_movtype to p_r_movtype.
    * Additional changes done for other movement types--> by deepak
      lwa_movtype-low = '103'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '104'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '105'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '106'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '122'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '123'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '161'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '162'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '201'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '202'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '261'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '262'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '301'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '302'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '303'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '304'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '305'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '306'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '309'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '310'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '331'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '332'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '333'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '334'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '335'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '336'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '511'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '512'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '531'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '532'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '541'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '542'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '561'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '562'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '601'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '602'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '641'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '642'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '643'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '644'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '701'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '702'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '909'.
      append lwa_movtype to p_r_movtype.
      lwa_movtype-low = '910'.
      append lwa_movtype to p_r_movtype.
    endform.                    " f000_initialize_mov_type
    *&      Form  f001_determine_fiscal_period
    *       Desc  Determination of fiscal period
    form f001_determine_fiscal_period .
      clear : w_monat,
              w_gjahr,
              w_date,
              w_buper,
              w_year.
      w_monat = so_date-low+4(2).
      if w_monat = '01'.
        w_monat = '12'.
        w_gjahr = so_date-low+0(4).
        w_date_fiscal = w_gjahr+0(4) - 1.
        w_gjahr = w_date_fiscal.
      else.
        w_monat = w_monat - 1.
        w_gjahr = so_date-low+0(4).
      endif.
      concatenate w_gjahr w_monat '01'  into w_gjahr.
    *****Determines Fiscal yr and period
      call function 'DATE_TO_PERIOD_CONVERT'
        EXPORTING
          i_date  = w_gjahr
          i_periv = 'V3'
        IMPORTING
          e_buper = w_buper
          e_gjahr = w_year.
      if sy-subrc <> 0.
      endif.
      w_datum = w_buper+1(2).
    **Month text
      select single ltx from t247 into t247-ltx
             where spras = 'E'
             and   mnr   = so_date-low+4(2).
    endform.                    " f001_determine_fiscal_period
    *&      Form  f001_determine_closing_stock
    *       Desc : Determination of closing stock
    form f002_determine_closing_stock
                       changing p_it_stockclose like it_stockclose[].
      data : lw_recs type i,
             w_dval like mseg-menge,
             w_opbal like mseg-menge.
      data : begin of lit_stockclose occurs 0,
             lfgja like mardh-lfgja,   "Fiscal yr
             lfmon like mardh-lfmon,   "Period
             werks like s031-werks,   "Plant
             matnr like mara-matnr,   "Material
             lgort like mseg-lgort,   "Storage Loc
             labst like mardh-labst,  "Unrestricted Stock
           end of lit_stockclose.
      data : begin of lit_mard occurs 0,
             matnr like mara-matnr,
             werks like mseg-werks,
             lgort like mseg-lgort,
             end of lit_mard.
      data : lwa_stockclose like line of p_it_stockclose.
      select matnr werks lgort from mard
      into corresponding fields of table lit_mard
      where matnr in so_matnr
      and werks in so_werks.
      refresh it_stockclose.
      clear   it_stockclose.
    *****Fetch Closing stock
    *If the entry is found in MARD then consider the same
    *else fetch the closing stock from MARDH.
      loop at lit_mard.
        refresh lit_stockclose.
        clear   lit_stockclose.
        select werks matnr lgort labst
              insme speme einme retme
              lfgja lfmon
               into corresponding fields of
                table lit_stockclose
               from mard
        where   lfmon = w_datum
        and     lfgja = w_year
        and     werks = lit_mard-werks
        and     matnr = lit_mard-matnr
        and     lgort = lit_mard-lgort.
        clear lw_recs.
        describe table lit_stockclose lines lw_recs.
    *If no entry in MARD fetch from MARDH.
        if lw_recs = 0.
          select werks matnr lgort labst
                insme speme einme retme
                lfgja lfmon
                 into corresponding fields of
                table lit_stockclose
                from mardh
         where   lfmon = w_datum
         and     lfgja = w_year
         and     werks = lit_mard-werks
         and     matnr = lit_mard-matnr
         and     lgort = lit_mard-lgort.
        endif.
        sort lit_stockclose by lfgja lfmon descending.
        read table lit_stockclose index 1.
        if sy-subrc eq 0.
          move-corresponding lit_stockclose to lwa_stockclose.
          append  lwa_stockclose to p_it_stockclose.
          clear  lwa_stockclose.
        endif.
      endloop.
    endform.                    " f001_determine_closing_stock
    *&      Form   f003_change_closing_stock
    *       Desc : Selection of the mat docs for the intermediate
    *              days if the selection begin date is not from
    *              first date of the corresponding month.
    form f003_change_closing_stock changing
                                       p_it_stockclose like it_stockclose[].
      data : lwa_stockclose like line of p_it_stockclose[].
      refresh : r_date,
                it_docs,
                it_finalstock.
      clear : r_date,
              lwa_stockclose.
      r_date-sign = 'I'.
      r_date-option = 'BT'.
      concatenate so_date-low+0(4)
                  so_date-low+4(2)
                  '01'
                  into r_date-low.
      r_date-high = so_date-low - 1.
      append r_date.
      clear r_date.
    read table r_loekz index 1.
      select mkpf~budat
             mseg~matnr
             mseg~bwart
             mseg~menge
             mseg~werks
             mseg~shkzg
             mseg~lgort
             makt~maktx
             into corresponding
             fields of
             table it_docs
             from mkpf as mkpf inner join mseg as mseg
             on mkpf~mandt = mseg~mandt and
                mkpf~mblnr = mseg~mblnr and
                mkpf~mjahr = mseg~mjahr
             inner join makt as makt
               on mseg~matnr = makt~matnr
             where
                mseg~werks IN SO_WERKS and
                mseg~matnr in so_matnr and
                mkpf~budat in r_date and
                mseg~bwart in r_movtype.
      Clear it_docs.
      loop at it_docs.
        if it_docs-shkzg = 'H'.
          it_docs-menge = - ( it_docs-menge ).
          modify it_docs.
        endif.
        move-corresponding it_docs to it_finalstock.
        collect it_finalstock.
        clear   it_finalstock.
        move it_docs-maktx to it_head-maktx.
      endloop.
      loop at p_it_stockclose into lwa_stockclose.
        read table it_finalstock with key
                           matnr = lwa_stockclose-matnr
                           werks = lwa_stockclose-werks
                           lgort = lwa_stockclose-lgort.
        if sy-subrc eq 0.
          lwa_stockclose-labst = lwa_stockclose-labst +
                                 it_finalstock-menge.
          modify p_it_stockclose from lwa_stockclose.
          read table p_it_stockclose into lwa_stockclose index 1.
          "with key matnr = wa_head-matnr.
          "budat = wa_head-p_date.
          if sy-subrc = 0.
            w_dval = lwa_stockclose-labst.
          ENDIF.
          clear lwa_stockclose.
        endif.
      endloop.
    endform.                    " f003_change_closing_stock
    *&      Form  f004_determine_mat_docs
    *       DEsc : Determination of Receipts and Issues
    form f004_determine_mat_docs  changing p_it_mkpf like it_mkpf[]
                                           p_it_mseg like it_mseg[].
      data : lwa_mkpf like line of p_it_mkpf[],
             lwa_mseg like line of p_it_mseg[],
              ls_quantity   type mseg-menge,
              sum_issue type mseg-menge,
              sum_receipt type mseg-menge,
              sum_531 type mseg-menge,
              sum_541 type mseg-menge,
              sum_101  type mseg-menge,
              sum_511  type mseg-menge,
              sum_261  type mseg-menge,
              sum_601  type mseg-menge,
              sum_201 type mseg-menge,
              sum_641 type mseg-menge,
              sum_po  type mseg-menge,
              sum_551  type mseg-menge,
              sum_331  type mseg-menge,
              sum_161  type mseg-menge,
              sum_305  type mseg-menge,
              sum_309  type mseg-menge,
              sum_701  type mseg-menge,
              sum_702  type mseg-menge.
    ***Determination of Mat Docs
      select mblnr xblnr budat mjahr cpudt from mkpf
             into corresponding fields
             of table it_mkpf
             where budat in so_date.
    ***Determination of Receipts and issues
    *  loop at p_it_mkpf into lwa_mkpf.
    *    select mblnr matnr bwart menge werks mjahr shkzg lgort
    *          from mseg into corresponding
    *          fields of lwa_mseg
    *          where mblnr = lwa_mkpf-mblnr
    *          and   mjahr = lwa_mkpf-mjahr
    *          and   werks in so_werks
    *          and   matnr in so_matnr
    *          and   bwart in r_movtype.
    *      if lwa_mseg-shkzg = 'H'.
    *        lwa_mseg-menge = - ( lwa_mseg-menge ).
    *      endif.
    *      move : lwa_mkpf-budat to lwa_mseg-budat,
    *             lwa_mkpf-xblnr to lwa_mseg-xblnr,
    *             lwa_mkpf-cpudt to lwa_mseg-cpudt.
    *      append lwa_mseg to p_it_mseg.
    *      move lwa_mseg-matnr to it_head-matnr.
    *      move lwa_mseg-budat to it_head-p_date.
    *      move lwa_mseg-bwart to it_head-bwart.
    *      append it_head.
    *      clear it_head.
    *      clear lwa_mseg.
    *    endselect.
    *  endloop.
      sort it_mkpf by budat cpudt .
      loop at it_mkpf.
        at new budat.
          if w_opbal = SPACE.
            it_head-openbal = w_dval.
            w_chk = 1.
          else.
            it_head-openbal = w_opbal.
            w_chk = 2.
          endif.
        endat.
        if w_chk = 1.
          it_head-openbal = w_dval.
        elseif w_chk = 2.
          it_head-openbal = w_opbal.
        endif.
        select  Single *
              from mseg
              where mblnr = it_mkpf-mblnr
              and   mjahr = it_mkpf-mjahr
              and   werks in so_werks
              and   matnr in so_matnr
              and   bwart in r_movtype.
        if mseg-matnr ne SPACE.
          move mseg-mblnr to it_mseg-xblnr.
          move mseg-matnr to it_mseg-matnr.
          move mseg-bwart to IT_mseg-bwart.
          move mseg-menge to it_mseg-menge.
          move mseg-werks to it_mseg-werks.
          move mseg-mjahr to it_mseg-mjahr.
          move mseg-shkzg to it_mseg-shkzg.
          move mseg-lgort to it_mseg-lgort.
          if it_mseg-shkzg = 'H'.
            it_mseg-menge = - ( lwa_mseg-menge ).
          endif.
          move : it_mkpf-budat to it_mseg-budat,
                 it_mkpf-xblnr to it_mseg-xblnr,
                 it_mkpf-cpudt to it_mseg-cpudt.
    *      append lwa_mseg to p_it_mseg.
          append it_mseg.
    *  it_head-R_PO = it_head-r_po + ls_quantity.
          if ( it_mseg-bwart eq '101'
             or   it_mseg-bwart eq '102'
             or   it_mseg-bwart eq '103'
             or   it_mseg-bwart eq '104'
             or   it_mseg-bwart eq '105'
             or  it_mseg-bwart eq '106'
             or  it_mseg-bwart eq '161'
             or  it_mseg-bwart eq '162'
             or  it_mseg-bwart eq '122'
             or  it_mseg-bwart eq '123'
             or  it_mseg-bwart eq '511'
             or  it_mseg-bwart eq '512'
             or  it_mseg-bwart eq '531'
             or  it_mseg-bwart eq '532'
             or  it_mseg-bwart eq '561'
             or  it_mseg-bwart eq '562'
             or  it_mseg-bwart eq '305'
             or  it_mseg-bwart eq '306'
             or  it_mseg-bwart eq '702') and it_mseg-shkzg = 'S'.
            move it_mseg-menge to ls_quantity.
            sum_receipt = sum_receipt + ls_quantity.
          elseif
           ( it_mseg-bwart eq '261'
             or   it_mseg-bwart eq '262'
             or   it_mseg-bwart eq '601'
             or   it_mseg-bwart eq '602'
             or   it_mseg-bwart eq '201'
             or  it_mseg-bwart eq '202'
             or  it_mseg-bwart eq '551'
             or  it_mseg-bwart eq '552'
             or  it_mseg-bwart eq '541'
             or  it_mseg-bwart eq '542'
             or  it_mseg-bwart eq '331'
             or  it_mseg-bwart eq '332'
             or  it_mseg-bwart eq '333'
             or  it_mseg-bwart eq '334'
             or  it_mseg-bwart eq '335'
             or  it_mseg-bwart eq '336'
             or  it_mseg-bwart eq '641'
             or  it_mseg-bwart eq '642'
             or  it_mseg-bwart eq '643'
             or  it_mseg-bwart eq '644'
             or  it_mseg-bwart eq '351'
             or  it_mseg-bwart eq '352'
             or  it_mseg-bwart eq '301'
             or  it_mseg-bwart eq '302'
             or  it_mseg-bwart eq '303'
             or  it_mseg-bwart eq '304'
             or  it_mseg-bwart eq '309'
             or  it_mseg-bwart eq '310'
             or  it_mseg-bwart eq '909'
             or  it_mseg-bwart eq '910'
             or  it_mseg-bwart eq '701')  and it_mseg-shkzg = 'S'.
             move it_mseg-menge to ls_quantity.
            sum_issue = sum_issue + ls_quantity.
          endif.
        if ( it_mseg-bwart eq '101' or it_mseg-bwart eq '102'
            or it_mseg-bwart eq '103' or it_mseg-bwart eq '104'
            or it_mseg-bwart eq '105' or it_mseg-bwart eq '106')
            And it_mseg-shkzg = 'S'.
            move it_mseg-menge to ls_quantity.
            sum_po = sum_po + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '531'
             or it_mseg-bwart eq '532') and it_mseg-shkzg = 'S'.
            move it_mseg-menge to ls_quantity.
            sum_531 = sum_531 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '541' or it_mseg-bwart eq '542' ).
            move it_mseg-menge to ls_quantity.
            sum_541 = sum_541 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '102' or it_mseg-bwart eq '102' ).
            move it_mseg-menge to ls_quantity.
            sum_101 = sum_101 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '561' or it_mseg-bwart eq '562'
              OR IT_MSEG-BWART EQ '511' OR it_mseg-bwart eq '512').
            move it_mseg-menge to ls_quantity.
            sum_511 = sum_511 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '261' or it_mseg-bwart eq '262').
            move it_mseg-menge to ls_quantity.
            sum_261 = sum_261 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '601' or it_mseg-bwart eq '602').
            move it_mseg-menge to ls_quantity.
            sum_601 = sum_601 + ls_quantity.
          endif.
          if ( it_mseg-bwart eq '201' or it_mseg-bwart eq '202').
            move it_mseg-menge to ls_quantity.
            sum_201 = sum_201 + ls_quantity.
          endif.
        if ( it_mseg-bwart eq '551' or it_mseg-bwart eq '552').
            move it_mseg-menge to ls_quantity.
            sum_551 = sum_551 + ls_quantity.
          endif.
        if ( it_mseg-bwart eq '331' or it_mseg-bwart eq '332'
              or it_mseg-bwart eq '333' or it_mseg-bwart eq '334'
              or it_mseg-bwart eq '335' or it_mseg-bwart eq '336').
            move it_mseg-menge to ls_quantity.
            sum_331 = sum_331 + ls_quantity.
          endif.
        if ( it_mseg-bwart eq '161' or it_mseg-bwart eq '162'
              or it_mseg-bwart eq '123' or it_mseg-bwart eq '122').
            move it_mseg-menge to ls_quantity.
            sum_161 = sum_161 + ls_quantity.
          endif.
        if ( it_mseg-bwart eq '641' or it_mseg-bwart eq '642'
              or it_mseg-bwart eq '643' or it_mseg-bwart eq '644'
              or it_mseg-bwart eq '351' or it_mseg-bwart eq '352'
              or it_mseg-bwart eq '301' or it_mseg-bwart eq '302'
              or it_mseg-bwart eq '303' or it_mseg-bwart eq '304').
            move it_mseg-menge to ls_quantity.
            sum_641 = sum_641 + ls_quantity.
          endif.
      if ( it_mseg-bwart eq '305' or it_mseg-bwart eq '306').
            move it_mseg-menge to ls_quantity.
            sum_305 = sum_305 + ls_quantity.
          endif.
      if ( it_mseg-bwart eq '309' or it_mseg-bwart eq '310'
         or it_mseg-bwart eq '909' or it_mseg-bwart eq '910').
            move it_mseg-menge to ls_quantity.
            sum_309 = sum_309 + ls_quantity.
          endif.
    if ( it_mseg-bwart eq '701').
            move it_mseg-menge to ls_quantity.
            sum_701 = sum_701 + ls_quantity.
          endif.
    if ( it_mseg-bwart eq '702').
            move it_mseg-menge to ls_quantity.
            sum_702 = sum_702 + ls_quantity.
          endif.
          at end of budat.
        it_head-closing_bal = ( it_head-openbal + sum_receipt ) - sum_issue.
            w_opbal = it_head-closing_bal.
            move it_mseg-matnr to it_head-matnr.
            move it_mseg-budat to it_head-p_date.
            move it_mseg-bwart to it_head-bwart.
            move sum_po  to it_head-R_po.
            move sum_101  to it_head-R_ProdOrd.
            move sum_531 to it_head-R_ByProd.
            move sum_511  to it_head-R_OTHERS.
            move sum_receipt to it_head-r_total.
            move sum_261  to it_head-I_Prod.
            move sum_601  to it_head-I_cust.
            move sum_201  to it_head-I_CostCen.
            move sum_551  to it_head-I_Scrapping.
            move sum_541 to it_head-I_subcontractor.
            move sum_331  to it_head-I_Sampling.
            move sum_issue   to it_head-i_total.
            move sum_161  to it_head-PurRet.
            move sum_641  to it_head-stock_out.
            move sum_305  to it_head-stock_in.
            move sum_309  to it_head-M_to_M_transit.
            move sum_701  to it_head-phy_loss.
            move sum_702  to it_head-phy_gain.
            append it_head.
            w_chk = 0.
            sum_issue = 0.
            sum_receipt = 0.
            sum_531 = 0.
            sum_541 = 0.
            sum_101 = 0.
            SUM_511 = 0.
            sum_261 = 0.
            sum_601 = 0.
            sum_201 = 0.
            sum_po = 0.
            sum_551 = 0.
            sum_641 = 0.
            sum_701 = 0.
            sum_702 = 0.
          endat.
          clear it_head.
          clear it_mseg.
        endif.
    endloop.
      sort it_mseg by matnr budat bwart.
      sort it_head by matnr p_date bwart.
      delete ADJACENT duplicates from it_head.
    endform.                    " f004_determine_mat_docs
    *&      Form  f005_receipts_issues
    *       Desc
    form f005_receipts_issues  using    p_it_mseg  like it_mseg[]
                               changing p_it_issue like it_issue[]
                                        p_it_receipt like it_receipt[]
                                        p_it_matnr like it_matnr[].
      data : lwa_mseg like line of p_it_mseg[],
             lwa_issue like line of p_it_issue[],
             lwa_receipt like line of p_it_receipt[],
             lwa_matnr like line of p_it_matnr[],
             ls_quantity   type mseg-menge,
             wa_head type ty_head,
             lwa_stockclose like line of it_stockclose[].
    *  sort it_head by bwart p_date matnr.
    *  loop at it_head into wa_head.
    *    read table p_it_mseg into lwa_mseg with key bwart = wa_head-bwart.
    *    if sy-subrc = 0.
    *      if ( lwa_mseg-bwart eq '101'
    *          or   lwa_mseg-bwart eq '102'
    *          or   lwa_mseg-bwart eq '103'
    *          or   lwa_mseg-bwart eq '104'
    *          or   lwa_mseg-bwart eq '105'
    *          or  lwa_mseg-bwart eq '106') and lwa_mseg-shkzg = 'S'.
    *        loop at p_it_mseg into lwa_mseg where matnr = wa_head-matnr
    *                                        and   budat = wa_head-p_date
    *                                        and   bwart = wa_head-bwart.
    *          move lwa_mseg-menge to ls_quantity.
    *          wa_head-R_PO = ls_quantity + wa_head-R_PO.
    *          modify it_head from wa_head.
    *        endloop.
    *        clear ls_quantity .
    *      endif.
    *      if ( lwa_mseg-bwart eq '641'
    *       and lwa_mseg-shkzg = 'S' ).
    *        loop at p_it_mseg into lwa_mseg where matnr = wa_head-matnr
    *                                        and   budat = wa_head-p_date
    *                                        and   bwart = wa_head-bwart.
    *          IF SY-SUBRC = 0 .
    *            move lwa_mseg-menge to ls_quantity.
    *            wa_head-stock_out = ls_quantity + wa_head-stock_out.
    *            modify it_head from wa_head.
    *          ENDIF.
    *        endloop.
    *        clear ls_quantity .
    *      endif.
    *      read table it_stockclose into lwa_stockclose
    *         with key matnr = wa_head-matnr.
    *                  "budat = wa_head-p_date.
    *      if sy-subrc = 0.
    *        wa_head-openbal = lwa_stockclose-labst.
    *        modify it_head from wa_head.
    *      ENDIF.
    *    endif.
    *  endloop.
    *  sort it_head by bwart p_date matnr.
    *  loop at it_head into wa_head.
    *    read table it_mseg into lwa_mseg with key bwart = wa_head-bwart.
    *    if sy-subrc = 0.
    *      if ( lwa_mseg-bwart eq '101'
    *          or   lwa_mseg-bwart eq '102'
    *          or   lwa_mseg-bwart eq '103'
    *          or   lwa_mseg-bwart eq '104'
    *          or   lwa_mseg-bwart eq '105'
    *          or  lwa_mseg-bwart eq '106') and lwa_mseg-shkzg = 'S'.
    *        loop at it_mseg into lwa_mseg where matnr = wa_head-matnr
    *                                        and   budat = wa_head-p_date
    *                                        and   bwart = wa_head-bwart.
    *          move lwa_mseg-menge to ls_quantity.
    *          wa_head-R_PO = ls_quantity + wa_head-R_PO.
    *          modify it_head from wa_head.
    *        endloop.
    *        clear ls_quantity .
    *      endif.
    *      if ( lwa_mseg-bwart eq '641'
    *       and lwa_mseg-shkzg = 'S' ).
    *        loop at it_mseg into lwa_mseg where matnr = wa_head-matnr
    *                                        and   budat = wa_head-p_date
    *                                        and   bwart = wa_head-bwart.
    *          IF SY-SUBRC = 0 .
    *            move lwa_mseg-menge to ls_quantity.
    *            wa_head-stock_out = ls_quantity + wa_head-stock_out.
    *            modify it_head from wa_head.
    *          ENDIF.
    *        endloop.
    *        clear ls_quantity .
    *      endif.
    *      read table it_stockclose into lwa_stockclose
    *         with key matnr = wa_head-matnr.
    *                  "budat = wa_head-p_date.
    *      if sy-subrc = 0.
    *        wa_head-openbal = lwa_stockclose-labst.
    *        modify it_head from wa_head.
    *      ENDIF.
    *    endif.
    *  endloop.
    endform.                    " f005_receipts_issues
    *&      Form  COMMENT_BUILD
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM comment_build USING p_it_st_list_top_of_page TYPE slis_t_listheader
      DATA: ls_line TYPE slis_listheader.
      REFRESH p_it_st_list_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info  = 'Details of Stock Ledger'.
      APPEND ls_line TO p_it_st_list_top_of_page.
    ENDFORM.                    " COMMENT_BUILD
    *&      Form  TOP_OF_PAGE-ALV
    *       text
    FORM top_of_page-alv.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_st_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE-ALV
    *&      Form  FIELDCAT
    *      -->P_IT_ST_FIELDCAT[]  text
    FORM fieldcat  USING p_it_st_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname  = 'P_DATE'.
      ls_fieldcat-datatype   = 'P_DATE'.
      ls_fieldcat-outputlen  = 18.
      ls_fieldcat-seltext_m  = text-002 .
    *  ls_fieldcat-rollname   = 'MATNR'.
      ls_fieldcat-key         = 'X'.
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MATNR'.
      ls_fieldcat-rollname    = 'MATNR'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-outputlen  = 18.
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MAKTX'.
      ls_fieldcat-rollname    = 'MAKTX'.
      ls_fieldcat-ddictxt     = 'L'.
        ls_fieldcat-outputlen  = 40.
      APPEND ls_fieldcat TO p_it_st_fieldcat.
    *  CLEAR ls_fieldcat.
    *  ls_fieldcat-fieldname   = 'BWART'.
    *  ls_fieldcat-rollname    = 'BWART'.
    *  ls_fieldcat-ddictxt     = 'L'.
    *  APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'OPENBAL'.
      ls_fieldcat-rollname    = 'OPENBAL'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-003 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'R_PO'.
      ls_fieldcat-rollname    = 'R_PO'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-004 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'R_PRODORD'.
      ls_fieldcat-rollname    = 'R_PRODORD'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-005 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'R_BYPROD'.
      ls_fieldcat-rollname    = 'R_BYPROD'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-006 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'R_OTHERS'.
      ls_fieldcat-rollname    = 'R_OTHERS'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-007 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'R_TOTAL'.
      ls_fieldcat-rollname    = 'R_TOTAL'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-008 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_PROD'.
      ls_fieldcat-rollname    = 'I_PROD'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-009 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_CUST'.
      ls_fieldcat-rollname    = 'I_CUST'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-010 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_COSTCEN'.
      ls_fieldcat-rollname    = 'I_COSTCEN'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-011 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_SCRAPPING'.
      ls_fieldcat-rollname    = 'I_SCRAPPING'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-012 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_SUBCONTRACTOR'.
      ls_fieldcat-rollname    = 'I_SUBCONTRACTOR'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-013 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_SAMPLING'.
      ls_fieldcat-rollname    = 'I_SAMPLING'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-014 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'I_TOTAL'.
      ls_fieldcat-rollname    = 'I_TOTAL'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-015 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'PURRET'.
      ls_fieldcat-rollname    = 'PURRET'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-016 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'STOCK_OUT'.
      ls_fieldcat-rollname    = 'STOCK_OUT'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-017 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'STOCK_IN'.
      ls_fieldcat-rollname    = 'STOCK_IN'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-018 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'STOCK_TRANSIT'.
      ls_fieldcat-rollname    = 'STOCK_TRANSIT'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-019 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'M_TO_M_TRANSIT'.
      ls_fieldcat-rollname    = 'M_TO_M_TRANSIT'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-020 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'PHY_LOSS'.
      ls_fieldcat-rollname    = 'PHY_LOSS'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-021 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'PHY_GAIN'.
      ls_fieldcat-rollname    = 'PHY_GAIN'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-022 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'CLOSING_BAL'.
      ls_fieldcat-rollname    = 'CLOSING_BAL'.
      ls_fieldcat-ddictxt     = 'L'.
      ls_fieldcat-seltext_m  = text-023 .
      APPEND ls_fieldcat TO p_it_st_fieldcat.
    ENDFORM.                    " FIELDCAT
    *&      Form  LAYOUT_BUILD
    *       text
    *      -->P_ST_LAYOUT  text
    FORM layout_build  USING    p_st_layout TYPE slis_layout_alv.
      p_st_layout-box_fieldname       = 'SELK'.  " Checkbox
      p_st_layout-get_selinfos        = 'X'.
      p_st_layout-f2code              =  'PICK' .  " Doppelklickfunktion
      p_st_layout-confirmation_prompt = 'X'.       "Sicherheitsabfrage
      p_st_layout-key_hotspot         = 'X'.       "Schlüssel als Hotspot
      p_st_layout-info_fieldname      = 'COL'.     "Zeilenfarbe
    ENDFORM.                    " LAYOUT_BUILD
    *&      Form  REUSE_ALV_LIST_DISPLAY
    *       text
    FORM reuse_alv_list_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                 i_background_id          = 'ALV_BACKGROUND'
                 i_callback_program       = s_repid
    *            I_CALLBACK_PF_STATUS_SET = S_STATUS
    *            I_CALLBACK_USER_COMMAND     = S_USER_COMMAND
    *            I_STRUCTURE_NAME         = ''
    *            IS_LAYOUT                = ST_LAYOUT
                 it_fieldcat              = it_st_fieldcat[]
    *            IT_EXCLUDING             =
    *            IT_SPECIAL_GROUPS        = ST_SP_GROUP
    *            IT_SORT                  =
    *            IT_FILTER                =
    *            IS_SEL_HIDE              =
    *            I_DEFAULT                = 'X'
    *            I_SAVE                   = S_SAVE
    *            IS_VARIANT               = S_VARIANT
                IT_EVENTS                = IT_ST_EVENTS[]
    *            IT_EVENT_EXIT            =
    *            IS_PRINT                 =
    *            IS_REPREP_ID             =
    *            I_SCREEN_START_COLUMN    = 0
    *            I_SCREEN_START_LINE      = 0
    *            I_SCREEN_END_COLUMN      = 0
    *            I_SCREEN_END_LINE        = 0
    *     IMPORTING
    *           E_EXIT_CAUSED_BY_CALLER   =
    *           ES_EXIT_CAUSED_BY_USER    =
           TABLES
                t_outtab                  =  it_head.
    ENDFORM.                    " REUSE_ALV_LIST_DISPLAY
    *&      Form  EVENTTAB_BUILD
    *       text
    *      -->P_IT_ST_EVENTS[]  text
    FORM eventtab_build  USING    p_st_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   = p_st_events.
      READ TABLE p_st_events WITH KEY name = slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE st_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_st_events.
      ENDIF.
      READ TABLE p_st_events WITH KEY name = slis_ev_user_command
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE s_user_command TO ls_event-form.
        APPEND ls_event TO p_st_events.
      ENDIF.
    *  READ TABLE p_st_events WITH KEY name = slis_ev_pf_status_set
    *                         INTO ls_event.
    *  IF sy-subrc = 0.
    *    MOVE s_status TO ls_event-form.
    *    APPEND ls_event TO p_st_events.
    *  ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  VARIANT_INIT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM variant_init .
      CLEAR s_variant.
      s_variant-report = s_repid.
      s_variant-handle = code.
    ENDFORM.                    " VARIANT_INIT

  • Document type KR is not picking to Clear GL account with T-code F-03

    Hi all,
    My client wants to clear GL account Cash-in-Transit which is open item managed. He has posted two items. One is with KR document type like Intercompnay adjustment account debit (40) and Cash-in-Transit account credit (50). Second item is with SA document type like Cash-in-Transit accont debit (40) and Intercompany adjustment account credit (50). He did not give vendor number and appropriate posting key (31) while postings. With document type KR, he posted with posting keys 40 and 50. Now while clearing the GL account through T-code F-03, system is picking only SA document type. The system is not picking document type KR. He wants to clear the items with each other. I have checked the document type settings. Check boxes Intercompany postings and trading partner are active in both above document types.
    How can the GL account be cleared ? Are any configuration settings missing ? Kindly advice as soon as possible.
    Thanks in advance.
    Regards,
    K.S.K

    Hi,
    First of all..why would system need a Exchange gain/Loss Account..If your local currency is INR and you posted a debit and a credit document both in INR..then there is no question of a foreign exchange gain/loss account..
    BUT, if you have posted the document in any currency other than INR, ie: your local currency...then the system would need a exchnage gain/loss account when you try to clear the debits and credits.. i am giving an example below to explain better..
    You posted a debit of 100 USD @ 40 = Rs. 4000.00
    You posted a Credit of 100 USD @ 42 = Rs. 4200.00
    Now, if you clear this debit and credit then there is no difference in 100 USD, as the debit and credit is netting off.. but if you see INR there is a difference of Rs. 200.00 which system posts to Exchange gain/loss account..which we maintain in OB09.
    Hope it is clear to you now..
    Regards,
    SAPFICO.

  • Stock variance report Crashes with error code REP-56048

    SR : 6990718.992
    gtcr : http://qmon.oraclecorp.com/qmon3/quickpicks.pl?t=t&q=6990718.992
    Problem Statement : When the user is trying to generate report for Stock variance report from Oracle Retail Merchandising System the report crashes with error code REP-56048.
    The steps to reproduce are specific to Oracle Retail Merchandising system application and hence I have not mentioned here.
    The REP-56048 error seems to be generic. Could you please advise me on this issue.
    Thanks & Regards,
    Sameer

    You can review the following Oracle Metalink Document;
    Comprehensive REP-56048 Troubleshooting and Overview Guide: Doc ID: Note:285281.1
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:88153902823984055::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,285281.1,1,1,1,helvetica
    Hope it would be useful.
    Adith

  • How to create 2 transaction codes for same report program with diff title

    Hi All -
      I have created report program and create 2 transaction codes with different short description. I want to display the Tcodes decriptions instead of program attributes title.
    Can anyone pls tell me how to do this?
    Thanks,
    Kannan

    Hi Kannan,
    define 2 titlebars t1 and t2 for the report. In report initialization,
    IF sy-tcode = 't1'
      SET TITLE t1.
    ELSE.
      SET TITLE t2.
    ENDIF.
    Regards,
    Clemens

  • GR IR Clearing Report Items still appear

    Hi Experts,
    I have problems with GR IR Clearing Report FAGL003/FBL1N. There are still items in my GL in report FAGL003 that are not cleared even GR-Invoice are already done. What are the scenarios that caused this?
    Thanks a lot!

    Have you done GR / IR clearing using the T code F.13 or F.19 .
    As generally it has to be done on a periodic basis for clearing the GR/IR balances i.e knocking off GR/IR amount at the time of GR with the GR/IR amount at the time of invoice .
    First run the clearing run and then check for the balances that are left out , it may be the case like GR is prepared and IR is not done then in that case your GR / IR account will have the balance .
    Cheers ,
    Dewang

  • Need sample code with RV_INVOICE_CREATE used

    Hi everybody!
    I need sample code with RV_INVOICE_CREATE or similar FMs used.
    The thing is that I do not know how to populate parametres of this and other invoicing FMs....
    For example, there are some tables to be passed to RV_INVOICE_CREATE
         TABLES
              XKOMFK     = XKOMFK
              XKOMV       = XKOMV
              XTHEAD      = XTHEAD
              XVBFS        = XVBFS
              XVBPA        = XVBPA
              XVBRK        = XVBRK
              XVBRP        = XVBRP
              XVBSS        = XVBSS
    How to populate them? I mean how to fill them with needed values?
    Useful answers will be awarded.
    Kind regards, M.

    RV_INVOICE_CREATE is the function module to create invoice based on delivery .
    when you pass delivery number ,it will create invoice ,see the invoice number in vf02,vf03 transaction. and also see the data vbrk,vbrp tables
    I have done this development and i have cancelled invoice,reverse goods issue,updated the delivery and again i am createing invoice..see the below progrm to get better understanding.
    REPORT ZWM_OVERWEIGHT_FIX  no standard page heading
                               message-id zwm.
    ======================================================================
    Program Name : ZWM_OVERWEIGHT_FIX                                    *
    Description  : Tool to fix Overweight in delivery line item,         *
                   Used All Function module to cancel invoice ,          *
                   Reverse the goods issue  ,Update Delivery qty,Create  *
                   invoice                                               *
    Author       : Seshu                                                 *
    Date         : 05/08/2007                                            *
    MODIFICATION HISTORY                                                 *
    DATE    | AUTHOR   | CHANGE #   | DESCRIPTION OF MODIFICATION        *
    --|||--
    05/08/07| Seshu    | DEVK921979 | Initial                            *
    D A T A - D E C L A R A T I O N     *******************
    Tables
    Tables : vbak,
             vbap,
             vbfa,
             likp,
             lips,
             vbrk,
             vbrp.
    Internal Tables
    data : i_lips like lips occurs 0 with header line,
           i_vbap like vbap occurs 0 with header line.
    Variables
    data : v_deliv like vbfa-vbelv,
           v_invoic like vbfa-vbelv.
    Data Declaration Part for Post Goods Issue
    DATA: l_vbeln LIKE likp-vbeln,
          l_vbkok LIKE vbkok,
          i_prot LIKE prott OCCURS 0 WITH HEADER LINE,
          ef_error_any_0 TYPE c,
          ef_error_in_item_deletion_0 TYPE c,
          ef_error_in_pod_update_0 TYPE c,
          ef_error_in_interface_0 TYPE c,
          ef_error_in_goods_issue_0 TYPE c,
          ef_error_in_final_check_0 TYPE c,
          d_return   LIKE bapireturn1.
    Internal tables for BAPI Function Module
    data : i_cret like BAPIRETURN1 occurs 0 with header line,
           i_csucess like BAPIVBRKSUCcESS occurs 0 with header line,
           i_ret2 like bapiret2 ,
           flag type c,
           i_mesg like mesg occurs 0 with header line.
    Data Declaration for Invoice Creation
    DATA: VBSK_I     LIKE  VBSK.
    data: d_success  type  c.
    DATA: XKOMFK LIKE      KOMFK   OCCURS 0 WITH HEADER LINE,
          XKOMV  LIKE      KOMV    OCCURS 0 WITH HEADER LINE,
          XTHEAD LIKE      THEADVB OCCURS 0 WITH HEADER LINE,
          XVBFS  LIKE      VBFS    OCCURS 0 WITH HEADER LINE,
          XVBPA  LIKE      VBPAVB  OCCURS 0 WITH HEADER LINE,
          XVBRK  LIKE      VBRKVB  OCCURS 0 WITH HEADER LINE,
          XVBRP  LIKE      VBRPVB  OCCURS 0 WITH HEADER LINE,
          XVBSS  LIKE      VBSS    OCCURS 0 WITH HEADER LINE,
          XKOMFKGN LIKE    KOMFKGN OCCURS 0 WITH HEADER LINE.
    S E L E C T I O N  -  S C R E E N   ******************
    Selection-screen
    Selection-screen : begin of block blk with frame title text-001.
    parameters : p_vbeln like vbak-vbeln obligatory.
    selection-screen : end of block blk.
    A T -  S E L E C T I O N  - S C R E E N ***************
    Validation on Sales order
    at selection-screen on p_vbeln.
    Check the data on VBAK Table
      select single vbeln from vbak into vbak-vbeln
                                where vbeln = p_vbeln.
      if sy-subrc ne 0.
        message e006 with p_vbeln.
      endif.
    S T A R T  - O F - S E L E C T I O N *******************
    Start-of-selection.
      break sreddy.
    Get the Invoice Number corresponding Sales Order Number
      perform get_invoice.
    Step 1.
    Cancel the Invoice  - Transaction VF11
      perform cancel_invoice.
    Reverse the goods issue
      perform reverse_goodsissue.
    Get the Order and Delivery Items
      perform get_sales_deliv.
    Delivery Change
      perform Delivery_change.
    Create Invoice document
      perform invoice_create.
    E N D  -  O F -  S E L E C T I O N  *******************
    end-of-selection.
    if flag = 'X'.
    message i012 with p_vbeln.
    endif.
    *&      Form  get_invoice
          Get Invoice Number
    FORM get_invoice.
    Clear Variables
      clear : v_deliv,
              v_invoic,
              flag.
    Get the Delivery Number First
      select single vbeln from vbfa into v_deliv
                               where vbelv = p_vbeln
                               and   vbtyp_n = 'J'.
      if sy-subrc ne 0.
        message i004 with p_vbeln.
        stop.
      endif.
    Get the Invoice Number
      select single vbeln from vbfa into v_invoic
                               where vbelv = p_vbeln
                               and   vbtyp_n = 'M'.
      if sy-subrc ne 0.
        message i003 with p_vbeln.
        stop.
      endif.
    ENDFORM.                    " get_invoice
    *&      Form  cancel_invoice
          Cancel the Invoice
    FORM cancel_invoice.
      clear : i_ret2,
              i_cret,
              i_csucess.
      refresh : i_cret,
                i_csucess.
      CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
        EXPORTING
          BILLINGDOCUMENT       = v_invoic
      TESTRUN               =
      NO_COMMIT             =
      BILLINGDATE           =
        TABLES
          RETURN                = i_cret
          SUCCESS               = i_csucess
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                WAIT   = space
           IMPORTING
                RETURN = i_ret2.
    read table i_cret with key type = 'E'.
      if sy-subrc ne 0.
        message i005 with v_invoic.
        stop.
      endif.
    ENDFORM.                    " cancel_invoice
    *&      Form  reverse_goodsissue
          Reverse the goods Issue
    FORM reverse_goodsissue.
    Local Variable
      data : lv_vbtyp like likp-vbtyp.
      clear : i_mesg,
              lv_vbtyp.
      refresh : i_mesg.
      select single vbtyp from likp into lv_vbtyp
                               where vbeln = v_deliv.
      CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
        EXPORTING
          I_VBELN                         = v_deliv
          I_BUDAT                         = sy-datum
        I_COUNT                         =
        I_MBLNR                         =
        I_TCODE                         =
          I_VBTYP                         = lv_vbtyp
        TABLES
          T_MESG                          = i_mesg
       EXCEPTIONS
         ERROR_REVERSE_GOODS_ISSUE       = 1
         OTHERS                          = 2
      if sy-subrc ne 0.
        message i007 with v_deliv.
      endif.
    ENDFORM.                    " reverse_goodsissue
    *&      Form  get_sales_deliv
          Get the Sales order and Deliv Items
    FORM get_sales_deliv.
    Local Variables
      data : lv_kwmeng like vbap-kwmeng.
      clear : i_lips,
              i_vbap.
      refresh : i_lips,
                i_vbap.
    Select the data from LIPS
      select * from lips into table i_lips
                         where vbeln = v_deliv.
      if sy-subrc ne 0.
        message i008 with v_deliv.
        stop.
      endif.
      sort i_lips by vbeln posnr.
      Get the Sales order Item Data.
      select * from vbap into table i_vbap
                              where vbeln = p_vbeln.
      if sy-subrc ne 0.
        message i006 with p_vbeln.
        stop.
      endif.
      sort i_vbap by vbeln posnr.
    Compare delivery Item and Order Items
      loop at i_lips.
        clear lv_kwmeng.
        read table i_vbap with key posnr = i_lips-posnr.
        if sy-subrc eq 0.
          lv_kwmeng = i_vbap-kwmeng * 2.
          if lv_kwmeng >= i_lips-lfimg.
            i_lips-lfimg = i_vbap-kwmeng.
            modify i_lips.
          endif.
        endif.
      endloop.
    ENDFORM.                    " get_sales_deliv
    *&      Form  Delivery_change
          Delivery Update
    FORM Delivery_change.
      Clear : i_prot.
      refresh : i_prot.
    Delivery Update
      CALL FUNCTION 'LE_MOB_DELIVERY_UPDATE'
           EXPORTING
                do_commit                = 'X'
           TABLES
                t_delivery_items         = i_lips
                prot                     = i_prot
           EXCEPTIONS
                conversion_overflow      = 1
                essential_data_missing   = 2
                error                    = 3
                nothing_to_update        = 4
                lock_after_update_failed = 5
                error_in_delivery_update = 6
                OTHERS                   = 7.
      COMMIT WORK.
      IF sy-subrc <> 0.
        MESSAGE i009 with v_deliv.
      endif.
    Post Goods Issue
      CLEAR:    d_return,
                i_prot,
                l_vbeln,
                l_vbkok.
      REFRESH i_prot.
      CLEAR:  ef_error_in_item_deletion_0    ,
              ef_error_in_pod_update_0       ,
              ef_error_in_interface_0        ,
              ef_error_in_goods_issue_0      ,
              ef_error_in_final_check_0      .
    carry out goods issue
      l_vbeln          = v_deliv.
      l_vbkok-vbeln_vl = l_vbeln.
      l_vbkok-wabuc    = 'X'.
    carry out goods issue
      l_vbeln          = v_deliv.
      l_vbkok-vbeln_vl = l_vbeln.
      l_vbkok-wabuc    = 'X'.
    SET UPDATE TASK LOCAL.
      CALL FUNCTION 'WS_DELIVERY_UPDATE'
           EXPORTING
                vbkok_wa                    = l_vbkok
                synchron                    = 'X'
                no_messages_update          = ' '
                update_picking              = 'X'
                commit                      = 'X'
                delivery                    = l_vbeln
                nicht_sperren               = 'X'
                if_error_messages_send_0    = space
           IMPORTING
                ef_error_any_0              = ef_error_any_0
                ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
                ef_error_in_pod_update_0    = ef_error_in_pod_update_0
                ef_error_in_interface_0     = ef_error_in_interface_0
                ef_error_in_goods_issue_0   = ef_error_in_goods_issue_0
                ef_error_in_final_check_0   = ef_error_in_final_check_0
           TABLES
                prot                        = i_prot
           EXCEPTIONS
                error_message               = 1
                OTHERS                      = 2.
      if sy-subrc ne 0.
        message i010 with v_deliv.
      else.
        COMMIT WORK .
      endif.
    ENDFORM.                    " Delivery_change
    *&      Form  invoice_create
          Invoice Creation
    FORM invoice_create.
      refresh: XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS.
      clear  : XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS,
               VBSK_I.
      VBSK_I-SMART = 'F'.
      XKOMFK-VBELN =  v_deliv.
      XKOMFK-VBTYP = 'J'.
      APPEND XKOMFK.
      CALL FUNCTION 'RV_INVOICE_CREATE'
           EXPORTING
                VBSK_I       = VBSK_I
                WITH_POSTING = 'C'
           TABLES
                XKOMFK       = XKOMFK
                XKOMV        = XKOMV
                XTHEAD       = XTHEAD
                XVBFS        = XVBFS
                XVBPA        = XVBPA
                XVBRK        = XVBRK
                XVBRP        = XVBRP
                XVBSS        = XVBSS.
      if sy-subrc eq 0.
        COMMIT WORK.
       flag = 'X'.
      else.
      message i011 with p_vbeln.
      endif.
    ENDFORM.                    " invoice_create
    Reward Points if it is helpful
    Thanks
    Seshu

  • Sample code with more than one ResultSet in JSP

    Hi
    Can anyone give me sample JSP code using crystal reports JRC with more than one ResultSets which works, since mine always seem to be giving error .
    Thank you
    Selvi
    RCAgent5 detected an exception: Cannot modify a read-only collection.
         at com.crystaldecisions.reports.common.e.a.clear(Unknown Source)

    You can access the JRC samples from SDN in the Business Objects Portal.  The link to them can be found [here.|https://smpdl.sap-ag.de/~sapidp/012002523100006008982008E/crxi_r2_jrc_web_smpl.zip]  There is a sample called jrc_resultset_datasource that shows how to pass a result set to a report; you can use this and modify it to allow another result set to be passed in.
    As a note, if you are having issues and believe it is your code, start with the sample and take small steps when adding new functionality so that you can determine where things go wrong.

  • ALV report code dumping

    Hello gurus,
    I am trying to write a simple ALV report code. I pasted the code below.
    The program is getting dumped. I am unable to find where the error is.
    Please help me out.
    Thanks in advance.
    Regards,
    Balu
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF itab OCCURS 500,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF itab.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE  matnr in s_matnr.
    ENDSELECT.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME               = i_repid
    I_INTERNAL_TABNAME           = 'ITAB'
    I_INCLNAME                   = i_repid
    CHANGING
    CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
    INCONSISTENT_INTERFACE       = 1
    PROGRAM_ERROR                = 2
    OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM  = i_repid
    IT_FIELDCAT                    = int_fcat
    I_SAVE                         = 'A'
    TABLES
    T_OUTTAB                       = itab
    EXCEPTIONS
    PROGRAM_ERROR                  = 1
    OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE :/ 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    Edited by: Balu on Jan 3, 2008 12:27 PM

    Rich,
    my code after the suggested changes -
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF xtab,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF xtab,
              itab LIKE STANDARD TABLE OF xtab WITH HEADER LINE.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE
      matnr in s_matnr.
    ENDSELECT.
    describe TABLE itab LINES i_lines.
    *if i_lines lt 1.
    write: / 'no material found'.
    exit.
    *endif.
    *clear i_lines.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = i_repid
       I_INTERNAL_TABNAME           = 'XTAB'
       I_INCLNAME                   = i_repid
      CHANGING
        CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = i_repid
       IT_FIELDCAT                    = int_fcat
       I_SAVE                         = 'A'
      TABLES
        T_OUTTAB                       = itab
    EXCEPTIONS
       PROGRAM_ERROR                  = 1
       OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE : / 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    The dump analysis is as below. Sorry I pasted the wrong analysis before -
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_READ_SRC_LINE_TOO_LONG',
    was neither
    caught nor passed along using a RAISING clause, in the procedure
    "K_KKB_FIELDCAT_MERGE" "(FUNCTION)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    You tried to read the program "YBP_ALV1" from the database. The READ REPORT
    statement allows you to copy a program's source code into an internal
    table. The lines of source code must not be longer than the width of the
    internal table. The internal table is 72 characters wide. The source
    code line is 80 wide.
    Regards,
    Balu

  • Custom Report Layout with mutliple child tables

    I am trying to create a custom report layout (using Bi Publisher) where I have parent data (multiple jobs on a page) and several child tables for each job (JobDays and JobStops) and several child tables for JobDays (JobDayProviders, JobDayCrew). On the apex screen, I have a join on Jobs and JobDays and I am using functions to string each child row value for JobDayProviders and JobDayCrew together and putting a <br> in between so that they will format on separate lines within a cell. It works fine on the screen but when trying to print to pdf, it ignores these line breaks. I have also tried using <br></br> (saw an article that said just use HTML in bi pulisher) which puts two lines in between each value on the screen and is still ignored on the pdf.
    for example:
    Table hierarchy:
    Jobs table
    Job Stops
    Job Days
    Job Day Service Providers
    Job Day Crew
    Report Layout per job (will have mutlipe jobs to print, just printing 1 day per job):
    Jobs.col1 JobStops.row1 JobDay.col1 JobDayProviders.row1 JobDayCrew.r1
    JobStops.row2 JobDayProviders.row2 JobDayCrew.r2
    JobDayProviders.row3
    Thanks,
    Linda
    First, is there a way to get bi publisher to recognize the line breaks? If not, what is the best way to create a custom report for this scenario? I tried to create a report query with mutliple queries, but cannot determine how to link the child queries to the paren query. I have seen an example where a button is pressed to print one parent row and the id of that row is saved and referenced as a parameter in each of the queries, but if printing mutliple parents on a report, how would I link the child queries to the parent query?

    Helen,
    The best way for your case is to use a content folder and customize it whichever way you like.
    however, your question is about reports. the problem in reports is this that you have to use just one single query and the layout of the results of this query are displayed in a peculiar way.
    anyway. something similar but not exactly the same as what you wanted do is the following.
    use a query like the following: (with a union in between)
    SELECT COLUMN1,NULL , NULL ,NULL ,NULL
    FROM my_source_table
    WHERE myCriteria LIKE 'SoAndSo%'
    UNION
    SELECT NULL,COLUMN2 , COLUMN3, COLUMN4, COLUMN5
    FROM my_source_table
    WHERE myCriteria LIKE 'SoAndSo%'
    ---------- Now, have the following codes in the layout segments:
    <!--- header --->
    <table border="0" cellpadding="1" cellspacing="1" width="20%" align="center">
    <!--- body --->
    <tr align="center">
    <td><table border="0" cellpadding="1" cellspacing="0" width="30%" align="center">
    <tr align="center">
    <TH><#COLUMN1.FIELD#></TH>
    </tr>
    </table>
    </td>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN2.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN3.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN4.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN5.FIELD#></TD>
    </tr>
    <!--- footer --->
    <TR><TD></TD></TR>
    this should produce a report with a table structure (you may see the whole if you give BORDER="1" in the main table tag). Within this table, the first column of the first row should be showing top-leftmost column value once (COLUMN1 value) and then the next rows would show last four column values as a table block on the right-bottom part.
    with kind regards,
    naqvi

  • How to create reports servers with the same name in two nodes in Reports

    Greetings
    We are migrating Oracle Application Server 10g (9.0.4) to a better hardware infrastructure with high availability. We want to provide 2 new Oracle Application Server 10g (9.0.4) in High availability and we want to avoid modify the existing forms and reports code, but the code is looking for a specific reports server name when calling reports, but I couldn't create the same reports server name in the both oas machines, I could create the reports server in only one node. I want to create a reports server with the same name in both nodes but it is not possible. I know that there is a procedure to do that in 10.1,2 (Note 437228.1, How to Create Two Reports Servers With the Same Name in the Same Subnet) but I couldn't find the equivalent procedure in 9.0.4.
    Anybody kwows how to create a reports server with the same name in two nodes using 10g (9.0.4)
    Thanks
    Ramiro Ortiz.

    Hello.
    I applied the patch 4092150 on my oas 9.0.4.2 and I modified my rwnetwork.conf file changing the port to 14022 by following the note "How to Create Two Reports Servers With the Same Name in the Same Subnet? [ID 437228.1]" but I am facing the same error rep-56040 "server already exists in the network".
    When I run osfind command I get the following information (My reports server is senarep and I want to create it on SNMMBOGOAS10):
    osfind: Found 2 agents at port 14000
    HOST: SNMVBOGOAS10.sena.red
    HOST: SNMVBOGOAS09.sena.red
    osfind: There are no OADs running on in your domain.
    osfind: There are no Object Implementations registered with OADs.
    osfind: Following are the list of Implementations started manually.
    HOST: SNMVBOGOAS10.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep2
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep2
    HOST: SNMVBOGOAS09.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep
    Any Ideas?

  • Error: Reason codes with automatic charge-off are not permitted here(F-28)

    Hi All
    I creted a reason code in obxl t-code and assigned a gl code in OBXL transaction code, But when I am trying to clear a payment with reason code in F-28, System is throwing the following error..Can some one tell me why i am getting this error?
    Reason codes with automatic charge-off are not permitted here
    Message no. F5605
    Diagnosis
    The reason code entered is designed to ensure that the payment difference amount is posted to an account specially set up for this purpose.  Postings of this nature usually require additional specifications (e.g. tax code, business area). If the difference stems from a single open item, the necessary specifications can be taken from that item. In the case that led to this error message, however, the difference does not stem soley from one item, which means that this method cannot be used.
    System Response
    The reason code entered is not accepted.
    Procedure
    You can either select a different reason code, which would create a new open item for the customer or vendor OR write off the difference using the function Charge off diff.. This function either takes you into a pre-configured account assignment model or into the document overview. From here you can enter the required difference postings.

    Hi Venkata,
    It seems while entering the payment (partial payment / residual items) ... you are clearing multiple items with differences. (e.g. if the difference amount is $30, then may the difference consists of two invoices underpaid by $15 each). In this scenario, F-28 doesn't know which additional account assignment fields should be picked up ... hence the error.
    First of all, to validate that this indeed is the case, try clearing a payment with the same reason code where difference can be attributed to a single invoice. If you still get an error, then there is some other problem.
    Then, to take care of a the business scenario where the difference can indeed be due to multiple documents, select "charge off difference" option and create an entry to post the difference as necessary.
    HTH,
    Manish Patel
    Sr. SAP Solutions Consultant

  • Remove Company Code with all the Employees in it from r/3?

    Hi i have a bit unusual requirement.
    i want to know how can i Remove a Company Code with all its assigned Employees completely from a system(r/3) ?
    can this be possible at all? if yes then please also mentions what can be the side effects of this action.

    Jack,
    You will have to follow reverse engineering....
    As Sikandar Guru Mentioned.....identify all the PERNRs for mass deletion....
    Secondly I believe, that you want to Delete the Company Code.....check with Finance Folks.......If they have no issues, you can delete the co. code with TCODE EC01... but this will not delete the Relationships to Personnel area...etc.
    There may be custom Features, Reports or programs functioning based on Co. Code.......
    So, in a way....its not feasible..neither wise to attempt deletion of Co. Code....
    S_PHO_48000106 is the TCode for Mass Deletion.
    Good Luck !!!
    Kumarpal Jain.
    Edited by: Kumarpal Jain on Oct 26, 2009 3:20 PM

  • Implementing SQL Server Reporting Services with a Java EE Application

    Hi All,
    I need to find some tutorial on
    "Implementing SQL Server Reporting Services with a Java EE Application"
    for my j2EE application.
    Until now i have searched a lot of sites but have not any thing related to this topic.
    I am using apache axis along with SQL Server Report Manager for creating the sql server reports.
    I have done upto :
    Creating the webservice with the help of report manager.
    Now i want to connect it through my j2EE application and want to retrieve some data from that web service.
    I have got stuck on the following BOLD lines in my code .
    code:
    public CatalogItem[] getData(String res, String searchStr) throws RemoteException     {
                  ReportingService2005Soap port = null;
                  ReportingService2005Locator loc = new ReportingService2005Locator();
                  // Retrieve a port from the service locator
                  try {
                       port = loc.getReportingService2005Soap(new java.net.URL(res));
                  } catch (MalformedURLException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                  } catch (ServiceException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                  org.apache.axis.client.Stub stub = (org.apache.axis.client.Stub) port;
                  stub.setUsername("localhost\\Administrator");
                  stub.setPassword("servWIN@2007");
                  // Retrieve a port from the service locator
                  SearchCondition condition = new SearchCondition();
                  condition.setCondition(ConditionEnum.Contains);
                  condition.setName("Name");
                  if (searchStr != null)
                  condition.setValue(searchStr);
                  else
                  condition.setValue("");
        //           Create an array of SearchConditions which will contain our single search condition
                  SearchCondition[] conditions;
                  conditions = new SearchCondition[1];
                  conditions[0] = condition;
        //           Call the Web service with the appropriate CatalogItem[] returnedItems;
                  CatalogItem[] returnedItems = null;
                  port.findItems("foldername",BooleanOperatorEnum.Or, conditions);
                  return returnedItems;
             }i.e. while executing the findItems() method i got the following exception :
    System.Web.Services.Protocols.SoapException: The item '/reportingservices' cannot be found. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ItemNotFoundException: The item '/reportingservices' cannot be found.
    at Microsoft.ReportingServices.Library.RSService.FindItems(String folder, String operation, SearchCondition[] properties)
    at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.FindItems(String Folder, BooleanOperatorEnum BooleanOperator, SearchCondition[] Conditions, CatalogItem[]& Items)
    Any any body has any idea please help me.
    I need it urgently.
    Regards.

    The above example is mentioned in msdn virtual lab that teaches how to connect to reporting services from a j2ee application.
    I have done the same thing .. but i am not able to render the report programmatically .. if anybody knows pls let me know the solution.

  • Clear Report cache directory

    Hi,
    We are running 12.0.4 EBS version. I want to clear the reports cache directory (/apps/oracle/PROD/inst/apps/PROD_glapp/logs/ora/10.1.2/reports/cache). It has large number of PDF and XML files. How can I delete them since 'rm' command is giving error 'Argument list too long'.
    Is same process for clearing reports cache can be used to clear the concurrent cache. It also has large number of out put and log files.
    Regards,
    Farhan Ali

    For concurrent manager, you should be running the job "Purge Concurrent Request and/or Manager Data Program " as described in "Concurrent Processing - Purge Concurrent Request and/or Manager Data Program (FNDCPPUR)" [ID 104282.1]
    For Reports cache, please review "Reports Cache Directory in Oracle E-Business R12 is Growing Rapidly" [ID 859255.1] as following this note should allow the files to be controlled automatically in future
    With regards to your specific question, the issue is with the "rm" command not being able to cope with the number of files. One easy way to deal with it, is to provide a shortened list to the rm command... for example
    rm a*.pdf
    rm b*.pdf
    rm z*.pdf
    You could automate this slightly, but I would be nervous to do so without testing, and it will surely be quicker to type the rm command multiple times than to write and test a script :)
    Hope this helps
    regards
    Mike

Maybe you are looking for

  • Having strange issues with kbmap and utc/localtime

    Hello, I've been using Archlinux for a month or so, never had any problems until now. 1. Setting the keymap doesn't stick. At first I had the German keymap selected in System-Preferences-Keyboard, and at reboot it would switch back to the standard US

  • Runtime Error - DBIF_RSQL_INVALID_RSQL - Too many OPEN CURSOR

    When I try to train a Decision Tree Model via an APD process in RSANWB, I get a runtime error when my model is configured with too many parameter fields or too many leaves (with 2 leaves it works, with more it fails). By searching SAP Notes I see tha

  • Cannot choose login options in clamshell mode

    I am having problems choosing any user or option from the user list login window when my MBP is in my Hengedock.  I try to choose a user and nothing happens.  I cannot choose Restart, Sleep or Shutdown either.  If I then remove the MBP from the Henge

  • New to Mac - parrallels help

    can anyone tell me how to rightclick in parralels using a macbook pro.

  • Flash Crash/Chrome/Mountain Lion solved?

    I had been plagued with Google Chrome Flash plugin crashes after upgrding to OSX 10.8. Following Google's instructions to disable Chrome's pluging and allowing the system's plugin shared with Safari did no good. However after finding out that The Gim