How to dispaly datas from the table, base on the selection screen

hi there gurus,
im currently developing a stock aging report,
i have completed one program but it do not allow me to excutes the program althought the syntax is correct.
i would to get some ideas from you, regarding how to extract the datas from the tables?
my selction screen will be, mat number, date, and gl account.
and the out put datas are, mbew-matnr, makt-maktx, mbew-lbkum, mara_meins, mbew-salk3,and the consumptions for the past 12months and the values for it.
can u plz guide me with this,
thank you,.
this is kind of very urgent program that i need to finish , plz help me.

here is the total code the i do
REPORT  ZSTK_AGING_REP2.
*TABLES
TABLES: mseg,
        mara,
        makt,
        SKAT,
        SKA1,
        MARV,
        T001,
        T030,
        T149D,
        AM07M,
        MCMSEG,
        T001K,
        T001W,
        T134M,
        vbak,
        mbew,
mcon, rmcb0, marc, t024w,  mvke, v134w, t438a, propf, maprf, t000, t024e
, tvko.
DATA: BEGIN OF ta_material OCCURS 2,
       werks LIKE mard-werks,
       lgort LIKE mard-lgort,
       matnr LIKE mard-matnr,
       labst LIKE mard-labst,
       umlme LIKE mard-umlme,
       insme LIKE mard-insme,
       einme LIKE mard-einme,
       speme LIKE mard-speme,
       retme LIKE mard-retme,
       verpr LIKE mbew-verpr,
       maktx LIKE makt-maktx,
       meins LIKE mara-meins,
      bukrs LIKE t001-bukrs,
      konto LIKE t030-konts,
      butxt LIKE t001-butxt,
      txt50 LIKE skat-txt50,
      MABTR LIKE MCMSEG-DMBTR,
      SKBTR LIKE MCMSEG-DMBTR,
      WAERS LIKE T001-WAERS,
      WAER2 LIKE T001-WAERS,
      BWKEY LIKE MBEW-BWKEY,
      LBKUM LIKE MBEW-LBKUM,
     MEINS LIKE MARA-MEINS,
         SALK3 LIKE MBEW-SALK3,
         WAERS1 LIKE T001-WAERS,
         BUKRS1 LIKE T001-BUKRS,
         KONTO1 LIKE T030-KONTS,
        lbkum LIKE mbew-lbkum,
          erdat LIKE vbak-erdat,
      END OF ta_material.
DATA: BEGIN OF ta_mseg OCCURS 2,
        mblnr LIKE mseg-mblnr,
*->Begin of KL02+ -
        mjahr like mseg-mjahr,
        zeile like mseg-zeile,
*->End of KL02+ -
        meins LIKE mseg-meins,
        menge LIKE mseg-menge,
        werks LIKE mseg-werks,
        lgort LIKE mseg-lgort,
        matnr LIKE mseg-matnr,
        budat LIKE mkpf-budat,
        saknr LIKE SKA1-SAKNR,
      END OF ta_mseg.
single recs based on MATNR
DATA: BEGIN OF i_matnr OCCURS 0,
        werks LIKE mard-werks,
        lgort LIKE mard-lgort,
        matnr LIKE mard-matnr,
        maktx LIKE makt-maktx,
        mblnr LIKE mseg-mblnr,
        verpr LIKE mbew-verpr,
        labst LIKE mard-labst,                    "Valuated stock with
*unrestricted use
        umlme LIKE mard-umlme,                    "Stock in transfer
*(from one storage location to another)
        insme LIKE mard-insme,                    "Stock in quality
*inspection
        einme LIKE mard-einme,                    "Total Stock of All
*Restricted Batches
        speme LIKE mard-speme,                    "Blocked stock
        retme LIKE mard-retme,                    "Blocked Stock Returns
        meins LIKE mara-meins,                    "base unit
      bukrs LIKE t001-bukrs,
      konto LIKE t030-konts,
      butxt LIKE t001-butxt,
      txt50 LIKE skat-txt50,
      MABTR LIKE MCMSEG-DMBTR,
      SKBTR LIKE MCMSEG-DMBTR,
      WAERS LIKE T001-WAERS,
      WAER2 LIKE T001-WAERS,
      BWKEY LIKE MBEW-BWKEY,
      LBKUM LIKE MBEW-LBKUM,
     MEINS LIKE MARA-MEINS,
         SALK3 LIKE MBEW-SALK3,
         WAERS1 LIKE T001-WAERS,
         BUKRS1 LIKE T001-BUKRS,
         KONTO1 LIKE T030-KONTS,
        lbkum LIKE mbew-lbkum,
       END OF i_matnr.
recs based on MBLNR
DATA: BEGIN OF i_mblnr OCCURS 0,
        mblnr LIKE mseg-mblnr,
        werks LIKE mseg-werks,
        lgort LIKE mseg-lgort,
        matnr LIKE mseg-matnr,
        menge LIKE mseg-menge,
        meint LIKE mseg-meins,
        budat LIKE mkpf-budat,
     bukrs LIKE t001-bukrs,
     konts LIKE t030-konts,
     butxt LIKE t001-butxt,
     txt50 LIKE skat-txt50,
     MABTR LIKE MCMSEG-DMBTR,
     SKBTR LIKE MCMSEG-DMBTR,
     WAERS LIKE T001-WAERS,
     WAER2 LIKE T001-WAERS,
     BWKEY LIKE MBEW-BWKEY,
      LBKUM LIKE MBEW-LBKUM,
     MEINS LIKE MARA-MEINS,
         SALK3 LIKE MBEW-SALK3,
         WAERS1 LIKE T001-WAERS,
         BUKRS1 LIKE T001-BUKRS,
         KONTO1 LIKE T030-KONTS,
       END OF i_mblnr.
