<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ALV using objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924025#M383674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe refering to the perfect tutorial by Serdar Simsekler &amp;lt;a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf"&amp;gt;"An Easy Reference for ALV Grid Control"&amp;lt;/a&amp;gt; will be helpfull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Renata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Feb 2007 11:32:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-12T11:32:20Z</dc:date>
    <item>
      <title>ALV using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924024#M383673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Im using the class which is mentioned below,&lt;/P&gt;&lt;P&gt;1)i need to display the top_of_page and  end_of_page how can i do that?,&lt;/P&gt;&lt;P&gt;2)how could i give user defiined column headings.&lt;/P&gt;&lt;P&gt;for eg:for the first column ,the  coumn heading is sales document number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZALV_SAMPLE.&lt;/P&gt;&lt;P&gt;types:begin of ty_final,&lt;/P&gt;&lt;P&gt;      vbeln type vbeln_va,&lt;/P&gt;&lt;P&gt;      matnr type matnr,&lt;/P&gt;&lt;P&gt;      end of ty_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:IT_FINAL TYPE TABLE OF TY_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select  vbeln matnr&lt;/P&gt;&lt;P&gt;         FROM VBAP&lt;/P&gt;&lt;P&gt;         INTO TABLE IT_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************this is the code for alv (OO concept)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : R_TABLE TYPE REF TO CL_SALV_TABLE,&lt;/P&gt;&lt;P&gt;       R_COLUMNS TYPE REF TO CL_SALV_COLUMNS,&lt;/P&gt;&lt;P&gt;       R_COLUMN TYPE REF TO CL_SALV_COLUMN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;CALL METHOD cl_salv_table=&amp;gt;factory&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;    R_SALV_TABLE   = R_TABLE&lt;/P&gt;&lt;P&gt;  CHANGING&lt;/P&gt;&lt;P&gt;    t_table        = IT_final.&lt;/P&gt;&lt;P&gt;    .&lt;/P&gt;&lt;P&gt; CATCH CX_SALV_MSG .&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;R_COLUMNS  = R_TABLE-&amp;gt;GET_COLUMNS( ).&lt;/P&gt;&lt;P&gt;R_TABLE-&amp;gt;DISPLAY( ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2007 10:04:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924024#M383673</guid>
      <dc:creator>former_member842213</dc:creator>
      <dc:date>2007-02-12T10:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924025#M383674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe refering to the perfect tutorial by Serdar Simsekler &amp;lt;a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf"&amp;gt;"An Easy Reference for ALV Grid Control"&amp;lt;/a&amp;gt; will be helpfull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Renata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2007 11:32:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924025#M383674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-12T11:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924026#M383675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution -&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) &amp;lt;b&amp;gt;Use standard Events in the Class - SET_TABLE_FOR_FIRST_DISPLAY&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;lt;b&amp;gt;To give user defiined column headings.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;for eg:for the first column ,the coumn heading is sales document number. Use text-elements or 'Hard code text' in the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;NOTE -&amp;gt; In the code below, Instead of Sample text 1, 2, 3... you can type ur text.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt; Sample Code -&lt;HR originaltext="--------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  Z_ATUL
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  z_atul no standard page heading .

************************************************************************
*              D A T A B A S E   T A B L E S                           *
************************************************************************

tables :
    vbrk,      "Billing Document: Header Data
    vbrp,      "Billing Document: Item Data
    vbak,      "Sales Document: Header Data
    cskt,      "Cost Center Master Data
    bseg.      "Accounting Document Segment (USING FOR G/L Line Items)

types:

* TYPE Used to capture the records to be displayed
begin of ty_list,
vtweg  like vbrk-vtweg,
spart  like vbrk-spart,
hkont like bseg-hkont,
fkart  like vbrk-fkart,
fkdat  like vbrk-fkdat,
erdat  like vbrk-erdat,
ernam  like vbrk-ernam,
rfbsk  like vbrk-rfbsk,
aedat  like vbrk-aedat,
vbeln  like vbrk-vbeln,
bukrs  like vbrk-bukrs,
kunag  like vbrk-kunag,
aktnr  like vbrp-aktnr,
aubel  like vbrp-aubel,
ktext like  cskt-ktext,
kostl like  cskt-kostl,
end of ty_list,


begin of ty_vbrk,
  vbeln like vbrk-vbeln,
  bukrs like vbrk-bukrs,
  fkart like vbrk-fkart,
  fkdat like vbrk-fkdat,
  ernam like vbrk-ernam,
  erdat like vbrk-erdat,
  kunag like vbrk-kunag,
  aedat like vbrk-aedat,
  gjahr like vbrk-gjahr,
