Regarding ABAP report

Hi Experts,
I have to create a report in the following format:
Report
AA   |Date     |      X     |Y      |     Z    |     XX   |     YY
11:30|05/10/08| 989     |4567 |     B   |     A    |     A
     Maria Smith      123  Main St.       Apt.
     990-876-0987     Neighborhood        City
Some message for header
Item     ABC       GHI            OPQ             RST
                DEF       IJK/LMN     1         KG                
0010     09876     Books                  908        WHP/ 1000          
0020     87878     Ice Maker     1         KG
     876        WHP/ M909     
..................................................................................... Some message for item
Here first row is header and second row is corressponding values and the third & fourth line are customer address informations and fifth row is the messafe for header. this is just one record.
After this in the second part is the item information for the value X in the header. there are 2 items 0010 and 0020 and there corresponding details
Also when the user click on the value 989, corresponding transacion should open. say MM03
please give me some example reports with these two cases .
ie classical and interactive features.
Thanks a lot.
Useful answers will be highly rewarded.
Reagrs
Krishan

KK,
REPORT zm_vendor_payments LINE-SIZE 255 LINE-COUNT 65.
** Vendor payment details
** Amit gujargoud - Inverted Sphere Inc. 2003/03/26
** modification history
** by   date      description
** DO   20031107  include reversal transaction as well. improve
*                 report legibility.
*       20031110  Add drilldown capability
* Agujargoud 2007/04.29 - New Client Upgrade.
TABLES: bsik, bsak, bsis, bsas, bseg, ekpo, lfa1.
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-010,
                  SKIP.
SELECT-OPTIONS: s_lifnr FOR bsik-lifnr,
                s_bukrs FOR bsik-bukrs,
                s_budat FOR bsik-budat.
PARAMETERS:     p_grdat LIKE bsik-augdt.
SELECTION-SCREEN: SKIP,
                  END OF BLOCK blk1.
DATA: BEGIN OF i_docs OCCURS 0,
        lifnr LIKE bseg-lifnr,
        hkont LIKE bseg-hkont,
        dmbtr LIKE bsis-dmbtr,
        kostl LIKE bseg-kostl,
        sgtxt LIKE bseg-sgtxt,
        bukrs LIKE bseg-bukrs,
        belnr LIKE bseg-belnr,
        buzei LIKE bseg-buzei,
        blart LIKE bkpf-blart,
        shkzg LIKE bseg-shkzg,
        budat LIKE bkpf-budat,
        augbl LIKE bseg-augbl,
        gjahr LIKE bseg-gjahr,
      END OF i_docs.
DATA: i_revs LIKE i_docs OCCURS 100 WITH HEADER LINE,
      lifnr LIKE i_docs-lifnr,
        bukrs LIKE i_docs-bukrs,
        belnr LIKE i_docs-belnr,
        blart LIKE i_docs-blart,
        hkont LIKE i_docs-hkont,
        dmbtr LIKE i_docs-dmbtr,
        kostl LIKE i_docs-kostl,
        sgtxt LIKE i_docs-sgtxt,
        budat LIKE i_docs-budat,
        total LIKE i_docs-dmbtr,
        gjahr LIKE i_docs-gjahr,
        w_ebeln LIKE ekpo-ebeln,
        w_ebelp LIKE ekpo-ebelp,
        w_zuonr LIKE bseg-zuonr,
        toggle TYPE i VALUE 1.
DATA: v_grir_acct LIKE bsis-hkont,
      v_coa LIKE t001-ktopl.
START-OF-SELECTION.
  CASE sy-mandt.
    WHEN '500'.
      v_coa = 'MACK'.
    WHEN '600'.
      v_coa = 'COA1'.
  ENDCASE.
  SELECT konts FROM t030 INTO v_grir_acct
         WHERE ktopl = v_coa
           AND ktosl = 'WRX'.
  ENDSELECT.
  SELECT hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
          FROM bsis
          INTO CORRESPONDING FIELDS OF TABLE i_docs
*                     WHERE hkont = '211200' "goods received w/o invoice
                      WHERE hkont = v_grir_acct
                      AND   bukrs IN s_bukrs
                      AND   budat IN s_budat.
*                      AND   blart = 'WE'.
  SELECT hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
          FROM bsas
          APPENDING CORRESPONDING FIELDS OF TABLE i_docs
*                     WHERE hkont = '211200' "goods received w/o invoice
                      WHERE hkont = v_grir_acct
                      AND   bukrs IN s_bukrs
                      AND   budat IN s_budat
*                      AND   blart = 'WE'
                      AND   augdt GE p_grdat.
  LOOP AT i_docs.
    SELECT SINGLE lifnr ebeln ebelp FROM bseg
           INTO (i_docs-lifnr, w_ebeln, w_ebelp)
                              WHERE bukrs = i_docs-bukrs
                              AND   belnr = i_docs-belnr
                              AND   buzei = i_docs-buzei.
    IF i_docs-lifnr IN s_lifnr.
      IF NOT w_ebeln IS INITIAL AND i_docs-sgtxt IS INITIAL.
        SELECT SINGLE txz01 FROM ekpo INTO i_docs-sgtxt
                                WHERE ebeln = w_ebeln
                                AND   ebelp = w_ebelp.
      ENDIF.
      MODIFY i_docs.
    ELSE.
      DELETE i_docs.
    ENDIF.
  ENDLOOP.
  SELECT lifnr hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
         FROM bsik
         APPENDING TABLE i_docs
                     WHERE lifnr IN s_lifnr
                     AND   bukrs IN s_bukrs
                     AND   budat IN s_budat
*                     AND   blart IN ('KR', 'RE').
                     AND   blart IN ('KR', 'RE', 'KN', 'RN').
*see if there are reversal documents
  SELECT lifnr hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
         FROM bsik
         APPENDING TABLE i_revs
                     WHERE lifnr IN s_lifnr
                     AND   bukrs IN s_bukrs
                     AND   blart IN ('KA').
  SELECT lifnr hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
         FROM bsak
         APPENDING TABLE i_docs
                     WHERE lifnr IN s_lifnr
                     AND   bukrs IN s_bukrs
                     AND   budat IN s_budat
*                     AND   blart IN ('KR', 'RE').
                     AND   blart IN ('KR', 'RE', 'KN', 'RN').