TYPES: BEGIN OF t_mat,
        lgort LIKE mseg-lgort,
        werks LIKE mseg-werks,
        matnr LIKE mseg-matnr,
        mblnr LIKE mseg-mblnr,
        maktx LIKE makt-maktx,
        meins LIKE mara-meins,
meng0 LIKE mbew-lbkum,
value0 LIKE mbew-salk3,
       meng0  LIKE mard-labst,                   "0 to 10 days
       value0 LIKE mseg-dmbtr,
       meng1  LIKE mard-labst,                   "11 to 30 days
       value1 LIKE mseg-dmbtr,
       meng2 LIKE mard-labst,                   "31 to 60 days
       value2 LIKE mseg-dmbtr,
       meng3 LIKE mard-labst,                   "61-90
       value3 LIKE mseg-dmbtr,
       meng4 LIKE mard-labst,                   "90 days onwards
       value4 LIKE mseg-dmbtr,
       END OF t_mat.
DATA: i_mat2 TYPE t_mat OCCURS 0 WITH HEADER LINE.
TYPES: BEGIN OF t_mat2,
        lgort LIKE mard-lgort,                    " storage location
        cnt0(5),
        cnt1(5),
        cnt2(5),
        cnt3(5),
        cnt4(5),
   meng0 LIKE mbew-lbkum,
value0 LIKE mbew-salk3,
       meng0  LIKE mard-labst,                   "0 to 10 days
       value0 LIKE mseg-dmbtr,
       meng1  LIKE mard-labst,                   "11 to 30 days
       value1 LIKE mseg-dmbtr,
       meng2 LIKE mard-labst,                   "31 to 60 days
       value2 LIKE mseg-dmbtr,
       meng3 LIKE mard-labst,                   "61-90
       value3 LIKE mseg-dmbtr,
       meng4 LIKE mard-labst,                   "90 days onwards
       value4 LIKE mseg-dmbtr,
       END OF t_mat2.
DATA: i_matsum TYPE t_mat2 OCCURS 0 WITH HEADER LINE.
DATA:  w_mengb TYPE mbew-lbkum,
       w_workqyt TYPE mbew-lbkum,
       w_index TYPE sy-tabix,
*DATA: w_mengb TYPE mard-labst,     "tmp Balance qty
     w_workqty TYPE mard-labst,   "Work qty
     w_index TYPE sy-tabix,
      w_days(5)  TYPE n,           "duration difference (days)
      w_mths(5)  TYPE n,           "duration difference (mths)
      w_dat1 TYPE sy-datum,        "date
      w_dat2 TYPE sy-datum,        "today's date
      w_detl(1) TYPE c,
      w_summ(1) TYPE c,
      w_denom TYPE i,
      w_numer TYPE i,
      w_conv TYPE i,
      w_ttlcnt TYPE i,
      w_cnt TYPE i,
      v_topofpage(1),
     w_meng LIKE mard-labst,
       w_meng LIKE mbew-lbkum,
*sapscript values
      w_title(20) TYPE c.              "Summary / Detail Report
DATA: lv_peinh LIKE mbew-peinh,  "Price Unit
      lv_verpr LIKE mbew-verpr.  "Moving Price
proram comes here
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks FOR mseg-werks,
                s_lgort FOR mseg-lgort,
                s_matnr FOR mara-matnr,
                s_saknr FOR ska1-saknr,
                S_ERDAT FOR VBAK-ERDAT.
PARAMETERS: pck_detl RADIOBUTTON GROUP rep1,
            pck_summ RADIOBUTTON GROUP rep1,
            pck_dtsm RADIOBUTTON GROUP rep1 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK blk1.
top of the page
  TOP-OF-PAGE.
  PERFORM  f_top_of_page.
  FORM f_top_of_page .
  IF v_topofpage = 'D'.
*-->Report header for detail report
    WRITE:/2 'Printed By :', sy-uname,
           80 'Stock Aging Report - Detail',
           180 'Printed on:', sy-datum, sy-timlo,
           220 'Page:', sy-pagno.
    WRITE:/,/,/.
    WRITE:/2 'Storage',
           10 'Matl ID',
           22 'Matl Description',
           61 'UOM',
           78 '<--=<QTY ON THIS DATE -->',
          78 '<-- =< 10 days -->',
          112 '<--11 to 30 days -->',
          148 '<--31 to 60 days -->',
          181 '<--61 to 90 days -->',
          216 '<-- > 90 days -->',
           /2 'Location',
           76 'Qty',
           92 'Value'.
          112 'Qty',
          128 'Value',
          148 'Qty',
          164 'Value',
          181 'Qty',
          195 'Value',
          216 'Qty',
          231 'Value'.
    WRITE:/2 sy-uline(235).
  ELSE.
