Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling SAP Standard screen in report output screen

Former Member
0 Kudos

Hello All,

Here is my requirement: I have created one report program(just displays basic list) with sales order details.

Here i am displaying fileds for ex: sales order number, creation date, description etc.

Now when i click on perticular sales order number in output screen it has to take me to that sales order desplay screen (VA03) with that order display.

Can any body suggest me on this.

Thanks in Advance for ur inputs.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sure, check this out.



report zrich_0002 no standard page heading.

data: ivbak type table of vbak with header line.

data : cursor_field(30),
       field_value(30) .

select-options: s_vbeln for ivbak-vbeln.

start-of-selection.

  select * into corresponding fields of table ivbak
      from vbak
          where vbeln in s_vbeln.

  loop at ivbak.
    format hotspot on.
    write:/ ivbak-vbeln.
    hide ivbak-vbeln.
    format hotspot off.
  endloop.

at line-selection.

  set parameter id 'AUN' field ivbak-vbeln.
  call transaction 'VA03' and skip first screen.

Regards,

RIch Heilman

11 REPLIES 11

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sure, check this out.



report zrich_0002 no standard page heading.

data: ivbak type table of vbak with header line.

data : cursor_field(30),
       field_value(30) .

select-options: s_vbeln for ivbak-vbeln.

start-of-selection.

  select * into corresponding fields of table ivbak
      from vbak
          where vbeln in s_vbeln.

  loop at ivbak.
    format hotspot on.
    write:/ ivbak-vbeln.
    hide ivbak-vbeln.
    format hotspot off.
  endloop.

at line-selection.

  set parameter id 'AUN' field ivbak-vbeln.
  call transaction 'VA03' and skip first screen.

Regards,

RIch Heilman

0 Kudos

Hello,

But it always stores the last sales order number and displaying the same.

It is not displaying the one on which i am clicking.

Thanks,

Devasing.

0 Kudos

Hello Rich,

Here is my code,

REPORT zdeva_viewtest NO STANDARD PAGE HEADING.

TABLES: vbap,

vbak.

TYPES: BEGIN OF s_tab,

vbeln LIKE vbak-vbeln,

audat LIKE vbak-audat,

ernam LIKE vbak-ernam,

kunnr LIKE vbak-kunnr,

matnr LIKE vbap-matnr,

posnr LIKE vbap-posnr,

arktx LIKE vbap-arktx,

END OF s_tab.

data : cursor_field(30),

field_value(30) .

DATA: i_tab TYPE s_tab OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_box FOR vbap-arktx. " Sales Order

SELECTION-SCREEN END OF BLOCK blk1.

START-OF-SELECTION.

SELECT vbakvbeln vbakaudat vbakernam vbakkunnr vbap~matnr

vbapposnr vbaparktx

INTO CORRESPONDING FIELDS OF TABLE i_tab FROM vbap

JOIN vbak ON vbakvbeln = vbapvbeln

WHERE vbap~arktx IN s_box.

IF sy-subrc <> 0.

WRITE:/ 'No records found'.

ENDIF.

LOOP AT i_tab.

FORMAT HOTSPOT ON.

WRITE:/ 'Sales Order Number - ', i_tab-vbeln.

HIDE i_tab-vbeln.

FORMAT HOTSPOT OFF.

WRITE:/ 'Document date - ', i_tab-audat.

WRITE:/ 'Creator - ', i_tab-ernam.

WRITE:/ 'Sold-to-party - ', i_tab-kunnr.

WRITE:/ 'Material Number - ', i_tab-matnr.

WRITE:/ 'Posnr - ', i_tab-posnr.

WRITE:/ 'BOX Number - ', i_tab-arktx.

SKIP.

ENDLOOP.

AT LINE-SELECTION.

SET PARAMETER ID 'AUN' FIELD i_tab-vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

This is always displaying the last sales order details....

Thanks,

Devasing.

0 Kudos

Your code works fine in our system. I have made one minor change. Normally, I would use a separate variable for the hide:

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_box FOR vbap-arktx. " Sales Order
SELECTION-SCREEN END OF BLOCK blk1.

