Basic Doubt in ALV grids
All -
I'm realtively new to ALV grid reporting.
What should be done in order to not get the default setting like sorting,set filter screen Icons and the other icons in the report .
Thanks in advance.
You mean that you want to exclude those icons from the toolbar? You can do it by using the exclude parameter.
Here's how. See the parts in bold, you can look at the other functions that can be execluded via SE24 in the attributes tab. Check the attributes that start with MC_FC_
REPORT ZRICH_0001.
TABLES: MARA.
DATA: BEGIN OF I_ALV OCCURS 0,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF I_ALV.
* CLASS cl_event_receiver DEFINITION Handles Double Click
CLASS CL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
PRIVATE SECTION.
ENDCLASS.
* CLASS CL_EVENT_RECEIVER IMPLEMENTATION Handles Double Click
CLASS CL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
PERFORM DRILL_DOWN USING E_ROW-INDEX.
ENDMETHOD.
ENDCLASS.
DATA: ALV_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: EVENT_RECEIVER TYPE REF TO CL_EVENT_RECEIVER.
DATA: ALV_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: LAYOUT TYPE LVC_S_LAYO.
DATA: FIELDCAT TYPE LVC_T_FCAT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA.
CALL SCREEN 100.
* Module status_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
DATA: VARIANT TYPE DISVARIANT.
VARIANT-REPORT = SY-REPID.
VARIANT-USERNAME = SY-UNAME.
* Create Controls
CREATE OBJECT ALV_CONTAINER
EXPORTING
CONTAINER_NAME = 'ALV_CONTAINER'.
CREATE OBJECT ALV_GRID
EXPORTING
I_PARENT = ALV_CONTAINER.
* Create Event Receiver
CREATE OBJECT EVENT_RECEIVER.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM GET_FIELDCATALOG.
<b>* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.</b>
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LAYOUT
IS_VARIANT = VARIANT
I_SAVE = 'U'
I_STRUCTURE_NAME = 'I_ALV'
<b> it_toolbar_excluding = lt_exclude</b>
CHANGING
IT_OUTTAB = I_ALV[]
IT_FIELDCATALOG = FIELDCAT[].
* handler for ALV grid
SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR ALV_GRID.
ENDMODULE.
* Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR 'CANC'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
IF SY-SUBRC = 0.
SET SCREEN 0.
LEAVE SCREEN.
ELSE.
LEAVE PROGRAM.
ENDIF.
WHEN 'EXIT'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
* FORM GET_DATA
FORM GET_DATA.
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ALV
FROM MARA
INNER JOIN MAKT
ON MARA~MATNR = MAKT~MATNR
WHERE MARA~MATNR IN S_MATNR
AND MAKT~SPRAS = SY-LANGU.
SORT I_ALV ASCENDING BY MATNR.
ENDFORM.
* Form Get_Fieldcatalog - Set Up Columns/Headers
FORM GET_FIELDCATALOG.
DATA: LS_FCAT TYPE LVC_S_FCAT.
REFRESH: FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Number'.
LS_FCAT-COLTEXT = 'Material Number'.
LS_FCAT-FIELDNAME = 'MATNR'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '18'.
LS_FCAT-COL_POS = 1.
APPEND LS_FCAT TO FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Description'.
LS_FCAT-COLTEXT = 'Material Description'.
LS_FCAT-FIELDNAME = 'MAKTX'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '40'.
LS_FCAT-COL_POS = 2.
APPEND LS_FCAT TO FIELDCAT.
ENDFORM.
* DRILL_DOWN
FORM DRILL_DOWN USING INDEX.
READ TABLE I_ALV INDEX INDEX.
IF SY-SUBRC = 0.
SET PARAMETER ID 'MAT' FIELD I_ALV-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
ENDIF.
ENDFORM.
<b>***********************************************************************
* Form EXCLUDE_TB_FUNCTIONS
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_SORT_ASC.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_SORT_DSC.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
** This excludes all buttons
* LS_EXCLUDE = '&EXCLALLFC'.
* APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.</b>
Regards,
RIch Heilman
Similar Messages
-
Hi Everyone,
I am working on ALV Grid Control, where i am facing a problem with adding new buttons and writing the new code for the button, for placing the (display) button i used the method <b>handle_tool_bar</b>, But i want to know how to write the code for this particular button (display).
Kindly give me the solution for thishttp://www.abap4.it/download/ALV.pdf
Add the handle so we get user command control (ie Refresh)
perform add_handle using 'USER_COMMAND' 'PAI_USER_COMMAND'.
Colour and hotspot the project id column
w_fieldcat-fieldname = 'PROJECT_ID'.
w_fieldcat-emphasize = 'C400'.
w_fieldcat-hotspot = 'X'.
append w_fieldcat to t_fieldcat.
Iconify and set the length of the icon column
clear w_fieldcat.
w_fieldcat-fieldname = 'ZEXCEPTION'.
w_fieldcat-icon = 'X'.
w_fieldcat-outputlen = g_light_length.
append w_fieldcat to t_fieldcat.
Intensify every other line, improves readability
t_layout-zebra = 'X'.
Set up an exit on the refresh event, so it gets passed back to us
wa_event_exit-ucomm = '&REFRESH'. " Refresh
wa_event_exit-after = 'X'.
append wa_event_exit to t_event_exit.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'ZGER_PROJECT_ID' " **CHANGE** !
i_callback_pf_status_set = 'SET_PF_STATUS'
i_structure_name = 'ZPROJECT_DATA'
i_grid_title = 'Project list'
it_event_exit = t_event_exit
i_default = 'X'
it_fieldcat = t_fieldcat
is_layout = t_layout
i_save = 'A'
it_events = t_events
tables
t_outtab = t_main
exceptions
program_error = 1
others = 2. -
Doubt in ALV grid (OO ALV) download to Excel
Hi All,
I done Report using OOALV when down loading to Excel one row got automatically inserted to the ALV Excel downloaded sheet at the top and the row contains Sy datum , Dynamic list display , page no
my requirement is to delete that row. Is that possible. If so please suggest me how to handle that
Thanks
KiranHi,
Check this link:
Re: Digit missing in the alv export
Hope this helps.
Regards,
Satish Kanteti -
Hi,
i have developed a new program in which i have to display the material number, short text and long text in the ouput i had developed a program in which it was displaying the output for the material number having only long texts but i have to display the texts which was short text also. By executing the below program i'm getting the output for the values which are having only long texts but i have to display the output even if there is shor text also
FORM GET_DATA.
*To Fetch Data from Ekpo Table
SELECT WERKS MATNR FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE
INT_EKPO
WHERE
EKPO~MATNR = S_MATNR AND
EKPO~WERKS = S_WERKS.
* sort int_ekpo by werks.
delete adjacent duplicates from INT_EKPO .
*To Fetch Data from MAKT Table
SELECT MATNR MAKTX FROM MAKT
INTO CORRESPONDING FIELDS OF TABLE
INT_MAKT
FOR ALL ENTRIES IN INT_EKPO
WHERE MAKT~MATNR = INT_EKPO-MATNR.
loop at int_ekpo.
read table int_MAKT with key matnr = INT_EKPO-MATNR.
int_OUT-MATNR = INT_EKPO-MATNR.
INT_OUT-MAKTX = INT_MAKT-MAKTX.
ENDLOOP.
**" Read text
thread-tdname = INT_EKPO-MATNR.
thread-tdid = 'BEST'.
thread-tdobject = 'MATERIAL'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = thread-tdid
LANGUAGE = sy-langu
NAME = thread-tdname
OBJECT = thread-tdobject
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = it_tlines.
LOOP AT it_tlines.
IF sy-tabix <> 1.
CLEAR :int_out-matnr, int_out-maktx.
ENDIF.
int_out-tdline = it_tlines-tdline.
APPEND int_out.
ENDLOOP.
ENDFORM.
****ALV list definintion
DATA: ws_cat TYPE slis_t_fieldcat_alv ,
int_cat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
g_custom_container TYPE REF TO cl_gui_custom_container.
FORM field_catalog.
***MATERIAL NO no
int_cat-tabname = 'INT_OUT'.
int_cat-fieldname = 'MATNR'.
int_cat-reptext_ddic = 'MATERIAL NO'.
APPEND int_cat .
*material Short Description
int_cat-tabname = 'INT_OUT'.
int_cat-fieldname = 'MAKTX'.
int_cat-reptext_ddic = 'MATERIAL SHORT DESCRIPTION'.
APPEND int_cat .
** Material Long Description
int_cat-tabname = 'INT_OUT'.
int_cat-fieldname = 'TDLINE'.
int_cat-reptext_ddic = 'MATERIAL LONG DESCRIPTION'.
int_cat-datatype = 'CHAR'.
int_cat-outputlen = '100'.
APPEND int_cat .
endform.
*& Form display_data
* text
FORM display_data.
data: new(15) TYPE N.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = int_cat[]
TABLES
t_outtab = int_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "display_data
thanks in advancemake the following corrections.
loop at int_ekpo.
read table int_MAKT with key matnr = INT_EKPO-MATNR.
if sy-subrc = 0.
int_OUT-MATNR = INT_EKPO-MATNR.
INT_OUT-MAKTX = INT_MAKT-MAKTX.
endif.
**" Read text
thread-tdname = INT_EKPO-MATNR.
thread-tdid = 'BEST'.
thread-tdobject = 'MATERIAL'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = thread-tdid
LANGUAGE = sy-langu
NAME = thread-tdname
OBJECT = thread-tdobject
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = it_tlines.
clear thread.
LOOP AT it_tlines.
condense it_tlines-tdline.
concatenate int_out-tdline it_tlines-tdline into int_out-tdline separetd by space.
ENDLOOP.
refresh it_tlines.
append int_out.
clear int_out.
endloop.
ENDFORM.
Regards,
Ravi -
Hi,
I collected some data in an internal table. when i am trying to display the
Output through REUSE_ALV_GRID_DISPLAY.
I included the statement
SET PF-STATUS 'VIEW_ORDERS'.
But this statement is not executed. Y what's the problem.Hi,
You have to create a subroutine SET_PF_STATUS..Then pass the subroutine name in the parameter
i_callback_pf_status_set ..
Check this example
TYPE-POOLS: slis.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
DATA: s_layout TYPE slis_layout_alv.
DATA: BEGIN OF itab OCCURS 0,
icon TYPE icon-id,
vbeln TYPE vbeln,
kunnr TYPE kunnr,
erdat TYPE erdat,
box TYPE c,
END OF itab.
DATA: v_repid TYPE syrepid.
START-OF-SELECTION.
* Get the data.
SELECT vbeln kunnr erdat UP TO 100 ROWS
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE itab.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'No data found'.
LEAVE LIST-PROCESSING.
ENDIF.
* Modify the record with red light.
itab-icon = '@0A@'.
MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
v_repid = sy-repid.
* Get the field catalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'ICON'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-seltext_l = 'Status'.
s_fieldcatalog-icon = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'VBELN'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'KUNNR'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'KUNNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'ERDAT'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'ERDAT'.
APPEND s_fieldcatalog TO t_fieldcatalog.
* Set the layout.
s_layout-box_fieldname = 'BOX'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = s_layout
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = t_fieldcatalog[]
TABLES
t_outtab = itab.
* FORM SET_PF_STATUS *
* --> EXTAB *
FORM set_pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'TEST2'.
ENDFORM.
* FORM user_command *
* --> UCOMM *
* --> SELFIELD *
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
* Check the ucomm.
IF ucomm = 'DETAIL'.
LOOP AT itab WHERE box = 'X'.
itab-icon = '@08@'.
MODIFY itab TRANSPORTING icon.
ENDLOOP.
ENDIF.
selfield-refresh = 'X'.
ENDFORM.
Thanks
Naren -
Hi,
I have this doubt regarding ALV grid display.
I am displaying a list using REUSE_ALV_GRID_DISPLAY.
I need to go to a transaction when i double click on a particular line on the output list based on the content of the 1st cell of that line. (ie if i have 4 columns and 5 records and click on the 3rd column of 2nd record then i need to know the value of the 1st field of the 2nd record)
I am using a call back user command subroutine to capture the index and the field which has been clicked upon. This index is giving perfect result by which I am reading the output table and doing the later operations.
But what if i sort the list in ALV by any column? Then the index that I will get on double clicking will correspond to the index on the screen but not to the index on my internal output table. In that case I will get a wrong value of the 1st field.
I do not want to use OO alv. Is there a way to handle this situation?
Regards,
ShinjanHello Shinjan,
When i display an output table say t_out on ALV GRID, the records in the table shown on the grid is identical to what i have in t_out. Hence the tabindex will correspond to that very record in t_out.
But when i sort the table on the grid, the order of the rows changes... so for example a row which had index 2 will now have an index 6 (say). So on clicking this record, the tabindex will be 6 where as the same record exist in 2nd position in t_out. How to handle this?
{quote]
Did you try this scenario? Your output table t_out also gets refarranged after SORT. Good thing is you DONOT have to code anything for this )
As per your example the table t_out will be rearranged so that the initial 2nd record will be at 6th posn.
FORM f_user_command USING fp_v_ucomm TYPE syucomm
fp_selfield TYPE slis_selfield."#EC CALLED
CONSTANTS:
l_c_ic1 TYPE char4 VALUE '&IC1',
l_c_vl TYPE char2 VALUE 'VL',
l_c_vl03n TYPE char5 VALUE 'VL03N'.
CASE fp_v_ucomm.
* Ok code for double code
WHEN l_c_ic1.
IF fp_selfield-tabindex NE space.
READ TABLE it_final INTO wa_final "it_final gets rearranged as per the SORT condition
INDEX fp_selfield-tabindex. "tabindex keeps the correct index after SORT
SET PARAMETER ID l_c_vl FIELD wa_final-vbeln.
CALL TRANSACTION l_c_vl03n AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. "f_user_command
Please check & let us know.
BR,
Suhas
Edited by: Suhas Saha on Jan 2, 2009 11:48 AM
Edited by: Suhas Saha on Jan 2, 2009 11:53 AM -
How to get the alv grid report in another screen when double click on basic
Hi.
I have created an alv report using class cl_gui_alv_grid.I got another report in the same screen,when double clicked on basic list(using double_click event).I want to get this report in another screen.What i have to do?(In classical reports i worked with sy-lsind = 1 ,but how to do here?)
How to set color to the selected rows in the alv grid report?I worked with change_data_from_inside method of cl_gui_alv_grid.But it didn't work out..
With Regards,
Ramana.On double click event . you will have to call another screen say 9000.
now within screen 900 PBO.. you will have to prepare the fieldcatalog/layout.. and the table to be displayed there.
in PAI of screen 9000, you can return to the original ALV.
method double_click.
call screen 9000.
endmethod.
" now in PBO create a module display_alv2
module display_alv2.
'prepare the fieldcat/layout info for new alv
'add the data to the new ALV table
'instantiate the grid call.. etc
'call the ALV
endmodule
"in PAI
module exit.
case sy-ucomm.
when 'ENT1'.
leave to screen 0.
endcase.
endmodule
while preparing the field catalog you can mention the EMPHASIZE field, whish will give color to tht column
E.g
*--Service Order
ls_fieldcat-tabname = 'IT_FINAL_VALID'.
ls_fieldcat-fieldname = 'AUFNR'.
ls_fieldcat-scrtext_m = 'Service Order'.
ls_fieldcat-ref_table = 'AUFK'.
ls_fieldcat-ref_field = 'AUFNR'.
ls_fieldcat-col_pos = 1.
ls_fieldcat-outputlen = 12.
ls_fieldcat-emphasize = 'C400'. "This will add color to the cell
APPEND ls_fieldcat TO fcat_valid.
Hope this helps. -
Header Text for Field Catalog ALV Grid doubt ..
Hi everybody
I have an ALV Grid List Report (REUSE_ALV_LIST_DISPLAY)
but i have a trouble: the header texts for the fields are always truncated to 10 positions.
The code for fill the Field Catalog are:
CLEAR l_field_cat.
l_field_cat-COL_POS = 2.
l_field_cat-FIELDNAME = 'AVERAGE'.
l_field_cat-TABNAME = 'T_REPORT'.
l_field_cat-REF_TABNAME = 'RPSCO'.
l_field_cat-REF_FIELDNAME = 'WLP00'.
l_field_cat-SELTEXT_S = TEXT-004. <- 'AverageAmount' 20 lenght
l_field_cat-DDICTXT = 'S'.
l_field_cat-KEY = ' '.
l_field_cat-KEY_SEL = ' '.
APPEND l_field_cat TO p_field_cat.
But, although the column appears with 20 characters lenght, the header text appears 'AverageAmo', and it is in the same way for all the fields, even with fields with 40 characters lenght.
What am i doing incorrect ?
Thanks in Advanced
FrankThat is because of field I_field_cat-SELTEXT_S.
This will always display 10 char long text.
To avoid truncating you can specify length for the header.
Try this
x_fieldcat-seltext_l = TEXT-004.
x_fieldcat-outputlen = 20.
x_fieldcat-ddictxt = c_l.
Message was edited by: Ashish Gundawar
Message was edited by: Ashish Gundawar -
About filter in alv grid display
Hi,
I am practicing on REUSE_ALV_GRID_DISPLAY in that i want to know about how to use some fields like
*ITFILTER*_
IT_ALV_GRAPHICS
IT_HYPERLINK
IT_ADD_FIELDCAT
IT_EXCEPT_QINFOHi Rock.
I would like to suggest you a couple of references which quite relate to your case,
REUSE_ALV_GRID_DISPLAY - Output of a simple list (single-line)
[SDN - Reference for Using REUSE_ALV_GRID_DISPLAY - Basic Program|alv prog;
[SDN - Reference for Use of IT_FILTER in REUSE_ALV_GRID_DISPLAY |Doubts in ALV?;
[SDN - Reference for use of IT_FILTER with CODE in REUSE_ALV_GRID_DISPLAY|ALV Report;
[SDN - Refernce for Using IT_ALV_GRAPHICS in REUSE_ALV_GRID_DISPLAY|OOPs : SAVE and ALV Display Variant;
[SDN - Reference for Editing a graph in ALV (IT_ALV_GRAPHICS) using REUSE_ALV_GRID_DISPLAY|Edit Graph display ALV list display;
[SDN - Reference for use of IT_HYPERLINK in REUSE_ALV_GRID_DISPLAY|editable fields on ALV grid;
[SDN - Reference including example of IT_ADD_FIELDCAT in REUSE_ALV_GRID_DISPLAY|building top of page in ALV list;
[SDN - Reference for scenario for use of IT_EXCEPT_QINFO in REUSE_ALV_GRID_DISPLAY|Background ID in ALV Grid;
[SDN - Reference for application example of IT_EXCEPT_QINFO in REUSE_ALV_GRID_DISPLAY|PF Status in ALV list.;
Hope That's Usefull.
Good Luck & Regards.
Harsh Dave -
Hello,
i am displaying an ALV Grid by using "REUSE_ALV_GRID_DISPLAY". When I switch to Excel inplace display for the result list only 202 rows are displayed in excel. (in alv list there are 1376). When i switch back to alv list all are shown again. Has anyone an idea about ? I guess there is a parameter who limits it for excel.
Kind Regards
Joachim BertramHi,
There is a Macro Security setting "Trust Access to Visual Basic Project" which needs to be turned on within Excel in order to get any rows in the Excel inplace from your ALV, but since you are getting a subset of rows I doubt this is your issue.
Judging from the number of SAP Notes updated in the year 2008, it would seem to me that the Excel integration is still very much an ongoing work-in-progress. Unfortunately, I couldn't find any other Notes that specifically talk about missing only some rows (other than the ones that cover the ALL rows missing problem).
You may want to check with your Basis team to determine if there is some sort of setting that is limiting the number of rows being transferred. From what you describe, though, I'd be very surprised if a setting like this (if it even exists) would be set to such a small number of Excel rows. You might also want to check with them to find out if there is a max number of bytes allowed for Excel inplace transfers. If so, and if you have a lot of columns, then this might be a factor.
Which versions of Office/Excel and SAPGUI are you using? This is important because, as [Note 722513|https://service.sap.com/sap/support/notes/722513] explains in detail, only certain combinations of MS Office, SAPGUI and SAP Basis are supported. If you can exclude the support issue as a factor then there is a chance that the issue you described in you original message may actually be a new problem that has not been addressed by SAP yet. After all, how and why do you suppose all of the dozens of existing Notes regarding ALV and Office integration got created in the first place? Some customer had to discover the problem and report it to SAP.
One final suggestion I can make is that you should have someone confirm that Note 756623 has been applied correctly in your system. Even though the support pack SAPKB62061 should have this Note, it never hurts to check the Note implementation line-by-line just in case (especially in a case like this in which the note seems to match your symptoms so closely).
Best Regards,
Jamie -
How to enable excel downloading in ALV grid report.
Hi all,
How to enable excal downing in ALV grid report?
Thanks in Advance.
Siva Sankar.hi
check the following code
Example of a Simple ALV Grid Report
REPORT ZTUFI091 .
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
*REPORT zdemo_alvgrid .
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.
hope it will help you
regards
sreelatha gullapalli -
Dear Experts
I need to do summation of netprice when ever the PO Changes for the sample report given below
REPORT ZTUFI091 .
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
*REPORT zdemo_alvgrid .
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.
pls show me how to accomplish this
Thanks in advance
karthikHi,
Try like the below...
REPORT ZTUFI091 .
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
*REPORT zdemo_alvgrid .
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'.
<b> fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.</b>
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[]
<b> IT_SORT = i_sort</b>
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>
clear wa_sort.
wa_sort-tabname = it_ekko
wa_sort-fieldname = 'EBELN'.
wa_sort-up = gc_var_x.
APPEND wa_sort to i_sort.</b>
Satya -
Field Catolgue in alv grid display
Hi Abapers,
I need to display the percentage rows with decimals and other rows without decimal . Is their any option in field catalog to do like this. Or tell me any other alternative to achieve this.
sno total col1 col2 col3
1 220 100 20 100
2 320 120 50 150
tot 540 220 70 250
per 40.74 1.87 and so on
or ,
I have two different internal tables how can i put it in one field catalog to pass it to alv grid display.
Regards,
PriyaDon't do total by your self in the Pogram.
in the Fieldcatalog there is an Attribute which will do total & Average .
Enable it so that from one internal table data it self it will do good.
example program
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
REPORT zdemo_alvgrid .
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.
*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 = '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-do_sum = 'X'. "Display column total
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_XEVENTS
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
gowri
Message was edited by:
Gowri Krishna -
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
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.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
Hi guys,
I use the following method (register_edit_event) in the PBO soon after first display of an editable ALV grid to register enter as an event to do validations on fields like qty. If user enters some character like 'abc' for qty and hits enter on keyboard, ALV grid pop's up a standard message ( I haven't coded for this.Since I use DDIC structure in field catalog, the Std. ALV program takes care of it. ). THis takes care of the validation before I click on save.
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
This works fine. But I want this validation to run when I also click the SAVE button of the screen. Is it possible to run this standard validation in my PAI event eg. SAVE ? I thought I will be, by calling the method check_changed_data in my PAI event. But this is doing nothing. Does this method conflict with register_edit_event or something ? So , basically what I am looking for is to trigger the event or call the method which does the same work as the "check" button on ALV grid.
Any advice or tips or sample code is greatly appreciated.
Thanks,
ShareenHi Shareen,
Handle the data_changed event in the grid.
Whenever you make changes in the data in ALV Grid this event would be triggered. Here you can perform additional validations that you may need to perform.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
Implementation:
METHOD handle_data_changed.
PERFORM validations USING er_data_changed.
ENDMETHOD.
FORM validations USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA: ls_good TYPE lvc_s_modi.
DATA wa LIKE LINE OF lt_good_cells.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'FIELDNAME'. "Your fieldname
CALL METHOD er_data_changed->get_cell_value "Get the changed value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = temp. "Your temp variable
"Make your validations here.
ENDCASE.
Ps: Reward points if helpful.
Regards,
Wenceslaus.
Maybe you are looking for
-
Error while creating RFC Jco provider in visual Admin
Hi, I have crated a rfc jco provider in visual admin , I have given all the ECC related details both in registered server AND Spcific application server. In both of these I have given R/3 related details like host of ecc and all. All i have given cor
-
How to use BAPI_OBJCL* to set classification data for Techn. Objects - PM ?
Good afternoon ! I´m working in a project to integrate some legacy system with the ECC 6.0, and I need to do some activities like, create functional locations and equipments in SAP PM, I have done this creating Z RFC modules that call bapis l
-
Oracle Terminal, how can i simulate this setting into all client places
Hi friends, i did setting at ORacle Terminal for ESC button to exit_form. it is ok working fine. i have his application installed into several client places, so, in all this places do i ahve to install Oracle terminal and change the key mappings or i
-
Downloading shows form current DVR to laptop
I want to download my current shows on dvr to my laptop how do i do this? I have to install a new dvr & don't want to lose unviewed shows. Comcast person told me i can download my current shows to laptop but I don't understand how to do this.
-
Do i have to download Update twice?
i have ipad 2 and the original ipad as well. both using the same account on itunes and updating via the same pc. Is there anyway i can just download the latest updates once instead of having to re-download a 600 meg file once for each ipad when they