*-->Report header for Summary report
    WRITE:/2 'Printed By :', sy-uname,
           80 'Stock Aging Report - Summary',
           180 'Printed on:', sy-datum, sy-timlo,
           220 'Page:', sy-pagno.
    WRITE:/,/,/.
    WRITE:/2 'Storage',
           10 'Matl ID',
           22 'Matl Description',
           61 'UOM',
           78 '<--< QTY ON THIS DATE -->',
          78 '<-- < 10 days -->',
          112 '<--11 to 30 days -->',
          148 '<--31 to 60 days -->',
          181 '<--61 to 90 days -->',
          216 '<-- > 90 days -->',
           /2 'Location',
           76 'Qty',
           92 'Value'.
          112 'Qty',
          128 'Value',
          148 'Qty',
          164 'Value',
          181 'Qty',
          195 'Value',
          216 'Qty',
          231 'Value'.
    WRITE:/2 sy-uline(235).
  ENDIF.
ENDFORM.                    " f_top_of_page
*start-of-selection
*PERFOM f_data_selection.
FORM f_data_selection.
  SELECT a~werks
         a~lgort
         a~matnr
        a~saknr
        a~lbkum
        a~erdat
        a~labst
         a~umlme
         a~insme
         a~einme
         a~speme
         a~retme
       b~verpr    "this field no long been used
         c~maktx
         d~meins
         INTO CORRESPONDING FIELDS OF TABLE ta_material
         FROM mard AS a
         INNER JOIN makt AS c ON amatnr = cmatnr
         INNER JOIN mara AS d ON amatnr = dmatnr
         WHERE a~matnr IN s_matnr
           AND a~werks IN s_werks
           AND a~lgort IN s_lgort
          AND a~saknr IN s_saknr
          AND a~erdat IN s_erdat
           AND c~spras = 'EN'.
*--> SC01 - End  of Insertion **
*-->Select material documents
  SELECT a~mblnr
        a~mjahr
        a~zeile
        a~meins
        a~menge
        a~werks
        a~lgort
        a~matnr
        b~budat
        INTO CORRESPONDING FIELDS OF TABLE ta_mseg
  FROM mseg AS a INNER JOIN mkpf AS b
  ON amblnr = bmblnr
  AND amjahr = bmjahr
  FOR ALL ENTRIES IN ta_material
  WHERE matnr = ta_material-matnr
  AND a~werks = ta_material-werks
  AND a~lgort = ta_material-lgort
  AND algort NE aumlgo
  AND a~shkzg = 'S'
  AND a~smbln EQ space
  AND a~smblp EQ space.
*--> SC03 - Start of Insertion **
If MBLNR exist in MSEG-SMBLN and this
record's SHKZG = 'H'. Remove it from the table.
This is becuase this particular record has already been reverse.
  LOOP AT ta_mseg.
    SELECT SINGLE *
             FROM mseg
            WHERE smbln = ta_mseg-mblnr
*->Begin of KL02+ -
              and SMBLP = ta_mseg-zeile.
             AND shkzg = 'H'.  "return.           " KL02-
*->End of KL02+ -
    IF sy-subrc = 0.
      DELETE ta_mseg.
    ENDIF.
  ENDLOOP.
*--> SC03 - Enf   of Insertion **
ENDFORM.                    " f_data_selection
*IMPORTANT , NEED TO CHECK LATER
FORM f_data_preparation.
*-->Append data for report details
  LOOP AT ta_material.
    DATA: ta_msegtemp LIKE ta_mseg OCCURS 2 WITH HEADER LINE.
*-->Loop at all material documents into a temp table
    REFRESH ta_msegtemp. CLEAR ta_msegtemp.
    LOOP AT ta_mseg WHERE matnr = ta_material-matnr AND
                          werks = ta_material-werks AND
                          lgort = ta_material-lgort.
      ta_msegtemp = ta_mseg. APPEND ta_msegtemp.
    ENDLOOP.
*-->Add up all the stock for the material
    CLEAR w_mengb.
    w_mengb = ta_material-labst +
                    ta_material-umlme +
                    ta_material-insme +
                    ta_material-einme +
                    ta_material-speme +
                    ta_material-retme.
    IF w_mengb IS INITIAL.
      CONTINUE.
    ENDIF.
*-->sort msegtemp by posting date
    SORT ta_msegtemp BY budat DESCENDING.
*-->get the values from the material documents into the report output
    LOOP AT ta_msegtemp.
*->Begin of KL02- -
     CALL FUNCTION 'HRCM_TIME_PERIOD_CALCULATE'
       EXPORTING
         begda               = ta_msegtemp-budat
         endda               = sy-datum
       IMPORTING
        NOYRS               =
         nomns               = w_mths
         nodys               = w_days
      EXCEPTIONS
        invalid_dates       = 1
        overflow            = 2
        OTHERS              = 3
*->End of KL02- -
*->Begin of KL02+ -
*-->Get the days difference btw two dates
      clear w_days.
      w_days = sy-datum - ta_msegtemp-budat.
*--> Include today's date into calculation
      w_days = w_days + 1.
*->End of KL02+ -
check base unit, do conversion
      IF ta_material-meins <> ta_msegtemp-meins.
        CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
          EXPORTING
            i_matnr              = ta_material-matnr
            i_in_me              = ta_msegtemp-meins
            i_out_me             = ta_material-meins
            i_menge              = ta_msegtemp-menge
          IMPORTING
            e_menge              = ta_msegtemp-menge
          EXCEPTIONS
            error_in_application = 1
            error                = 2
            OTHERS               = 3.
      ENDIF.