START-OF-SELECTION.
  SELECT vbak~vbeln vbak~audat vbak~ernam vbak~kunnr vbap~matnr
  vbap~posnr vbap~arktx
  INTO CORRESPONDING FIELDS OF TABLE i_tab FROM vbap
  JOIN vbak ON vbak~vbeln = vbap~vbeln
  WHERE vbap~arktx IN s_box.
  IF sy-subrc <> 0.
    WRITE:/ 'No records found'.
  ENDIF.

  LOOP AT i_tab.
    FORMAT HOTSPOT ON.
    WRITE:/ 'Sales Order Number - ', i_tab-vbeln.
    HIDE i_tab-vbeln.
    CLEAR i_tab-vbeln.                              "<=========
    FORMAT HOTSPOT OFF.
    WRITE:/ 'Document date - ', i_tab-audat.
    WRITE:/ 'Creator - ', i_tab-ernam.
    WRITE:/ 'Sold-to-party - ', i_tab-kunnr.
    WRITE:/ 'Material Number - ', i_tab-matnr.
    WRITE:/ 'Posnr - ', i_tab-posnr.
    WRITE:/ 'BOX Number - ', i_tab-arktx.
    SKIP.
  ENDLOOP.

AT LINE-SELECTION.

  SET PARAMETER ID 'AUN' FIELD i_tab-vbeln.

  CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

Rob

0 Kudos

Hello Rob,

I have added clear statement after hide, even though it is always displaying the last sales order.

Devasing.

Former Member
0 Kudos

Hi,

the statement

call transaction 'VA03' and skip first screen.

does not check any Authorisation objects.

You can check the user rights for the Transaction using the FM:

AUTHORITY_CHECK_TCODE

Regards,

Gianpietro

Message was edited by:

Gianpietro Dal Zio

Former Member
0 Kudos

hi,

I just copied the Rich program and tested it and it is running successfully, please test the program and let us know

Regards

Sudheer

0 Kudos

Hello Sudheer,

It works fine wheb there is only one sales order in the output, but when we have multiple sales orders then it is always displying last one.

Thanks,

Devasing.

0 Kudos

Hi,

i have tried the code too.

It works fine...

Regards,

Gianpietro

Former Member
0 Kudos

Hi Guys --this is the OO Forum so I'll show you how to do it the OO way.

Forget about old reports for this type of stuff.

Using the ALV is easy once you've got a basic class defined which I'll give you below.

Here's a little program which displays 200 sales orders. When you double click on an Order number the Order is dispayed. If you click on the Material then the material is displyed whilst if you click on the customer the customer is displayed.

After you've finshed the transaction the GRID is updated to show whether you displayed an Order, Material or Customer.

(You can add order selection etc --and change the layout --this just serves as an example).

The grid will also download directly to EXCEL WITH HEADINGS , or as a simple list. Quite flexible.

1) Create a simple blank screen (SE51) with a custom container in it called CCONTAINER1 and the folllowing logic

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

2) Create a bog standard status SE41 (optional but easier for some user commands after PAI) called 0001 with the Standard toolbar etc. The example will work without this but it's easier to show the standard exit / cance / back buttons).

3)Copy this program

Program ZZORDERDISP.

INCLUDE ZZJIMBOXX_INCL. *====> Shown at the end of this code

TABLES : VAPMA.

TYPES: BEGIN OF s_elements,

vbeln TYPE vapma-vbeln,

posnr TYPE vapma-posnr,

matnr TYPE vapma-matnr,

kunnr TYPE vapma-kunnr,

werks TYPE vapma-werks,

vkorg TYPE vapma-vkorg,

vkbur TYPE vapma-vkbur,

status(5) TYPE c,

END OF s_elements.

DATA: t_elements TYPE TABLE OF s_elements, "refers to our ITAB

my_line TYPE s_elements.

START-OF-SELECTION.

CALL SCREEN 100.

END-OF-SELECTION.

MODULE status_0100 OUTPUT.

IF z_object is initial.

CREATE OBJECT z_object EXPORTING z_object = z_object.

CALL METHOD z_object->build_dynamic_structures

EXPORTING

my_line = my_line

calling_program = sy-repid

IMPORTING

dy_table = dy_table

CHANGING