end of ty_vbrk,

begin of ty_vbrp,
  fkart like vbrk-fkart,
  bukrs like vbrk-bukrs,
  ktext like cskt-ktext,
  vbeln like vbrk-vbeln,
  kunag like vbrk-kunag,
  fkdat like vbrk-fkdat,
  ernam like vbrk-ernam,
  erdat like vbrk-erdat,
  aedat like vbrk-aedat,
  aktnr like vbrp-aktnr,
  aubel like vbrp-aubel,
  sonam like vbak-ernam,
  posnr  like vbrp-posnr ,
  netwr like vbrp-netwr,
  rfbsk  like vbrk-rfbsk,
end of ty_vbrp,

begin of ty_vbak,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam like vbak-ernam,

end of ty_vbak,

begin of ty_cskt,
kostl like cskt-kostl,
ktext like cskt-ktext,
end of ty_cskt,

begin of ty_bseg,
belnr like bseg-belnr,
koart like bseg-koart,
buzid like bseg-buzid,
hkont like bseg-hkont,
shkzg like bseg-shkzg,
end of ty_bseg.


data :

ts_list type standard table of ty_list,
ts_vbrk type standard table of ty_vbrk,
ts_vbrp type standard table of ty_vbrp,
ts_vbak type standard table of ty_vbak,
ts_cskt type standard table of ty_cskt,

ts_bseg type standard table of ty_bseg.


data:

wa_list like line of ts_list,
wa_vbrk like line of ts_vbrk,
wa_vbrp like line of ts_vbrp,
wa_vbak like line of ts_vbak,
wa_cskt like line of ts_cskt,
*WA_ZT308 LIKE LINE OF TS_ZT308,
wa_bseg like line of ts_bseg.



************************************************************************
*              ALV GRID COMPONENTS
************************************************************************
data : ok_code like sy-ucomm,
       g_container type scrfname value 'Z361_GRID_CONTAINER' ,
       grid type ref to cl_gui_alv_grid,
       g_custom_container type ref to cl_gui_custom_container,
       gs_layout type lvc_s_layo,
       gt_fieldcatalog type lvc_t_fcat,
       gs_print type lvc_s_prnt.
data : st_fieldcat type lvc_t_fcat .

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;       Class LCL_EVENT_RECEIVER
*&amp;amp;---------------------------------------------------------------------*
class lcl_event_receiver definition.

  public section.

    methods :
    t_double_click
    for event double_click of cl_gui_alv_grid
    importing e_row e_column.

endclass.               "LCL_EVENT_RECEIVER


class lcl_event_receiver definition deferred.

data : g_event_rec type ref to lcl_event_receiver.

*selection for user input
*First block
selection-screen begin of block sales with frame title text-009.

select-options s_vkorg for vbrk-vkorg.
select-options s_vtweg for vbrk-vtweg.
select-options s_spart for vbrk-spart.
select-options s_fkart for vbrk-fkart.
select-options s_fkdat for vbrk-fkdat.

select-options s_erdat for vbrk-erdat.
select-options s_ernam for vbrk-ernam.
select-options s_aktnr for vbrp-aktnr.
select-options s_aubel for vbrp-aubel.

select-options s_rfbsk for vbrk-rfbsk.
select-options s_aedat for vbrk-aedat.
select-options s_kunag for vbrk-kunag.
select-options s_vbeln for vbrk-vbeln.

selection-screen end of block sales.
*Second block
selection-screen begin of block output with frame title text-008.
parameter : p_vari type slis_vari.
selection-screen end of block output.

***********************************************************************
**** INITIALIZATION
***********************************************************************

***********************************************************************
**** AT SELECTION SCREEN OUTPUT
***********************************************************************
at selection-screen on end of s_vbeln .

  if       s_vkorg[] is initial
    and    s_vtweg[] is initial
    and    s_spart[] is initial
    and    s_fkart[] is initial
    and    s_fkdat[] is initial

    and    s_erdat[]  is initial
    and    s_ernam[]  is initial
    and    s_aktnr[] is initial
    and    s_aubel[] is initial

    and    s_rfbsk[] is initial
    and    s_aedat[]   is initial
    and    s_kunag[]    is initial
    and    s_vbeln[] is initial .
    message 'Please enter some selection criteria' type 'E'.
  endif.

***********************************************************************
**** START OF SELECTION
***********************************************************************

start-of-selection.

  perform get_data.