*--> SC01 - Start of Insertion **
      SELECT SINGLE peinh
                    verpr
               INTO (lv_peinh,
                     lv_verpr)
               FROM mbew
              WHERE matnr = ta_material-matnr
                AND bwkey = ta_material-werks.
      IF sy-subrc = 0.
        ta_material-verpr = lv_verpr.
      ENDIF.
*--> SC01 - End   of Insertion **
*-->check whether the mseg value is LE than the stock value
      IF ta_msegtemp-menge LE w_mengb.
*-->Days < 10 days
        IF w_days  LE 1 AND w_days EQ 366.
          i_mat2-meng0 = i_mat2-meng0 + ta_msegtemp-menge.
          IF NOT lv_peinh EQ 0.
            i_mat2-value0 = ( i_mat2-meng0 / lv_peinh ) *
ta_material-verpr."+SC01
          ENDIF.
**-->Days 11 - 30 days
       ELSEIF w_days >= 11 AND w_days =< 30.
         i_mat2-meng1 = i_mat2-meng1 + ta_msegtemp-menge.
         IF NOT lv_peinh EQ 0.
           i_mat2-value1 = ( i_mat2-meng1 / lv_peinh ) *
*ta_material-verpr."+SC01
         ENDIF.
**-->Days 31-60 days
       ELSEIF w_days >= 31 AND w_days =< 60.
         i_mat2-meng2 = i_mat2-meng2 + ta_msegtemp-menge.
         IF NOT lv_peinh EQ 0.
           i_mat2-value2 = ( i_mat2-meng2 / lv_peinh ) *
*ta_material-verpr."+SC01
         ENDIF.
**-->Days 61-90 days
       ELSEIF w_days >= 61 AND w_days =< 90.
         i_mat2-meng3 = i_mat2-meng3 + ta_msegtemp-menge.
         IF NOT lv_peinh EQ 0.
           i_mat2-value3 = ( i_mat2-meng3 / lv_peinh ) *
*ta_material-verpr.
         ENDIF.
**-->Days > 90 days
       ELSEIF w_days > 90.
         i_mat2-meng4 = i_mat2-meng4 + ta_msegtemp-menge.
         IF NOT lv_peinh EQ 0.
           i_mat2-value4 = ( i_mat2-meng4 / lv_peinh ) *
*ta_material-verpr.
         ENDIF.
       ENDIF.
*->End of KL002+
        w_mengb = w_mengb - ta_msegtemp-menge.
      ELSE.
        IF NOT w_mengb LE 0 .
             IF NOT lv_peinh EQ 0.
**->End of KL001+
               i_mat2-value0 = ( i_mat2-meng0 / lv_peinh )
*ta_material-verpr."+SC01
**->Begin of KL001+
             ENDIF.
           ELSEIF w_days GE 22.
             i_mat2-meng3 = i_mat2-meng3 + w_mengb.
             IF NOT lv_peinh EQ 0.
               i_mat2-value3 = ( i_mat2-meng3 / lv_peinh )
*ta_material-verpr.
             ENDIF.
**->End of KL001+
           ENDIF.
**--> SC02 - End  of Insertioin **
       ENDIF.
*->End of KL002-
*->Begin of KL002+
*--> < 10 days
                 IF w_days EQ 1 AND w_days LE 366.
          i_mat2-meng0 = i_mat2-meng0 + ta_msegtemp-menge.
          IF NOT lv_peinh EQ 0.
            i_mat2-value0 = ( i_mat2-meng0 / lv_peinh ) *
ta_material-verpr."+SC01
          ENDIF.
         ELSEIF w_days >= 11 AND w_days =< 30.
           i_mat2-meng1 = i_mat2-meng1 + w_mengb.
           IF NOT lv_peinh EQ 0.
             i_mat2-value1 = ( i_mat2-meng1 / lv_peinh ) *
*ta_material-verpr.
           ENDIF.
**--> 31 - 60 days
         ELSEIF w_days >= 31 AND w_days =< 60.
           i_mat2-meng2 = i_mat2-meng2 + w_mengb.
           IF NOT lv_peinh EQ 0.
             i_mat2-value2 = ( i_mat2-meng2 / lv_peinh ) *
*ta_material-verpr.
           ENDIF.
**--> 61 - 90 days
         ELSEIF w_days >= 61 AND w_days =< 90.
           i_mat2-meng3 = i_mat2-meng3 + w_mengb.
           IF NOT lv_peinh EQ 0.
             i_mat2-value3 = ( i_mat2-meng3 / lv_peinh ) *
*ta_material-verpr.
           ENDIF.
**--> > 90 days
         ELSEIF w_days > 90.
           i_mat2-meng4 = i_mat2-meng4 + w_mengb.
           IF NOT lv_peinh EQ 0.
             i_mat2-value4 = ( i_mat2-meng4 / lv_peinh ) *
*ta_material-verpr.
           ENDIF.
          ENDIF.
*->End of KL002+
          w_mengb = 0.
        ENDIF. " check stock value NE zero
      ENDIF.   "check Mat doc amount is LE than the stock value
ENDIF.
    ENDLOOP. " msegtemp
*-->append i_mat2 values
    i_mat2-werks = ta_material-werks.
    i_mat2-lgort = ta_material-lgort.
    i_mat2-matnr = ta_material-matnr.
    i_mat2-maktx = ta_material-maktx.
    i_mat2-meins = ta_material-meins.
    APPEND i_mat2. CLEAR i_mat2.
  ENDLOOP. " ta_material