it_fldcat = it_fldcat.

  • Here before displaying you can change the field catalog to

  • adjust your own names

  • Method call just uses the names in the table structure.

col_name 1 'Order Nr' 10.

col_name 2 'Item' 6 .

col_name 3 'Material' 10.

col_name 4 'Customer' 10.

col_name 5 'Plant' 6.

col_name 6 'Sales Org' 6.

col_name 7 'Sales Office' 8.

col_name 8 'Status' 9.

PERFORM populate_dynamic_itab.

CALL METHOD z_object->display_grid

EXPORTING

g_outtab = <dyn_table>

g_fldcat = it_fldcat

CHANGING

it_fldcat = it_fldcat

gt_outtab = <dyn_table>.

SET PF-STATUS '0001'.

SET TITLEBAR '000'.

Endif.

ENDMODULE.

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'RETURN'.

LEAVE PROGRAM.

WHEN OTHERS.

ENDCASE.

ENDMODULE.

FORM populate_dynamic_itab.

ASSIGN dy_table->* TO <dyn_table>.

CREATE DATA dy_line LIKE LINE OF <dyn_table>.

ASSIGN dy_line->* TO <dyn_wa>.

SELECT vbeln posnr matnr kunnr werks vkorg vkbur

UP TO 200 rows

FROM vapma

INTO CORRESPONDING FIELDS OF TABLE <dyn_table>.

  • Populate Dynamic table and save a copy

  • create 2nd Dyn table to hold original data (optional)

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fldcat

IMPORTING

ep_table = dy_table.

ASSIGN dy_table->* TO <orig_table>.

CREATE DATA dy_line LIKE LINE OF <orig_table>.

ASSIGN dy_line->* TO <dyn_wa>.

<orig_table> = <dyn_table>.

ENDFORM.

FORM DATA_CHANGED

USING

changed_tab

inserted_tab

deleted_tab

modified_cells_tab.

ENDFORM.

FORM process.

  • Orig table is in dynamic table <orig_table>

  • ALV GRID changed table is in <dyn_table>.

Loop AT <orig_table> INTO <dyn_wa>.

  • Do what you want

  • end

ENDLOOP.

ENDFORM.

FORM refresh.

CALL METHOD z_object->refresh_grid.

ENDFORM.

form dubbelklik using

e_row type LVC_S_ROW

e_column type LVC_S_col

es_row_no type lvc_s_roid.

field-symbols: <row_nr> type any.

assign e_row to <row_nr>.

READ TABLE <dyn_table> index <row_nr> into my_line.

case e_column.

when 'MATNR'.

SET PARAMETER ID 'MAT' FIELD my_line-matnr.

CALL TRANSACTION 'MM03' and skip first screen.

my_line-status = 'C-MAT'.

when 'KUNNR'.

SET PARAMETER ID 'KUN' FIELD my_line-kunnr.

CALL TRANSACTION 'XD03' and skip first screen.

my_line-status = 'C-KUN'.

when others.

set parameter id 'AUN' field my_line-vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

my_line-status = 'C-ORD'.

endcase.

modify <dyn_table> from my_line index <row_nr>.

SET TITLEBAR '001'.

i_gridtitle = 'Order / Material Display'.

CALL METHOD z_object->change_title

EXPORTING i_gridtitle = i_gridtitle.

PERFORM refresh.

call method z_object->set_cursor

EXPORTING column_id = e_column

row_no = es_row_no.

endform.

4) copy this INCLUDE which puts it all together.

  • Generic ALV class etc for use as INCLUDE Jimbo 2007.

DEFINE col_name.

READ TABLE it_fldcat INTO wa_it_fldcat INDEX &1.

wa_it_fldcat-coltext = &2.

wa_it_fldcat-outputlen = &3.

modify it_fldcat from wa_it_fldcat index &1.

END-OF-DEFINITION.

DEFINE toolbar_funcs.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_TYPE.

MOVE &1 TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE &2 TO ls_toolbar-icon.

MOVE &3 TO ls_toolbar-quickinfo.

APPEND ls_toolbar TO e_object->mt_toolbar.

END-OF-DEFINITION.

INCLUDE <icon>.

FIELD-SYMBOLS :

<fs1> TYPE STANDARD TABLE,

