Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata
Error rendering macro 'code': Invalid value specified for parameter 'lang'
REPORT ZALVTEST.
TABLES VBAK.
* type pools
TYPE-POOLS SLIS.
* types and internal tables
*Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
END OF T_VBAK.
DATA IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0.
*ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FLDCAT TYPE SLIS_FIELDCAT_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
DATA: DATE1(10).
* selection screen design
SELECT-OPTIONS: VBELN FOR VBAK-VBELN.
* start of selection
START-OF-SELECTION.
  PERFORM DATA_RETRIEVAL.
  PERFORM BLD_FLDCAT.
  PERFORM BLD_LAYOUT.
  PERFORM DISPLAY_ALV_REPORT.
*-----------------------------------------------------------------------
* build catalog
*-----------------------------------------------------------------------
*Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
  W_FLDCAT-FIELDNAME = 'VBELN'.
  W_FLDCAT-SELTEXT_M = 'Sales_Document'.
  W_FLDCAT-COL_POS = 0.
  W_FLDCAT-OUTPUTLEN = 15.
  W_FLDCAT-KEY = 'X'.
  W_FLDCAT-ICON = 'X'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'ERDAT'.
  W_FLDCAT-SELTEXT_L = 'Record_Date_created'.
  W_FLDCAT-COL_POS = 1.
  W_FLDCAT-KEY = 'X'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'ERNAM'.
  W_FLDCAT-SELTEXT_L = 'Cteated_Person_Name'.
  W_FLDCAT-COL_POS = 2.
  W_FLDCAT-EMPHASIZE = 'C011'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'AUDAT'.
  W_FLDCAT-SELTEXT_M = 'Document_Date'.
  W_FLDCAT-COL_POS = 3.
  W_FLDCAT-EMPHASIZE = 'C110'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'VBTYP'.
  W_FLDCAT-SELTEXT_L = 'SDDocument_category'.
  W_FLDCAT-COL_POS = 4.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'NETWR'.
  W_FLDCAT-SELTEXT_L = 'Net_Value'.
  W_FLDCAT-COL_POS = 5.
  W_FLDCAT-OUTPUTLEN = 10.
  W_FLDCAT-DO_SUM = 'X'.
  W_FLDCAT-DATATYPE = 'CURR'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'VKORG'.
  W_FLDCAT-SELTEXT_L = 'Sales_Organization'.
  W_FLDCAT-COL_POS = 6.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
  W_FLDCAT-FIELDNAME = 'VKGRP'.
  W_FLDCAT-SELTEXT_M = 'Sales_Group'.
  W_FLDCAT-COL_POS = 7.
  W_FLDCAT-EMPHASIZE = 'C801'.
  APPEND W_FLDCAT TO FLDCAT.
  CLEAR W_FLDCAT.
ENDFORM. "BLD_FLDCAT
*-----------------------------------------------------------------------
* display fatalog
*-----------------------------------------------------------------------
*Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
  GD_LAYOUT-NO_INPUT = 'X'.
  GD_LAYOUT-BOX_FIELDNAME = 'VBELN'.
ENDFORM. "BLD_LAYOUT
*Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
  GD_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM          = GD_REPID
      IS_LAYOUT                   = GD_LAYOUT
      I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE_SPLIT'
      IT_FIELDCAT                 = FLDCAT[]
    TABLES
      T_OUTTAB                    = IT_VBAK.
ENDFORM. "DISPLAY_ALV_REPORT
*-----------------------------------------------------------------------
* get data
*-----------------------------------------------------------------------
*Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
  SELECT VBELN
  ERDAT
  ERNAM
  AUDAT
  VBTYP
  NETWR
  VKORG
  FROM VBAK
  INTO TABLE IT_VBAK
  WHERE VBELN IN VBELN.
ENDFORM. "DATA_RETRIEVAL
*-----------------------------------------------------------------------
* build header for alv
*-----------------------------------------------------------------------
FORM TOP_OF_PAGE_SPLIT USING R_TOP TYPE REF TO CL_DD_DOCUMENT.
  DATA: S_TAB TYPE SDYDO_TEXT_TABLE,
  C_AREA TYPE REF TO CL_DD_AREA,
  TEXT TYPE SDYDO_TEXT_ELEMENT.
  TYPES: BEGIN OF TAB_TEXT,
  TEXT TYPE SDYDO_TEXT_ELEMENT,
  END OF TAB_TEXT.
  DATA: I_TEXT TYPE TABLE OF TAB_TEXT.
  DATA: W_TEXT TYPE TAB_TEXT.
  CALL METHOD R_TOP->INITIALIZE_DOCUMENT.
  CALL METHOD R_TOP->VERTICAL_SPLIT
    EXPORTING
      SPLIT_AREA  = R_TOP
      SPLIT_WIDTH = '70%'
    IMPORTING
      RIGHT_AREA  = C_AREA.
  CONCATENATE SY-DATUM+4(2)
  ' / '
  SY-DATUM+6(2)
  ' / '
  SY-DATUM(4)
  INTO DATE1.
  CONCATENATE 'DATE'
  DATE1
  INTO W_TEXT-TEXT
  SEPARATED BY ':'.
  APPEND W_TEXT TO I_TEXT.
  CONCATENATE 'time:' SY-UZEIT INTO W_TEXT .
  APPEND W_TEXT TO I_TEXT.
  CONCATENATE 'uesr:' SY-UNAME INTO W_TEXT .
  APPEND W_TEXT TO I_TEXT.
  CONCATENATE 'local date:' SY-DATLO INTO W_TEXT .
  APPEND W_TEXT TO I_TEXT.
  CONCATENATE 'time zone:' SY-ZONLO INTO W_TEXT .
  APPEND W_TEXT TO I_TEXT.
  S_TAB[] = I_TEXT[].
  CALL METHOD C_AREA->ADD_TEXT
    EXPORTING
      TEXT_TABLE   = S_TAB
      FIX_LINES    = 'X'
      SAP_FONTSIZE = CL_DD_DOCUMENT=>MEDIUM
      SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG.
  CALL METHOD R_TOP->ADD_GAP
    EXPORTING
      WIDTH = 60.
  TEXT = 'THIS IS REPORT HEADING'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'STRONG'.
  CALL METHOD R_TOP->NEW_LINE.
  CALL METHOD R_TOP->ADD_GAP
    EXPORTING
      WIDTH = 70.
  TEXT = 'THIS IS REPORT HEADING1'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'STRONG'.
  CALL METHOD R_TOP->NEW_LINE.
  CALL METHOD R_TOP->ADD_GAP
    EXPORTING
      WIDTH = 80.
  TEXT = 'THIS IS REPORT HEADING2'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'STRONG'.
  CALL METHOD R_TOP->NEW_LINE.
  TEXT = 'Report Subheading1'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'NORMAL'.
  CALL METHOD R_TOP->NEW_LINE.
  TEXT = 'Report Subheading2'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'NORMAL'.
  CALL METHOD R_TOP->NEW_LINE.
  TEXT = 'Report Subheading3'.
  CALL METHOD R_TOP->ADD_TEXT
    EXPORTING
      TEXT         = TEXT
      SAP_EMPHASIS = 'NORMAL'.
  CALL METHOD R_TOP->NEW_LINE.
ENDFORM. "TOP_OF_PAGE_SPLIT

 

Out Put :

 

  • No labels