* check for reversal
  SELECT lifnr hkont dmbtr kostl sgtxt bukrs belnr
         buzei blart shkzg budat augbl gjahr
         FROM bsak
         APPENDING TABLE i_revs
                     WHERE lifnr IN s_lifnr
                     AND   bukrs IN s_bukrs
                     AND   blart IN ('KA').
  SORT: i_docs BY lifnr bukrs budat hkont,
        i_revs BY lifnr bukrs augbl.
  LOOP AT i_docs.
    toggle = toggle * -1.
    AT NEW lifnr.
      SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
                          WHERE lifnr = i_docs-lifnr.
      CLEAR total.
    ENDAT.
    IF i_docs-blart = 'KR' OR i_docs-blart EQ 'KN'.
      SELECT SINGLE hkont kostl gjahr FROM bseg
           INTO (i_docs-hkont, i_docs-kostl, i_docs-gjahr)
                              WHERE bukrs = i_docs-bukrs
                              AND   belnr = i_docs-belnr
                              AND   kostl <> ' '.
    ELSEIF i_docs-blart = 'RE' OR i_docs-blart = 'RN'.
      SELECT SINGLE hkont kostl gjahr ebeln ebelp FROM bseg
           INTO (i_docs-hkont, i_docs-kostl, i_docs-gjahr,
                 w_ebeln, w_ebelp)
                              WHERE bukrs = i_docs-bukrs
                              AND   belnr = i_docs-belnr
                              AND   ebeln <> ' '.
      IF NOT w_ebeln IS INITIAL
       AND i_docs-sgtxt IS INITIAL.
        SELECT SINGLE txz01 FROM ekpo INTO i_docs-sgtxt
                                WHERE ebeln = w_ebeln
                                AND   ebelp = w_ebelp.
      ENDIF.
    ENDIF.
    CASE i_docs-shkzg.
      WHEN 'S'.
        i_docs-dmbtr = i_docs-dmbtr * -1.
    ENDCASE.
    lifnr = i_docs-lifnr.
    bukrs = i_docs-bukrs.
    belnr = i_docs-belnr.
    blart = i_docs-blart.
    hkont = i_docs-hkont.
    dmbtr = i_docs-dmbtr.
    kostl = i_docs-kostl.
    sgtxt = i_docs-sgtxt.
    budat = i_docs-budat.
    gjahr = i_docs-gjahr.
    PERFORM print_document USING lifnr lfa1-name1 bukrs belnr blart
                                 hkont dmbtr kostl sgtxt budat gjahr.
    total = total + dmbtr.
    IF i_docs-blart = 'KR' OR i_docs-blart EQ 'KN'.
      READ TABLE i_revs WITH KEY lifnr = i_docs-lifnr
                                 bukrs = i_docs-bukrs
                                 belnr = i_docs-augbl
                                 blart = 'KA'.
      IF sy-subrc EQ 0.
        dmbtr = i_revs-dmbtr * -1.
        lifnr = i_revs-lifnr.
        bukrs = i_revs-bukrs.
        belnr = i_revs-belnr.
        blart = i_revs-blart.
        hkont = i_revs-hkont.
        kostl = i_revs-kostl.
        sgtxt = space.
        budat = i_revs-budat.
        gjahr = i_revs-gjahr.
        PERFORM print_document USING lifnr lfa1-name1 bukrs belnr blart
                                    hkont dmbtr kostl sgtxt budat gjahr.
        total = total + dmbtr.
      ENDIF.
    ENDIF.
    AT END OF lifnr.
      SKIP.
      FORMAT COLOR COL_TOTAL INTENSIFIED.
      WRITE:/ text-011, i_docs-lifnr,
           (14) total UNDER dmbtr.
      SKIP.
      FORMAT RESET.
    ENDAT.
  ENDLOOP.
AT LINE-SELECTION.
  CHECK belnr NE space.
  SET PARAMETER ID: 'BLN' FIELD belnr,"this is your second answer
                    'BUK' FIELD bukrs,
                    'GJR' FIELD gjahr.
  CALL TRANSACTION 'FB03'."this is the way to call transaction for perticuler doc
*       FORM print_document                                           *
FORM print_document    USING lifnr name1 bukrs belnr blart hkont dmbtr
                       kostl sgtxt budat gjahr.
  IF toggle GT 0.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
  ELSE.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
  ENDIF.
  WRITE:/ lifnr,
          name1,
          bukrs,
          belnr COLOR COL_KEY HOTSPOT,
          blart,
      (6) hkont,
     (14) dmbtr,
      (7) kostl,
          sgtxt,
          budat.
  HIDE: belnr, lifnr, bukrs, gjahr.
ENDFORM.

