Skip to Content
author's profile photo Former Member
Former Member

alv

how to give top of page using alv and how handle the events like top of page in alv

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:03 AM

    in REUSE_ALV_GRID_DISPLAY for the

    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'.

    Then TOP_OF_PAGE is an Event.

    Write ur Stattements in TOP_OF_PAGE Event.

    awrd points if useful

    Bhupal

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bhupal!

      I wanted my alv report to show the following fields only but its showing the entire report, can anyone help me please.This shows the contract list and goes through transaction va43.I have attached the report too.

      3. result screena. ONLY the billing plan lines fulfill ALL of followings are displayed1) Billing Status (FPLT- FKSAF) is “A” or “B”

      2) Billing Date (FPLT- AFDAT) is earlier than or equal to Base Date specified in selection screen

      b. One line for a billing plan line. If an item has multiple billing plan lines in selection, display them in multiple lines; data of Contract Header/Item & Billing Plan Header are the same for these lines, and only the data of Billing Plan line are different for these linesc. add fields of item data

      1) Internal Order # = VBAP-AUFNR

      2) Usage = VBAP-VKAUS

      d. billing plan header – by default, they are NOT displayed but the users have the option to display them

      1) Billing Play Type

      2) Start date

      3) End date

      4) Horizon

      e. add fields of billing plan header billing plan item.

      1) Settlement

      2) To

      3) Billing date

      4) Bill.value

      5) Bill St

      &----


      -

      *& Report ZSD_CONTRACT_LIST

      *&

      &----


      -

      &----


      -

      REPORT zsd_contract_list.

      INCLUDE zsd_contract_list_t01.

      ----


      -

      • Selection Screen

      ----


      -

      SELECTION-SCREEN BEGIN OF BLOCK m1 WITH FRAME TITLE text-t01.

      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t02.

      SELECT-OPTIONS: s_vkorg FOR vbak-vkorg MEMORY ID vko,

      s_vtweg FOR vbak-vtweg MEMORY ID vtw,

      s_spart FOR vbak-spart MEMORY ID spa,

      s_vkbur FOR vbak-vkbur MEMORY ID vkb.

      SELECTION-SCREEN SKIP 1.

      SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,

      s_erdat FOR vbak-erdat,

      s_ernam FOR vbak-ernam,

      s_guebg FOR vbak-guebg,

      s_gueen FOR vbak-gueen,

      s_auart FOR gv_auart MEMORY ID vta

      MATCHCODE OBJECT h_vakz.

      SELECTION-SCREEN SKIP 1.

      SELECT-OPTIONS:

      s_kunnr FOR vbak-kunnr,

      s_kunwe FOR vbap-oid_ship,

      s_kunre FOR wbrk-kunre.

      SELECTION-SCREEN END OF BLOCK b1.

      SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t03.

      SELECT-OPTIONS: s_werks FOR vbap-werks MEMORY ID wrk,

      s_lgort FOR vbap-lgort MEMORY ID lag,

      s_vstel FOR vbap-vstel MEMORY ID vst,

      s_route for vbap-route,

      s_matnr FOR vbap-matnr.

      SELECTION-SCREEN END OF BLOCK b2.

      SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t04.

      PARAMETERS: p_varia TYPE disvariant-variant MEMORY ID wrk,

      p_all AS CHECKBOX DEFAULT 'X',

      p_group AS CHECKBOX DEFAULT 'X'.

      SELECTION-SCREEN END OF BLOCK b3.

      SELECTION-SCREEN END OF BLOCK m1.

      ----


      -

      • Start of Selection

      ----


      -

      START-OF-SELECTION.

      PERFORM get_data.

      ----


      -

      • Display ALV

      ----


      -

      END-OF-SELECTION.

      IF gt_report[] IS INITIAL.

      MESSAGE s419(brain).

      ELSE.

      PERFORM create_alv.

      ENDIF.

      ----


      -

      • AT SELECTION-SCREEN ON VALUE-REQUEST *

      ----


      -

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varia.

      PERFORM f01_f4_variant CHANGING p_varia.

      &----


      -

      *& Form get_data

      &----


      -

      • text

      ----


      -

      FORM get_data .

      • Select the appropriate contract data.

      SELECT a~vbeln a~erdat a~ernam a~audat a~vbtyp a~auart a~vkorg

      a~vtweg a~spart a~vkbur a~guebg a~gueen a~kunnr a~kvgr4

      b~posnr b~matnr b~charg b~matkl b~arktx b~pstyv b~zmeng

      b~zieme b~kdmat b~werks b~lgort b~vstel b~netpr b~kpein

      b~kmein b~shkzg b~oid_extbol b~oid_miscdl b~oidrc b~oid_ship AS kunwe

      b~zzwprofid c~datbi c~datab b~route

      INTO CORRESPONDING FIELDS OF TABLE gt_sel

      FROM vbak AS a

      INNER JOIN vbap AS b ON a~vbeln = b~vbeln

      LEFT OUTER JOIN zsdsched AS c ON b~vbeln = c~vbeln AND

      b~posnr = c~posnr

      WHERE a~vbeln IN s_vbeln

      AND a~erdat IN s_erdat

      AND a~vbtyp = gc_g

      AND a~ernam IN s_ernam

      AND a~vkorg IN s_vkorg

      AND a~vtweg IN s_vtweg

      AND a~spart IN s_spart

      AND a~vkbur IN s_vkbur

      AND a~guebg IN s_guebg

      AND a~gueen IN s_gueen

      AND a~auart IN s_auart

      AND a~kunnr IN s_kunnr

      AND b~oid_ship IN s_kunwe

      AND b~werks IN s_werks

      AND b~lgort IN s_lgort

      AND b~vstel IN s_vstel

      and b~route in s_route

      AND b~matnr IN s_matnr.

      SORT gt_sel.

      IF NOT gt_sel[] IS INITIAL.

      • Get Bill-to Party's for Item Lines

      SELECT vbeln posnr parvw kunnr INTO CORRESPONDING FIELDS OF TABLE gt_vbpa

      FROM vbpa

      FOR ALL ENTRIES IN gt_sel

      WHERE vbeln = gt_sel-vbeln

      AND parvw = gc_re.

      • Select the remaining records from the ZSDSCHED Table.

      SELECT * FROM zsdsched

      INTO TABLE gt_sched

      FOR ALL ENTRIES IN gt_sel

      WHERE vbeln = gt_sel-vbeln

      AND posnr = gt_sel-posnr.

      SORT gt_sched.

      ENDIF.

      • Loop through captured data for additional information

      LOOP AT gt_sel INTO gs_report.

      • Find the bill-to party

      READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report-vbeln

      posnr = gs_report-posnr

      parvw = gc_re.

      IF sy-subrc <> 0.

      READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report-vbeln

      parvw = gc_re.

      CHECK sy-subrc = 0 AND gs_vbpa-kunnr IN s_kunre.

      ELSE.

      CHECK gs_vbpa-kunnr IN s_kunre.

      ENDIF.

      gs_report-kunre = gs_vbpa-kunnr.

      • Get the Customer's Name

      gs_report-kunnrt = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunnr ).

      gs_report-kunwet = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunwe ).

      gs_report-kunret = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunre ).

      • Get the scheduling lines for the item line.

      CLEAR gv_counter.

      IF NOT p_group IS INITIAL.

      • If we are grouping the lines add the icon button.

      LOOP AT gt_sched INTO gs_sched WHERE vbeln = gs_report-vbeln

      AND posnr = gs_report-posnr.

      IF gv_counter > 0.

      gs_report-addl_schd = '@1E@'.

      CONTINUE.

      ENDIF.

      MOVE-CORRESPONDING gs_sched TO gs_report.

      ADD 1 TO gv_counter.

      ENDLOOP.

      ELSE.

      • Otherwise get the rest of the schedule information

      READ TABLE gt_sched INTO gs_sched

      WITH KEY vbeln = gs_report-vbeln

      posnr = gs_report-posnr

      datbi = gs_report-datbi

      datab = gs_report-datab.

      IF sy-subrc = 0.

      MOVE-CORRESPONDING gs_sched TO gs_report.

      ENDIF.

      ENDIF.

      APPEND gs_report TO gt_report.

      ENDLOOP.

      • Remove any duplicates from the reporting table

      DELETE ADJACENT DUPLICATES FROM gt_report.

      • If Show all records is initial, delete non-scheduled lines (ex. Sub-items)

      IF p_all IS INITIAL.

      DELETE gt_report WHERE datbi = 0

      AND datab = 0.

      ENDIF.

      ENDFORM. " get_data

      &----


      -

      *& Form create_alv

      &----


      -

      • text

      ----


      -

      FORM create_alv .

      PERFORM initialize_fieldcat USING gt_fieldcat[].

      PERFORM populate_layout CHANGING gs_layout

      gs_variant.

      PERFORM populate_sort USING gt_sort[].

      PERFORM display_alv_report.

      ENDFORM. " create_alv

      &----


      -

      *& Form initialize_fieldcat

      &----


      -

      • Get and enhance the field catalog data

      ----


      -

      • -->L_FIELDCAT[] text

      ----


      -

      FORM initialize_fieldcat USING l_fieldcat TYPE slis_t_fieldcat_alv.

      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

      EXPORTING

      i_program_name = 'ZSD_CONTRACT_LIST'

      i_internal_tabname = 'GT_REPORT'

      i_inclname = 'ZSD_CONTRACT_LIST_T01'

      CHANGING

      ct_fieldcat = l_fieldcat

      EXCEPTIONS

      inconsistent_interface = 1

      program_error = 2

      OTHERS = 3.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'VBELN'.

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Contract'.

      ls_fieldcat-hotspot = 'X'.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNNRT'.

      ls_fieldcat-seltext_s =

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sold-to Name'.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNWET'.

      ls_fieldcat-seltext_s =

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Ship-to Name'.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNRET'.

      ls_fieldcat-seltext_s =

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Bill-to Name'.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'ADDL_SCHD'.

      IF NOT p_group IS INITIAL.

      ls_fieldcat-seltext_s = 'Schd'.

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Additional Scheduling Lines'.

      ls_fieldcat-icon = 'X'.

      CLEAR: ls_fieldcat-key,

      ls_fieldcat-ref_fieldname,

      ls_fieldcat-ref_tabname,

      ls_fieldcat-reptext_ddic,

      ls_fieldcat-ddic_outputlen.

      ls_fieldcat-hotspot = 'X'.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      ELSE.

      DELETE l_fieldcat INDEX sy-tabix.

      ENDIF.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'DATAB'.

      ls_fieldcat-seltext_s = 'Schd From'.

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. From Date'.

      CLEAR: ls_fieldcat-key.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'DATBI'.

      ls_fieldcat-seltext_s = 'Schd To'.

      ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. To Date'.

      CLEAR: ls_fieldcat-key.

      MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.

      ENDFORM. " initialize_fieldcat

      &----


      -

      *& Form populate_layout

      &----


      -

      • text

      ----


      -

      • <--GS_LAYOUT

      • <--GS_VARIANT

      ----


      -

      FORM populate_layout CHANGING gs_layout TYPE slis_layout_alv

      gs_variant TYPE disvariant.

      gs_layout-colwidth_optimize = 'X'.

      gs_layout-allow_switch_to_list = 'X'.

      gs_layout-zebra = 'X'.

      gs_variant-report = sy-repid.

      ENDFORM. " populate_layout

      &----


      -

      *& Form populate_sort

      &----


      -

      • text

      ----


      -

      • -->l_SORT[] text

      ----


      -

      FORM populate_sort USING l_sort TYPE slis_t_sortinfo_alv.

      ENDFORM. " populate_sort

      &----


      -

      *& Form display_alv_report

      &----


      -

      *

      ----


      -

      FORM display_alv_report .

      gv_repid = sy-repid.

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

      EXPORTING

      • I_INTERFACE_CHECK = ' '

      • I_BYPASSING_BUFFER =

      • I_BUFFER_ACTIVE = ' '

      i_callback_program = gv_repid

      • I_CALLBACK_PF_STATUS_SET = ' '

      i_callback_user_command = 'USER_COMMAND'

      i_structure_name = 'gt_report'

      is_layout = gs_layout

      it_fieldcat = gt_fieldcat

      • IT_EXCLUDING =

      • IT_SPECIAL_GROUPS =

      it_sort = gt_sort

      • IT_FILTER =

      • IS_SEL_HIDE =

      i_default = 'X'

      i_save = gc_a

      is_variant = gs_variant

      • IT_EVENTS =

      • IT_EVENT_EXIT =

      • IS_PRINT =

      • IS_REPREP_ID =

      • I_SCREEN_START_COLUMN = 0

      • I_SCREEN_START_LINE = 0

      • I_SCREEN_END_COLUMN = 0

      • I_SCREEN_END_LINE = 0

      • IMPORTING

      • E_EXIT_CAUSED_BY_CALLER =

      • ES_EXIT_CAUSED_BY_USER =

      TABLES

      t_outtab = gt_report

      EXCEPTIONS

      program_error = 1

      OTHERS = 2

      IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      ENDFORM. " display_alv_report

      &----


      -

      *& Form f01_f4_variant

      &----


      -

      • Get the Layout variant for the user.

      ----


      -

      FORM f01_f4_variant CHANGING c_variant TYPE disvariant-variant.

      DATA: ls_variant TYPE disvariant,

      l_exit TYPE char1.

      ls_variant-report = sy-repid.

      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

      EXPORTING

      is_variant = ls_variant

      i_save = 'A'

      • it_default_fieldcat =

      IMPORTING

      e_exit = l_exit

      es_variant = ls_variant

      EXCEPTIONS

      not_found = 2.

      IF sy-subrc = 2.

      MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ELSE.

      IF l_exit EQ space.

      c_variant = ls_variant-variant.

      ENDIF.

      ENDIF.

      ENDFORM. " f01_f4_variant

      ----


      -

      • FORM USER_COMMAND *

      ----


      --

      • --> R_UCOMM *

      • --> RS_SELFIELD *

      ----


      --

      FORM user_command USING r_ucomm LIKE sy-ucomm

      rs_selfield TYPE slis_selfield.

      • Check function code

      CASE r_ucomm.

      WHEN '&IC1'.

      READ TABLE gt_report INTO gs_report INDEX rs_selfield-tabindex.

      CHECK sy-subrc = 0.

      CASE rs_selfield-fieldname.

      WHEN 'VBELN'.

      • Set parameter ID for transaction screen field

      CHECK NOT gs_report-vbeln IS INITIAL.

      SET PARAMETER ID 'KTN' FIELD gs_report-vbeln.

      CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.

      WHEN 'ADDL_SCHD'.

      CHECK NOT gs_report-addl_schd IS INITIAL.

      REFRESH gt_sched_tmp.

      LOOP AT gt_sched INTO gs_sched

      WHERE vbeln = gs_report-vbeln

      AND posnr = gs_report-posnr.

      APPEND gs_sched TO gt_sched_tmp.

      ENDLOOP.

      CHECK sy-subrc = 0.

      CALL SCREEN '1010' STARTING AT 5 5.

      ENDCASE.

      ENDCASE.

      ENDFORM. "user_command

      &----


      -

      *& Module STATUS_1010 OUTPUT

      &----


      -

      • text

      ----


      -

      MODULE status_1010 OUTPUT.

      SET PF-STATUS 'MAIN_1010'.

      SET TITLEBAR '1010' WITH gs_report-vbeln gs_report-posnr.

      ENDMODULE. " STATUS_1010 OUTPUT

      &----


      -

      *& Module USER_COMMAND_1010 INPUT

      &----


      -

      • text

      ----


      -

      MODULE user_command_1010 INPUT.

      CASE sy-ucomm.

      WHEN 'BACK' OR 'CANC'.

      LEAVE TO SCREEN 0.

      ENDCASE.

      ENDMODULE. " USER_COMMAND_1010 INPUT

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:03 AM

    hi,

    check this program u will get idea

    REPORT ALVINTERSAMPLE NO STANDARD PAGE HEADING LINE-SIZE 650.

    TYPE-POOLS: SLIS.

    *type declaration for values from ekko

    TYPES: BEGIN OF I_EKKO,

    EBELN LIKE EKKO-EBELN,

    AEDAT LIKE EKKO-AEDAT,

    BUKRS LIKE EKKO-BUKRS,

    BSART LIKE EKKO-BSART,

    LIFNR LIKE EKKO-LIFNR,

    END OF I_EKKO.

    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,

    WA_EKKO TYPE I_EKKO.

    *type declaration for values from ekpo

    TYPES: BEGIN OF I_EKPO,

    EBELN LIKE EKPO-EBELN,

    EBELP LIKE EKPO-EBELP,

    MATNR LIKE EKPO-MATNR,

    MENGE LIKE EKPO-MENGE,

    MEINS LIKE EKPO-MEINS,

    NETPR LIKE EKPO-NETPR,

    END OF I_EKPO.

    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,

    WA_EKPO TYPE I_EKPO .

    *variable for Report ID

    DATA: V_REPID LIKE SY-REPID .

    *declaration for fieldcatalog

    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.

    • declaration for events table where user comand or set PF status will

    • be defined

    DATA: V_EVENTS TYPE SLIS_T_EVENT,

    WA_EVENT TYPE SLIS_ALV_EVENT.

    • declartion for layout

    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.

    • declaration for variant(type of display we want)

    DATA: I_VARIANT TYPE DISVARIANT,

    I_VARIANT1 TYPE DISVARIANT,

    I_SAVE(1) TYPE C.

    *PARAMETERS : p_var TYPE disvariant-variant.

    *Title displayed when the alv list is displayed

    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.

    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.

    INITIALIZATION.

    V_REPID = SY-REPID.

    PERFORM BUILD_FIELDCATLOG.

    PERFORM EVENT_CALL.

    PERFORM POPULATE_EVENT.

    START-OF-SELECTION.

    PERFORM DATA_RETRIEVAL.

    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.

    PERFORM DISPLAY_ALV_REPORT.

    &----


    *& Form BUILD_FIELDCATLOG

    &----


    • Fieldcatalog has all the field details from ekko

    ----


    FORM BUILD_FIELDCATLOG.

    WA_FIELDCAT-TABNAME = 'IT_EKKO'.

    WA_FIELDCAT-FIELDNAME = 'EBELN'.

    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_EKKO'.

    WA_FIELDCAT-FIELDNAME = 'AEDAT'.

    WA_FIELDCAT-SELTEXT_M = 'DATE.'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_EKKO'.

    WA_FIELDCAT-FIELDNAME = 'BUKRS'.

    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_EKKO'.

    WA_FIELDCAT-FIELDNAME = 'BUKRS'.

    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_EKKO'.

    WA_FIELDCAT-FIELDNAME = 'LIFNR'.

    WA_FIELDCAT-NO_OUT = 'X'.

    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    ENDFORM. "BUILD_FIELDCATLOG

    &----


    *& Form EVENT_CALL

    &----


    • we get all events - TOP OF PAGE or USER COMMAND in table v_events

    ----


    FORM EVENT_CALL.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = V_EVENTS

    • EXCEPTIONS

    • LIST_TYPE_WRONG = 1

    • OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. "EVENT_CALL

    &----


    *& Form POPULATE_EVENT

    &----


    • Events populated for TOP OF PAGE & USER COMAND

    ----


    FORM POPULATE_EVENT.

    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

    IF SY-SUBRC EQ 0.

    WA_EVENT-FORM = 'TOP_OF_PAGE'.

    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

    WA_EVENT-FORM.

    ENDIF.

    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.

    IF SY-SUBRC EQ 0.

    WA_EVENT-FORM = 'USER_COMMAND'.

    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

    WA_EVENT-NAME.

    ENDIF.

    ENDFORM. "POPULATE_EVENT

    &----


    *& Form data_retrieval

    &----


    • retreiving values from the database table ekko

    ----


    FORM DATA_RETRIEVAL.

    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.

    ENDFORM. "data_retrieval

    &----


    *& Form bUild_listheader

    &----


    • text

    ----


    • -->I_LISTHEADEtext

    ----


    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

    DATA HLINE TYPE SLIS_LISTHEADER.

    HLINE-INFO = 'this is my first alv pgm'.

    HLINE-TYP = 'H'.

    ENDFORM. "build_listheader

    &----


    *& Form display_alv_report

    &----


    • text

    ----


    FORM DISPLAY_ALV_REPORT.

    V_REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = V_REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

    I_GRID_TITLE = I_TITLE_EKKO

    • I_GRID_SETTINGS =

    • IS_LAYOUT = ALV_LAYOUT

    IT_FIELDCAT = I_FIELDCAT[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • i_default = 'ZLAY1'

    I_SAVE = 'A'

    • is_variant = i_variant

    IT_EVENTS = V_EVENTS

    TABLES

    T_OUTTAB = IT_EKKO

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. "display_alv_report

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM TOP_OF_PAGE.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = IT_LISTHEADER

    • i_logo =

    • I_END_OF_LIST_GRID =

    .

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form USER_COMMAND

    &----


    • text

    ----


    • -->R_UCOMM text

    • -->, text

    • -->RS_SLEFIELDtext

    ----


    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

    RS_SELFIELD TYPE SLIS_SELFIELD.

    CASE R_UCOMM.

    WHEN '&IC1'.

    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.

    PERFORM BUILD_FIELDCATLOG_EKPO.

    PERFORM EVENT_CALL_EKPO.

    PERFORM POPULATE_EVENT_EKPO.

    PERFORM DATA_RETRIEVAL_EKPO.

    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.

    PERFORM DISPLAY_ALV_EKPO.

    ENDCASE.

    ENDFORM. "user_command

    &----


    *& Form BUILD_FIELDCATLOG_EKPO

    &----


    • text

    ----


    FORM BUILD_FIELDCATLOG_EKPO.

    WA_FIELDCAT-TABNAME = 'IT_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'EBELN'.

    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'EBELP'.

    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'I_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'MATNR'.

    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'I_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'MENGE'.

    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'I_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'MEINS'.

    WA_FIELDCAT-SELTEXT_M = 'UOM'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'I_EKPO'.

    WA_FIELDCAT-FIELDNAME = 'NETPR'.

    WA_FIELDCAT-SELTEXT_M = 'PRICE'.

    APPEND WA_FIELDCAT TO I_FIELDCAT.

    CLEAR WA_FIELDCAT.

    ENDFORM. "BUILD_FIELDCATLOG_EKPO

    &----


    *& Form event_call_ekpo

    &----


    • we get all events - TOP OF PAGE or USER COMMAND in table v_events

    ----


    FORM EVENT_CALL_EKPO.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = V_EVENTS

    • EXCEPTIONS

    • LIST_TYPE_WRONG = 1

    • OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. "event_call_ekpo

    &----


    *& Form POPULATE_EVENT

    &----


    • Events populated for TOP OF PAGE & USER COMAND

    ----


    FORM POPULATE_EVENT_EKPO.

    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

    IF SY-SUBRC EQ 0.

    WA_EVENT-FORM = 'TOP_OF_PAGE'.

    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

    WA_EVENT-FORM.

    ENDIF.

    ENDFORM. "POPULATE_EVENT

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM F_TOP_OF_PAGE.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = IT_LISTHEADER

    • i_logo =

    • I_END_OF_LIST_GRID =

    .

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form USER_COMMAND

    &----


    • text

    ----


    • -->R_UCOMM text

    • -->, text

    • -->RS_SLEFIELDtext

    ----


    *retreiving values from the database table ekko

    FORM DATA_RETRIEVAL_EKPO.

    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.

    ENDFORM.

    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

    DATA: HLINE1 TYPE SLIS_LISTHEADER.

    HLINE1-TYP = 'H'.

    HLINE1-INFO = 'CHECKING PGM'.

    ENDFORM.

    FORM DISPLAY_ALV_EKPO.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = V_REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'

    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    I_GRID_TITLE = I_TITLE_EKPO

    • I_GRID_SETTINGS =

    • IS_LAYOUT =

    IT_FIELDCAT = I_FIELDCAT[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT =

    I_SAVE = 'A'

    • IS_VARIANT =

    IT_EVENTS = V_EVENTS

    TABLES

    T_OUTTAB = IT_EKPO

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:05 AM

    Hai Shankar,

    Check This program. It has TOP OF PAGE AND USER COMMEND Also.

    &----


    *& Report ZALV_DEMOGRID *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZALV_DEMOGRID.

    TABLES: ekko.

    TYPE-POOLS: slis. "ALV Declarations

    *Data Declaration

    *----


    TYPES: BEGIN OF t_ekko,

    ebeln TYPE ekpo-ebeln,

    ebelp TYPE ekpo-ebelp,

    statu TYPE ekpo-statu,

    aedat TYPE ekpo-aedat,

    matnr TYPE ekpo-matnr,

    menge TYPE ekpo-menge,

    meins TYPE ekpo-meins,

    netpr TYPE ekpo-netpr,

    peinh TYPE ekpo-peinh,

    END OF t_ekko.

    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

    wa_ekko TYPE t_ekko.

    *ALV data declarations

    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

    gd_tab_group TYPE slis_t_sp_group_alv,

    gd_layout TYPE slis_layout_alv,

    gd_repid LIKE sy-repid,

    gt_events TYPE slis_t_event,

    gd_prntparams TYPE slis_print_alv.

    ************************************************************************

    *Start-of-selection.

    START-OF-SELECTION.

    PERFORM data_retrieval.

    PERFORM build_fieldcatalog.

    PERFORM build_layout.

    PERFORM build_events.

    PERFORM build_print_params.

    PERFORM display_alv_report.

    &----


    *& Form BUILD_FIELDCATALOG

    &----


    • Build Fieldcatalog for ALV Report

    ----


    FORM build_fieldcatalog.

    • There are a number of ways to create a fieldcat.

    • For the purpose of this example i will build the fieldcatalog manualy

    • by populating the internal table fields individually and then

    • appending the rows. This method can be the most time consuming but can

    • also allow you more control of the final product.

    • Beware though, you need to ensure that all fields required are

    • populated. When using some of functionality available via ALV, such as

    • total. You may need to provide more information than if you were

    • simply displaying the result

    • I.e. Field type may be required in-order for

    • the 'TOTAL' function to work.

    fieldcatalog-fieldname = 'EBELN'.

    fieldcatalog-seltext_m = 'Purchase Order'.

    fieldcatalog-col_pos = 0.

    • fieldcatalog-outputlen = 10.

    • fieldcatalog-emphasize = 'C300'.

    fieldcatalog-key = 'X'.

    • fieldcatalog-do_sum = 'X'.

    • fieldcatalog-no_zero = 'X'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'EBELP'.

    fieldcatalog-seltext_m = 'PO Item'.

    fieldcatalog-col_pos = 1.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'STATU'.

    fieldcatalog-seltext_m = 'Status'.

    fieldcatalog-col_pos = 2.

    fieldcatalog-emphasize = 'C300'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'AEDAT'.

    fieldcatalog-seltext_m = 'Item change date'.

    fieldcatalog-col_pos = 3.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MATNR'.

    fieldcatalog-seltext_m = 'Material Number'.

    fieldcatalog-col_pos = 4.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MENGE'.

    fieldcatalog-seltext_m = 'PO quantity'.

    fieldcatalog-col_pos = 5.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'MEINS'.

    fieldcatalog-seltext_m = 'Order Unit'.

    fieldcatalog-col_pos = 6.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'NETPR'.

    fieldcatalog-seltext_m = 'Net Price'.

    fieldcatalog-col_pos = 7.

    fieldcatalog-outputlen = 15.

    fieldcatalog-do_sum = 'X'.

    fieldcatalog-datatype = 'CURR'.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    fieldcatalog-fieldname = 'PEINH'.

    fieldcatalog-seltext_m = 'Price Unit'.

    fieldcatalog-col_pos = 8.

    APPEND fieldcatalog TO fieldcatalog.

    CLEAR fieldcatalog.

    ENDFORM. " BUILD_FIELDCATALOG

    &----


    *& Form BUILD_LAYOUT

    &----


    • Build layout for ALV grid report

    ----


    FORM build_layout.

    gd_layout-no_input = 'X'.

    gd_layout-zebra = 'X'.

    gd_layout-colwidth_optimize = 'X'.

    gd_layout-totals_text = 'Totals'(201).

    • gd_layout-totals_only = 'X'.

    • gd_layout-f2code = 'DISP'. "Sets fcode for when double

    • "click(press f2)

    • gd_layout-zebra = 'X'.

    • gd_layout-group_change_edit = 'X'.

    gd_layout-header_text = 'helllllo'.

    • gd_layout-box_fieldname = 'EBELN'.

    • gd_layout-info_fieldname = 'EBELN'.

    ENDFORM. " BUILD_LAYOUT

    &----


    *& Form DISPLAY_ALV_REPORT

    &----


    • 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

    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

    i_callback_user_command = 'USER_COMMAND'

    • i_grid_title = outtext

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    • it_special_groups = gd_tabgroup

    it_events = gt_events

    is_print = gd_prntparams

    i_save = 'X'

    • is_variant = z_template

    TABLES

    t_outtab = it_ekko

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " DISPLAY_ALV_REPORT

    &----


    *& Form DATA_RETRIEVAL

    &----


    • Retrieve data form EKPO table and populate itab it_ekko

    ----


    FORM data_retrieval.

    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh

    UP TO 10 ROWS

    FROM ekpo

    INTO TABLE it_ekko.

    ENDFORM. " DATA_RETRIEVAL

    ----


    • Form TOP-OF-PAGE *

    ----


    • ALV Report Header *

    ----


    FORM top-of-page.

    *ALV Header declarations

    DATA: t_header TYPE slis_t_listheader,

    wa_header TYPE slis_listheader,

    t_line LIKE wa_header-info,

    ld_lines TYPE i,

    ld_linesc(10) TYPE c.

    • Title

    wa_header-typ = 'H'.

    wa_header-info = 'EKKO Table Report'.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    • Date

    wa_header-typ = 'S'.

    wa_header-key = 'Date: '.

    CONCATENATE sy-datum+6(2) '.'

    sy-datum+4(2) '.'

    sy-datum(4) INTO wa_header-info. "todays date

    APPEND wa_header TO t_header.

    CLEAR: wa_header.

    • Total No. of Records Selected

    DESCRIBE TABLE it_ekko LINES ld_lines.

    ld_linesc = ld_lines.

    CONCATENATE 'Total No. of Records Selected: ' ld_linesc

    INTO t_line SEPARATED BY space.

    wa_header-typ = 'A'.

    wa_header-info = t_line.

    APPEND wa_header TO t_header.

    CLEAR: wa_header, t_line.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = t_header.

    • i_logo = 'Z_LOGO'.

    ENDFORM. "top-of-page

    ----


    • FORM USER_COMMAND *

    ----


    • --> R_UCOMM *

    • --> RS_SELFIELD *

    ----


    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    • Check function code

    CASE r_ucomm.

    WHEN '&IC1'.

    • Check field clicked on within ALVgrid report

    IF rs_selfield-fieldname = 'EBELN'.

    • Read data table, using index of row user clicked on

    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.

    • Set parameter ID for transaction screen field

    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.

    • Sxecute transaction ME23N, and skip initial data entry screen

    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDFORM. "user_command

    &----


    *& Form BUILD_EVENTS

    &----


    • Build events table

    ----


    FORM build_events.

    DATA: ls_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = gt_events[].

    READ TABLE gt_events WITH KEY name = slis_ev_end_of_page

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE 'END_OF_PAGE' TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    READ TABLE gt_events WITH KEY name = slis_ev_end_of_list

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE 'END_OF_LIST' TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    ENDFORM. " BUILD_EVENTS

    &----


    *& Form BUILD_PRINT_PARAMS

    &----


    • Setup print parameters

    ----


    FORM build_print_params.

    gd_prntparams-reserve_lines = '3'. "Lines reserved for footer

    gd_prntparams-no_coverpage = 'X'.

    ENDFORM. " BUILD_PRINT_PARAMS

    &----


    *& Form END_OF_PAGE

    &----


    FORM end_of_page.

    DATA: listwidth TYPE i,

    ld_pagepos(10) TYPE c,

    ld_page(10) TYPE c.

    WRITE: sy-uline(50).

    SKIP.

    WRITE:/40 'Page:', sy-pagno .

    ENDFORM. "END_OF_PAGE

    &----


    *& Form END_OF_LIST

    &----


    FORM end_of_list.

    DATA: listwidth TYPE i,

    ld_pagepos(10) TYPE c,

    ld_page(10) TYPE c.

    SKIP.

    WRITE:/40 'Page:', sy-pagno .

    ENDFORM. "END_OF_LIST

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:10 AM

    HI

    Follow these steps:

    First make a form like this:

    &----


    *& Form alv_top_of_page

    &----


    • To display Top Of Page Data

    ----


    FORM top_of_page . "#EC CALLED

    DATA: it_l_header TYPE slis_t_listheader,

    wa_header TYPE slis_listheader.

    DATA : v_l_plnt TYPE string,

    v_l_sloc TYPE string,

    v_l_usr TYPE string,

    v_l_rsl TYPE string,

    v_rec TYPE string,

    v_num_rec TYPE string,

    v_rsl TYPE string,

    v_plnt_des TYPE string,

    v_sloc_des TYPE string,

    v_l_date TYPE char15,

    v_l_fdate TYPE char12.

    • IF sy-linct LT 11 AND sy-spono IS NOT INITIAL.

    • MESSAGE e255(/fir/rf2s0bgsi_msg) DISPLAY LIKE 'E'.

    *

    • ENDIF.

    DESCRIBE TABLE it_output LINES v_num_rec.

    • populate the descrpition of plant

    READ TABLE it_swerks INTO wa_swerks WITH KEY werks = s_werks-low.

    IF sy-subrc IS INITIAL.

    v_plnt_des = wa_swerks-name1.

    ENDIF.

    • populate the descrpition of sloc

    READ TABLE it_ssloc INTO wa_ssloc WITH KEY lgort = s_lgort-low.

    IF sy-subrc IS INITIAL.

    v_sloc_des = wa_ssloc-lgobe.

    ENDIF.

    • Conactenate the Plant with it's Description

    CONCATENATE ':'

    s_werks-low

    v_plnt_des

    INTO

    v_l_plnt SEPARATED BY space.

    • Concatenate the Storage location with it's description

    CONCATENATE ':'

    s_lgort-low

    v_sloc_des

    INTO v_l_sloc SEPARATED BY space.

    • Display the Date in user's format

    v_l_date = sy-datum.

    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

    EXPORTING

    input = v_l_date

    IMPORTING

    output = v_l_fdate.

    • Conactenate the user detail, date and time of execution2

    CONCATENATE

    ':'

    sy-uname

    '/'

    v_l_fdate

    '/'

    sy-uzeit(2)':'

    sy-uzeit+2(2)':'

    sy-uzeit+4(2)

    INTO v_l_usr SEPARATED BY space.

    • Concatenate the Remaining Shelf life

    v_rsl = p_rsl.

    CONCATENATE ':'

    v_rsl

    text-057

    INTO

    v_l_rsl SEPARATED BY space.

    • Concatenate the No. of records fetched

    CONCATENATE ':'

    v_num_rec

    INTO

    v_rec SEPARATED BY space.

    • Build the Top of page

    wa_header-typ = 'S'.

    wa_header-key = text-048. " Text for the List Header

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    wa_header-typ = 'S'.

    wa_header-key = text-049.

    wa_header-info = v_l_plnt.

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    wa_header-typ = 'S'.

    wa_header-key = text-050.

    wa_header-info = v_l_sloc.

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    wa_header-typ = 'S'.

    wa_header-key = text-051.

    wa_header-info = v_l_usr.

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    wa_header-typ = 'S'.

    wa_header-key = text-052.

    wa_header-info = v_l_rsl.

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    wa_header-typ = 'S'.

    wa_header-key = text-053.

    wa_header-info = v_rec.

    APPEND wa_header TO it_l_header.

    CLEAR wa_header.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_l_header

    • I_LOGO =

    • I_END_OF_LIST_GRID =

    • I_ALV_FORM =

    .

    ENDFORM. " alv_top_of_page

    Then build the events table like this :

    &----


    *& Form build_events

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM build_events.

    DATA: ls_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = gt_events[]

    EXCEPTIONS

    list_type_wrong = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    READ TABLE gt_events WITH KEY name = slis_ev_end_of_page

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE 'END_OF_PAGE' TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    READ TABLE gt_events WITH KEY name = slis_ev_end_of_list

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE 'END_OF_LIST' TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    ENDFORM. " build_events

    Then call your function module :

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    i_callback_program = repid

    i_callback_pf_status_set = 'SET_PF_STATUS'

    i_callback_user_command = 'USER_COMMAND'

    i_callback_top_of_page = 'TOP_OF_PAGE' <----


    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    • I_GRID_TITLE =

    • I_GRID_SETTINGS =

    is_layout = l_i_layout

    it_fieldcat = fieldcat[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    i_default = c_x

    i_save = c_x

    • IS_VARIANT =

    it_events = gt_events <----


    • IT_EVENT_EXIT =

    is_print = print

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_HTML_HEIGHT_TOP = 0

    • I_HTML_HEIGHT_END = 0

    • IT_ALV_GRAPHICS =

    • IT_HYPERLINK =

    • IT_ADD_FIELDCAT =

    • IT_EXCEPT_QINFO =

    • IR_SALV_FULLSCREEN_ADAPTER =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    t_outtab = it_output

    EXCEPTIONS

    program_error = 1

    OTHERS = 2

    .

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    Hope that helps you

    Regards

    Ravish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:12 AM

    hi shankar

    pls try from this code.

    may be it will helpfull for you.

    &----


    *& Report ZSALES_REQUIREMENT3

    *&

    &----


    *&

    *&

    &----


    REPORT ZSALES_REQUIREMENT3 line-size 145 no standard page heading.

    tables : vbrk, vbrp, kna1, vbap, vbak .

    type-pools : slis. " ALV USE

    DATA: Begin of itab occurs 0,

    fkdat like vbrk-fkdat, " sales order date means period

    vkorg like vbrk-vkorg, " sales organization

    vbeln like vbrk-vbeln, " billing doccument means invoice no.

    kunag like vbrk-kunag, " payer means customer code

    netwr like vbrk-netwr, " basic price

    vtweg like vbrk-vtweg, " distribution channel

    spart like vbrk-spart, " division

    matnr like vbrp-matnr, " material means mat. code

    arktx like vbrp-arktx, " description means mat. desc.

    werks like vbrp-werks, " plant code

    name1 like kna1-name1, " customer name

    kunnr like kna1-kunnr, " customer code

    fkimg like vbrp-fkimg, " billed quantity means invoice qty

    sfakn like vbrk-sfakn, " cancelled invoice

    end of itab.

    data : begin of itab1 occurs 0,

    name1 like kna1-name1,

    kunnr like kna1-kunnr,

    kunag like vbrk-kunag,

    end of itab1.

    data : begin of itab2 occurs 0,

    fkimg like vbrp-fkimg,

    matnr like vbrp-matnr,

    werks like vbrp-werks,

    end of itab2.

    select-options:

    plnt_cd for vbrp-werks,

    dst_ch for vbrk-vtweg,

    divis for vbrk-spart,

    cust_co for vbrk-kunag,

    period for vbrk-fkdat,

    mat_code for vbrp-matnr.

    SELECT akvkorg akvbeln akkunag aknetwr akvtweg akspart ak~fkdat

    aksfakn apmatnr aparktx apwerks

    INTO corresponding fields of itab

    FROM vbrk as ak

    INNER JOIN vbrp as ap ON akvbeln = apvbeln

    where

    ap~werks in plnt_cd and

    ak~vtweg IN dst_ch AND

    ak~SPART in DIVIS and

    ak~kunag in cust_co and

    ak~fkdat in period and

    ap~matnr in mat_code.

    *************************************************************

    • select statement for customer number

    *************************************************************

    select name1 kunnr from kna1

    into table itab1

    where

    kunnr = itab-kunag.

    *************************************************************

    • select statement for invoice quantity

    *************************************************************

    select fkimg matnr werks from vbrp

    into table itab2

    where

    matnr = itab-matnr and

    werks = itab-werks.

    ***************************************************************

    • READ COMMAND FOR ITAB1 AND ITAB2 TABLES

    ***************************************************************

    read table itab1 with key kunnr = itab-kunag.

    if sy-subrc = 0.

    itab-name1 = itab1-name1.

    itab-kunnr = itab1-kunnr.

    endif.

    read table itab2 with key matnr = itab-matnr werks = itab-werks.

    if sy-subrc = 0.

    itab-fkimg = itab2-fkimg.

    endif.

    append itab.

    endselect.

    clear : itab.

    *******************************************************************

    • ALV data declarations

    *******************************************************************

    data: fieldcatalog type slis_t_fieldcat_alv with header line,

    gd_tab_group type slis_t_sp_group_alv,

    gd_layout type slis_layout_alv,

    gd_repid like sy-repid,

    gt_events type slis_t_event,

    gd_prntparams type slis_print_alv.

    **********************************************************************

    • Start-of-selection.

    **********************************************************************

    START-OF-SELECTION.

    perform build_fieldcatalog.

    perform build_layout.

    perform build_events.

    perform build_print_params.

    perform display_alv_report.

    **& Form BUILD_FIELDCATALOG

    **&----


    **

    • Build Fieldcatalog for ALV Report

    **----


    form build_fieldcatalog.

    fieldcatalog-fieldname = 'FKDAT'.

    fieldcatalog-seltext_m = 'DATE'.

    fieldcatalog-col_pos = 1.

    fieldcatalog-key = 'X'.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'KUNNR'.

    fieldcatalog-seltext_m = 'CUSTOMER CODE'.

    fieldcatalog-col_pos = 2.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'NAME1'.

    fieldcatalog-seltext_m = 'CUSTOMER NAME'.

    fieldcatalog-col_pos = 3.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'MATNR'.

    fieldcatalog-seltext_m = 'MATERIAL CODE'.

    fieldcatalog-col_pos = 4.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'ARKTX'.

    fieldcatalog-seltext_m = 'MATERIAL DESCRIPTION'.

    fieldcatalog-col_pos = 5.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'NETWR'.

    fieldcatalog-seltext_m = 'BASIC PRICE'.

    fieldcatalog-col_pos = 6.

    fieldcatalog-fieldname = 'VBELN'.

    fieldcatalog-seltext_m = 'INVOICE NO'.

    fieldcatalog-col_pos = 7.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'FKIMG'.

    fieldcatalog-seltext_m = 'INVOICE QTY.'.

    fieldcatalog-col_pos = 8.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    fieldcatalog-fieldname = 'SFAKN'.

    fieldcatalog-seltext_m = 'CANCELLED INVOICE'.

    fieldcatalog-col_pos = 9.

    append fieldcatalog to fieldcatalog.

    clear fieldcatalog.

    endform. " BUILD_FIELDCATALOG

    **&----


    **& Form BUILD_LAYOUT

    **&----


    **

    • Build layout for ALV grid report

    **----


    *

    form build_layout.

    gd_layout-no_input = 'X'.

    gd_layout-colwidth_optimize = 'X'.

    gd_layout-totals_text = 'Totals'(201).

    endform. " BUILD_LAYOUT

    **&----


    **& Form DISPLAY_ALV_REPORT

    **&----


    form display_alv_report.

    gd_repid = sy-repid.

    call function 'REUSE_ALV_GRID_DISPLAY'

    exporting

    i_callback_program = gd_repid

    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

    • i_grid_title = outtext

    is_layout = gd_layout

    it_fieldcat = fieldcatalog[]

    it_special_groups = gd_tab_group

    it_events = gt_events

    is_print = gd_prntparams

    i_save = 'X'

    • is_variant = z_template

    tables

    t_outtab = itab

    exceptions

    program_error = 1

    others = 2.

    if sy-subrc <> 0.

    endif.

    endform. " DISPLAY_ALV_REPORT

    *----


    • Form TOP-OF-PAGE *

    *----


    • ALV Report Header *

    *----


    Form top-of-page.

    *ALV Header declarations

    data: t_header type slis_t_listheader,

    wa_header type slis_listheader,

    t_line like wa_header-info,

    ld_lines type i,

    ld_linesc(10) type c.

    • Title

    wa_header-typ = 'H'.

    wa_header-info = 'SALES REQUIREMENT'.

    append wa_header to t_header.

    clear wa_header.

    • Date

    wa_header-typ = 'S'.

    wa_header-key = 'Date: '.

    CONCATENATE sy-datum+6(2) '.'

    sy-datum+4(2) '.'

    sy-datum(4) INTO wa_header-info. "todays date

    append wa_header to t_header.

    clear: wa_header.

    • Total No. of Records Selected

    describe table itab lines ld_lines.

    ld_linesc = ld_lines.

    concatenate 'Total No. of Records Selected: ' ld_linesc

    into t_line separated by space.

    wa_header-typ = 'A'.

    wa_header-info = t_line.

    append wa_header to t_header.

    clear: wa_header, t_line.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = t_header.

    endform. "top-of-page

    **&----


    **& Form BUILD_EVENTS

    **&----


    • Build events table

    **----


    form build_events.

    data: ls_event type slis_alv_event.

    call function 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = gt_events[].

    read table gt_events with key name = slis_ev_end_of_page

    into ls_event.

    if sy-subrc = 0.

    move 'END_OF_PAGE' to ls_event-form.

    append ls_event to gt_events.

    endif.

    read table gt_events with key name = slis_ev_end_of_list

    into ls_event.

    if sy-subrc = 0.

    move 'END_OF_LIST' to ls_event-form.

    append ls_event to gt_events.

    endif.

    endform. " BUILD_EVENTS

    **&----


    **& Form BUILD_PRINT_PARAMS

    **&----


    • Setup print parameters

    **----


    form build_print_params.

    gd_prntparams-reserve_lines = '3'. "Lines reserved for footer

    gd_prntparams-no_coverpage = 'X'.

    endform. " BUILD_PRINT_PARAMS

    *&----


    *& Form END_OF_PAGE

    *&----


    form END_OF_PAGE.

    data: listwidth type i,

    ld_pagepos(10) type c,

    ld_page(10) type c.

    write: sy-uline(50).

    skip.

    write:/40 'Page:', sy-pagno .

    endform. "END_OF_PAGE

    **&----


    **& Form END_OF_LIST

    **&----


    form END_OF_LIST.

    data: listwidth type i,

    ld_pagepos(10) type c,

    ld_page(10) type c.

    skip.

    write:/40 'Page:', sy-pagno .

    endform. "END_OF_LIST.

    regards

    pardeep

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:47 AM

    Hi Shankar,

    have a look on the following code,

    it split's the top-of-page and prints data in left and right side.

    TABLES VBAK.

    TYPE-POOLS SLIS.

    • 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 WITH HEADER LINE,

    GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

    GD_REPID TYPE SY-REPID,

    • I_EVENTS TYPE SLIS_T_EVENT,

    • W_EVENTS LIKE LINE OF I_EVENTS.

    START-OF-SELECTION.

    PERFORM DATA_RETRIEVAL.

    PERFORM BLD_FLDCAT.

    PERFORM BLD_LAYOUT.

    PERFORM DISPLAY_ALV_REPORT.

    • Build Field Catalog for ALV Report

    FORM BLD_FLDCAT.

    FLDCAT-FIELDNAME = 'VBELN'.

    FLDCAT-SELTEXT_M = 'Sales Document'.

    FLDCAT-COL_POS = 0.

    *FLDCAT-EMPHASIZE = 'C411'.

    FLDCAT-OUTPUTLEN = 20.

    FLDCAT-KEY = 'X'.

    *FLDCAT-NO_OUT = 'X'. "It hides the field from display

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'ERDAT'.

    FLDCAT-SELTEXT_L = 'Record Date created'.

    FLDCAT-COL_POS = 1.

    FLDCAT-KEY = 'X'.

    FLDCAT-JUST = 'R'. "Right(R)/Left(L)/Center(C) Justification

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'ERNAM'.

    FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.

    FLDCAT-COL_POS = 2.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'AUDAT'.

    FLDCAT-SELTEXT_M = 'Document Date'.

    FLDCAT-COL_POS = 3.

    FLDCAT-EMPHASIZE = 'C110'.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'VBTYP'.

    FLDCAT-SELTEXT_L = 'SD Document category'.

    FLDCAT-COL_POS = 4.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'NETWR'.

    FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.

    FLDCAT-COL_POS = 5.

    FLDCAT-OUTPUTLEN = 60.

    FLDCAT-DO_SUM = 'X'.

    FLDCAT-DATATYPE = 'CURR'.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'VKORG'.

    FLDCAT-SELTEXT_L = 'Sales Organization'.

    FLDCAT-COL_POS = 6.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    FLDCAT-FIELDNAME = 'VKGRP'.

    FLDCAT-SELTEXT_M = 'Sales Group'.

    FLDCAT-COL_POS = 7.

    FLDCAT-EMPHASIZE = 'C801'.

    APPEND FLDCAT TO FLDCAT.

    CLEAR FLDCAT.

    ENDFORM.

    • Build Layout for ALV Grid Report

    FORM BLD_LAYOUT.

    GD_LAYOUT-NO_INPUT = 'X'.

    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

    ENDFORM.

    • Display report using ALV grid

    FORM DISPLAY_ALV_REPORT.

    DATA T_EVENT TYPE SLIS_T_EVENT.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = T_EVENT.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    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[]

    I_SAVE = 'X'

    TABLES

    T_OUTTAB = IT_VBAK

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM.

    • Retrieve data from VBAK table and populate itab IT_VBAK

    FORM DATA_RETRIEVAL.

    SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG

    UP TO 20 ROWS

    FROM VBAK

    INTO TABLE IT_VBAK.

    ENDFORM.

    FORM TOP_OF_PAGE.

    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,

    W_HEADER TYPE SLIS_LISTHEADER.

    W_HEADER-TYP = 'H'.

    W_HEADER-INFO = 'WELCOME HEADER LIST'.

    APPEND W_HEADER TO T_HEADER.

    W_HEADER-TYP = 'S'.

    W_HEADER-KEY = 'REPORT:'.

    W_HEADER-INFO = SY-REPID.

    APPEND W_HEADER TO T_HEADER.

    W_HEADER-TYP = 'S'.

    W_HEADER-KEY = 'DATE:'.

    CONCATENATE SY-DATUM4(2) ' / ' SY-DATUM6(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.

    APPEND W_HEADER TO T_HEADER.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = T_HEADER.

    ENDFORM.

    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.

    DATA: BEGIN OF TAB_TEXT OCCURS 0,

    TEXT TYPE SDYDO_TEXT_ELEMENT,

    END OF 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.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    TAB_TEXT-TEXT = 'GEMS TECHNO SOLUTIONS PVT LIMITED'.

    APPEND TAB_TEXT.

    TAB_TEXT-TEXT = 'PLOT NO.100,SECTOR 1'.

    APPEND TAB_TEXT.

    TAB_TEXT-TEXT = 'MVP DOUBLE ROAD'.

    APPEND TAB_TEXT.

    TAB_TEXT-TEXT = 'MVP COLONY,VIZAG'.

    APPEND TAB_TEXT.

    S_TAB[] = TAB_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.

    TEXT = 'REPORT:'.

    CALL METHOD R_TOP->ADD_TEXT

    EXPORTING

    TEXT = TEXT

    SAP_EMPHASIS = 'STRONG'.

    CALL METHOD R_TOP->ADD_GAP

    EXPORTING

    WIDTH = 2.

    TEXT = SY-REPID.

    CALL METHOD R_TOP->ADD_TEXT

    EXPORTING

    TEXT = TEXT

    SAP_STYLE = 'KEY'.

    CALL METHOD R_TOP->NEW_LINE.

    TEXT = 'DATE:'.

    CALL METHOD R_TOP->ADD_TEXT

    EXPORTING

    TEXT = TEXT

    SAP_EMPHASIS = 'STRONG'.

    CALL METHOD R_TOP->ADD_GAP

    EXPORTING

    WIDTH = 8.

    TEXT = SY-DATUM.

    CALL METHOD R_TOP->ADD_TEXT

    EXPORTING

    TEXT = TEXT

    SAP_STYLE = 'KEY'.

    CALL METHOD R_TOP->NEW_LINE.

    ENDFORM.

    reward points,if it is helpful.

    Thanks

    chandu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 06:56 AM

    Hi,

    Please refer to the link below :

    http://www.sapdev.co.uk/reporting/alv/alvgrid_rephead.htm

    Thanks,

    Sri,

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.