<fs0> TYPE STANDARD TABLE,

<dyn_table> TYPE STANDARD TABLE,

<orig_table> TYPE STANDARD TABLE,

<dyn_wa> TYPE ANY.

CLASS zcl_alv_test DEFINITION DEFERRED.

DATA:

z_object TYPE REF TO zcl_alv_test, "Instantiate our class

it_fldcat TYPE lvc_t_fcat,

i_gridtitle TYPE lvc_title,

i_rows TYPE lvc_t_row,

i_row_nr TYPE LVC_T_ROID,

wa_it_fldcat TYPE lvc_s_fcat,

new_table TYPE REF TO DATA,

dy_table TYPE REF TO DATA,

inserted_tab TYPE lvc_t_moce,

deleted_tab TYPE LVC_T_MOCE,

changed_tab TYPE REF TO DATA,

is_layout TYPE LVC_S_LAYO,

modified_cells_tab TYPE LVC_T_MODI,

i_columns TYPE lvc_t_col,

dy_line TYPE REF TO DATA.

CLASS zcl_alv_test DEFINITION.

PUBLIC SECTION.

METHODS:

constructor

IMPORTING

z_object TYPE REF TO zcl_alv_test,

display_grid

IMPORTING

g_outtab TYPE STANDARD TABLE

g_fldcat TYPE lvc_t_fcat

CHANGING

it_fldcat TYPE lvc_t_fcat

GT_OUTTAB TYPE STANDARD TABLE,

change_title

IMPORTING

i_gridtitle TYPE lvc_title,

refresh_grid,

set_cursor

IMPORTING

column_id TYPE lvc_s_col

row_no TYPE lvc_s_roid,

build_dynamic_structures

IMPORTING

my_line TYPE ANY

calling_program TYPE sy-repid

EXPORTING

dy_table TYPE REF TO DATA

CHANGING

it_fldcat TYPE lvc_t_fcat,

get_selected_columns

CHANGING et_index_columns TYPE lvc_t_col,

get_selected_rows

CHANGING et_index_rows TYPE lvc_t_row

et_row_no TYPE LVC_T_ROID.

PRIVATE SECTION.

*

  • Attributes

*

DATA:

lr_rtti_struc TYPE REF TO cl_abap_structdescr,

zog LIKE LINE OF lr_rtti_struc->components,

zogt LIKE table of zog,

struct_grid_lset TYPE lvc_s_layo,

e_row TYPE lvc_s_row,

e1_row TYPE i,

e_value TYPE c,

e1_col TYPE i,

e_column TYPE lvc_s_col,

es_rowid TYPE lvc_s_roid,

es_row_id TYPE LVC_S_ROW,

es_col_id TYPE LVC_S_COL,

es_row_no TYPE lvc_s_roid,

grid_container1 TYPE REF TO cl_gui_custom_container,

grid1 TYPE REF TO cl_gui_alv_grid,

ls_layout TYPE kkblo_layout,

lt_fieldcat_wa TYPE kkblo_fieldcat,

gt_outtab TYPE REF TO DATA,

l_mode TYPE raw4,

celltab TYPE lvc_t_styl,

wa_celltab TYPE lvc_s_styl,

lt_fieldcat TYPE kkblo_t_fieldcat,

l_tabname TYPE slis_tabname,

ls_toolbar TYPE stb_button,

caller TYPE sy-repid,

g_outtab1 TYPE REF TO DATA,

g_fldcat1 TYPE REF TO DATA.

*

  • Event Receivers - These methods are entered

  • when the specified event occurs

*

EVENTS: user_command.

METHODS:

on_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING

e_ucomm

sender,

on_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING

e_object

e_interactive,

on_dubbelklik

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING

e_row

e_column

es_row_no,

handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING

er_data_changed,

handle_data_changed_finished

FOR EVENT data_changed_finished OF cl_gui_alv_grid

IMPORTING

e_modified

et_good_cells,

*

  • Rest of the methods

*

process,

dubbelklik

IMPORTING

e_row TYPE lvc_s_row

e_column TYPE lvc_s_col

es_row_no TYPE lvc_s_roid,

return_structure

IMPORTING

my_line TYPE ANY,

create_dynamic_fcat