Similar Messages

  • Regarding abap reporting

    hi all
    i had written one code to display outstanding credit notes(payments) from our customers.when i chk display this proram in dev server it runs perfectly but on production it shows recieved payments a otstanding nd outstanding as recieved. why this has happened n now will i correct it?
    secondly when i write a statement to delete a duplication of records, in production it fetches very less data even though its not duplicate, any reason behind it?
    rewards will b given
    thanks in advance 2 all
    gaurav

    here is my code 
    chk form process whre all the logical steps are there.
    *& Report  YMS_ZOUT1                                                   *
    REPORT  YGAU_ZOUT1 NO STANDARD PAGE HEADING LINE-SIZE 240.
    TABLES: VBAK,  "ORDER HEADER
            VBAP,  "ORDER DETAIL
            BSAD,  "CUSTOMER PAYMENTS
            VBRP,  "BILLING HEADER
            KNA1,  "CUSTOMER MASTER
            BSEG,  "A/c Document Segment
            bsid,  "A/c: Secondary Index for Customers
            VBRK.  "Billing Document
    DATA   : t_aubel(70), MEXT(70), MPART(10) TYPE c.
    DATA  : s_tdid LIKE thead-tdid ,
            s_tdobject LIKE thead-tdobject ,
            zline LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA   DELI(1) TYPE C VALUE 'I'.
    DATA : LIFEX3(35), S_ACK TYPE C.
    DATA : TXT1(4) TYPE C.
    DATA : TXT2(10) TYPE C.
    DATA : BEGIN OF ITAB OCCURS 0,
           VKBUR LIKE VBAK-VKBUR,  "SALES OFFICE
           LIFEX LIKE LIKP-LIFEX,
           EXTDEL LIKE LIKP-VBELN,  "Extended Outbound Delivery
           VBELN LIKE VBAK-VBELN, "BILLING DOCU NO.
           AUDAT LIKE VBAK-AUDAT,
           KUNNR LIKE VBAK-KUNNR,
           VKORG LIKE VBAK-VKORG,
           FKART LIKE VBRK-FKART, " BILLING TYPE
           VBELN1 LIKE VBRK-VBELN, " BILLING DOCU. NO.
           NETWR LIKE VBRK-NETWR,
           NETWR1 LIKE VBRK-NETWR,
           NAME1 LIKE KNA1-NAME1,
           NAME2 LIKE KNA1-NAME1,
           KURRF LIKE VBRK-KURRF,
           WAERK LIKE VBRK-WAERK,
           KUNRG LIKE VBRK-KUNRG,
           FKDAT LIKE VBRK-FKDAT,  "Billing Date
           WRBTR LIKE BSID-WRBTR,
           BELNR LIKE BSID-BELNR,
           BLART LIKE BSID-BLART,
           DMBTR LIKE BSID-DMBTR,
           WAERS LIKE BSID-WAERS,
           NEBTR LIKE BSEG-NEBTR,
           WAERK1 LIKE VBRK-WAERK,
           VGBEL LIKE VBRP-VGBEL,
           BSTKD LIKE VBKD-BSTKD,
           BSTDK LIKE VBKD-BSTDK,
              tdack LIKE tline-tdline,
              tdprno LIKE tline-tdline,
              tdprdt LIKE tline-tdline,
              tdcrno LIKE tline-tdline,
              tdcrva LIKE tline-tdline,
           TPRNCP LIKE tline-tdline,
           TPRNIN LIKE tline-tdline,
           CUSTCODE LIKE VBRK-KUNRG, "PAYER
          OUT TYPE P DECIMALS 2,
          OUTINR TYPE P DECIMALS 2,
           END OF ITAB.
    DATA:   OUT1 TYPE P DECIMALS 2.
    DATA:   wrbtr1 TYPE P DECIMALS 2.
    DATA:   DMbtr1 TYPE P DECIMALS 2.
    DATA:   D TYPE D.
    DATA:  JTAB LIKE itab OCCURS 0 WITH HEADER LINE .
    DATA:  PTAB LIKE itab OCCURS 0 WITH HEADER LINE .
    DATA:  PATH LIKE RLGRAP-FILENAME,
            PATH_AND_FILE LIKE RLGRAP-FILENAME.
      DATA: BEGIN OF FLDNAMES OCCURS 0,
              FIELDNAME(10),
            END OF FLDNAMES.
    FIELD-SYMBOLS <FN> LIKE ITAB.
    TYPE-POOLS : SLIS .
    DATA : GM_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : GS_PRINT            TYPE SLIS_PRINT_ALV,
           GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
           GT_EVENTS           TYPE SLIS_T_EVENT.
    DATA : g_variant LIKE disvariant,
           gx_variant LIKE disvariant.
    DATA: gs_variant LIKE disvariant,
          g_save,
          g_exit.
    DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE T1 .
      SELECT-OPTIONS :  S_VBELN FOR VBAK-VBELN.
      SELECT-OPTIONS : S_VBELN1 FOR VBRK-VBELN .
    SELECTION-SCREEN : END OF BLOCK B1.
    SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE T2 .
      SELECT-OPTIONS :  S_KUNNR FOR VBAK-KUNNR.
      SELECT-OPTIONS : S_KUNRG FOR VBRK-KUNRG .
    SELECTION-SCREEN : END OF BLOCK B2.
    SELECTION-SCREEN : BEGIN OF BLOCK B4 WITH FRAME TITLE T4.
    SELECTION-SCREEN : BEGIN OF LINE,COMMENT 5(27) T5 FOR FIELD ZFOR_O.
      PARAMETERS ZFOR_O RADIOBUTTON GROUP RADI DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,COMMENT 5(27) T6 FOR FIELD ZCUS_O.
      PARAMETERS ZCUS_O RADIOBUTTON GROUP RADI  .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN : END OF BLOCK B4.
    data :   repname like sy-repid.
    INITIALIZATION .
    T1 = 'DOCUMENT DATA'.
    T2 = 'CUSTOMER SELECTION'.
    T4 = 'DOCUMENT TYPE'.
    T5 = 'ZFOR'.
    T6 = 'ZCUS'.
    repname = sy-repid.
    AT SELECTION-SCREEN .
    START-OF-SELECTION .
    PERFORM FETCH .
    CLEAR ITAB.
    MPART =  '000010'.
    PERFORM GTEXT.
    PERFORM read_crdt_no.
    PERFORM read_crdt_val.
    END-OF-SELECTION.
    PERFORM PROCESS.
    PERFORM DISPLAY.
    *&      Form  FETCH
          text
    -->  p1        text
    <--  p2        text
    form FETCH .
    IF ZFOR_O = 'X'.
      TXT1 = 'ZFOR'.
    ELSE.
      TXT1 = 'ZCUS'.
    ENDIF.
    ASSIGN ITAB TO <FN>.
    TXT2 = 'NE'.
    PERFORM GETDATA.
    ASSIGN PTAB TO <FN>.
    TXT2 = 'EQ'.
    PERFORM GETDATA.
    CLEAR ITAB.
    CLEAR PTAB.
    loop at itab.
    loop at Ptab WHERE VBELN EQ ITAB-VBELN.
      DELETE PTAB.
    endloop.
    clear itab.
    endloop.
    APPEND LINES OF PTAB TO ITAB .
    SORT itab BY VBELN  VBELN1 .
    endform.                    " FETCH
    *&      Form  GETDATA
          text
    -->  p1        text
    <--  p2        text
    form GETDATA .
      SELECT VBELN VKBUR AUDAT KUNNR VKORG FROM VBAK INTO CORRESPONDING FIELDS
      OF <FN>
      WHERE VBELN IN S_VBELN AND AUDAT <= sy-datum AND
      KUNNR IN S_KUNNR and VKORG = '2000' AND AUART = TXT1.
      SELECT VBELN NETWR WAERK KURRF KUNRG FKDAT FROM VBRK INTO (<FN>-VBELN1,
      <FN>-NETWR, <FN>-WAERK, <FN>-KURRF, <FN>-KUNRG, <FN>-FKDAT) WHERE
      XBLNR = <FN>-VBELN AND VBELN IN S_VBELN1 AND KUNRG IN S_KUNRG .
      SELECT BSTKD BSTDK FROM VBKD INTO CORRESPONDING FIELDS OF <FN> WHERE
      VBELN = <FN>-VBELN .
      SELECT single VGBEL FROM VBRP INTO <FN>-vgbel WHERE
      VBELN = <FN>-VBELN1 .
      SELECT LIFEX VBELN FROM LIKP INTO (<FN>-LIFEX, <FN>-EXTDEL) WHERE
      VBELN = <FN>-VGBEL.
        LIFEX3 = <FN>-LIFEX.
          split lifex3 at DELI into <FN>-TPRNCP <FN>-TPRNIN.
      SELECT single NAME1 FROM KNA1 INTO CORRESPONDING FIELDS OF <FN> WHERE
      KUNNR = <FN>-KUNNR .
      SELECT single NAME1 FROM KNA1 INTO <FN>-NAME2 WHERE
      KUNNR = <FN>-KUNRG.
      IF TXT2 = 'NE'.
        SELECT WRBTR BLART BELNR DMBTR WAERS FROM BSID INTO CORRESPONDING FIELDS
        OF ITAB
        WHERE VBELN = ITAB-VBELN1 AND BLART <> 'RV'.
        APPEND ITAB.
        ENDSELECT.
      ENDIF.
      IF TXT2 = 'EQ'.
        SELECT WRBTR BLART BELNR DMBTR WAERS FROM BSID INTO CORRESPONDING FIELDS
        OF PTAB
        WHERE VBELN = PTAB-VBELN1 AND BLART <> 'RV'  .
        ptab-wrbtr = 0 .
        ptab-dmbtr = 0 .
        APPEND PTAB.
        ENDSELECT.
      ENDIF.
      CLEAR <FN>-TPRNCP.
      CLEAR <FN>-TPRNIN.
      LIFEX3 = ''.
      ENDSELECT.
      ENDSELECT.
      ENDSELECT.
      ENDSELECT.
    endform.                    " GETDATA
    *&      Form  PROCESS
          text
    -->  p1        text
    <--  p2        text
    form PROCESS .
    SORT ITAB BY  VKBUR VBELN VBELN1 BELNR .
    OUT1 = 0.
    wrbtr1 = 0.
    DMbtr1 = 0.
    CLEAR ITAB.
    jtab[] = itab[].
    LOOP AT ITAB .
    LOOP AT JTAB .
    IF ITAB-VBELN1 = JTAB-VBELN1.
    OUT1   = OUT1 + JTAB-WRBTR .
    WRBTR1 = WRBTR1 + JTAB-WRBTR .
    DMBTR1 = DMBTR1 + JTAB-DMBTR.
    ENDIF.
    ENDLOOP.
    ITAB-WRBTR = WRBTR1 .
    ITAB-DMBTR = DMBTR1 .
       IF OUT1 = '0'.
       ITAB-OUT = ITAB-NETWR.
    ELSE.
        ITAB-OUT = ITAB-NETWR - OUT1.
    ENDIF.
      IF ITAB-WAERS <> ITAB-WAERK.
       ITAB-NETWR1 = ITAB-NETWR * ITAB-KURRF.
       ITAB-OUT = ITAB-NETWR1 - ITAB-DMBTR.
       ITAB-OUTINR = ITAB-OUT.
       ITAB-WAERK1 = 'INR'.
      ELSE.
       ITAB-NETWR1 = ITAB-NETWR.
       ITAB-OUT = ITAB-NETWR - ITAB-WRBTR.
       ITAB-WAERK1 = ITAB-WAERK.
       ITAB-OUTINR = ITAB-OUT.
      ENDIF.
      IF ITAB-WAERS <> 'INR'.
       ITAB-NETWR1  = ITAB-NETWR * ITAB-KURRF.
       ITAB-OUTINR = ITAB-OUT * ITAB-KURRF.
      ENDIF.
    MODIFY ITAB.
    OUT1 = 0.
    WRBTR1 = 0.
    DMBTR1 = 0.
    ENDLOOP.
    LOOP AT ITAB.
      IF ITAB-NETWR1 < ITAB-DMBTR.
       ITAB-OUT = '0'.
       ITAB-OUTINR = '0'.
      ENDIF.
    MODIFY ITAB.
    ENDLOOP.
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING VBELN1.
    endform.                    " PROCESS
    *&      Form  DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form DISPLAY .
    SORT ITAB BY  VKBUR VBELN VBELN1 .
    PERFORM INIT_FIELDCAT USING GM_FIELDCAT[] .
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = repname
       is_layout   = ls_layout
    I_STRUCTURE_NAME = 'ITAB'
       IT_FIELDCAT                       = GM_FIELDCAT[]
       it_sort     = lt_sort
        IT_EVENTS = GT_EVENTS[]
         IS_PRINT    = GS_PRINT
          I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
       IS_VARIANT                        = G_VARIANT
      TABLES
        t_outtab                          = ITAB
    IF sy-subrc <> 0.
    ENDIF.
    endform.                    " DISPLAY
    *&      Form  INIT_FIELDCAT
          text
         -->P_GM_FIELDCAT[]  text
    form INIT_FIELDCAT USING E01_LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV .
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    CLEAR FLDNAMES.
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'VBELN'.
    FLDNAMES-FIELDNAME    = 'VBELN'.
      LS_FIELDCAT-COL_POS      = 1.
      LS_FIELDCAT-KEY          = 'X'.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = ' S. O. No. '.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'AUDAT'.
    FLDNAMES-FIELDNAME    = 'AUDAT'.
      LS_FIELDCAT-COL_POS      = 2.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'DOC DATE'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'KUNNR'.
    FLDNAMES-FIELDNAME    = 'KUNNR'.
      LS_FIELDCAT-COL_POS      = 3.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'SOLD-TO-PARTY'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'NAME1'.
    FLDNAMES-FIELDNAME    = 'NAME1'.
      LS_FIELDCAT-COL_POS      = 4.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'NAME OF SOLD-TO-PARTY'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'BSTKD'.
    FLDNAMES-FIELDNAME    = 'BSTKD'.
      LS_FIELDCAT-COL_POS      = 5.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'P.O. NO'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'BSTDK'.
    FLDNAMES-FIELDNAME    = 'BSTDK'.
      LS_FIELDCAT-COL_POS      = 6.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'P.O. DATE'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'TPRNCP'.
    FLDNAMES-FIELDNAME    = 'TPRNCP'.
      LS_FIELDCAT-COL_POS      = 7.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'PRNCP ACK No'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'TPRNIN'.
    FLDNAMES-FIELDNAME    = 'TPRNIN'.
      LS_FIELDCAT-COL_POS      = 8.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'PRNCP INV No'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'KUNRG'.
    FLDNAMES-FIELDNAME    = 'KUNRG'.
      LS_FIELDCAT-COL_POS      = 9.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'PRINCIPAL'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'NAME2'.
    FLDNAMES-FIELDNAME    = 'NAME2'.
      LS_FIELDCAT-COL_POS      = 10.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'PRINCIPAL NAME'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'VBELN1'.
    FLDNAMES-FIELDNAME    = 'VBELN1'.
      LS_FIELDCAT-COL_POS      = 11.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'INVOICE No.'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'FKDAT'.
    FLDNAMES-FIELDNAME    = 'FKDAT'.
      LS_FIELDCAT-COL_POS      = 12.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'INVOICE DATE'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'NETWR'.
    FLDNAMES-FIELDNAME    = 'NETWR'.
      LS_FIELDCAT-COL_POS      = 13.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'INVOICE AMOUNT'.
      LS_FIELDCAT-datatype     = 'CURR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
      LS_FIELDCAT-cfieldname     = 'WAERK'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
    LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'WAERK'.
    FLDNAMES-FIELDNAME    = 'WAERK'.
      LS_FIELDCAT-COL_POS      = 14.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'INV CURR'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'KURRF'.
    FLDNAMES-FIELDNAME    = 'KURRF'.
      LS_FIELDCAT-COL_POS      = 15.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'EX. RATE'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
    LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'NETWR1'.
    FLDNAMES-FIELDNAME    = 'NETWR1'.
      LS_FIELDCAT-COL_POS      = 16.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'INV.AMT.IN INR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
    LS_FIELDCAT-TABNAME      = 'ITAB_VBMTV'.
      LS_FIELDCAT-FIELDNAME    = 'TDCRNO'.
      LS_FIELDCAT-COL_POS      = 17.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'CREDIT NOTE NO'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    LS_FIELDCAT-TABNAME      = 'ITAB_VBMTV'.
      LS_FIELDCAT-FIELDNAME    = 'TDCRVA'.
      LS_FIELDCAT-COL_POS      = 18.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'AMT OF CREDIT NOTE'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'WRBTR'.
    FLDNAMES-FIELDNAME    = 'WRBTR'.
      LS_FIELDCAT-COL_POS      = 19.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'REC. AMOUNT'.
      LS_FIELDCAT-datatype     = 'CURR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
      LS_FIELDCAT-cfieldname     = 'WAERS'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
    LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'WAERS'.
    FLDNAMES-FIELDNAME    = 'WAERS'.
      LS_FIELDCAT-COL_POS      = 20.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'REC. AMOUNT CURR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'DMBTR'.
    FLDNAMES-FIELDNAME    = 'DMBTR'.
      LS_FIELDCAT-COL_POS      = 21.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'REC. AMT IN INR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB'.
      LS_FIELDCAT-FIELDNAME    = 'OUT'.
    FLDNAMES-FIELDNAME    = 'OUT'.
      LS_FIELDCAT-COL_POS      = 22.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'OUTSTANDING AMOUNT'.
      LS_FIELDCAT-datatype     = 'CURR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
      LS_FIELDCAT-cfieldname     = 'WAERK1'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    *APPEND FLDNAMES.
    *CLEAR FLDNAMES.
      LS_FIELDCAT-TABNAME      = 'ITAB_VBMTV'.
      LS_FIELDCAT-FIELDNAME    = 'WAERK1'.
      LS_FIELDCAT-COL_POS      = 23.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'OUT. CURR'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
    LS_FIELDCAT-TABNAME      = 'ITAB_VBMTV'.
      LS_FIELDCAT-FIELDNAME    = 'OUTINR'.
      LS_FIELDCAT-COL_POS      = 24.
      LS_FIELDCAT-KEY          = ''.
      LS_FIELDCAT-KEY_SEL      = 'X'.
      LS_FIELDCAT-SELTEXT_L    = 'OUT IN INR'.
      LS_FIELDCAT-DO_SUM       = 'X'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT  .
      CLEAR LS_FIELDCAT.
      DEFINE m_sort.
       add 1 to ls_sort-spos.
       LS_SORT-TABNAME = 'ITAB'.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      m_sort 'VBELN' 'X'.                  " Sort by vkorg and subtotal
      ls_layout-cell_merge = 'X'.
    endform.                    " INIT_FIELDCAT
    *&      Form  BUILD_COMMENT
          text
         -->P_HEADING[]  text
    form BUILD_COMMENT  using p_heading TYPE SLIS_T_LISTHEADER.
    DATA: HLINE TYPE SLIS_LISTHEADER,
            TEXT(60) TYPE C,
            SEP(20) TYPE C.
      CLEAR: HLINE, TEXT.
      HLINE-TYP  = 'H'.
      WRITE: TEXT-101 TO TEXT+23.
      HLINE-INFO = TEXT.
      APPEND HLINE TO P_HEADING.
      CLEAR TEXT.
      WRITE: 'User: ' TO TEXT,
             SY-UNAME TO TEXT+6,
             'Date: ' TO TEXT+25,
             SY-DATUM TO TEXT+31,
             'Page: ' TO TEXT+50,
             SY-PAGNO TO TEXT+56.
      HLINE-INFO = TEXT.
      APPEND HLINE TO P_HEADING.
    endform.                    " BUILD_COMMENT
    *&      Form  EVENTTAB_BUILD
          text
         <--P_GT_EVENTS  text
    form EVENTTAB_BUILD  changing LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  COMMENT_BUILD
          text
         <--P_GT_LIST_TOP_OF_PAGE  text
    form COMMENT_BUILD  changing GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      IF ZFOR_O = 'X'.
      GS_LINE-INFO = 'OUTSTANDING IN ZFOR'.
      ELSEIF ZCUS_O = 'X'.
      GS_LINE-INFO = 'OUTSTANDING IN ZCUS'.
      ENDIF.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
    endform.                    " COMMENT_BUILD
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    *&      Form  read_princ_no
          text
    -->  p1        text
    <--  p2        text
    form read_crdt_no .
      s_tdid = 'ZCRN'.
      s_tdobject = 'VBBK'.
      LOOP AT itab.
        t_aubel = itab-vbeln1.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
      CLIENT                        = SY-MANDT
            id                            = s_tdid
            language                      = sy-langu
            name                          = t_aubel
            object                        = s_tdobject
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
          TABLES
            lines                         = zline
         EXCEPTIONS
           id                            = 1
           language                      = 2
           name                          = 3
           not_found                     = 4
           object                        = 5
           reference_check               = 6
           wrong_access_to_archive       = 7
           OTHERS                        = 8.
        IF NOT zline[] IS INITIAL.
          READ TABLE zline INDEX 1.
          itab-tdcrno = zline-tdline.
          CLEAR zline.
          REFRESH zline.
          MODIFY itab.
          CLEAR ITAB.
        ENDIF.
      ENDLOOP.
    endform.                    " read_princ_no
    form read_crdt_val .
      s_tdid = 'ZCRV'.
      s_tdobject = 'VBBK'.
      LOOP AT itab.
        t_aubel = itab-vbeln1.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
      CLIENT                        = SY-MANDT
            id                            = s_tdid
            language                      = sy-langu
            name                          = t_aubel
            object                        = s_tdobject
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
          TABLES
            lines                         = zline
         EXCEPTIONS
           id                            = 1
           language                      = 2
           name                          = 3
           not_found                     = 4
           object                        = 5
           reference_check               = 6
           wrong_access_to_archive       = 7
           OTHERS                        = 8.
        IF NOT zline[] IS INITIAL.
          READ TABLE zline INDEX 1.
          itab-tdcrva = zline-tdline.
          CLEAR zline.
          REFRESH zline.
          MODIFY itab.
          CLEAR ITAB.
        ENDIF.
      ENDLOOP.
    endform.                    " read_crdt_val
    *&      Form  GTEXT
          text
    -->  p1        text
    <--  p2        text
    form GTEXT .
    LOOP AT ITAB.
        CONCATENATE ITAB-EXTDEL MPART INTO T_AUBEL.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
          CLIENT                        = SY-MANDT
            id                            = 'ZPIN'        "S_TDID
            language                      = SY-LANGU
            name                          = T_AUBEL
            object                        = 'VBBP'        "S_TDOBJECT
          ARCHIVE_HANDLE                = 0
          LOCAL_CAT                     = ' '
        IMPORTING
          HEADER                        =
          tables
            lines                         = ZLINE
         EXCEPTIONS
           ID                            = 1
           LANGUAGE                      = 2
           NAME                          = 3
           NOT_FOUND                     = 4
           OBJECT                        = 5
           REFERENCE_CHECK               = 6
           WRONG_ACCESS_TO_ARCHIVE       = 7
           OTHERS                        = 8.
        IF NOT ZLINE[] IS INITIAL.
          READ TABLE ZLINE INDEX 1.
          ITAB-TPRNIN = ZLINE-TDLINE.
          CLEAR zline.
          REFRESH zline.
          MODIFY itab.
          CLEAR ITAB.
        ENDIF.
      ENDLOOP.
    endform.                    " GTEXT

  • ABAP Reports and SAP Query

    Hi Experts,
    I have question regarding ABAP Reports, SAP Query, and Transaction with variant.  How are we securing one the above reports that we assign them through pfcg.  We can secure custom program by custom transaction or define the auth group in S_PROGRAM auth object but in this case we have to assign SA38 in production. is that correct?
    Please help me understand difference between the ABAP reports and SAP query. Is the ABAP reports same as Program or they are different.
    Thanks in advance
    Faisal
    Edited by: Faisal on Jun 30, 2009 11:06 PM

    Hi,
    1) End user security (role matrix coordinate with process team)
    This role Matrix design is most important where we can put restrictions and use SoD.
    2) Secure Table (by auth group)
    Table TDDAT and use of transaction se54 for security tables to right auth Groups. Secure s_tabu_dis, s_tabu_cli.
    3) Secure program (as you said ABAP reports are referred to Program)
    Use of table TPGP and program RSCSAUTH for assignment of groups to Program. SA38 Running of SA38 requires a minimum SUBMIT in user Action. A user having SA38 is dangerous as he/she is now enabled to run any report. Hence protection in Auth Group is needed. Verify each and every program is having authority check statement and Auth Group or not before assigning sa38. As you mentioned its best to avoid SA38 and create CUSTOM TXN for each report.
    (We should also SECURE S_DEVELOP in Production properly along with ur points. Please Note).
    4) Secure some batch jobs roles for batch job
    Secure by s_btch* objects and less access to se36.
    5) Create support roles for cutover activity during Go-live
    That is always needed. Go ahead.
    6) Emergency roles & IT roles for support
    This is very much needed as a role of Mitigation and Fire Fighting for Temporary access. Ensure to enable ur audit parameters in RZ10 (rsau* sm20,RSLG* for sm21). Give emergency access but enable audit via sm19 and get audit reports from sm20 and sm21 immediately after the use of emergency access.
    There are also other auth objects we need to be care ful which is a long list and hope every body ensures that (s_cts,a_admi,s_trans, tables ssm_cust, prgn,t000) etc and a host of others. Besh wishes. Let us know if any issue.
    Regards
    Aveek.

  • Regarding SET TITLEBAR in normal ABAP report

    Hi All,
        I  wnat to know the  use of SET TITLEBAR command in ABAP report . i have searched the forum but i am not find any sutable answers.
    for what purpose we  use the SET TITLEBAR in normal ABAP report.
    Regards
    CB

    SET TITLEBAR - Liste
    Syntax
    SET TITLEBAR title [OF PROGRAM prog]
                       [WITH text1 ... text9].
    Extras:
    1. ... OF PROGRAM prog
    2. ... WITH text1 ... text9
    Effect
    During list processing, this statement sets the GUI title, specified in title, for the display window of the current list level and all following list levels up to the next statement SET TITLEBAR. The statement has - for the most part - the same syntax and semantics as for screens.
    In contrast to the screens of dynpros, each list level automatically remains linked to the title set for it. When you return from the display of a higher list level to the display of a lower list level, the latter is displayed with the title that was set for it.
    Check the HELP file of SAP before posting your queries.

  • Regarding curves IN abap REPORT

    hi experts,
    i got one assignment ,i have to show the graphical representaton of the output data in the abap report,
    i have to create  the bell curve on the basis of appraisal data which will come in the output how will i proceed for this plz help me remember i have to create this only with the help of abap report or alv report plz  help me considering this point .
    how will i create x axis ,y axis or any bell curve plz throw light ,it will be fruitful for u also as this things we have make it possible without BI but only ABAP.
    plz help me if possible send me the codes or guide me.

    Hi ,
    To start with X and Y axis u can refer the fm GRAPH_2D  to illustrate  the x and y axis .
    There is another FM GRAPH_3D ..
    I have never tried with curve plotting but yielded the o/p in bargraphs .
    Br,
    Vijay

  • HR ABAP report

    Hello,
    I am writing a bespoke HR ABAP report. I am using logical database PNP for this.
    I also need to include the Scale Proficiency Text in my report.
    I have had a look at the SAP standard Qualifications Overview report and I can see that this uses the logical database PCH.
    As I can only link to a single logical data, I am looking for a way of including the Scale Proficiency Text in my report.
    Does anyone have any ideas on this?
    Thanks,
    Ruby

    Hi,
    "" rp_provide_from_last p0033 space pn-begda pn-endda""
    Here if u don't want subtype specific records then give space otherwise u have to specify Subtype instead of space.
    ""provide * from p0033 between pn-ebgda and pn-endda
    endprovide.""
    used as loop where all records for the employee would be selected
    But if u use
    ""rp_provide_from_last p0033 '9001' pn-begda pn-endda""
    It will fetch only latest record for particular employee whose subtype is 9001.
    Hope it will help u!!!
    Regards,
    Aparna

  • Error in Phase Run ABAP report

    Hi All,
    We are running an installation on I5/OS for ERP 6.0 EHP5. Installation is stucked at phase Run ABAP reports where it is trying to run RSWBOINS report and giving an error SQL error -7008. Log says ddic user is not able to login in the system and RFC all fails. However system is up and running fine.
    I checked number of notes 116192 but it did not help. One note says to upgrade the database library and we did the same but issue still remains. Anyone phase similar errors, Please suggest.
    Thanks
    Sunny

    Hi Sunny,
    it sounds like some tables are not journaled. You may want to try to run AS4FIXFILE DBLIB(R3<sid>DATA) STRJRN(*YES).
    If that does not help, I suggest to check SAP note 1387754, and to try the workaround described there, or to get the newest version of AS4FXIFILE and to try to run it again.
    Best regards,
    Dorothea Stein

  • Abap Report including sales orders and delivery data.

    Hi Experts,
    I Want to develop a new abap report which would contain the data for sales orders and delivery.
    I want to fetch all the sales orders based on the ship date (LIKP-WADAT_IST) of the delievry.
    Could anyone please let me know how to fetch teh data or is their any function module which would help me to solve my problem.
    <Removed by moderator>
    Thanks,
    Komal.
    Moderator message : Spec dumping not allowed. Thread locked.
    Edited by: Vinod Kumar on Aug 10, 2011 1:25 PM

    post this in ABAP forum for quicker response.
    Regards
    Raja

  • SUBMIT an ABAP report after creating the WI but before completion of WI.

    Dear All,
    I am having an activity which sends the approval work item.
    Now my requirement is to SUBMIT an ABAP report after creating the WI but before completion of WI.
    I can not call this report before approval activity because i need to pass this WI ID to this report.
    Please suggest some way to solve this.
    Regards,
    Amar

    Hello,
    You could create a 2-from-2 fork and put the workitem in one branch and the report in the other. Have the report branch wait 1 minute and then read the workitem id from the other branch.
    What is the purpose of this report? Why does it need the workitem id?
    regards
    Rick Bakker
    hanabi technology

  • Abap Report Performance

    One of our abap report is extremely slow, this report is used by all
    branches of our company
    and we are facing serious performance problem in this report. I have
    analyzed the problem
    and noted following things.
    1) The report used "BSIS" table for a query.
    2) In peak times it is observed lot of IO wait is happening on that
    particular report and on
    "BSIS" table.
    3) After analysis of table BSIS it is noted that table has more than 12
    million records and
    exceeding table class limit in technical setting of tables.
    4) Size of table is 4 GB.
    5) Table also does not have other indexes apart from one composite PK-
    unique index. This
    index is composed of 9 fields.
    6) Update Stats is has been taken in 10 minutes of BSIS~0.
    We are closely analyzing code and where clause of our report.
    I want to ask do we need other indexes specially on DATE field which is
    not included in
    existing index?
    Do we need index rebuild as stats are gathered in 10 minutes which is
    quite a long time in
    my opinion?
    Do we need table partition right now as BSIS has 12 million records and
    4 GB of size ?
    Best Regards
    Waqas

    Hi,
    1) table bsis is the table for open items (GL-accounts)
    -> perfect state of such a table is that there are <b>zero</b> entries,
    because all open items had to be cleared and are moved to table bsas
    (cleared items)
    -> so 1st there is an organisational problem in your company / account dept.
    why there are so many open items?
    2) analyse the select statements and the abaps, which fetch bsis-table with
    st05
    -> check, whether key-fields BUKRS and HKONT are filled in where-clause
    3)-> look to wiki- ABAP Performance and Tuning
    https://wiki.sdn.sap.com/wiki/display/HOME/ABAPPerformanceand+Tuning#ABAPPerformanceandTuning-Whattoolscanbeusedtohelpwithperformancetuning%3F
    regards Andreas

  • Product for presenting ABAP report output in Dashboard Presentation

    <u>Background</u>
    Monash University environment is SAP ERP  ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement.  The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and  Corporate Credit Card expenditure).  This information  is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
    <u>Requirement</u>
    To present output from our Spend Analysis Report  in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data..  Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the  set up time for either of these solutions is prohibitive.  Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.   
    Some colleagues visited a  conference a couple of weeks ago and saw a demonstration of a product call XenoCube  http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
    which was proposed as a quick way to present SAP 'raw' report output in a more readable form.  Other solutions in this space that have been suggested include:-
    Zycus - Actionable Spend Analysis – Zycus.com
    Emptoris Spend Analysis  - emptoris.com
    ONIQUA Enterprise Analytics– oniqua.com.au
    Ariba Buyer – ariba.com
    SAS Spend Analysis – sas.com
    Etesius – SpendGuardian  etesius.com
    Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined?  The main selection criteria will include a product which is:
    a) quick & easy to implement,
    b)  presentation and manipulation of ABAP extracted data
    c) is scalable and
    d)  is reasonably priced.
    Grateful for any advice regarding a solution .
    Thank-you

    Hi,
      This development writes to mapped network drive in Unix. The concept will be similar.
    [http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
    cheers
    Aveek

  • Options for ABAP report output in Dashboard type presentation

    Background
    Monash University environment is SAP ERP ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement. The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and Corporate Credit Card expenditure). This information is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
    Requirement
    To present output from our Spend Analysis Report in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data.. Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the set up time for either of these solutions is prohibitive. Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.
    Some colleagues visited a conference a couple of weeks ago and saw a demonstration of a product call XenoCube http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
    which was proposed as a quick way to present SAP 'raw' report output in a more readable form. Other solutions in this space that have been suggested include:-
    Zycus - Actionable Spend Analysis – Zycus.com
    Emptoris Spend Analysis - emptoris.com
    ONIQUA Enterprise Analytics– oniqua.com.au
    Ariba Buyer – ariba.com
    SAS Spend Analysis – sas.com
    Etesius – SpendGuardian etesius.com
    Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined? The main selection criteria will include a product which is:
    a) quick & easy to implement,
    b) presentation and manipulation of ABAP extracted data
    c) is scalable and
    d) is reasonably priced.
    Grateful for any advice regarding a solution .
    Thank-you

    Hi,
      This development writes to mapped network drive in Unix. The concept will be similar.
    [http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
    cheers
    Aveek

  • Create ABAP Report  for  Infoprovider

    Could anyone tell me Function module to fetch Infoprovider(s) for creating ABAP report on.
    The report should provide:
    Input:
    - Infoprovider(s)
    - Date-range: default: last 6 months
    Output:
    - data which is shown in the requests tab as described before, preceeded with the name of the infoprovider and having the possibility to download to Excel.
    Thanks

    Hi,
    you can easily use it as a template to create your own program. The program just shows what to do and how you need to populate the tables in order to pass selection parameters to the fm to get the required data back.
    Here a little demo I created to do it a bit flexible from different cubes:
    DATA: ref_data_tab TYPE REF TO data,
          ref_data_line TYPE REF TO data,
          it_sfc TYPE rsdri_th_sfc,
          l_sfc TYPE rsdri_s_sfc,
          it_sfc2 TYPE rsdd_th_sfc,
          l_sfc2 TYPE rrsfc01,
          it_sfk TYPE rsdri_th_sfk,
          l_sfk TYPE rsdri_s_sfk,
          it_sfk2 TYPE rsdd_th_sfk,
          l_sfk2 TYPE rrsfk01,
          l_first_call TYPE rs_bool,
          l_end_of_data TYPE rs_bool,
          l_tabname(30) TYPE c,
          l_cube(30) TYPE c,
          it_cobpro TYPE rsd_t_cob_pro,
          l_cobpro TYPE rsd_s_cob_pro.
    FIELD-SYMBOLS: <e_t_data> TYPE table,
                   <l_data> TYPE ANY,
                   <fs_field>.
    PARAMETERS: pa_cube TYPE rsinfoprov OBLIGATORY DEFAULT '/NBAG/CML_C05',
                pa_debug AS CHECKBOX.
    IF pa_cube(1) = '0'.
      CONCATENATE '/BI0/V' pa_cube '2' INTO l_tabname.
    ELSE.
      CONCATENATE '/BIC/V' pa_cube '2' INTO l_tabname.
    ENDIF.
    CREATE DATA ref_data_tab TYPE TABLE OF (l_tabname).
    CREATE DATA ref_data_line TYPE (l_tabname).
    ASSIGN ref_data_tab->* TO <e_t_data>.
    ASSIGN ref_data_line->* TO <l_data>.
    IF pa_debug = 'X'.
      BREAK-POINT.
    ENDIF.
    CALL FUNCTION 'RSD_COB_PRO_ALL_GET'
      EXPORTING
        i_infocube                      = pa_cube
      I_WITH_ATR_NAV                  = RS_C_FALSE
      I_WITH_META_IOBJ                = RS_C_FALSE
      I_OBJVERS                       = RS_C_OBJVERS-ACTIVE
      I_BYPASS_BUFFER                 = RS_C_FALSE
    IMPORTING
       e_t_cob_pro                     = it_cobpro
      E_T_IOBJ_CMP                    =
      E_T_ATR                         =
      E_TLOGO                         =
    EXCEPTIONS
       infocube_not_found              = 1
       error_reading_infocatalog       = 2
       illegal_input                   = 3
       OTHERS                          = 4.
    IF sy-subrc <> 0.
      WRITE: / sy-subrc, sy-msgno, sy-msgid, sy-msgv1, sy-msgv2, sy-msgv3.
    ENDIF.
    CLEAR: it_sfk[], it_sfc[].
    LOOP AT it_cobpro INTO l_cobpro.
      IF l_cobpro-iobjtp = 'KYF'.
        IF l_cobpro-ncumfl IS INITIAL.
          l_sfk-kyfnm = l_cobpro-iobjnm.
          l_sfk-kyfalias = l_cobpro-iobjnm.
          l_sfk-aggr = l_cobpro-aggrgen.
          INSERT l_sfk INTO TABLE it_sfk.
          MOVE-CORRESPONDING l_cobpro TO l_sfk2.
          INSERT l_sfk2 INTO TABLE it_sfk2.
        ENDIF.
      ELSE.
        IF l_cobpro-dimension NP '*P'.
          l_sfc-chanm = l_cobpro-iobjnm.
          l_sfc-chaalias = l_cobpro-iobjnm.
          l_sfc-orderby = 0.
          INSERT l_sfc INTO TABLE it_sfc.
          MOVE-CORRESPONDING l_cobpro TO l_sfc2.
          INSERT l_sfc2 INTO TABLE it_sfc2.
        ENDIF.
      ENDIF.
    ENDLOOP.
    CLEAR l_end_of_data.
    l_first_call = 'X'.
    WHILE l_end_of_data = space.
      CALL FUNCTION 'RSDRI_INFOPROV_READ'
        EXPORTING
          i_infoprov                   = pa_cube
          i_th_sfc                     = it_sfc
          i_th_sfk                     = it_sfk
      I_T_RANGE                    =
      I_TH_TABLESEL                =
      I_T_RTIME                    =
       i_reference_date             = sy-datum
      I_T_REQUID                   =
      I_SAVE_IN_TABLE              = ' '
      I_TABLENAME                  =
      i_save_in_file               = 'X'
      i_filename           = 'C:\test.csv'
       i_packagesize                = 1000
      I_MAXROWS                    = 0
         i_authority_check            = ' '
      I_CURRENCY_CONVERSION        = RS_C_TRUE
       i_use_db_aggregation         = ' '
       i_use_aggregates             = ' '
       i_rollup_only                = ' '
      I_READ_ODS_DELTA             = RS_C_FALSE
      I_CALLER                     = RSDRS_C_CALLER-RSDRI
      I_DEBUG                      = RS_C_FALSE
       IMPORTING
         e_t_data                     = <e_t_data>
         e_end_of_data                = l_end_of_data
      E_AGGREGATE                  =
      E_SPLIT_OCCURRED             =
        CHANGING
          c_first_call                 = l_first_call
       EXCEPTIONS
         illegal_input                = 1
         illegal_input_sfc            = 2
         illegal_input_sfk            = 3
         illegal_input_range          = 4
         illegal_input_tablesel       = 5
         no_authorization             = 6
         ncum_not_supported           = 7
         illegal_download             = 8
         illegal_tablename            = 9
         trans_no_write_mode          = 10
         inherited_error              = 11
         x_message                    = 12
         OTHERS                       = 13.
      IF sy-subrc <> 0.
        WRITE: / sy-subrc, sy-msgno, sy-msgid, sy-msgv1, sy-msgv2, sy-msgv3.
        EXIT.
      ELSE.
        LOOP AT <e_t_data> INTO <l_data>.
          WRITE: / sy-tabix, ':'.
          LOOP AT it_cobpro INTO l_cobpro.
            IF l_cobpro-ncumfl IS INITIAL.
              ASSIGN COMPONENT l_cobpro-iobjnm OF STRUCTURE <l_data>
                  TO <fs_field>.
              IF sy-subrc = 0.
                WRITE: <fs_field>.
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDLOOP.
      ENDIF.
      CLEAR: l_first_call, <e_t_data>[].
      IF l_end_of_data <> space.
        EXIT.
      ENDIF.
    ENDWHILE
    Hope this helps a bit
    regards
    Siggi

  • Save the output of the abap report to local file in the pc

    Hi ALL,
    In my ABAP Report I am having a internal table with final data, right now I am moving that data to al11. but now I want to save that data in local PC as the file format given in the selection screen before executing the report.
    CAn any one say how to do this or suggest me how to proceed please.
    Ravi

    Hi Ravi,
    You can use the function module GUI_DOWNLOAD to store in a file on PC.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
            filename         = file_path
            filetype         = 'ASC'
    *       APPEND           = 'X'
            write_field_separator = 'X'
    *       CONFIRM_OVERWRITE = 'X'
       TABLES
            data_tab         = it_finaltab     "need to declare and populate
       EXCEPTIONS
            file_open_error  = 1
            file_write_error = 2
            OTHERS           = 3.
    Regards,
    Chandra Sekhar

  • ABAP Report to HTML in BSP

    Hi,
    I have read the very interesting posts about calling ABAP reports from BSP applications.
    Nevertheless, I noticed 2 constraints in order for a Report to be called :
    - the <b>sap/bc/report</b> must be active in Transaction SICF
    - the report must have an <b>Authorization Group</b> defined
    <b>Am i right, so far ?</b>
    Besides, I tried to implement the solution given in the forum as follows :
    DATA: html TYPE TABLE OF w3html. " occurs 10 with header line.
    DATA: html_wa TYPE w3html.
    DATA: listobject TYPE TABLE OF abaplist. " occurs 10.
    DATA: report_name TYPE syrepid.
    DATA: result TYPE string.
    report_name = 'SHOWCOLO'.
    SUBMIT (report_name) EXPORTING LIST TO MEMORY AND RETURN .
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = listobject.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      EXPORTING
        report_name = 'WEBREPORTING_REPORT'
      TABLES
        html        = html
        listobject  = listobject.
    LOOP AT html INTO html_wa.
      CONCATENATE result html_wa INTO result SEPARATED BY space.
    ENDLOOP.
    The problem is that the 'WWW_HTML_FROM_LISTOBJECT' is fauly. There is a call to the FM 'RECORDER_PLAY_BACK' which itself calls 'ABAPLIST_VERSION %_RFC' and the code stops !
    <b>Any idea why this is happening ?
    Am I missing a service in SICF ?</b>
    Of course, when I do the same code in a classic ABAP Program everything works fine...
    Thanks in advance.
    Cheers,
    Guillaume
    Message was edited by: Guillaume Garcia

    <i> the sap/bc/report must be active in Transaction SICF
    - the report must have an Authorization Group defined</i>
    both the points above are correct, more than that, using sap/bc/report  you cannot pass selection screen values or variants.
    regarding
    'WWW_HTML_FROM_LISTOBJECT'
    i have been using this and no problem at all. where is your BSP you wrote the logic using 'WWW_HTML_FROM_LISTOBJECT'.
    also dose it generate a dump? if so can you give us the gist of the dump analysis.
    REgards
    Raja

Maybe you are looking for

  • How do I use VISA to perform GET (Group Execute Trigger) to three DMMs?

    Hi, My systems have about 4 GPIB instruments connecting to my computer via Agilent GPIB-USB Interface card.  I have to use VISA to communicate with the interface and instrument.  I wish I can use NI488,.2 but it does not seem to work with Agilent car

  • Write data in Excel Sheet

    I want to write data from oracle table to Excel sheet in formated way like bold or merge the cell in case of same value. Edited by: shiv kumar on Jul 27, 2010 10:18 AM

  • ME5A PO FIELD PROBLEM

    Hello Guru, we have facing problem in ME5A report. we have PR No .4300000338  and Its Line Number 10 qty is 500. Now Purchse department make 3 PO against this PR line item. 1100001428    200 qty 1100001429   100 qty 1100001496  200 qty. but during Ru

  • Check specific value in alert

    dear all, we have table 'x' with column c1, we want to create an even alert which will fire when the user enter value equals to 5 Kindly Advice. Regards...Ashraf

  • I can´t synchronise my iphone. The process doesn´t start

    Hey folks since three days i cannot synchronise my Iphone.Itunes tells me the process could not start. I already made newstart with it  but it didn´t work. any ideas ???would be great!!!! thanks