***********************************************************************
**** END OF SELECTION
***********************************************************************
*IF TS_LIST[] IS INITIAL.

  if ts_vbrp[] is initial.  "TEMP TO BE DELETED
    message 'No data found for the selection.' type 'S'.
    exit.
  else.
    call screen 1001.
  endif.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form get_data .

 select k~fkart k~fkdat k~erdat k~ernam k~rfbsk k~aedat k~vbeln k~bukrs
 k~kunag
 p~aktnr p~aubel p~posnr
 p~netwr a~ernam
 from  ( vbrk as k
 inner join vbrp  as p
       on  p~vbeln = k~vbeln
 inner join vbak  as a
       on  a~vbeln = p~aubel )
 into corresponding fields of table ts_vbrp
 where
       k~vkorg in s_vkorg
       and k~vtweg in s_vtweg
       and k~spart in s_spart
       and k~fkart in s_fkart
       and k~fkdat in s_fkdat
       and k~erdat in s_erdat
       and k~ernam in s_ernam
       and k~rfbsk in s_rfbsk
       and k~aedat in s_aedat
       and k~vbeln in s_vbeln
       and k~kunag in s_kunag

       and p~aktnr in s_aktnr
       and p~aubel in s_aubel.


* Transferring Billing docu. no. &amp;amp; Company code to internal table

  loop at ts_vbrp into wa_vbrp.

    move    wa_vbrp-vbeln to wa_vbrk-vbeln.
    move    wa_vbrp-bukrs to wa_vbrk-bukrs.

    append wa_vbrk to ts_vbrk.

  endloop.

  sort ts_vbrk by vbeln bukrs.

  delete adjacent duplicates from ts_vbrk comparing vbeln bukrs.

  sort ts_vbrk by fkart ascending vbeln bukrs descending.

endform.                    " get_data

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;       Class (Implementation)  LCL_EVENT_RECEIVER
*&amp;amp;---------------------------------------------------------------------*

class lcl_event_receiver implementation.

  method t_double_click.
    message 'Double click successful' type 'I' .
  endmethod.                    "t_double_click

endclass.               "LCL_EVENT_RECEIVER

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  create_and_display_container
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form create_and_display_container .

*Create custom container control for our ALV Control
  create object g_custom_container
     exporting
        container_name = g_container
     exceptions
        cntl_error = 1
        cntl_system_error = 2
        create_error = 3
        lifetime_error = 4
        lifetime_dynpro_dynpro_link = 5.

*Create instance of alv control
  create object grid
     exporting
       i_parent = g_custom_container.

*Create instance of event--&amp;gt;double click
  create object g_event_rec.
  set handler g_event_rec-&amp;gt;t_double_click for grid.


*Set a titlebar for the grid control
  gs_layout-grid_title = 'Supplier Funding Billing Documents'.

*Return field descriptions and rename as report titles
  data: lt_fieldcat type lvc_t_fcat.
  perform set_fieldcatalog_init using lt_fieldcat.
  gs_layout-zebra = 'X'.
  st_fieldcat = lt_fieldcat.

*Display container
  call method grid-&amp;gt;set_table_for_first_display
    exporting
      is_print        = gs_print
      is_layout       = gs_layout
    changing
      it_outtab       = ts_vbrp[]        
      it_fieldcatalog = lt_fieldcat.

  call method cl_gui_control=&amp;gt;set_focus
    exporting
      control = grid.


endform.                    " create_and_display_container
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  exit_program
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form exit_program .

  call method g_custom_container-&amp;gt;free.

  leave to screen 0.

endform.                    " exit_program
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_1001  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_1001 output.

  set pf-status 'MAIN1001'.
  set titlebar '1001'.

  if g_custom_container is initial.
*Create container and set up grid data for display
    perform create_and_display_container.
  endif.

endmodule.                 " STATUS_1001  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_1001  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_1001 input.

  constants:      c_exit    like sy-ucomm value 'EXIT',
                  c_back    like sy-ucomm value 'BACK',
                  c_cancel  like sy-ucomm value 'CANCEL'.

  ok_code = sy-ucomm.
  case ok_code.
    when c_exit or c_back or c_cancel.
      perform exit_program.
    when others.
  endcase.