*-->Append data for summary data
  DATA: i_lgort LIKE i_mat2 OCCURS 2 WITH HEADER LINE.
  i_lgort[] = i_mat2[].
  SORT i_lgort BY werks lgort.
  DELETE ADJACENT DUPLICATES FROM i_lgort COMPARING werks lgort.
  DATA: v_cnt0(5), v_cnt1(5), v_cnt2(5), v_cnt3(5), v_cnt4(5),
        v_value0 LIKE i_matsum-value0.
       v_value1 LIKE i_matsum-value1,
       v_value2 LIKE i_matsum-value2,
       v_value3 LIKE i_matsum-value3,
       v_value4 LIKE i_matsum-value4.
  LOOP AT i_lgort.
    CLEAR v_cnt0. CLEAR v_value0.
  CLEAR v_cnt1. CLEAR v_value1.
   CLEAR v_cnt2. CLEAR v_value2.
   CLEAR v_cnt3. CLEAR v_value3.
   CLEAR v_cnt4. CLEAR v_value4.
    LOOP AT i_mat2 WHERE lgort = i_lgort-lgort AND
                         werks = i_lgort-werks.
      IF NOT i_mat2-meng0 IS INITIAL.
        v_cnt0 = v_cnt0 + 1.
        v_value0 = v_value0 + i_mat2-value0.
      ENDIF.
     IF NOT i_mat2-meng1 IS INITIAL.
       v_cnt1 = v_cnt1 + 1.
       v_value1 = v_value1 + i_mat2-value1.
     ENDIF.
     IF NOT i_mat2-meng2 IS INITIAL.
       v_cnt2 = v_cnt2 + 1.
       v_value2 = v_value2 + i_mat2-value2.
     ENDIF.
     IF NOT i_mat2-meng3 IS INITIAL.
       v_cnt3 = v_cnt3 + 1.
       v_value3 = v_value3 + i_mat2-value3.
     ENDIF.
     IF NOT i_mat2-meng4 IS INITIAL.
       v_cnt4 = v_cnt4 + 1.
       v_value4 = v_value4 + i_mat2-value4.
     ENDIF.
    ENDLOOP.
    CLEAR i_matsum.
    i_matsum-lgort = i_mat2-lgort.
    IF v_cnt0 NE space.
      i_matsum-cnt0 = v_cnt0.
      i_matsum-value0 = v_value0.
      APPEND i_matsum.
    ENDIF.
   CLEAR i_matsum.
   i_matsum-lgort = i_mat2-lgort.
   IF v_cnt1 NE space.
     i_matsum-cnt1 = v_cnt1.
     i_matsum-value1 = v_value1.
     APPEND i_matsum.
   ENDIF.
   CLEAR i_matsum.
   i_matsum-lgort = i_mat2-lgort.
   IF v_cnt2 NE space.
     i_matsum-cnt2 = v_cnt2.
     i_matsum-value2 = v_value2.
     APPEND i_matsum.
   ENDIF.
   CLEAR i_matsum.
   i_matsum-lgort = i_mat2-lgort.
   IF v_cnt3 NE space.
     i_matsum-cnt3 = v_cnt3.
     i_matsum-value3 = v_value3.
     APPEND i_matsum.
   ENDIF.
   CLEAR i_matsum.
   i_matsum-lgort = i_mat2-lgort.
   IF v_cnt4 NE space.
     i_matsum-cnt4 = v_cnt4.
     i_matsum-value4 = v_value4.
     APPEND i_matsum.
   ENDIF.
  ENDLOOP.
ENDFORM.                    "f_data_preparation
*IMPORTANT , NEED TO CHECK LATER
FORM f_display_data .
  IF pck_dtsm = 'X'.
*-->Display detail
    v_topofpage = 'D'.
    PERFORM f_display_detail.
*-->display summary
    v_topofpage = 'S'.
    NEW-PAGE.
    PERFORM f_display_summary.
  ELSEIF pck_detl = 'X'.
*-->Display detail
    v_topofpage = 'D'.
    PERFORM f_display_detail.
  ELSEIF pck_summ = 'X'.
*-->display summary
    v_topofpage = 'S'.
    PERFORM f_display_summary.
  ENDIF.
ENDFORM.                    " f_display_data
FORM f_display_detail .
  v_topofpage = 'D'.
  SORT i_mat2 BY werks lgort.
*DATA: v_count(5),
DATA: v_count,
        v_va1 LIKE i_mat2-value0.
       v_va2 LIKE i_mat2-value0,
       v_va3 LIKE i_mat2-value0,
       v_va4 LIKE i_mat2-value0,
       v_va5 LIKE i_mat2-value0.
  LOOP AT i_mat2.
    WRITE:/2 i_mat2-lgort,
          10 i_mat2-matnr,
          22 i_mat2-maktx(38),
          61 i_mat2-meins,
          64 i_mat2-meng0,
          82 i_mat2-value0.
         100 i_mat2-meng1,
         118 i_mat2-value1,
         136 i_mat2-meng2,
         154 i_mat2-value2,
         169 i_mat2-meng3,
         186 i_mat2-value3,
         204 i_mat2-meng4,
         222 i_mat2-value4.
