Doubt in alv grid
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 advance
make 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
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. -
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 -
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 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 -
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 -
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. -
I made my first attempt to use OO programing in ABAP and created an ALV Grid using CL_GUI_ALV_GRID. I have excluded toolbar buttons without a problem, but now I would like to add a button and code my own reaction to its ok_code. Can anyone tell me how to do this? Please keep in mind I am very new to ABAP Objects.
Hi Jason,
Have you had a look at the example program BCALV_GRID_05 ?
The program demonstrates exactly what you are intending to do.
Please get back with any specific doubts you may encounter.
Regards,
Anand MAndalika. -
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 -
hiiiiiiiiiiii
i write one alv grid program
i wnat total at last of output for the field *DMBTR*
plz see the code and give me solution
type-pools: slis.
tables: BSID, KNA1.
data : begin of it_BSID occurs 0,
BUKRS TYPE BSID-BUKRS, "COMPANY CODE
KUNNR TYPE BSID-KUNNR, "Customer no
NAME1 TYPE KNA1-NAME1, "Customer name
XBLNR TYPE BSID-XBLNR, "REFERANCE
BLART TYPE BSID-BLART, "Document Type
BUDAT TYPE BSID-BUDAT, "Posting Date in the Document
SHKZG TYPE BSID-SHKZG, "Debit/Credit Indicator
BELNR TYPE BSID-BELNR, "Accounting Doc no
DMBTR TYPE BSID-DMBTR, "Amount in Local Currency
SGTXT TYPE BSID-SGTXT, "Item text
end of it_BSID.
data : begin of itab occurs 0,
BUKRS TYPE BSID-BUKRS, "COMPANY CODE
KUNNR TYPE BSID-KUNNR, "Customer no
NAME1 TYPE KNA1-NAME1, "Customer name
XBLNR TYPE BSID-XBLNR, "REFERANCE
BLART TYPE BSID-BLART, "Document Type
BUDAT TYPE BSID-BUDAT, "Posting Date in the Document
SHKZG TYPE BSID-SHKZG, "Debit/Credit Indicator
BELNR TYPE BSID-BELNR, "Accounting Doc no
DMBTR TYPE BSID-DMBTR, "Amount in Local Currency
SGTXT TYPE BSID-SGTXT, "Item text
end of itab.
*********ALV Declaration************************************************
data: it_fieldcatalog type slis_t_fieldcat_alv with header line,
wa_fieldcatalog like line of it_fieldcatalog,
wa_layout type slis_layout_alv,
it_rec type table of itab,
it_rec1 type table of itab,
wa_rec like line of itab,
wa_itab like line of itab.
data : it_sort type slis_t_sortinfo_alv,
wa_sort type slis_sortinfo_alv.
*********ALV Declaration************************************************
selection-screen : begin of block b with frame title text-100.
select-options:
COMPANY for BSID-BUKRS ,
CUSTOMER for BSID-KUNNR,
DATE FOR BSID-BUDAT.
selection-screen end of block b .
start-of-selection.
select BUKRS KUNNR XBLNR BLART BUDAT
SHKZG BELNR DMBTR SGTXT
from BSID into corresponding fields of table it_BSID
where
BUKRS IN COMPANY AND
KUNNR IN CUSTOMER AND
BUDAT IN DATE .
sort it_BSID by BUDAT KUNNR.
end-of-selection.
loop at it_BSID.
IF it_BSID-SHKZG EQ 'H'.
MULTIPLY it_BSID-DMBTR BY -1.
ENDIF.
move: IT_BSID-BUKRS TO ITAB-BUKRS, "COMPANY CODE
IT_BSID-KUNNR TO ITAB-KUNNR, "Customer no
IT_BSID-XBLNR TO ITAB-XBLNR, "REFERANCE
IT_BSID-BLART TO ITAB-BLART, "Document Type
IT_BSID-BUDAT TO ITAB-BUDAT, "Posting Date in the Document
IT_BSID-SHKZG TO ITAB-SHKZG, "Debit/Credit Indicator
IT_BSID-BELNR TO ITAB-BELNR, "Accounting Doc no
IT_BSID-DMBTR TO ITAB-DMBTR, "Amount in Local Currency
IT_BSID-SGTXT TO ITAB-SGTXT. "Item text
select single NAME1 from KNA1 into (itab-NAME1) where KUNNR = itab-KUNNR.
APPEND ITAB.
endloop.
loop at itab .
at end of itab-dmbtr.
sum.
endat.
endloop.
if not itab[] is initial.
perform populate_field_catalog.
perform fill_layout.
perform display_alv.
else.
write: ' NO DATA'.
endif.
*& Form populate_field_catalog
* text
form populate_field_catalog .
wa_fieldcatalog-fieldname = 'BUKRS'.
wa_fieldcatalog-seltext_m = 'COMPANY'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'KUNNR'.
wa_fieldcatalog-seltext_m = 'CUSTOMER CODE.'.
wa_fieldcatalog-no_zero = 'X'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'NAME1'.
wa_fieldcatalog-seltext_m = 'NAME'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BLART'.
wa_fieldcatalog-seltext_m = 'DOC. TYPE '.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BUDAT'.
wa_fieldcatalog-seltext_m = 'POSTING DATE'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'BELNR'.
wa_fieldcatalog-seltext_m = 'DOCUMENT NO.'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'DMBTR'.
wa_fieldcatalog-seltext_m = 'AMOUNT'.
wa_fieldcatalog-DO_SUM = 'X'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'SGTXT'.
wa_fieldcatalog-seltext_m = 'TEXT'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'XBLNR'.
wa_fieldcatalog-seltext_m = 'REFERANCE'.
append wa_fieldcatalog to it_fieldcatalog.
clear wa_fieldcatalog.
endform. " populate_field_catalog
*& Form fill_layout
* text
* --> p1 text
* <-- p2 text
form fill_layout .
wa_layout-no_input = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-zebra = 'X'.
endform. " fill_layout
*& Form display_alv
* text
* --> p1 text
* <-- p2 text
form display_alv .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fieldcatalog[]
i_default = 'X'
i_save = 'A'
tables
t_outtab = itAB
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number
sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " display_alv
Edited by: pranay panchbhai on Mar 15, 2010 3:18 PMHi
Give this code for field DMBTR in fielcatalog.
wa_fieldcatalog-FIELDNAME = 'DMBTR'.
wa_fieldcatalog-INTTYPE = 'C'.
wa_fieldcatalogT-DO_SUM = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
It will work definitely.
If you still have doubts then revert back.
Thanks & Regards
Khushboo -
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 -
ALV grid can we remove the repetation values in field & display as one .
Dear Freinds,
i have developed a custom development relating to a salarly report based on the orgunit, the output is coming however i have one doubt in alv output.
right now my internal table data having data as follows : (iam giving only some fields)
orgunit orgdesc Empno Empname
70000905 Human Resources 7056 Richard
70000905 Human Resources 7057 Reymond Jain
70000905 Human Resources 7058 Maria Gulz
70000905 Human Resources 7061 Jacob
now in my output i dont want to have the orgunit value 70000905 and orgdesc (human resources) shouldnt not be repeated . is there any option in ALV where we I can use in
the field cat ( any parameter) where i can set that we can make the orgid as one and remove the repeation.(iam using alv grid function module).
Please help me in this regard
Regards
SyamlaHi,
Before displaying sort ur internal table.
refer this code.
*& Form sub_display_data
text
FORM sub_display_data .
*--To sort the output through material number
DATA : lwa_sort TYPE slis_sortinfo_alv.
DATA : lit_sort TYPE slis_t_sortinfo_alv.
*--Pass the values to the table
lwa_sort-fieldname = 'PERNR'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '1'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = 'X'. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WORKDATE'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '2'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WEKLY'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '3'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
wa_layout-colwidth_optimize = 'X'.
IF NOT it_final2[] IS INITIAL.
*--Call the function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = wa_layout
i_callback_program = v_repid
it_fieldcat = it_fieldcat1[]
i_default = c_chk
i_save = c_save
it_sort = lit_sort
TABLES
t_outtab = it_final2
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.
ELSE.
*--Message No data found
MESSAGE i888 WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " sub_display_data
Regards,
Prashant -
How to change sub total value in ALV Grid.
Hi All,
Can u please explain how to change SUBTOTAL Value in ALV Grid display based on another field value.
EX; F1 subtotal is initial then we have to modify the F2 sub total to 9999.9.
Thanks
Radha.Hi Radha,
I doubt if that can be changed....because the event that i was referring to in my previous post works with ALV List display...But in any case you can try that.....
There is an event in SLIS....(As i told you, i dont remember the name and currently i dont have access to SAP system, so i am not able to verify and let you know that event name).....
Other thatn TOP and END of PAGE events, there is an event for sub-total text......i think it would start with "SUBTOTAL"...
you need to use that event in your events table and pass it to ALV Grid display.
Then create a sub-routine with that name (As you do for TOP-OF-PAGE event)....and in this event you can change the values in runtime (PROVIDED, this event gets triggered for ALV GRID).....
If this does not work, i think calculating sub-totals while you build the internal table would be a better option....(If you have time constraint....else you can do some more research on the same)........
Best Regards,
Ram. -
How change standard field lable in alv grid display
Hi Experts,
How are you doing! I am having some doubts in the alv grid display, I am new to this concepts.
I want to display field lable manually, actually its taking from table field discription but I want to display one field name manually.
example code.
ls_fldcat-fieldname = 'BPKIND'.
ls_fldcat-ref_tabname = 'BUT000'.
ls_fldcat-ref_fieldname = 'BPKIND'.
APPEND ls_fldcat TO lt_fldcat.
ls_fldcat-fieldname = 'PARTNER2'.
ls_fldcat-ref_tabname = 'BUT051'.
ls_fldcat-ref_fieldname = 'PARTNER2'.
Here I dont want to display 'PARTNER2' I need 'KEY ACCOUNT MANAGER'.
Please send me how to do this.
Surya Ramireddy.Hi
Please check out this program.
Type-pools: slis.
Tables: likp.
Data: Begin of i_likp occurs 0,
vbeln like likp-vbeln,
ernam like likp-ernam,
erzet like likp-erzet,
erdat like likp-erdat,
End of i_likp.
Data: it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type SLIS_FIELDCAT_ALV,
it_events type slis_t_event.
Selection-screen: Begin of block b1 with frame title text-001.
select-options: s_vbeln for likp-vbeln.
Selection-screen: End of block b1.
start-of-selection.
perform get_sales_header_data.
end-of-selection.
perform field_catalogue.
perform modify_field_catalogue.
perform display_alv_grid_display.
*& Form get_sales_header_data
text
--> p1 text
<-- p2 text
form get_sales_header_data .
select vbeln
ernam
erzet
erdat
into table i_likp
from likp
where vbeln in s_vbeln.
endform. " get_sales_header_data
*& Form field_catalogue
text
--> p1 text
<-- p2 text
form field_catalogue .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'I_LIKP'
I_INCLNAME = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
endform. " field_catalogue
*& Form modify_field_catalogue
text
--> p1 text
<-- p2 text
form modify_field_catalogue .
loop at it_fieldcat into wa_fieldcat.
case wa_fieldcat-fieldname.
when 'VBELN'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-seltext_l = 'Sales Doc Header No'.
wa_fieldcat-emphasize = 'C100'.
when 'ERNAM'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-seltext_l = 'Created By'.
wa_fieldcat-emphasize = 'C200'.
when 'ERZET'.
wa_fieldcat-col_pos = 3.
wa_fieldcat-seltext_l = 'Entry Time'.
wa_fieldcat-emphasize = 'C300'.
when 'ERDAT'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-seltext_l = 'Created On'.
wa_fieldcat-emphasize = 'C400'.
endcase.
modify it_fieldcat from wa_fieldcat.
endloop.
endform. " modify_field_catalogue
*& Form display_alv_grid_display
text
--> p1 text
<-- p2 text
form display_alv_grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = IT_FIELDCAT
TABLES
t_outtab = i_likp
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
endform. " display_alv_grid_display
Regards
Haritha.
Maybe you are looking for
-
My iphone 3gs stopped appearing in the sidebar
A week or so ago my iphone 3gs stopped appearing in the itunes (10.7) sidebar when plugged in to my computer. It shows in the itunes fuile menu and when I right click the itunes icon in my task bar. It would still sync from the file menu. Now, itu
-
New Hard Drive Won't Configure
I just bought a new Hard Drive (Crucial 256gb SSD) and physically installed it. However I am having problems configuring it. When I C or option boot and go to Diskutil and erase/partition the drive I get the same error: "POSIX reports: the operation
-
Word 2000 and Acrobat 9 PDFMaker
I see that it is a known issue that PDFMaker doesn't always install nicely into Word 2007 with Acrobat 9. What I want to ask is, is it possible to use PDFMaker with Word 2000? The fact that it seems to be implemented as a dll makes me think maybe it
-
Apps doesn't have access to my photo library
All Apps says that they don't have access to my photos and when I open privacy/photos/ it only shows tell policy and says that no apps have requested an access, What to do??
-
Hi everyone. I'm experiencing a hang up issue as I'm attempting to shut down or restart my Mac. I've attempted numerous fixes including verifying permissions, running fsck -fy, creating a new user account, but with no luck. When you click shut down,