endmodule.                 " USER_COMMAND_1001  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  set_fieldcatalog_init
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_LT_FIELDCAT  text
*----------------------------------------------------------------------*
form set_fieldcatalog_init  using  lt_fieldcat type lvc_t_fcat.

  field-symbols : &amp;lt;fc&amp;gt; like line of lt_fieldcat.

  data : ls_fieldcatalog type lvc_s_fcat.

  constants : c_fkart(5)    type c value 'FKART',
              c_bukrs(5)    type c value 'BUKRS',
              c_rptgr(5) type c value 'RPTGR',
              c_ktext(5) type c value 'KTEXT',
              c_vbeln(5) type c value 'VBELN',
              c_kunag(5) type c value 'KUNAG',

              c_fkdat(5) type c value 'FKDAT',
              c_ernam(5) type c value 'ERNAM',
              c_erdat(5) type c value 'ERDAT',
              c_aedat(5) type c value 'AEDAT',
              c_aktnr(5) type c value 'AKTNR',

              c_aubel(5) type c value 'AUBEL',
              c_sonam(5) type c value 'SONAM',
              c_posnr(5) type c value 'POSNR',
              c_brand(5) type c value 'BRAND',
              c_att_value(9) type c value 'ATT_VALUE',
              c_netwr(5) type c value 'NETWR' ,
              c_rfbsk(5) type c value 'RFBSK'.


* Assign AUBEL column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_aubel.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c15. " Sample txt8
  &amp;lt;fc&amp;gt;-coltext   = text-c15. " Sample txt8
  &amp;lt;fc&amp;gt;-seltext   = text-c15. " Sample txt8
  &amp;lt;fc&amp;gt;-tooltip   = text-c15.  " Sample txt8
  &amp;lt;fc&amp;gt;-outputlen = '10'.
  &amp;lt;fc&amp;gt;-key       = 'X'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign SONAM column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_sonam.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c16. " Sample txt7
  &amp;lt;fc&amp;gt;-coltext   = text-c16. " Sample txt7
  &amp;lt;fc&amp;gt;-seltext   = text-c16. " Sample txt7
  &amp;lt;fc&amp;gt;-tooltip   = text-c16. " Sample txt7
  &amp;lt;fc&amp;gt;-outputlen = '12'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign POSNR column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_posnr.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c17. " Sample txt6
  &amp;lt;fc&amp;gt;-coltext   = text-c17. " Sample txt6
  &amp;lt;fc&amp;gt;-seltext   = text-c17. " Sample txt6
  &amp;lt;fc&amp;gt;-tooltip   = text-c17. " Sample txt6
  &amp;lt;fc&amp;gt;-outputlen = '6'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign BRAND column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_brand.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c18. " Sample txt5
  &amp;lt;fc&amp;gt;-coltext   = text-c18. " Sample txt5
  &amp;lt;fc&amp;gt;-seltext   = text-c18. " Sample txt5
  &amp;lt;fc&amp;gt;-tooltip   = text-c18. " Sample txt5
  &amp;lt;fc&amp;gt;-outputlen = '3'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign ATT_VALUE column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_att_value.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c19. " Sample txt4
  &amp;lt;fc&amp;gt;-coltext   = text-c19. " Sample txt4
  &amp;lt;fc&amp;gt;-seltext   = text-c19. " Sample txt4
  &amp;lt;fc&amp;gt;-tooltip   = text-c19. " Sample txt4
  &amp;lt;fc&amp;gt;-outputlen = '18'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign NETWR column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_netwr.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c20. " Sample txt3
  &amp;lt;fc&amp;gt;-coltext   = text-c20. " Sample txt3
  &amp;lt;fc&amp;gt;-seltext   = text-c20. " Sample txt3
  &amp;lt;fc&amp;gt;-tooltip   = text-c20. " Sample txt3
  &amp;lt;fc&amp;gt;-outputlen = '12'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

* Assign RFBSK column
  clear ls_fieldcatalog.
  assign ls_fieldcatalog to &amp;lt;fc&amp;gt;.
  &amp;lt;fc&amp;gt;-fieldname = c_rfbsk.
  &amp;lt;fc&amp;gt;-datatype  = 'C'.
  &amp;lt;fc&amp;gt;-reptext   = text-c21. " Sample txt2
  &amp;lt;fc&amp;gt;-coltext   = text-c21. " Sample txt2
  &amp;lt;fc&amp;gt;-seltext   = text-c21. " Sample txt2
  &amp;lt;fc&amp;gt;-tooltip   = text-c21. " Sample txt2
  &amp;lt;fc&amp;gt;-outputlen = '1'.
  append &amp;lt;fc&amp;gt; to lt_fieldcat.

  clear ls_fieldcatalog.

endform.             " set_fieldcatalog_init&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward suitable points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;- Atul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2007 11:48:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924026#M383675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-12T11:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: ALV using objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924027#M383676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
***********************************************************************

* Class definition :
***********************************************************************