*-->Set counter and add up all values by lgort
    v_count = v_count + 1.
     v_va1 = v_va1 + i_mat2-value0.
   v_va2 = v_va2 + i_mat2-value1.
   v_va3 = v_va3 + i_mat2-value2.
   v_va4 = v_va4 + i_mat2-value3.
   v_va5 = v_va5 + i_mat2-value4.
    AT END OF lgort.
      WRITE:/10 'Cnt:',
             15 v_count,
             55 'Subtotal',
             82 v_va1.
            118 v_va2,
            154 v_va3,
            186 v_va4,
            222 v_va5.
      CLEAR v_count. CLEAR v_va1.
     CLEAR v_va2. CLEAR v_va3. CLEAR v_va4. clear v_va5.
    ENDAT.
  ENDLOOP.
ENDFORM.                    " f_display_detail
FORM f_display_summary .
  v_topofpage = 'S'.
  LOOP AT i_matsum.
    IF NOT i_matsum-cnt0 IS INITIAL.
      WRITE:/2  i_matsum-lgort,
             10 'Cnt:',15 i_matsum-cnt0,
             82 i_matsum-value0.
    ENDIF.
   IF NOT i_matsum-cnt1 IS INITIAL.
     WRITE:/2  i_matsum-lgort,
            10 'Cnt:',15 i_matsum-cnt1,
            118 i_matsum-value1.
   ENDIF.
   IF NOT i_matsum-cnt2 IS INITIAL.
     WRITE:/2  i_matsum-lgort,
            10 'Cnt:',15 i_matsum-cnt2,
            154 i_matsum-value2.
   ENDIF.
   IF NOT i_matsum-cnt3 IS INITIAL.
     WRITE:/2  i_matsum-lgort,
            10 'Cnt:', 15 i_matsum-cnt3,
            186 i_matsum-value3.
   ENDIF.
   IF NOT i_matsum-cnt4 IS INITIAL.
     WRITE:/2  i_matsum-lgort,
            10 'Cnt:', 15 i_matsum-cnt4,
            222 i_matsum-value4.
   ENDIF.
  ENDLOOP.
ENDFORM.                    " f_display_summary

