Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to fill fields going across the report

0 Kudos

Hi guys

Thank you for assisting me for summing up values for the same cost centre.I now need help on how I should get my report to input or writing values to fields that i have created with cost centre numbers . which i need to go across the report with cost centre numbers has their column description.

*&---------------------------------------------------------------------*
*& Report  Z_COST_MATERIAL5
REPORT  z_cost_material5 LINE-SIZE 500.

* TABLE DECLARATION
TYPES: BEGIN OF z_keph,
      matnr TYPE mbew-matnr,
      BWKEY TYPE mbew-bwkey,
      KST001 TYPE KEPH-KST001,
      kst004  TYPE keph-kst004,
      KST006 TYPE keph-kst006,
      KST010 TYPE keph-kst010,
      kalnr TYPE keph-kalnr,
      KKZST TYPE KEPH-KKZST,
      KSTAR TYPE CKIS-KSTAR,
      WERTN TYPE CKIS-WERTN,
      LSTAR TYPE CKIS-LSTAR,
      KADKY TYPE KEPH-KADKY,
      KOSTL TYPE CKIS-KOSTL,
      DHU1  LIKE CKIS-WERTN.

TYPES:END OF z_keph.

 DATA: it_keph TYPE STANDARD TABLE OF z_keph INITIAL SIZE 0,
wa_keph TYPE z_keph,     "work area (header line)
wa_keph1 LIKE LINE OF it_keph,
PERM TYPE I VALUE 1000.

SELECT-OPTIONS:
material FOR WA_KEPH-MATNR,
COSTINGD FOR WA_KEPH-KADKY.

*START OF SELECTION "TO INPUT DATA INTO INTERNAL TABLE IT_KEPH

START-OF-SELECTION.
  SELECT: A~MATNR A~BWKEY B~KST001 B~KST004 B~KST006 B~KST010 B~KALNR C~KSTAR  C~LSTAR C~KOSTL SUM( C~WERTN ) AS WERTN
  FROM mbew AS a
  JOIN keph AS b
  ON a~kaln1 EQ b~kalnr INNER JOIN CKIS AS C
  ON B~KALNR EQ C~KALNR
  AND
   B~KADKY EQ C~KADKY
  INTO CORRESPONDING FIELDS OF TABLE it_keph
WHERE A~MATNR IN MATERIAL
    and a~bwkey EQ '3000'
    AND B~KKZST EQ 'X'
    AND B~KADKY IN COSTINGD
    GROUP BY A~MATNR A~BWKEY B~KST001 B~KST004 B~KST006 B~KST010 B~KALNR C~KSTAR  C~LSTAR C~KOSTL.
*PROCESSING DATA IN IT_ZEPH
  LOOP AT it_keph INTO WA_KEPH.

    AT FIRST.
    WRITE:  'MATERIAL N0' COLOR 3,
           30 'DHU' COLOR 3,
            120 'VALUE' COLOR 2,
            146 '1350' COLOR 3,
            156 '1380' COLOR 3,
            166 '1310' COLOR 3,
            176 '1320' COLOR 3.
     ULINE.
     ENDAT.


    WRITE: / WA_KEPH-MATNR,WA_KEPH-KST001,WA_KEPH-KST004,WA_KEPH-KST006,WA_KEPH-KST010,WA_KEPH-KSTAR,WA_KEPH-WERTN,WA_KEPH-KOSTL,WA_KEPH-DHU1.


  ENDLOOP.
0 REPLIES 0