EXPORTING

it_fldcat TYPE lvc_t_fcat,

create_dynamic_table

IMPORTING

it_fldcat TYPE lvc_t_fcat

EXPORTING

dy_table TYPE REF TO DATA,

download_to_excel,

refresh.

ENDCLASS. "zcl_alv_test DEFINITION

*

  • Implementation definition

*

CLASS zcl_alv_test IMPLEMENTATION.

*

  • Constructor

  • create our reference / instance to cl_gui_alv_grid

*

METHOD constructor.

CREATE OBJECT grid_container1

EXPORTING

container_name = 'CCONTAINER1'.

CREATE OBJECT grid1

EXPORTING

i_parent = grid_container1.

*

  • Set event handlers

*

SET HANDLER z_object->on_user_command for grid1.

SET HANDLER z_object->on_toolbar for grid1.

SET HANDLER Z_OBJECT->handle_data_changed FOR grid1.

SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.

SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.

CALL METHOD grid1->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

ENDMETHOD. "constructor

*

  • Rest of the methods

*

METHOD on_dubbelklik.

CALL METHOD me->dubbelklik

EXPORTING

e_row = e_row

e_column = e_column

es_row_no = es_row_no.

ENDMETHOD. "on_dubbelklik

*

METHOD get_selected_columns.

CALL METHOD grid1->get_selected_columns

IMPORTING

et_index_columns = i_columns.

ENDMETHOD.

METHOD get_selected_rows.

CALL METHOD grid1->get_selected_rows

IMPORTING

et_index_rows = i_rows

et_row_no = i_row_nr.

ENDMETHOD.

METHOD set_cursor.

CALL METHOD grid1->set_current_cell_via_id

EXPORTING

is_column_id = column_id

is_row_no = row_no.

ENDMETHOD.

METHOD handle_data_changed.

call method grid1->get_current_cell

IMPORTING

e_row = e1_row

e_value = e_value

e_col = e1_col

es_row_id = es_row_id

es_col_id = es_col_id

es_row_no = es_row_no.

changed_tab = er_data_changed->mp_mod_rows.

inserted_tab = er_data_changed->mt_inserted_rows.

deleted_tab = er_data_changed->mt_deleted_rows.

modified_cells_tab = er_data_changed->mt_mod_cells.

PERFORM data_changed IN PROGRAM (caller) IF FOUND

USING changed_tab

inserted_tab

deleted_tab

modified_cells_tab.

ENDMETHOD. "handle_data_changed

METHOD handle_data_changed_finished.

ENDMETHOD. "handle_data_changed_finished

METHOD return_structure.

lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( my_line ).

zogt[] = lr_rtti_struc->components.

ENDMETHOD. "return_structure

METHOD create_dynamic_fcat.

LOOP AT zogt INTO zog.

CLEAR wa_it_fldcat.

wa_it_fldcat-fieldname = zog-name .

wa_it_fldcat-dataTYPE = zog-TYPE_kind.

wa_it_fldcat-intTYPE = zog-TYPE_kind.

wa_it_fldcat-intlen = zog-length.

wa_it_fldcat-decimals = zog-decimals.

wa_it_fldcat-coltext = zog-name.

wa_it_fldcat-lowercase = 'X'.

case sy-tabix.

When 2.

wa_it_fldcat-edit = 'X'.

When 4.

wa_it_fldcat-edit = 'X'.

when 6.

wa_it_fldcat-edit = 'X'.

when others.

wa_it_fldcat-edit = ' '.

endcase.

APPEND wa_it_fldcat TO it_fldcat .

ENDLOOP.

ENDMETHOD. "create_dynamic_fcat

METHOD download_to_excel.

assign g_outtab1->* to <fs0>.

assign g_fldcat1->* to <fs1>.

CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'

EXPORTING

it_fieldcat_lvc = <fs1>

  • is_layout_lvc = m_cl_variant->ms_layout

is_tech_complete = ' '

IMPORTING

es_layout_kkblo = ls_layout

et_fieldcat_kkblo = lt_fieldcat.

LOOP AT lt_fieldcat INTO lt_fieldcat_wa.

CLEAR lt_fieldcat_wa-tech_complete.