Similar Messages

  • How to dynamically display the data from a table base on row selection of another table in ADF

    Hi ,
    I have a requirement in ADF. I need to change the data of a table  based on row selection of another Table . Both the table have a Parent Child relationship between them. They have a common attribute say department_id.
                                                                                         For this I created bind variable in view object of employees table and wrote a where clause in the sql query using that bind variable. Then I created method for selection listener of department Table in java bean.
    My method is following
        public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    It is printing the selected value of department id from department table in the log. But it is not able to pass the value to employees view. It is showing the following error in the log
    "Definition DepartmentId of type Variable is not found in EmployeesView1."
    I will be very thankful if someone helps me to solve this errror or is there any other way to achieve the same requirement.
    Thanks
    Nilesh

    Note quite sure why you simply wont create a viewlink for the viewobject the tables are based on..
    The viewlink attribute will be based on the departmentId and it's a simple master detail relationship which automatically uses ppr.
    However, if both tables are on the same page; using your hack about;
    On the underlying viewobject, define a viewcriteria e.g. "listById" and set your bind variable here.
    I would bind table two to a RichTable component:
    RichTable t2;
    public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
                   refreshTable2(pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    private void refreshTable2(Number pallet){
    RichTable x=getT2();
    CollectionModel cm=(CollectionModel)x.getValue();
    JUCtrlHierBinding jcb=(JUCtrlHierBinding)cm.getWrappedData();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(jcb.getName()+"Iterator");
    ViewObject vo =dciter.getViewObject();
    ViewCriteriaManager vcm=vo.getViewCriteriaManager();
    ViewCriteria vc=vcm.getViewCriteria("listById");
    vo.applyViewCriteria(vc);
    vo.setNamedWhereClauseParam("DepartmentId",pallet);
    vo.executeQuery();
    AdfFacesContext.getCurrentInstance().addPartialTarget(getT2());

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How to retrieve data from domain(Value Range)  of the table

    hi
    how to retrieve data from domain(Value Range)  of the table
    thanks

    Hello,
    You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 24, 2009 10:08 AM

  • JDBC-XI-FILE scenario. How to extract data from multiple tables

    Hi,
    At this moment I didn't have the access for XI system. So here I have some silly question. Could you please clarify the same ??
    If I got to extract data from single table using JDBC adapter I can put the below query in communication channel
    SELECT *FROM orders WHERE new='true'.
    But if I got to extract data from multiple tables, logic to be used should be like as shown below. ( from previous thread------prabhu).
    SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
    FROM <Table_1> INNER JOIN <Table_2> on
    <Table_1>.CARDNO = <Table_2>.CARD
    where REC_DAT = <condition>
    union
    SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
    FROM <Table_1> INNER JOIN <Table_2> on
    <Table_1>.CARDNO = <Table_2>.CARD
    where REC_DAT = <condition>
    But my query is ........how to put the above entire code in one line. (i.e in Qery place of communication channel ) ??
    Thanks
    Kumar

    Hi Palnati,
        You either use a select query with join or a stored procedure which will contain the logic to extract the data from multiple tables. But, the limitation in case of stored procedure is u can hv only one selct query in it.
    You write ur actual query provided in the parameter 'Query SQL Statement". u can also wrt a stored procedure in it. Also, u can provide a update statement in it which will update a certain flag so tht u don selct the data again.
    Check the following link
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm</a>
    Regards,
    Akshay
    Message was edited by:
            Akshay Salunke

  • How to Fetch Data From Standard Table MARA and Display using BOPF ?

    Hello All,
    In BOPF creation of Quey to a node fetches data from the Data Base Table attached to that Node,
    But in my requirement I have to fetch data Present in a Standard table and Display it in the FPM List Using FBI.
    **  Can we Fetch the data From Standard Table and fill the Node in BOPF, Is this possible as the standard Table do not contain KEY field which BOPF uses for Data Fetching ?
    Kindly share your Idea's .
    Thanks in Adv.

    Hi Dhivya,
    Thanks For your Response.
    In my Requirement I want to make ROOT Node as Transient Node.
    When I create a Sub Node to a Root Node, I am able to get this option to make this sub node as a Transient Node .
    By selecting   'Standard<-->Extended' option in the Menu item 'GoTo' I am able to get this Transient Node check box field for the Sub Nodes.
    I want to make a ROOT Node as a Transient Node.
    (Which Version you are using, and which transaction you are using to create BO . we are using BOBX Transaction, Version Ehp 6 )
    Kindly Guide me .
    Thanks,
    Kranthi Kumar.

  • How to Retrieve data from Variant Table

    Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?

    Hello Mohan,
    if u already have data and u want to populate it in F4 help then use below code -
    u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
    REPORT  ZGILL_VALUE_REQUEST                     .
    data: begin of lt_all occurs 0.
            include structure DYNPREAD.
    data  end of lt_all.
    data: begin of lt_selected occurs 0.
           include structure DDSHRETVAL.
    data: end of lt_selected.
    DATA: BEGIN OF lt_code OCCURS 0,
                code LIKE zgill_main-PERNR,
          END OF lt_code.
    data no_dyn like sy-dynnr.
    Parameters : ECODE like zgill_main-PERNR.
    *parameters: pernr like pa0001-pernr .
    no_dyn =  sy-dynnr.   "give the scren no directly or sy-dynnr in case of report.
    At selection-screen on value-request for ECODE.
    select PERNR into table lt_code from zgill_main.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield               = 'ECODE'
            dynpprog               = sy-repid
           dynpnr                  = no_dyn
          dynprofield              =       'ECODE'
          window_title           = 'Employee Details'
           value_org              = 'S'
          DISPLAY                = 'F'
       TABLES
            value_tab             = lt_code
           RETURN_TAB             = lt_selected.
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
    *if sy-subrc eq '0' .
      write: 'success'.
    *endif.
    read   table lt_selected index sy-tabix.
    move lt_selected-fieldval to ECODE.

  • How to fetch data from PTREQ tables

    I need to display  data in the customised webdynpro application from PTREQ tables.
    Can anyone help me out how to fetch data from these tables.

    use the standard modules like
    PT_ARQ_REQUEST_CHECK
    PT_ARQ_REQUEST_EXECUTE
    PT_ARQ_REQUEST_PREPARE

  • How to fetch data from cluster tables

    hi
    i need to know  how to fetch data from cluster tables please update me if any
    i know that we cannot use joins in cluster table we use view etc
    but i need detailed inforation on methods for fetching data from cluster tables
    regards
    Nishant

    Hi,
        Check the following links
    http://fuller.mit.edu/hr/cluster_tables.html
    The specified item was not found.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33

  • How to copy data from transparent table to our own ceated z table?

    How to copy data from transparent table to our own ceated z table?
    Plz tell me different methods and which one is best?
    Is get data from sflight into table z* is correct?

    Hi Ajay,
    let us consider you have to copy EKKO table to ZEKKO table
    1. In ABAP program define internal table based on EKKO
    <b>     eg: i_ekko</b>
    2. Select the data from EKKO to i_ekko
    <b>     eg: select * from ekko into table i_ekko.</b>
    3. insert into Z-TABLE from the internal table
    <b>     eg: INSERT EKKO FROM TABLE I_EKKO.
               COMMIT WORK.</b>
    <u>To insert in internal table you can use the following:</u>
    1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].
    2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.
    3. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO itab2 [INDEX idx3].
    4. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO TABLE itab2.
    <u>To inert in database table, use the following:</u>
    1. INSERT INTO <dbtabname> [CLIENT SPECIFIED] VALUES wa.
    2. INSERT <dbtabname> [CLIENT SPECIFIED] FROM TABLE itab.
    3. INSERT <dbtab> [CLIENT SPECIFIED]. oder
    4. INSERT <dbtabname> [CLIENT SPECIFIED] ... .
    <b>Reward points.. if helpful.
    Cheers !
    Moqeeth.</b>

  • How to fetch data from 2 tables

    Hi Experts,
    I am using 2 Ztables.Let us assume that there are 2 fields in Table1 as a and b and 2nd Table contain c as field.I want to retrive data from these tables by combining the fields of Table1 with that of 2.
    Eg: I want to compare a+b with c and fetch records.
    Is there any logic to combine 2 fields and compare with 3rd field using a single select statement?
    Regds,
    Sam.

    Hi Sam,
    if the tables have one or more common key fields, you can use a JOIN condition for the tables, i.e.
    data:
    begin of ls_target,
      a like ztable1-a,
      b like ztable1-b,
      c like ztable2-c,
    end of ls_target,
    lt_target like table of  ls_target.
    select ztable1~a ztable1~b ztable2~c
      into corresponding fields of table lt_target
      from ztable1
      join ztable2 ON  ztable2~key = ztable1~key
      where <your condition>.
    Note ahead:
    1)  some people say select into corresponding fields is not good for performance. I think it is good to avoid errors and nobody ever gave a perfomance proof.
    2) Most developers always use an alias such as ztable1AS a, ztable2 AS b. This is due to the fact that after table joins were introduced with release 3.1, the ABAP sample programs an documentation always used the ALIAS clause although it is not necessary nor does it establish transparency.
    Kind regards
    Clemens

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • How to display data from internal table in the SELECTION-SCREEN

    Hello Experts,
    My requirement is to display the data's from an internal table in the selection screen. I tried using selection-screen comment. But it is working only for a single record. Can anyone please tell me how to do this?

    Hi Ritika,
    we cant use write statement inside selection-screen.
    see my coding.
    SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
      SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
                                          NO INTERVALS.
        SELECT-OPTIONS SEL1 FOR SY-DATUM.
        PARAMETERS     PAR1(10).
    <b>** I WANT ALL RECORDS FROM AN INTERNAL TABLE HERE ONLY</b>
        SELECTION-SCREEN END OF BLOCK BL1.
      SELECTION-SCREEN PUSHBUTTON 2(10)  but1 USER-COMMAND cli1.
      SELECTION-SCREEN PUSHBUTTON 20(10)  but2 USER-COMMAND cli2.
    SELECTION-SCREEN END OF SCREEN 123.

  • How to get data from COSP table, field HRKFT as the key to data from PM?

    Dear ladies and gentlemen!
    I need to get data from COSP table, field HRKFT as the key to data from PM tables (AFKO and AUFK).
    The problem is that it is a key field to the COSP, and all non-key fields as an alternative to HRKFT are not suitable for this task.
    All this is necessary for the extractor, which loads the data from the R \ 3 systems in the BW-system. I need to perform SELECT from a table COSP and maybe also JOIN, most likely between tables COSP and AUFK.
    What should I do in this case?
    Thank you very much in advance!

    From information on help.sap.com I've made a conclusion that one of possible solutions in theory is to modify standard extractor PM_OM_OPA_1 in order to make HRKFT field available for work, because by default it is hidden by SAP and not available for use as a key field.
    Of course, it's not a very good solution, but for now I know no other way to solve this problem.
    Maybe someone knows better ways? In this case I will be very grateful for any help!
    Moderator: You'd better post it on BI forums

  • Access 2010 - How to display data from a table into a text box upon combo box selection?

    Hi
    I have a a table with 5 columns: month, year, USD, SGD, BAHT.
    I created a form with a combo box for selection of the month and year, and I would like to set adjacent text boxes to show USD, SGD, BAHT information. How can i go about doing that?
    From the Q&A here, most of them uses the function similar to this "=[Combo0].[Column](1)" to show the data in the text box, but this would require the combo box to list a whole bunch of details if i were to add in more currency values to the
    table. Is it possible to not show this information in the combo box, but still populate data in the textboxes base on a selection on only the "month" and "year" in the combo box.

    Hi,
    According to your description, my understanding is that you want to show only the month/year in the combo box, we can choose the date, and it will display the value of USD/SGD/BAHT based on the month/year.
    If it is, I recommend you try the steps:
    Create a form based on your data source table>Add the combo box>combo box wizard>Find a record on my form based on the value I selected my combo box>Add mouth and year to selected fields
    http://office.microsoft.com/en-us/access-help/create-a-list-of-choices-by-using-a-list-box-or-combo-box-HA010113052.aspx
    If I misunderstand something, please let me know. We may upload some screenshots or a sample through OneDrive.
    Regards,
    George Zhao
    TechNet Community Support

  • How to copy data from one table to another (in other database)

    Hi. I would like to copy all rows from one table to another (and not use BC4J). Tables can be in various databases. I have already 2 connections and I am able to browse source table using
    ResultSet rset = stmt.executeQuery("select ...");
    But I would not like to create special insert statement for every row . There will be problems with date formats etc and it will be slow. Can I use retrieved ResultSet somehow ? Maybe with method insertRow, but how, if ResultSet is based on select statement and want to insert into target table? Please point me in the right direction. Thanks.

    No tools please, it must be common solution. We suceeded in converting our BC4J aplication to PostgreSQL, the MSSQL will be next. So we want to write simple aplication, which could transfer data from our tables between these 3 servers.

