Example of class-alv
i'm looking for simple example of alv with class (this is OO)
and with events
thanks
Hi Guys -- all the replies and demos so far in this thread point to the OLD ALV grid
Any examples on using the NEW ALV API (6.40 and above)
There's quite a lot of stuff under packet type SALV and some SALV_DEMO* programs but they seem far too complicated to understand easily.
I've got an ABAP here which basically shows the Grid but How do I add the standard function buttons etc on it. I'm tyring to avoid extra screens with PAI and PBO processing or SE41 define menu statuses etc..
<b>
Program ZALV_TEST1.
include <color>.
include <icon>.
include <symbol>.
display stuff in alv grid easily using new simple alvgrid with new api's
no screen / pbo /pai needs to be defined anymore for just simple display with no events etc.
No field catalog needed either
tables: eine,
eina.
Data:
gr_table TYPE REF TO cl_salv_table.
data : begin of s_einea,
infnr type eina-infnr,
ekorg type eine-ekorg,
werks type eine-werks,
lifnr type eina-lifnr,
loekz type eina-loekz,
ebeln type eine-ebeln,
ebelp type eine-ebelp,
matnr type eina-matnr,
testfield(10) type c, "Own fields just for test
url(255) type c,
end of s_einea.
data t_einea
like table of s_einea.
data: s_name type tabname.
s_name = 'S_EINEA'.
get data
want data from both eina and eine where BOTH delete flags (LOEKZ) are 'X'
using the same info rec as primary key for the join (1 EINA ===> several EINE)
select ainfnr alifnr amatnr aloekz bekorg bwerks bebeln bebelp
into corresponding fields of table t_einea
up to 50 rows
from ( eina as a
inner join eine as b on ainfnr eq binfnr
and aloekz eq bloekz )
where a~loekz eq 'X'.
add user data (non ddic) into internal table
Just to test NON DDIC fields
Note No Field catalog needed.
loop at t_einea into s_einea.
s_einea-testfield = 'UserData'.
modify t_einea from s_einea index sy-tabix.
endloop.
Instead of if_salv_c_bool_sap=>false, you can pass the
value if_salv_c_bool_sap=>true to this method to
see your ALV as a list.
display data in Grid / List
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = t_einea.
CATCH cx_salv_msg.
ENDTRY.
data: lr_functions type ref to cl_salv_functions_list.
constants: gc_true type sap_bool value 'X',
gc_false type sap_bool value space.
add for colour displays
data: ls_color type lvc_s_colo.
DATA : LV_SALV_COLUMNS_TABLE TYPE REF TO CL_SALV_COLUMNS_TABLE.
data: lr_columns type ref to cl_salv_columns_table,
lr_column type ref to cl_salv_column_table.
LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'TESTFIELD' ).
ls_color-col = col_negative.
ls_color-int = 0.
ls_color-inv = 0.
lr_column->set_color( ls_color ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'INFNR' ).
ls_color-col = col_negative.
ls_color-int = 1.
ls_color-inv = 1.
lr_column->set_color( ls_color ).
lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'TESTFIELD' ).
lr_column->set_short_text( 'Short' ).
lr_column->set_medium_text( 'Medium' ).
lr_column->set_long_text( 'This is a test' ).
this statement actually does the display.
gr_table->display( ).</b>
Any help appreciated
Thanks
Similar Messages
-
Concrete example of (whole ALV program )
Hi
i did some modification in the ALV program before . like changing field catalog etc... but i have never write a whole program in ALV and would like to try one by myself .
could you please in just 2 3 words write the step, and is there a sample program where all that apply to ALV is coded like hotspot , drill down, color, check box etc...Hi,
go through this code.
Complete code for the ALV grid example
This example shows and ALV grid with flights. After selecting a line a change button can be pushed to display a change screen. After the changes have been saved, the ALV grid screen is displayed again, and the grid is updated with the changes.
The example shows:
How to setup the ALV grid
How to ste focus to the grid
How to set the title of the grid
How to allow a user to save and reuse a grid layout (Variant)
How to customize the ALV grid toolbar
Refresh the grid
Set and get row selection and read line contents
Make and exception field (Traffic light)
Coloring a line
Steps:
Create screen 100 with the ALV grid. Remember to include an exit button
Add a change button to the ALV grid toolbar
Create screen 200 the Change screen
The screens:
The code:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes -
Example of Interactive ALV Report
Hi all,
Can anyone give me simplest example of Interactive ALV Report.
Please give some description with that so that i can understand it ..
Thanks
RajREPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838 .
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.
another sample code
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.
REPORT Z_PO_ALV_R02 NO STANDARD PAGE HEADING MESSAGE-ID ZROJA.
*-----tables declaration
TABLES:EKKO.
TYPE-POOLS:SLIS.
*-----data declaration
TYPES:BEGIN OF X_EKKO,
EBELN type EKKO-EBELN, "PO Number
BUKRS type EKKO-BUKRS, "Company code
BSART type EKKO-BSART, "Purchasing Document type
LIFNR type EKKO-LIFNR, "Vendor
SPRAS type EKKO-SPRAS, "Language Key
ZTERM type EKKO-ZTERM, "Terms of payment key
END OF X_EKKO,
BEGIN OF X_EKPO,
EBELN type EKPO-EBELN,
EBELP type EKPO-EBELP, "Item number
WERKS type EKPO-WERKS, "Plant
MATNR type EKPO-MATNR, "Material Number
MATKL type EKPO-MATKL, "Material Group
END OF X_EKPO.
DATA:IT_EKKO TYPE STANDARD TABLE OF X_EKKO,
IT_EKPO TYPE STANDARD TABLE OF X_EKPO,
WA_EKKO TYPE X_EKKO,
WA_EKPO TYPE X_EKPO, "#EC *
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
*-----Selection-screen design
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
SELECTION-SCREEN END OF BLOCK B1.
*-----SELECTION-SCREEN VALIDATION
AT SELECTION-SCREEN.
SELECT EBELN
FROM EKKO
INTO TABLE IT_EKKO
WHERE EBELN IN S_EBELN.
*-----if there are no values display an error
IF SY-SUBRC NE 0.
MESSAGE E009.
ENDIF.
*-----Data retrieval
START-OF-SELECTION.
*-----retrieving data from the PO header
SELECT EBELN BUKRS BSART LIFNR SPRAS ZTERM
FROM EKKO
INTO TABLE IT_EKKO
WHERE EBELN IN S_EBELN.
*-----if there are no records display an error
IF SY-SUBRC NE 0.
MESSAGE E003.
ENDIF.
*-----Field catalog for the PO Header
REFRESH IT_FIELDCAT[].
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-HOTSPOT = 'X'.
WA_FIELDCAT-REF_FIELDNAME = 'EBELN'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-REF_FIELDNAME = 'BUKRS'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-FIELDNAME = 'BSART'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-REF_FIELDNAME = 'BSART'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '4'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '5'.
WA_FIELDCAT-FIELDNAME = 'SPRAS'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '6'.
WA_FIELDCAT-FIELDNAME = 'ZTERM'.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-REF_FIELDNAME = 'ZTERM'.
WA_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*-----to display the header details
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT[]
TABLES
T_OUTTAB = IT_EKKO[].
*& Form USER_COMMAND
text
-->UCOMM text
-->FIELD1 text
FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM FIELD1 TYPE "#EC CALLED
SLIS_SELFIELD. "#EC *
READ TABLE IT_EKKO INTO WA_EKKO INDEX FIELD1-TABINDEX.
*-----retrieving item details from the PO Item table
SELECT EBELN EBELP WERKS MATNR MATKL
FROM EKPO
INTO TABLE IT_EKPO
WHERE EBELN = WA_EKKO-EBELN.
*-----to display an error if other than PO Number is clicked
IF SY-SUBRC NE 0.
MESSAGE E001.
ENDIF.
*-----Fieldcatalog for the PO item details
REFRESH IT_FIELDCAT1[].
WA_FIELDCAT1-COL_POS = '1'.
WA_FIELDCAT1-FIELDNAME = 'EBELN'.
WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
WA_FIELDCAT1-REF_FIELDNAME = 'EBELN'.
WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-COL_POS = '2'.
WA_FIELDCAT1-FIELDNAME = 'EBELP'.
WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
WA_FIELDCAT1-REF_FIELDNAME = 'EBELP'.
WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-COL_POS = '3'.
WA_FIELDCAT1-FIELDNAME = 'WERKS'.
WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
WA_FIELDCAT1-REF_FIELDNAME = 'WERKS'.
WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-COL_POS = '4'.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
WA_FIELDCAT1-REF_FIELDNAME = 'MATNR'.
WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-COL_POS = '5'.
WA_FIELDCAT1-FIELDNAME = 'MATKL'.
WA_FIELDCAT1-TABNAME = 'IT_EKPO'.
WA_FIELDCAT1-REF_FIELDNAME = 'MATKL'.
WA_FIELDCAT1-REF_TABNAME = 'EKPO'.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
*-----to display the item details
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT1[]
TABLES
T_OUTTAB = IT_EKPO[].
ENDFORM. "user_command_form
regards,
srinivas
<b>*reward for useful answers*</b> -
Need a perfect example program for ALV GRID LIST
first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.
Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]
-
Looking for an example of class to run in database
A few years back our dba took a class I had written to run outside the database and put it inside.
I maintained it from that point on, but am unsure of all the rules.
I know about using the "default" connection, and remember that he took out all the imports and think I remember the package(s) were also removed.
I also remember that when I edited it in Eclipse it always showed errors.
I've looked at the simple examples and they are not much help.
Would like to find a more general example or a set of rules (dos and donts).
Also would like to know if JDeveloper will handle the code in context, i.e. no errors.
My project is to move the data access layer of a distributed set of apps (each in it's own JVM) on to the database so that I can fully sychronize the access.
Thanks,
Jim
Edited by: user642308 on Dec 4, 2009 4:14 AMI can help with some of the do's and don'ts but they are by no means exhaustive. One thing is is I am wondering why the imports were taken out?
The best way to do things is to compile the code into classes, then load and resolve those classes into the schema where the application will run.
You can refer the the Java Developers Guide for that.
The Java stored procedure can only access public static methods.
Do not load any jars or classes that contain methods that will call Non-JDK natives, they will fail. If the package does this then it will not run properly if called in our vm. We do not support the loading of JNI libraries because of security issues.
I don't know much about Jdeveloper but it supports development for the JVM and should handle the code correctly. It also will help with loading the classes into the database. -
Example program Hiearchical alv report
Hi,
can anyone send me hiearchical alv report example.
i m new to learn that plzz help me out.
Thanks,
satishHi,
Refer this Simple code.
type-pools: slis.
icon.
tables: zemp10,zemp12.
data: BEGIN OF WA1,
EMPID TYPE ZEMP10-EMPID,
EXPAND2,
BOX,
LIGHT,
END OF WA1.
DATA: BEGIN OF WA2,
EMPID TYPE ZEMP12-EMPID,
CITY TYPE ZEMP12-CITY,
STATE TYPE ZEMP12-STATE,
COUNTRY TYPE ZEMP12-COUNTRY,
INCENTIVE TYPE ZEMP12-INCENTIVE,
LIGHT,
END OF WA2.
DATA: ITAB1 LIKE STANDARD TABLE OF WA1 WITH HEADER LINE,
ITAB2 LIKE STANDARD TABLE OF WA2 WITH HEADER LINE,
it_events type slis_t_event,
wa_events like line of it_events,
CAT1 TYPE SLIS_T_FIELDCAT_ALV.
WA_CAT LIKE LINE OF CAT1.
*DATA IT_FCAT1 TYPE SLIS_T_FIELDCAT_ALV.
data wa_layout type slis_layout_alv.
data wa_keyinfo type slis_keyinfo_alv.
DATA CAT2 TYPE SLIS_T_FIELDCAT_ALV.
data wa_repid type sy-repid.
wa_keyinfo-header01 = 'EMPID'.
wa_keyinfo-item01 = 'EMPID'.
perform fill_tables.
perform layout.
PERFORM FIELD.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_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 it_events into wa_events with key name = 'USER_COMMAND'.
if sy-subrc = 0.
wa_events-form = 'FORM1'.
modify it_events from wa_events index sy-tabix.
endif.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZVIJIALV7'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = CAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_events
IT_EVENT_EXIT =
i_tabname_header = 'ITAB1'
i_tabname_item = 'ITAB2'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = WA_KEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IR_SALV_HIERSEQ_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = ITAB1
t_outtab_item = ITAB2
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.
form fill_tables .
SELECT
empid
FROM zemp10 INTO TABLE ITAB1.
SELECT
empid city state country INCENTIVE
FROM ZEMP12 INTO TABLE ITAB2.
LOOP AT ITAB2.
IF ITAB2-INCENTIVE < 100.
ITAB2-LIGHT = '2'.
ELSEIF ITAB2-INCENTIVE > 100 AND ITAB2-INCENTIVE < 200.
ITAB2-LIGHT = '1'.
ELSE.
ITAB2-LIGHT = '3'.
ENDIF.
MODIFY ITAB2 INDEX SY-TABIX.
ENDLOOP.
LOOP AT ITAB1.
IF ITAB1-EMPID = '101'.
ITAB1-BOX = 'X'.
ITAB1-LIGHT = '2'.
ELSE.
ITAB1-LIGHT = '1'.
ENDIF.
MODIFY ITAB1 INDEX SY-TABIX.
ENDLOOP.
endform. " fill_tables
form LAYOUT .
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND2'. "FOR EXPANDING
WA_LAYOUT-EXPAND_ALL = 'X'.
WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHT'. " FOR LIGHT
WA_LAYOUT-LIGHTS_TABNAME = 'ITAB1'.
WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHT'. " FOR LIGHT
WA_LAYOUT-LIGHTS_TABNAME = 'ITAB2'.
WA_LAYOUT-BOX_FIELDNAME = 'BOX'. " FOR CHECKBOX
WA_LAYOUT-BOX_TABNAME = 'ITAB1'.
endform. " LAYOUT
FORM FIELD.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = WA_REPID
I_INTERNAL_TABNAME = 'ITAB1'
I_STRUCTURE_NAME = 'ZEMP10'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = CAT1
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE CAT1 WHERE FIELDNAME <> 'EMPID'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = WA_REPID
I_INTERNAL_TABNAME = 'ITAB2'
I_STRUCTURE_NAME = 'ZEMP12'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = CAT2
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE CAT2 WHERE FIELDNAME <> 'EMPID' AND
FIELDNAME <> 'CITY' AND
FIELDNAME <> 'STATE' AND
FIELDNAME <> 'INCENTIVE'.
APPEND LINES OF CAT2 TO CAT1.
ENDFORM.
form FORM1 using ucomm like sy-ucomm
sel_field type slis_selfield.
write : sel_field-fieldname.
write : sel_field-value.
endform.
Thanks. -
Class ALV in Edit mode and F4 Value help
I am displaying Customer Information in ALV Grid with class method. Customer Number is editable mode and having search help. When user F4 on Customer Number and select any value from search help. This selected new value is not passing to ALV grid in Customer number column. I tried with on_f4 method, but it is not working or something i doing incorrect.
Can any one help to solve this problem ?
Many thanksHi.
try with method check_changed_data in after event.
CALL METHOD go_grid->check_changed_data
IMPORTING
or implement a local_event_class to handle F4 event and Change event.
The demo program "BCALV_TEST_GRID_F4_HELP" can help you tu find the correct code. -
Example of creating ALV double click event that can be used in ANY Program
Once you get the hang of OO you can really create useful generalized code that can be used in a huge number of situtations.
Double click on ALV is often wanted
Right here goes to implement a generalized double click action that returns the row, column and column name back to the caller.
In your CLASS in the DEFINITION part code as follows.
CLASS zcl_dog DEFINITION.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING z_object type ref to zcl_dog,
i_parent type ref to cl_gui_custom_container,
PRIVATE SECTION.
on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no,
dubbleklik
IMPORTING
e_row type LVC_S_ROW
e_column TYPE LVC_S_COL
es_row_no type lvc_s_ROID
program type sy-repid.
code here any extra any methods you need.
In the CONSTRUCTOR method of the implementation
CLASS zcl_dog IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT grid_container1
EXPORTING
container_name = 'CCONTAINER1'.
CREATE OBJECT grid1
EXPORTING
i_parent = grid_container1.
SET HANDLER z_object->on_user_command for grid1.
SET HANDLER z_object->on_toolbar for grid1.
SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.
SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.
endmethod.
METHOD on_dubbelklik.
CALL METHOD me->dubbleklik
exporting
e_row = e_row
e_column = e_column
es_row_no = es_row_no
program = sy-repid.
break-point 1.
method dubbleklik.
perform dubbleklik IN PROGRAM (program)
using
e_row
e_column
es_row_no.
ENDMETHOD.
endclass.
This will now perform a routine called dubbleklik in your application program whenever you double click a cell in the grid.
In the application program just code the following
DATA: z_object type ref to zcl_dog, "Instantiate our class
grid_container1 type ref to cl_gui_custom_container,
CREATE OBJECT z_object EXPORTING z_object = z_object.
call ANY method in the class which eventually displays the grid
CALL METHOD z_object->build_dynamic_structures
CHANGING it_fldcat = it_fldcat.
form dubbleklik using
e_row type LVC_S_ROW
e_column type LVC_S_col
es_row_no type lvc_s_roid.
break-point 1.
endform.
When you double click a cell you'should be at the break point in your routine in the application program.
You've got the cell that was clicked so by reading your table you can examine the data and take the appropriate action.
Cheers
JimboI suggest you purchase a case and have a dedicated support engineer work with you directly:
http://www.sdn.sap.com/irj/boc/gettingstarted
Or
http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728
If this is a bug you'll get a refund, if not post your enhancement request in the Idea Place. Or the Rep will suggest a better way to create your report. -
How to browse example skin class files?
Maybe I'm missing something.
I went ahead and read through Joan Lafferty's document "Differences between the Flex 3 and Flex 4 beta" and it said the best way
to learn how to do custom skinning is to take one of the default skin classes and copy it, make some small mods, etc.
So I'm trying to do this but I'm probably not looking in the right place. In my Flashbuilder project folder I'm going down to the SWC packages
and double-clicking to open an example, but it says the file isn't found. Where should I be looking for these examples?
I understand that the new architecture gives designers freedom to design their skins as they wish, but all I'm trying to do is to change the
rollover highlight color ( or turn it on, really ) for a spark List component.
Am I looking in the wrong place for this??
thanksif you are looking for the mxml skin files you can find them on this path
C:\Program Files\Adobe\Flash Builder Beta\sdks\4.0.0\frameworks\projects\flex4\src\spark\skins\default
they idea is to copy that a skin file into your project, preferably a subfolder like src\skins
i.e. ButtonSkin.mxml
you then attach the skin to the component's skin property - skinClass="skins\ButtonSkin.mxml"
hope this helps.
David. -
(DII) Client Example - - missing class error
To jump into DII, I have copied the source for the "Dynamic Invocation Interface (DII) Client Example" into a new class created in netbeans. The api jar for JAX-RPC has been mounted in the environment. The example compiles fine, but upon execute the following error comes up:
javax.xml.rpc.ServiceException: java.lang.ClassNotFoundException: com.sun.xml.rpc.client.ServiceFactoryImpl
at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:65)
at node.HelloClient.main(HelloClient.java:29)
Do I need to get another api here? Looking into the jax-rpc jar file I can see the javax.xml.rpc.ServiceFactory class, but can not see com.sun.xml.rpc.client.ServiceFactoryImpl .
Could someone point me to an answer? Thanks in advance for the help.The jaxrpc jar that I downloaded was from under the xml downloads (jaxrpc-1_0-fr-api-class.zip). Once extracted this gave me a jar file of jaxrpc-api.jar.
It seems that you might be using a different jar? (jaxrpc-ri.jar)?
Under my downloaded jar file, there is no client belwo the heirarchy of javax/xml/rpc . Where could I find the download for the jar file that you are refrencing?
Thank you for your help.
R -
Examples of Class Loading.
Are there any good tutorials or examples available on Dynamic Class Loading?
peace
neilHave you tried the Reflection tutorial at:
http://java.sun.com/docs/books/tutorial/reflect/index.html
Grant -
Help with running sun jndi tutorial example LookUp.class
I am learning JNDI,and when I run LookUp.java available in JNDI TUTORIAL ,souce code here:
* @(#)Lookup.java 1.3 99/08/12
* Copyright 1997, 1998, 1999 Sun Microsystems, Inc. All Rights
* Reserved.
* Sun grants you ("Licensee") a non-exclusive, royalty free,
* license to use, modify and redistribute this software in source and
* binary code form, provided that i) this copyright notice and license
* appear on all copies of the software; and ii) Licensee does not
* utilize the software in a manner which is disparaging to Sun.
* This software is provided "AS IS," without a warranty of any
* kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE
* HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
* MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN
* NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
* CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT
* OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* This software is not designed or intended for use in on-line
* control of aircraft, air traffic, aircraft navigation or aircraft
* communications; or in the design, construction, operation or
* maintenance of any nuclear facility. Licensee represents and warrants
* that it will not use or redistribute the Software for such purposes.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
class Lookup {
public static void main(String[] args) {
// Check that user has supplied name of file to lookup
if (args.length != 1) {
System.err.println("usage: java Lookup <filename>");
System.exit(-1);
String name = args[0];
// Identify service provider to use
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
try {
// Create the initial context
Context ctx = new InitialContext(env);
// Look up an object
Object obj = ctx.lookup(name);
// Print it out
System.out.println(name + " is bound to: " + obj);
// Close the context when we're done
ctx.close();
} catch (NamingException e) {
System.err.println("Problem looking up " + name + ": " + e);
after I compiled it sucessfully,I typed
java LookUp d:/test.java ,error message shown following:
Problem looking up LookUp.java: javax.naming.NoInitialContextException: Cannot i
nstantiate class: com.sun.jndi.fscontext.RefFSContextFactory [Root exception is
java.lang.ClassNotFoundException: com.sun.jndi.fscontext.RefFSContextFactory]
please help me!Read the Preparations chapter of the tutorial.
It tells you to download and install the file
system service provider from
http://java.sun.com/products/jndi/#download -
How can i add mark field to class alv ?
Here is my code like this.
CALL METHOD cl_salv_table=>factory
* EXPORTING
* list_display = IF_SALV_C_BOOL_SAP=>FALSE
* r_container =
* container_name =
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_itab[].
CATCH cx_salv_msg.
ENDTRY.
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ). "Gui için
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( abap_true ).
gr_display->set_list_header( baslik ).
gr_columns = gr_table->get_columns( ).Hi,
DATA: ob_salv_table TYPE REF TO cl_salv_table .
DATA: ob_salv_selections TYPE REF TO cl_salv_selections.
ob_salv_selections = ob_salv_table->get_selections( ).
ob_salv_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
Regards. -
Reg..ALV using classes
i have displayed a ALV report with a push button 'HST'.
When i select a particular line(vbeln) and click on pushbutton 'HST' it has to display me a interactive report based on the condition vbeln and posnr.
can anyone help me with the detail code using classes..
answers will be rewarded....
regards,
kumarHi,
Class ALV Specification
Classes used:
CL_GUI_ALV_GRID
Example of ALV using Classes
DATA: lcl_alv TYPE REF TO cl_gui_alv_grid,
t_flights TYPE STANDARD TABLE OF FLIGHTS.
SELECT * FROM flights INTO TABLE t_flights.
CREATE OBJECT lcl_alv
EXPORTING I_PARENT = cl_gui_container=>screen0.
CALL METHOD lcl_alv->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'FLIGHTS'
CHANGING
IT_OUTTAB = t_flights.
CALL SCREEN 100.
Example Details
This is a simple example of the class ALV, we do not need to create, in this case, a field catalog because we are using the whole table of FLIGHTS and we will show all the fields that this table contains, we do this at the I_STRUCTURE_NAME = 'FLIGHTS' statement.
The CL_GUI_ALV_GRID constructor needs the I_PARENT parameter to define where it will be show, in the example we set the entire screen to place the ALV.
reward if helpful -
How to trigger New page while using ALV with classes/oops?
Hi All
I am trying to print a report which has to show the data in two pages.
I am using ALV with classes/oops.
Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
Please send some code samples also if available.
Thanks in advance.
Jerryusing sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
in case of list you can view that directly.
sort-fieldname = 'FIELDNAME'.
sort-group = '*' "triggers new page
sort-up = 'X'.
append sort to it_sort.
Maybe you are looking for
-
For all the newbies who wants to learn Java
I was a newbie like 4 months ago. i have some skills of OOP in C++ like 2 years back but since then i did'nt took any of programming language courses. I have experience in MSaccess and MYsql. i did my internship Last summer with Tennessee Education L
-
Hi, Where I will get the bd87 idoc messages what the name of the table contain these messages. Thanks!!
-
Clicking Google search results in a frame gives blank screen
The back story to this is that i use Firefox and I use a simple frames home page where my fave links(ebay,craigslist links mainly) are on the left frame of the screen and google opens up on the right frame. When I do a search with google it does what
-
Linux server rebooting frequently.
HI Linux Gurus, Need some help. I have RED HAT LINUX AS2.1 .[This is a OS cluster ]. I frequently faced the problem that the server reboots itself suddenly.We have observed this multiple times . And surprisingly no abnormal activity is happening on t
-
I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks