Sap alv examples

hai
blow the function modules can u send the some code examples
Reuse_alv_list_display
Reuse_alv_fieldcatalog_merge
Reuse_alv_events_get
Reuse_alv_commentary_write
Reuse_alv_grid_display

Hi
<b>Reuse_alv_list_display</b>
type-pools: slis.
data: fieldcat type slis_t_fieldcat_alv,
fieldcat_ln like line of fieldcat,
fs_layout type slis_layout_alv,
t_layoout like standard table
of fs_layout.
data: begin of fs_spfli,
carrid type spfli-carrid,
connid type spfli-connid,
countryfr type spfli-countryfr,
cityfrom type spfli-cityfrom,
airpfrom type spfli-airpfrom,
countryto type spfli-countryto,
cityto type spfli-cityto,
airpto type spfli-airpto,
fltime type spfli-fltime,
deptime type spfli-deptime,
arrtime type spfli-arrtime,
distance type spfli-distance,
distid type spfli-distid,
fltype type spfli-fltype,
period type spfli-period,
checkbox,
color(3),
end of fs_spfli.
data:
begin of fs_table,
carrid type spfli-carrid,
connid type spfli-connid,
end of fs_table.
data: begin of fs_sflight,
check,
color(3).
include type sflight.
data:end of fs_sflight.
data:
begin of fs_table1,
carrid type sflight-carrid,
connid type sflight-connid,
fldate type sflight-fldate,
end of fs_table1.
data:
t_spfli like standard table
of fs_spfli.
data:
t_table like standard table
of fs_table.
data:
t_table1 like standard table
of fs_table1.
data:
t_sflight like standard table
of fs_sflight.
data:
t_sbook like standard table
of sbook.
data t_layout type slis_layout_alv.
select *
into corresponding fields of table t_spfli
from spfli.
perform start_list_viewer.
perform get_spfli_details.
*& Form SUB1
* text
* -->RT_EXTAB text
form sub1 using rt_extab type slis_t_extab.
data: flight type slis_extab.
flight-fcode = 'SFLIGHT'.
append flight to rt_extab.
set pf-status 'SFLIGHT'. " EXCLUDING RT_EXTAB.
endform. "SUB1
*& Form START_LIST_VIEWER
* text
* --> p1 text
* <-- p2 text
form start_list_viewer .
data: pgm like sy-repid.
pgm = sy-repid.
fs_layout-box_fieldname = 'CHECKBOX'.
fs_layout-info_fieldname = 'COLOR'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_callback_pf_status_set = 'SUB1'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SPFLI'
is_layout = fs_layout
tables
t_outtab = t_spfli
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. " START_LIST_VIEWER
********Process Call Back Events (Begin)***************************
form user_command using ucomm like sy-ucomm
selfield type slis_selfield.
case ucomm.
when 'SFLIGHT'.
selfield-refresh = 'X'.
perform get_spfli_details.
select *
from sflight
into corresponding fields of table t_sflight
for all entries in t_table
where carrid eq t_table-carrid
and connid eq t_table-connid.
perform display_sflight.
when 'SBOOK'.
selfield-refresh = 'X'.
perform get_sflight_details.
select *
from sbook
into corresponding fields of table t_sbook
for all entries in t_table1
where carrid eq t_table1-carrid
and connid eq t_table1-connid
and fldate eq t_table1-fldate.
perform display_sbook.
endcase.
endform. "USER_COMMAND
*& Form SUB2
* text
* -->RT_EXTAB text
form sub2 using rt_extab type slis_t_extab.
data: flight type slis_extab.
flight-fcode = 'SBOOK'.
append flight to rt_extab.
set pf-status 'SBOOK'. " EXCLUDING RT_EXTAB.
endform. "SUB2
*& Form DISPLAY_SFLIGHT
* text
* --> p1 text
* <-- p2 text
form display_sflight .
data: pgm like sy-repid.
pgm = sy-repid.
clear t_layout.
fs_layout-box_fieldname = 'CHECK'.
fs_layout-info_fieldname = 'COLOR'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_callback_pf_status_set = 'SUB2'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SFLIGHT'
is_layout = fs_layout
tables
t_outtab = t_sflight
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_SFLIGHT
*& Form GET_SPFLI_DETAILS
* text
* --> p1 text
* <-- p2 text
form get_spfli_details .
loop at t_spfli into fs_spfli.
if fs_spfli-checkbox = 'X'.
fs_spfli-color = 'C51'.
fs_spfli-checkbox = '1'.
fs_table-carrid = fs_spfli-carrid.
fs_table-connid = fs_spfli-connid.
append fs_table to t_table.
modify t_spfli from fs_spfli.
endif.
endloop.
endform. " GET_SFLIGHT_DETAILS
*& Form GET_SFLIGHT_DETAILS
* text
* --> p1 text
* <-- p2 text
form get_sflight_details .
loop at t_sflight into fs_sflight.
if fs_sflight-check = 'X'.
fs_sflight-color = 'C71'.
fs_sflight-check = '1'.
fs_table1-carrid = fs_sflight-carrid.
fs_table1-connid = fs_sflight-connid.
fs_table1-fldate = fs_sflight-fldate.
append fs_table1 to t_table1.
modify t_sflight from fs_sflight.
endif.
endloop.
endform. " GET_SFLIGHT_DETAILS
*& Form DISPLAY_SBOOK
* text
* --> p1 text
* <-- p2 text
form display_sbook .
data: pgm like sy-repid.
pgm = sy-repid.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_structure_name = 'SBOOK'
tables
t_outtab = t_sbook
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_SBOOK
<b> Reuse_alv_fieldcatalog_merge</b>
*data definition
tables:
marav. "Table MARA and table MAKT
* Data to be displayed in ALV
* Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
* matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
                        " intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                        "make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