Maybe you are looking for

  • Hi, using a macbook with photoshop and saving to mem stick,

    Can i use a macbook with photoshop save to a mem stick then use the same files on a windows pc wih photoshop?

  • IPhone 5 no data

    Started 3 days ago. LTE was on, now no LTE,4G,or E is present on my phone. I do have full service. I tried turn on/off airplane mode. Reinserting SIM Card, Reseting Data settings. No luck so far..please help!

  • Behaviour: "Set Text of Text Filed"

    I am attempting to apply the behaviour "Set Text of Text Filed" to a radio button pair (the NO of Yes, NO) in order to fill in a text field with "skip to question 4" However, when attempting to apply, I get an error message "no ID. Set ID in the Prop

  • Excise Base Value & Basic Excise Rate(16%) is notpicked in RG1

    Dear All, During Excise invoice generation the value of Excise Base Value & Basic Excise Rate is not picked  from billing. subsequently when i take print of RG1 in Excel format, Excise Base Value & Basic Excise Rate is also not picked it display 0. P

  • F.C.E. Difficulties in saving to DVD - PAL

    Having looked through this section and telling Apple that it was impossible to save via anything to DVD on the Pal side of the pond I reverted to PRINTING TO VIDEO and saving back to tape. The idea being, then to send that tape source to a combi Pana