IF lt_fieldcat_wa-tabname IS initial.

lt_fieldcat_wa-tabname = '1'.

MODIFY lt_fieldcat FROM lt_fieldcat_wa.

ENDIF.

l_tabname = lt_fieldcat_wa-tabname.

ENDLOOP.

CALL FUNCTION 'ALV_XXL_CALL'

EXPORTING

i_tabname = l_tabname

is_layout = ls_layout

it_fieldcat = lt_fieldcat

i_title = sy-title

TABLES

it_outtab = <fs0>

EXCEPTIONS

fatal_error = 1

no_display_possible = 2

others = 3.

IF sy-subrc <> 0.

message id sy-msgid TYPE 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDMETHOD. "download_to_excel

METHOD change_title.

CALL METHOD grid1->set_gridtitle

EXPORTING

i_gridtitle = i_gridtitle.

ENDMETHOD. "CHANGE_TITLE

METHOD create_dynamic_table.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fldcat

IMPORTING

ep_table = dy_table.

ENDMETHOD. "create_dynamic_table

METHOD build_dynamic_structures.

caller = calling_program.

CALL METHOD me->return_structure

EXPORTING

my_line = my_line.

CALL METHOD me->create_dynamic_fcat

IMPORTING

it_fldcat = it_fldcat.

CALL METHOD me->create_dynamic_table

EXPORTING

it_fldcat = it_fldcat

IMPORTING

dy_table = dy_table.

ENDMETHOD. "build_dynamic_structures

METHOD display_grid.

GET REFERENCE OF g_outtab INTO g_outtab1.

GET REFERENCE OF g_fldcat INTO g_fldcat1.

struct_grid_lset-grid_title = 'ALV generic class'.

struct_grid_lset-zebra = 'X '.

  • struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.

  • struct_grid_lset-stylefname = 'CELLTAB'.

  • CALL METHOD grid1->set_ready_for_input "sets WHOLE GRID editable in one step

  • EXPORTING

  • i_ready_for_input = '1'.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

is_layout = struct_grid_lset

CHANGING

it_outtab = gt_outtab

it_fieldcatalog = it_fldcat.

ENDMETHOD. "display_grid

METHOD on_user_command.

break-point 1.

CASE e_ucomm.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'EXCEL'.

CALL METHOD me->download_to_excel.

WHEN 'SAVE'.

WHEN 'PROC'.

CALL METHOD me->process.

WHEN 'REFR'.

CALL METHOD me->refresh.

ENDCASE.

ENDMETHOD. "on_user_command

METHOD on_toolbar.

  • customize this section with your own Buttons

  • When a button is pressed method ON_USER_COMMAND is entered

toolbar_funcs 'EXIT' icon_system_end 'Click2exit'.

toolbar_funcs 'SAVE' icon_system_save 'Savedata'.

toolbar_funcs 'EDIT' icon_toggle_display_change 'Edit data'.

toolbar_funcs 'PROC' icon_businav_process 'Process'.

toolbar_funcs 'EXCEL' icon_xxl 'Excel'.

toolbar_funcs 'REFR' icon_refresh 'Refresh'.

ENDMETHOD. "on_toolbar

METHOD refresh_grid.

CALL METHOD cl_gui_cfw=>flush.

CALL METHOD grid1->refresh_table_display.

ENDMETHOD. "refresh_grid

METHOD refresh.

PERFORM refresh IN PROGRAM (caller) IF FOUND.

ENDMETHOD. "refresh

METHOD process.

PERFORM process IN PROGRAM (caller) IF FOUND.

ENDMETHOD. "process

METHOD dubbelklik.

perform dubbelklik IN PROGRAM (caller) IF FOUND

USING e_row

e_column

es_row_no.

ENDMETHOD. "dubbelklik

ENDCLASS. "zcl_alv_test IMPLEMENTATION

5) Now just run the program.

This will work for almost ANY structure / list you care to want to define / use --saves load of coding time as you can use the class over and over again for ANY structure. Tables and field catalog built dynamically --couldn't be easier from an application programmer point of view.

Cheers

(And FORGET SLIS and all that old rubbish. OO is the way to do it now).

Jimbo

Former Member
0 Kudos

Thanks a lot for all your replies...