* Other data needed
* field to store report name
data i_repid like sy-repid.
* field to check table length
data i_lines like sy-tabix.
* Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
* read data into table imat
  select * from marav
  into corresponding fields of table imat
  where
  matnr in s_matnr.
* Check if material was found
  clear i_lines.
  describe table imat lines i_lines.
  if i_lines lt 1.
*   Using hardcoded write here for easy upload
    write: /
    'No materials found.'.
    exit.
  endif.
end-of-selection.
* Now, we start with ALV
* To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
* The fieldcatalouge can be generated by FUNCTION
* 'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
* report source, including this report.
* The only problem one might have is that the report and table names
* need to be in capital letters. (I had it :-( )
* Store report name
  i_repid = sy-repid.
* Create Fieldcatalogue from internal table
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME         = i_repid
            I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
            I_INCLNAME             = i_repid
       CHANGING
            CT_FIELDCAT            = int_fcat
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3.
*explanations:
*    I_PROGRAM_NAME is the program which calls this function
*    I_INTERNAL_TABNAME is the name of the internal table which you want
*                       to display in ALV
*    I_INCLNAME is the ABAP-source where the internal table is defined
*               (DATA....)
*      CT_FIELDCAT contains the Fieldcatalouge that we need later for
*      ALV display
  IF SY-SUBRC <> 0.
    write: /
    'Returncode',
    sy-subrc,
    'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
  ENDIF.
*This was the fieldcatlogue
* And now, we are ready to display our list
* Call for ALV list display
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
*            I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
            I_CALLBACK_PROGRAM = i_repid
            IT_FIELDCAT        = int_fcat
            I_SAVE             = 'A'
       TABLES
            T_OUTTAB           = imat
       EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.
*explanations:
*    I_CALLBACK_PROGRAM is the program which calls this function
*    IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
*                 now the data definition needed for display
*    I_SAVE allows the user to save his own layouts
*      T_OUTTAB contains the data to be displayed in ALV
  IF SY-SUBRC <> 0.
    write: /
    'Returncode',
    sy-subrc,
    'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
  ENDIF.
<b> Reuse_alv_events_get</b>
By using this  function module called 'REUSE_ALV_EVENTS_GET' where u get all the events like PF_STATUS_SET, TOP_OF_LIST, END_OF_PAGE,END_OF_LIST etc populated into an internal table So u can read this internal table and call the appropriate form to print the content at the end of the list. Below is the sample code for ur reference.
FORM build_events USING flag
CHANGING pa_events TYPE slis_t_event.
*Get all possible events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = pa_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
* Specify events used in selection screen
READ TABLE pa_events WITH KEY name = slis_ev_top_of_page
INTO ls_events.
IF sy-subrc = 0.
IF flag = 1.
ls_events-form = 'TOP_OF_PAGE1'.
ELSEIF flag = 2.
ls_events-form = 'TOP_OF_PAGE2'.
ELSE.
ls_events-form = 'TOP_OF_PAGE3'.
ENDIF.
MODIFY pa_events FROM ls_events INDEX sy-tabix.
CLEAR ls_events.
ENDIF.
ENDFORM. "build_events
*& Form top_of_page1
FORM top_of_page1.
WRITE: 'Last Year'.
ENDFORM. "TOP_OF_PAGE1
*& Form top_of_page2
FORM top_of_page2.
WRITE: 'Budget'.
ENDFORM. "TOP_OF_PAGE2
*& Form top_of_page3
FORM top_of_page3.
WRITE: 'This year'.
ENDFORM. "TOP_OF_PAGE3 
<b>Reuse_alv_commentary_write </b>
*& Report  ZALV                                                        *
Report  ZALV  .
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   = 'X'.
  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.
  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-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-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'.
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.
*       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.
*&      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.
*&      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.
<b>Reuse_alv_grid_display</b>
*& Report  ZALVTEST                                                    *
REPORT  ZALVTEST.
TABLES: mara, makt.
TYPE-POOLS: slis.
TYPES: BEGIN OF tab,
          matnr TYPE matnr,
          matkl TYPE matkl,
          maktx TYPE maktx,
       END OF tab.
DATA: itab TYPE TABLE OF tab,
      wa LIKE LINE OF 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.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
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   = 'MATNR'.
  fieldcatalog-seltext_m   = 'Material No'.
  fieldcatalog-col_pos     = 0.
  fieldcatalog-outputlen   = 10.
  fieldcatalog-emphasize   = 'X'.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.
  fieldcatalog-fieldname   = 'MATKL'.
  fieldcatalog-seltext_m   = 'Group'.
  fieldcatalog-col_pos     = 2.
   fieldcatalog-outputlen   = 5.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.
  fieldcatalog-fieldname   = 'MAKTX'.
  fieldcatalog-seltext_m   = 'Description'.
  fieldcatalog-col_pos     = 1.
  fieldcatalog-outputlen   = 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-colwidth_optimize = 'X'.
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_XEVENTS
            i_save                  = 'X'
*            is_variant              = z_template
       tables
            t_outtab                = itab
       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 F~matnr F~matkl P~maktx
    INTO table itab
    FROM mara AS F INNER JOIN makt AS P
           ON F~matnr = P~matnr.
endform.                    " DATA_RETRIEVAL
Regards
Pavan

Similar Messages

  • ALV example

    Dear experts,
                        i have just started off with WEB dynpro's for ABAP. i wanted a very basic ALV example to start off with. thanks in advance .

    Hi Girish,
       Welcome to the interesting world of Web Dynpro ABAP !
    For Web dynpro ABAP you will require SAP ECC 6.0 onwards and WAS 7.0
    is a must. It has very good future propspects as this is best UI technology.
    In web dynpro ABAP we follow MVC(Model View Controller) architecture.
    In this object oriented ABAP is used to provide background functionality. Here, your ABAP skills can be utilized to the fullest. Programming in web dynpro ABAP is different than conventional ABAP programming. Here we strictly follow MVC architecture in terms of controller interface. Also there are many wizards available so that we can directly pick the code from wizards.
    e.g We can call BAPI through a service call in web dynpro application. Thus automatically backgroud code for BAPI execution will be generated.
    To start with Web dynpro ABAP you can try following tutorial:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a282c952-0801-0010-1eb5-87953e036712
    You can start with tutorials and all. There are around six tutorials in SDN library.
    Web Dynpro for ABAP
    http://help.sap.com/saphelp_erp2005/helpdata/en/a5/1a1e3e7181b60ae10000000a114084/frameset.htm
    best tutorials in wbdynpro for ABAP to start with :
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
    Have a look at the following SDN WDA Wiki . There you can find all relevant information.
    https://wiki.sdn.sap.com/wiki/display/WDABAP/Main
    SAP has provided you with ample demo example of WD ABAP already bundled with SAP . Just Try out Components starting with WDR . I can tell you few like WDR_TEST_EVENTS ( It shows how every UI elments to use )
    See packages like SWDP_DEMO , SALV_WD_DEMO
    there are many more .
    /people/marilyn.pratt/blog/2005/12/20/web-dynpro-for-abap
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a282c952-0801-0010-1eb5-87953e036712
    The specified item was not found.
    Also you can search weblogs on web dynpro ABAP.
    Hope this will help you.
    Cheers,
    Darshna.

  • SAP ALV report scheduling background in excel format

    Hi Gurus,
    We are using SAP 4.7 and using different SAP reports.Now I want to send SAP ALV report in excel format directly from SAP in background.Now we send these reports in background weekly by using autimetic scheduling but this is PDF format.Now I want to change this pdf format to excel format.In SCOT T.Code I am able to find any excel format.Please help me out.
    I am waiting for your reply.
    Advance Thanks
    Nirmal

    > We are using SAP 4.7 and using different SAP reports.Now I want to send SAP ALV report in excel format directly from SAP in background.Now we send these reports in background weekly by using autimetic scheduling but this is PDF format.
    "Something" has to do the conversion to excel, it will not work without programming.
    If you display a grid the data is sent via OLE to the frontend where excel is started and displaying the data. If you run a program in the background there is no terminal connection and hence no excel and hence no conversion.
    What you can do is that you display the data as raw data and send it as attachment - but then people need to import and convert themselves.
    Markus

  • How to connect one SAP system to Non-SAP system(Example:Window's7)?

    Hi Experts,
        In general, One SAP system can connect another SAP system through RFC.How to  connect One SAP system  to Non-SAP system(example:window's 7) and is it possible through RFC?
    Thanks and Regards,
    Nageswar

    Hello  Wolfgang Schaper,
    Thank you so much for quick response.
    As you told I am trying to work with BRFplus/DSM to call decision services from nonABAP systems,so I tried with RFC.But it is not possible as you told.
    Please give any solution Without using Web Services, is there any ways to connect from SAP system  with the Non-SAP Systems.

  • SAP script example

    Hi
    can anybody forward be sap scripts examples . Please forward me the documents on [email protected] .
    Print program examples .
    Configuration in nace , spro etc.
    Thanks and regards

    Hi Naval,
    Check these links.
    http://www.sap-img.com/sapscripts/sample-sapscripts-label-printing-program.htm
    http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm
    Also check these links.
    SAP SCRIPT and the report
    about sap script
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • SAP standard example to get start with Webdynpro for ABAP

    Hi,
    I just started learning Webdynpro for ABAP.
    I'm looking for SAP standard buit in applilcation example which explains all the the view controls, properties and Layout desining.
    please let me know the standard applications of SAP for learning.
    Many Thanks,
    Gupta

    hi..
    just go to package SWDP_DEMO, it has all sample webdynpro applications using all UI elements.
    By the way...question is posted in wrong forum
    Regards
    Manas Dua

  • ALV Examples?????

    Hi experts,
                     could anyone please tell me about any sap standard alv interactive report, if there are any?
    Thanks and Regards,
    Ramana

    Hi,
    i've listed some standard ALV Reports.this may help you
    BALVEX02 ALV demo program: Output flights (simplest version)
    BALVEXTR Extract management
    BALVHD01 Demo program ALV: Hierarchical-sequential list flight model
    BALVHD01_GROUP Demo program ALV: Hierarchical-sequential list flight model
    BALVHT01 Test program ALV: hierarchical-sequential list flight model
    BALVHTMAINTENANCE Report for manipulating HTML templates
    BALVHTTRANSLHTMPL ALV: Report for automatic HTML template translation
    BALVSD01 Demo program ALV: Simple list flight model
    BALVSD02 ALV demo program: Output flights (simplest version)
    BALVSD02_GRID Simple ALV grid control call in fullscreen mode
    BALVSD02_SAVE Simple ALV call with storage option
    BALVSD03 Simple list
    BALVSD04 Simple list (merged)
    BALVSD06 Demoprogram ALV: Output flights (simple version + save)
    BALVSD11 Demo program ALV: Simple list with interactions and variants
    BALVST01 Test program ALV: Simple list flight model
    BALVST02 Test program ALV: Simple list flight model
    BCALV_TEST_BLOCK_LIST Program BCALV_TEST_BLOCK_LIST
    BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
    BCALV_TEST_EXCEL_DATATYPES FILTER Test Report
    BCALV_TEST_FB_CREATE Test Report for Dynamic Generation of Tables
    BCALV_TREE_01 ALV tree control: build up the hierarchy tree
    BCALV_TREE_02 ALV tree control: event handling

  • ALV Example with multiple headers, tree, editable column combined...

    Hello Experts,
    Any examples would be highly appreciated.Thank you and take care!

    Hi,
    Check this thread for ALVs -
    Interactive ALV
    ashish

  • SAP SCRIPT examples in SAP SERVER?

    can anyone kindly let me know the location of SAPscript examples which are present in the sap server? in one post, someboday said it's there in ABAPDOCU, but it's nowhere to be found.
    thanks,
    max

    refer ur standard sapscript
    MEDRUCK - purchase order
    RVORDER01 - sales order
    RVINVOICE01 - invoice.
    see the print program also for MEDRUCK print program is SAPFM06P
    RVORDER01 print program is RVADOR01
    try to change a standard sapscript form.
    with regards.
    Kalpana

  • Where i can found documents about a sap reallife example

    hello,
    i am a beginer for sap. i learn a lot about its config
    sometime i think of i need a example to link all of these
    i mainly study the sd module.
      where i can find a reallife example ,some thing may like a word document or pdf document about a small company
    's sap sd module.
    anybody know this, please give me a link or email me
    in [email protected]
                            thank a lot.

    Hi,
    If you undergo SAP Training , you will get notes with sample excercises at the end of every chapter that you can try out on a LIVE SAP system.
    Else try http://help.sap.com , you may find some examples not a surety though.
    Get access to a LIVE system where you can play around.
    All the best,
    Sam Varghese

  • Activation of SAP delivery example

    In SEM-BPS, SAP has provided pre-configured planning areas vis-a-vis standard business content of BW objects.
    Is there any similar pre-configured data basis and consolidation areas available in SEM-BCS? I saw one OSS note 736226 in this connection which helps to install the delivery example. Whether my understanding is correct?
    Thank you,
    ShankY

    hi shanky,
    I'll send you some documents on planning areas. i guess it helps.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce03c6bb-0601-0010-e69d-fb47733fe3b7
    <b>Moving SEM BCS data/config from one BW instance to another</b>
    Moving SEM BCS data/config from one BW instance to another
    <b>Merger in SEM-BCS</b>
    Merger in SEM-BCS
    <b>Strategic Enterprise management</b>
    http://help.sap.com/saphelp_bw320/helpdata/en/51/09193c38f98e1ce10000000a11405a/plain.htm
    Hope IT Helps...Happy Holi
    Thanks
    Varun CN

  • SAP Workflow example

    Hi Experts...
    Like to know whether SAP provided any standard example of
    work flow ... (As SAP provided Standard smart form example (sf_example_*)...
    or any Demo of Workflow
    ...Thanks..
    ..Ashish

    Hi
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/sapBusinessWorkflow
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/sdnBlogsfor+Workflows
    Regards
    Pavan

  • Excel to SAP Macro Example

    Ok so here's an example of how to mass generate PDF's from PO placed on various Vendors. The entire code, if used on a VBA for Excel, does the task.
    Can the VBA coding in SAP be edited so that instead of generating PDF's, it can be used to change Delivery and Stat date for a certain line item and save the PO? Like a mass Date Conversion on PO? Because thats very tedious task to accomplish sometimes.

    Hi Kaustav,
    See, the issue here is that your program is simulating human behavior. It is not asking SAP for details or field names, it is simply going to a point on the screen and performing the activity. It is just like a program we have in automation testing.
    We have experience of  programing such stuffs in college days, but wont be a wise thing to encourage it here.
    for making changes to delivery dates (for specific lines of PO where MEMASSPO wont work), i recommend you to follow the standard path of ABAP or LSMW in that matter
    Regards
    Vivek Singh

  • SAP SDK example is unable to build in eclipse

    Hi All,
    I am trying to install the standard SAP Example SDK application.
    I imported the com.sap.sample.audio and com.sap.sample.click in Eclipse workspace but getting build errors.
    Bundle  com.sap.ip.bi.zen.rt.components.sdk.eclipse cannot be resolved and
    Unknown extension point 'com.sap.ip.bi.zen.sdk'.
      my DS is on
      c:\Design Studio folder and I did try to setthe plugins to this path but still not able to build.
      Pls help me to resolve the issue.
      Thanks,
       Manju

    Hi Manjula,
    Did you install the Design Studio SDK XML Schema Definition?
    If not:
    1. Choose WindowPreferences.
    2. In the Preferences dialog box, choose XML catalog.
    3. Choose Add....
    4. In the Add XML Catalog Element dialog box, choose File System....
    5. Navigate to file sdk.xsd in your SDK Templates and Samples folder, for example C:\ds_sdk\sdk.xsd.
    6. Choose OK twice.
    Br
    Max

  • SAP standard example for Side Panels?

    Hiya,
    I've read up about side panels (thank you to all those who've written the lovely blogs!) and I think they look great!
    I'm so excited about them that I'd like to demonstrate the functionality to our business - hopefully to convince them that NWBC, and side panels, are the way forward for their power users.
    I was hoping to use a SAP delivered side panel - would anyone know how/where SAP has a standard example side panel that I could use for demonstration purposes?
    Thanks!

    Thanks everyone!
    In the end transaction BSSP_CONTENT seemed the most useful but now I'm a little stuck on how to proceed.
    I mean I found this side panel which I thought would be nice to show the power of NWBC:
    So I added it, and other roles, to my user via SU01:
    But when I go into VA02 I see no side panel?
    Obviously I'm missing something, would anyone know what?
    Many thanks in advance!

Maybe you are looking for

  • Modification to pdf files not saved in the original document

    The modification to pdf files are not saved in the original documents (e.g. in My Documents) but a new file is created in Download\Adobe Reader and for every saving I do a new file (e.g.  -1, -2, ..) is created. Is that normal? If yes, it is really a

  • Protecting data in pdf file

    dear all please help me, i have a case. if i have pdf file which consist 4 page can I protected ? page 1 : consist as image and text, want to protect text only. page 2 : consist just a text, unprotect anything page 3 : consist image and text, want to

  • Blocking_session in v$session

    Hi, My Oracle version : Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options When I am quering the v$seesion, it shows some Blocking_

  • Swap objects between photos

    if i took 2 different photos of the same person and one facial expression was better than the other photo can switch the faces in the pictures?

  • [iCal Server] Error when importing an .ics file received by e-mail

    Hi, I am setting up an iCal server. My SL server is member of my Active Directory with an extended schema. My SL server is also an OD master My AD users can connect to the iCal server, add events and delegates, send invites to each other without any