*---------------------------------------------------------------------*
*       CLASS v_lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
CLASS v_lcl_event_receiver DEFINITION.

  PUBLIC SECTION.

    METHODS:

    handle_print_top_of_page FOR EVENT print_top_of_page OF
                                       cl_gui_alv_grid,

    handle_top_of_page FOR EVENT top_of_page OF
                                 cl_gui_alv_grid.

ENDCLASS.
*---------------------------------------------------------------------*
*       CLASS V_LCL_EVENT_RECEIVER IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS v_lcl_event_receiver IMPLEMENTATION.

  METHOD handle_print_top_of_page.
    IF sy-pagno = 1.
        PERFORM top_of_page.
    ENDIF.
  ENDMETHOD.
  METHOD handle_top_of_page.
      PERFORM top_of_page.
  ENDMETHOD.

ENDCLASS.

DATA:        v_event_receiver      TYPE REF TO v_lcl_event_receiver.

FORM top_of_page.
  WRITE: text-020,
           / 

ENDFORM.                    " top_of_page


In PBo of the screen
   DATA: v_split            TYPE REF TO cl_gui_easy_splitter_container,
         v_contnr_top       TYPE REF TO cl_gui_container,
         v_contnr_bot       TYPE REF TO cl_gui_container,
         v_grid_02          TYPE REF TO cl_gui_alv_grid,
         v_html             TYPE REF TO cl_dd_document,
         v_text20(255)      TYPE c,
         v_text16(255)      TYPE c,

FORM f9000_objects_create.
  IF cl_gui_alv_grid=&amp;gt;offline( ) IS INITIAL.
Create a container
    CREATE OBJECT o_dockingcontainer
      EXPORTING
        ratio                       = '95'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        others                      = 6.
    IF sy-subrc NE 0.
      MESSAGE i000 WITH text-e01."Error in creating Docking container
      LEAVE LIST-PROCESSING.
    ENDIF.

    CREATE OBJECT v_split
         EXPORTING
           parent            = o_dockingcontainer
*          ORIENTATION       = 0
           sash_position     = 25
           with_border       = 0
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_error = 2
           others            = 3.
    IF sy-subrc NE 0.
      MESSAGE i000 WITH text-e01."Error in creating Docking container
      LEAVE LIST-PROCESSING.
    ENDIF.
*   Get the containers of the splitter control
    v_contnr_top = v_split-&amp;gt;top_left_container.
    v_contnr_bot = v_split-&amp;gt;bottom_right_container.

    CREATE OBJECT o_alvgrid
   EXPORTING
     i_parent = o_dockingcontainer.

*   Create an instance of alv control
    CREATE OBJECT o_alvgrid
         EXPORTING i_parent = v_contnr_bot.

*   Object for display of selection parameters in HTML top container
    CREATE OBJECT v_html
         EXPORTING
           style = 'ALV_GRID'.


*   Must be after the SET HANDLER for TOP_OF_PAGE and foreground only
    CALL METHOD o_alvgrid-&amp;gt;list_processing_events
                     EXPORTING i_event_name = 'TOP_OF_PAGE'
                               i_dyndoc_id  = v_html.

    v_text20 = text-020(summary Record counts)Any text.

    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 120.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text20.
    CALL METHOD v_html-&amp;gt;new_line.
** Display Text-016
    v_text16 = text-016.

    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 1.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text16.

    v_text16 = v_sap_recon.
    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 1.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text16.
    CALL METHOD v_html-&amp;gt;new_line.

* Display the data
    CALL METHOD v_html-&amp;gt;display_document
      EXPORTING
         parent             = v_contnr_top.

*   Handle the event
    CALL METHOD o_alvgrid-&amp;gt;list_processing_events
                        EXPORTING i_event_name = 'PRINT_TOP_OF_PAGE'.
 IN PBO while populating in the output table
FORM f9004_display_data TABLES   p_report_tab
                                 p_fieldcat.
  CALL METHOD o_alvgrid-&amp;gt;set_table_for_first_display
    EXPORTING
       is_variant                    = w_variant
       i_save                        = c_a
       is_layout                     = w_layout
    CHANGING
       it_outtab                     = p_report_tab[]
       it_fieldcatalog               = p_fieldcat[]
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       OTHERS                        = 4.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE i000 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.

* Create object
  IF v_event_receiver IS INITIAL.
    CREATE OBJECT v_event_receiver.
  ENDIF.

  SET HANDLER v_event_receiver-&amp;gt;handle_print_top_of_page FOR o_alvgrid.
  SET HANDLER v_event_receiver-&amp;gt;handle_top_of_page FOR o_alvgrid.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2007 11:55:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-using-objects/m-p/1924027#M383676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-12T11:55:25Z</dc:date>
    </item>
  </channel>
</rss>

