Reg : ALV Grid Refresh - Output not appearing
Hi All ,
Am calling a screen 100 at 3 different places.
Though i use refresh_table_display , The value in the output table, say i_final changes, but while displaying the output , the whole screen is blank , even the container is not appearing in the output .
Can you please help me with your inputs .
Regards,
Chitra
yes it is good ...see the example...for your requirement..
REPORT yztest .
TYPE-POOLS: slis.
Tables
TABLES: mara.
TYPES: BEGIN OF ty_name,
name TYPE char10,
age TYPE i,
END OF ty_name.
TYPES: BEGIN OF ty_marks,
sub1 TYPE i,
sub2 TYPE i,
total TYPE i,
END OF ty_marks.
TYPES: BEGIN OF ty_phone,
phnum TYPE char10,
END OF ty_phone.
TYPES: BEGIN OF ty_addr,
address TYPE char20,
END OF ty_addr .
Output internal table
DATA: itab TYPE TABLE OF ty_name,
wa TYPE ty_name,
itab1 TYPE TABLE OF ty_marks,
wa1 TYPE ty_marks,
itab2 TYPE TABLE OF ty_phone,
wa2 TYPE ty_phone,
itab3 TYPE TABLE OF ty_addr,
wa3 TYPE ty_addr.
ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
r_grid1 TYPE REF TO cl_gui_alv_grid,
r_grid2 TYPE REF TO cl_gui_alv_grid,
r_grid3 TYPE REF TO cl_gui_alv_grid,
g_dock TYPE REF TO cl_gui_docking_container,
g_dock1 TYPE REF TO cl_gui_docking_container,
g_dock2 TYPE REF TO cl_gui_docking_container,
g_dock3 TYPE REF TO cl_gui_docking_container,
g_dock4 TYPE REF TO cl_gui_docking_container,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat,
it_fieldcat2 TYPE lvc_t_fcat,
it_fieldcat3 TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
DATA picture TYPE REF TO cl_gui_picture.
DATA url(255).
CLEAR url.
DATA init.
START-OF-SELECTION.
wa-name = 'test01'.
wa-age = '1'.
APPEND wa TO itab.
wa-name = 'test02'.
wa-age = '2'.
APPEND wa TO itab.
wa-name = 'test03'.
wa-age = '3'.
APPEND wa TO itab.
wa1-sub1 = '11'.
wa1-sub2 = '22'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa1-sub1 = '22'.
wa1-sub2 = '33'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa2-phnum = '99999999999'.
APPEND wa2 TO itab2.
wa2-phnum = '888888888888'.
APPEND wa2 TO itab2.
wa2-phnum = '777777777777'.
APPEND wa2 TO itab2.
wa3-address = 'HItech City'.
APPEND wa3 TO itab3.
wa3-address = 'Secunderabad'.
APPEND wa3 TO itab3.
wa3-address = 'Hyderabad'.
APPEND wa3 TO itab3.
PERFORM display_image.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'SUB1'.
wa_fieldcat-seltext = 'SUBJECT1'.
wa_fieldcat-coltext = 'SUBJECT1'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'SUB2'.
wa_fieldcat-seltext = 'SUBJECT2'.
wa_fieldcat-coltext = 'SUBJECT2'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext = 'TOTAL'.
wa_fieldcat-coltext = 'TOTAL'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'PHNUM'.
wa_fieldcat-seltext = 'PHONE NO'.
wa_fieldcat-coltext = 'PHONE NO'.
APPEND wa_fieldcat TO it_fieldcat2.
wa_fieldcat-fieldname = 'ADDRESS'.
wa_fieldcat-seltext = 'ADDRESS'.
wa_fieldcat-coltext = 'ADDRESS'.
APPEND wa_fieldcat TO it_fieldcat3.
IF g_dock IS INITIAL.
CREATE OBJECT g_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock->dock_at_left
extension = 300.
CREATE OBJECT r_grid
EXPORTING
i_parent = g_dock.
ENDIF.
IF g_dock1 IS INITIAL.
CREATE OBJECT g_dock1
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock1->dock_at_right
extension = 300.
CREATE OBJECT r_grid1
EXPORTING
i_parent = g_dock1.
ENDIF.
IF g_dock2 IS INITIAL.
CREATE OBJECT g_dock2
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock2->dock_at_top
extension = 100.
CREATE OBJECT r_grid2
EXPORTING
i_parent = g_dock2.
IF g_dock3 IS INITIAL.
CREATE OBJECT g_dock3
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock3->dock_at_top
extension = 100.
CREATE OBJECT r_grid3
EXPORTING
i_parent = g_dock3.
ENDIF.
IF NOT itab[] IS INITIAL.
CALL METHOD r_grid->set_table_for_first_display
CHANGING
it_outtab = itab
it_fieldcatalog = it_fieldcat.
ENDIF.
IF NOT itab1[] IS INITIAL.
CALL METHOD r_grid1->set_table_for_first_display
CHANGING
it_outtab = itab1
it_fieldcatalog = it_fieldcat1.
ENDIF.
IF NOT itab2[] IS INITIAL.
CALL METHOD r_grid2->set_table_for_first_display
CHANGING
it_outtab = itab2
it_fieldcatalog = it_fieldcat2.
ENDIF.
IF NOT itab3[] IS INITIAL.
CALL METHOD r_grid3->set_table_for_first_display
CHANGING
it_outtab = itab3
it_fieldcatalog = it_fieldcat3.
ENDIF.
if g_dock4 is initial.
CREATE OBJECT g_dock4
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock4->dock_at_bottom
extension = 100.
CREATE OBJECT picture
EXPORTING parent = g_dock4.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
endif.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form display_image
FORM display_image .
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.
REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.
ENDFORM. " display_image
*& Module EXIT INPUT
text
MODULE exit INPUT.
CALL METHOD g_dock->free.
CALL METHOD g_dock1->free.
CALL METHOD g_dock2->free.
CALL METHOD g_dock3->free.
ENDMODULE. " EXIT INPUT
Similar Messages
-
Need to add Header and footer in an alv grid display output.
How can I add header and footer in an alv grid dispay output.
For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI,
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
l_grid TYPE REF TO cl_gui_alv_grid,
f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Nor'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow '
sap_emphasis = 'str'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IC''.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Mor'.
*set height of this section
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 14.
ENDFORM. "end_of_list_html.
This will solve it. Post if you need more help in this.
Regards,
Madhu. -
Hide/Remove Subtotal Icon in ALV Grid report output.
Hi,
Is ther a way to remove or hide the Subtotal icon in the ALV Grid report output?
Thanks & Regards,
Praveen.Hi,
You can add names of the buttons(which you want to hide) to internal table and pass this internal table for tool bar excluding parameter while calling ALV.
Here as shown in below code, 'Sorting, Ascending,Descending' buttons are removed from the tool bar list.
data : lt_exclude TYPE ui_functions.
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_ASC.
APPEND ls_exclude TO lt_exclude .
ls_exclude = cl_gui_alv_grid=>MC_FC_SORT_DSC.
APPEND ls_exclude TO lt_exclude .
CALL METHOD alvgd->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = lt_exclude
Regards,
Maharshi Vyas -
ALV grid refresh problem when I return from list-processing
hi,
I have made alv grid with f4 help features and i'm using row select feature.
When i click on a button in Application toolbar, the program leaves to list processing and then return to alv gridscreen.
Now the problem arises.
(1)Even if i select rows and press F8, the program does not identify the rows selected and does not give me desired output.
(2)Also, when i press F4, the selected value does not appear in the text field.
Both the cases are working fine, if i dont press button and go to list processing.
Please help!!You can use the function module as stated below -
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
ET_EXCLUDING =
E_FLG_NO_HTML =
E_CALLBACK_PROGRAM =
E_REPID =
e_grid = ref1
ES_LAYOUT_KKBLO =
ES_SEL_HIDE =
CALL METHOD ref1->check_changed_data.
This helps to get the data in the internal table refreshed as well as that on the screen so that both are in sync.
this is generally used on some event, you can also use it otherwise.
<b>
Reward if useful.</b>
Regards,
Pritha -
Regarding Alv Grid Totals_text is not Printing
Hi All,
I am presently working in Alv Grid dispaly.
I need to dispaly Totals_Text = 'Totals'. But this text is not displaying in my output dispaly.i am copying my code here.
Code:
REPORT ZFTRSERV NO STANDARD PAGE HEADING
MESSAGE-ID YV
LINE-SIZE 255.
TABLES: BSIS, "Accounting: Secondary Index for G/L Accounts
BSAS, "Accounting: Secondary Index for G/L Accounts (Cleared Items)
BSID, "Accounting: Secondary Index for Customers
BKPF, "Accounting Document Header
ITCPP. "SAPscript output parameters
TYPE-POOLS: SLIS. "ALV Declarations
$$********************************************************************
$$ GLOBAL TYPES
$$ NAMING CONVENTION: "Y_NAME"
$$********************************************************************
*eject
$$********************************************************************
$$ GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
$$ NAMING CONVENTION: "I_NAME"
$$********************************************************************
$$********************************************************************
$$ GLOBAL INTERNAL TABLES (CUSTOM STRUCTURE)
$$ NAMING CONVENTION: "T_NAME"
$$********************************************************************
*eject
$$********************************************************************
$$ GLOBAL FIELD-SYMBOLS
$$ NAMING CONVENTION: "<FS_NAME>"
$$********************************************************************
FIELD-SYMBOLS: <FS_BSIS> TYPE Y_BSIS.
$$********************************************************************
$$ MACROS DECLARATION
$$ NAMING CONVENTION: M_NAME
$$********************************************************************
$$********************************************************************
$$ PARAMETERS & SELECT-OPTIONS
$$ NAMING CONVENTION: "P_NAME" & "S_NAME"
$$********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK SS01 WITH FRAME TITLE TEXT-B01.
GENERAL SELECTIONS
SELECT-OPTIONS: S_BUKRS FOR BSIS-BUKRS OBLIGATORY,
S_HKONT FOR BSIS-HKONT OBLIGATORY,
S_BLART FOR BSIS-BLART,
S_BELNR FOR BSIS-BELNR.
SELECTION-SCREEN END OF BLOCK SS01.
SELECTION-SCREEN BEGIN OF BLOCK SS02 WITH FRAME TITLE TEXT-B02.
OPEN ITEMS:
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS P_OPIT LIKE ITEMSET-XOPSEL RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 3(20) TEXT-003 FOR FIELD P_OPIT.
SELECTION-SCREEN END OF LINE.
PARAMETERS P_STIDA LIKE RFPDO-ALLGSTID DEFAULT SY-DATLO.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN: COMMENT (12) BLANK1,
COMMENT (20) TEXT-006 FOR FIELD P_OSST.
PARAMETERS: P_OSST AS CHECKBOX DEFAULT SPACE.
SELECTION-SCREEN: COMMENT (12) BLANK2,
COMMENT (20) TEXT-007 FOR FIELD P_OUTD.
PARAMETERS:P_OUTD LIKE ITCPP-TDDEST.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK SS03.
*eject
$$********************************************************************
$$ INITIALIZATION
$$********************************************************************
INITIALIZATION.
CLEAR: E_BSID,
E_BSIS,
E_BSAS,
E_BKPF,
E_TOTAL,
E_SUMSHET_OPEN,
E_SUMSHET_CLEAR,
E_SUMSHET_TOTAL,
E_CATLOG,
E_ALV_LAYOUT.
FREE: T_BSID,
T_BSIS,
T_BSAS,
T_BKPF,
T_TOTAL,
T_SUMSHET_OPEN,
T_SUMSHET_CLEAR,
T_SUMSHET_TOTAL.
*eject
$$********************************************************************
$$ AT SELECTION-SCREEN
$$********************************************************************
AT SELECTION-SCREEN .
*eject
$$********************************************************************
$$ START-OF-SELECTION
$$********************************************************************
START-OF-SELECTION.
To Get data from tables
PERFORM F_OUT_DATA_RETRIEVEL.
*eject
$$********************************************************************
$$ END-OF-SELECTION
$$********************************************************************
END-OF-SELECTION.
To Display ALV Grid Layout
PERFORM F_ALV_DATA_RETRIVAL.
*eject
*& Form f_out_data_retrievel
data retrival for Open,Clear and All items
FORM F_OUT_DATA_RETRIEVEL.
IF P_OPIT EQ C_X.
*open items is selected data will be retrieved from BSIS table.
PERFORM F_OPEN_ITEMS.
TO GET DATA FOR SUMMARY SHEET OPEN ITEMS.
PERFORM F_GET_OPEN_SUMSHET.
ENDIF.
ENDFORM. " f_out_data_retrievel
*& Form F_OPEN_ITEMS
getting data for Open items from BSIS Table
FORM F_OPEN_ITEMS .
SELECT BUKRS
HKONT
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
BUDAT
BLDAT
BLART
BSCHL
MWSKZ
DMBTR
SGTXT
FROM BSIS
INTO CORRESPONDING FIELDS OF TABLE T_BSIS
WHERE BUKRS IN S_BUKRS
AND HKONT IN S_HKONT
AND BLART IN S_BLART
AND BELNR IN S_BELNR
AND AUGDT NE P_STIDA .
IF SY-SUBRC NE C_0.
MESSAGE S999 WITH text-030.
ENDIF.
PERFORM F_GET_DATA_BSIS.
ENDFORM. " F_OPEN_ITEMS
To get the Entry date and Reference Key2
PERFORM F_GET_DATA_BSIS.
*& Form F_GET_DATA_BSAS
GETTING DATA FROM BSAS TABLE
FORM F_GET_DATA_BSAS .
DATA: W_TABIX TYPE SY-TABIX.
UNASSIGN <FS_BSAS>.
GETTING DATA FROM BKPF AND BSID TABLES
LOOP AT T_BSAS ASSIGNING <FS_BSAS>.
CLEAR: E_BKPF,
E_BSID,
W_TABIX.
MOVE SY-TABIX TO W_TABIX.
SELECT SINGLE BUKRS
BELNR
GJAHR
CPUDT
BUDAT
FROM BKPF
INTO CORRESPONDING FIELDS OF E_BKPF
WHERE BUKRS EQ E_BSAS-BUKRS
AND BLART EQ E_BSAS-BLART
AND BELNR EQ E_BSAS-BELNR
AND BUDAT EQ E_BSAS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BKPF-CPUDT TO <FS_BSAS>-CPUDT.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING CPUDT.
ENDIF.
SELECT SINGLE BUKRS
KUNNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
XREF2
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSAS-BUKRS
AND BELNR EQ E_BSAS-BELNR
AND BLART EQ E_BSAS-BLART
AND BUDAT EQ E_BSAS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BSID-XREF2 TO <FS_BSAS>-XREF2.
FREE T_BSID.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING XREF2.
ENDIF.
<FS_BSAS>-IDATE = SY-DATUM.
<FS_BSAS>-IEDAT = <FS_BSAS>-CPUDT - <FS_BSAS>-ZUONR.
<FS_BSAS>-PTIME = SY-DATUM - <FS_BSAS>-CPUDT.
MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
TRANSPORTING IEDAT
PTIME
IDATE.
ENDLOOP.
SORT T_BSAS BY HKONT XREF2 CPUDT.
ENDFORM. " F_GET_DATA_BSAS
*& Form F_GET_DATA_BSIS
GETTING DATA FROM BSIS TABLE
FORM F_GET_DATA_BSIS .
DATA: W_TABIX TYPE SY-TABIX,
W_SGTXT LIKE BSIS-SGTXT,
W_SGTXT1 LIKE BSIS-SGTXT,
W_SORTL LIKE KNA1-SORTL.
CLEAR: E_BKPF,
E_BSID,
W_TABIX,
W_SGTXT,
W_SGTXT1,
W_SORTL.
GETTING DATA FROM BKPF AND BSID TABLES
LOOP AT T_BSIS INTO E_BSIS.
MOVE SY-TABIX TO W_TABIX.
SELECT SINGLE BUKRS
BELNR
GJAHR
CPUDT
BUDAT
FROM BKPF
INTO CORRESPONDING FIELDS OF E_BKPF
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF SY-SUBRC EQ C_0.
MOVE E_BKPF-CPUDT TO E_BSIS-CPUDT.
FREE T_BKPF.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING CPUDT.
ENDIF.
SELECT SINGLE BUKRS
KUNNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
XREF2
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF sy-subrc EQ C_0.
DUMMY CHECK
ENDIF.
SELECT SINGLE KUNNR
FROM BSID
INTO CORRESPONDING FIELDS OF E_BSID
WHERE BUKRS EQ E_BSIS-BUKRS
AND BLART EQ E_BSIS-BLART
AND BELNR EQ E_BSIS-BELNR
AND BUDAT EQ E_BSIS-BUDAT.
IF sy-subrc EQ C_0.
DUMMY CHECK
ENDIF.
SELECT SINGLE SORTL
FROM KNA1
INTO W_SORTL
WHERE KUNNR EQ E_BSID-KUNNR.
IF SY-SUBRC EQ C_0.
MOVE W_SORTL TO E_BSIS-XREF2.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING XREF2.
ENDIF.
W_SGTXT = E_BSIS-SGTXT.
SPLIT W_SGTXT AT C_SLASH INTO W_SGTXT W_SGTXT1.
MOVE: W_SGTXT TO E_BSIS-SGTXT,
SY-DATUM TO E_BSIS-IDATE.
DATA : W_ZOUNR LIKE BSAS-ZUONR,
W_DATE TYPE D,
W_Z(10) TYPE C.
CLEAR: W_ZOUNR,
W_DATE,
W_Z.
MOVE E_BSIS-ZUONR TO W_ZOUNR.
MOVE : W_ZOUNR4(4) TO W_Z0(4),
W_ZOUNR2(2) TO W_Z4(2),
W_ZOUNR0(2) TO W_Z6(2).
MOVE W_Z TO W_DATE.
E_BSIS-IEDAT = E_BSIS-CPUDT - W_DATE.
CONCATENATE W_ZOUNR+0(2) C_DOT
W_ZOUNR+2(2) C_DOT
W_ZOUNR+4(4) INTO E_BSIS-ZUONR.
E_BSIS-PTIME = SY-DATUM - E_BSIS-CPUDT.
MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
TRANSPORTING IEDAT
PTIME
IDATE
SGTXT
ZUONR. "30TH
ENDLOOP.
SORT T_BSIS BY HKONT XREF2 CPUDT.
ENDFORM. " F_GET_DATA_BSIS
*& Form f_build_fld_catlog1
BUILDING FIELD CATALOG FOR OPEN ITEMS DATA
FORM F_FLD_CATLOG_OPEN_ITEMS.
ORM f_fld_catlog_open_items.
REFRESH i_catlog1.
CLEAR w_col_pos.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_HKONT
C_BSIS
w_col_pos
text-010
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_XREF2
C_BSIS
w_col_pos
text-011
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_BELNR
C_BSIS
w_col_pos
text-012
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_BLART
C_BSIS
w_col_pos
text-013
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BLDAT
C_BSIS
W_col_pos
text-014
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BUDAT
C_BSIS
w_col_pos
text-015
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_CPUDT
C_BSIS
w_col_pos
text-016
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_ZUONR
C_BSIS
w_col_pos
text-017
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_BSCHL
C_BSIS
w_col_pos
text-018
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_DMBTR
C_BSIS
w_col_pos
text-019
C_X "dispaly Sum Total
'40'.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_MWSKZ
C_BSIS
w_col_pos
text-020
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_SGTXT
C_BSIS
w_col_pos
text-021
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING c_IEDAT
C_BSIS
w_col_pos
text-022
SPACE
SPACE.
w_col_pos = w_col_pos + c_1.
PERFORM f_first_field_catalog USING C_PTIME
C_BSIS
w_col_pos
text-023
SPACE
SPACE.
CLEAR: W_COL_POS,
I_ALV_EVENTS.
ENDFORM. " f_fld_catlog_open_items
*& Form f_first_report_dispaly
ROUTINE FOR OPEN ITEMS GRID LAYOUT DISPLAY
FORM F_DISPALY_OPEN_ITEMS.
CLEAR W_REPNAME.
W_REPNAME = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = W_REPNAME
I_CALLBACK_PF_STATUS_SET = C_FSTAT
I_CALLBACK_USER_COMMAND = C_FUCOM
I_CALLBACK_TOP_OF_PAGE = C_FTOPI
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = ' '
I_GRID_SETTINGS =
IS_LAYOUT = E_ALV_LAYOUT
IT_FIELDCAT = I_CATLOG1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = C_A
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_ALV_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_BSIS
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " f_dispaly_open_items
*& Form f_first_field_catalog
BUILDING FIELD CATALOG FOR SECONDERY LIST
-->us_fieldname field name
-->us_ref field ref field
-->us_ref tab ref table
-->us_text text
-->us_sum sum
FORM F_FIRST_FIELD_CATALOG USING US_FIELDNAME TYPE ANY
US_REF_TAB TYPE ANY
US_COL_POS TYPE ANY
US_COLTEXT TYPE ANY
US_DO_SUM TYPE ANY
us_out type any.
CLEAR E_CATLOG.
MOVE : US_FIELDNAME TO E_CATLOG-FIELDNAME,
US_REF_TAB TO E_CATLOG-TABNAME,
US_COL_POS TO E_CATLOG-COL_POS,
US_COLTEXT TO E_CATLOG-SELTEXT_L,
US_DO_SUM TO E_CATLOG-DO_SUM,
US_out to E_CATLOG-outputlen.
APPEND E_CATLOG TO I_CATLOG1.
CLEAR E_CATLOG.
APPEND E_CATLOG TO I_CATLOG1.
CLEAR E_CATLOG.
ENDFORM. " f_first_field_catalog
*& Form F_ALV_DATA_RETRIVAL
ALV DATA VALIDATION
FORM F_ALV_DATA_RETRIVAL .
IF P_OPIT EQ C_X
AND P_OSST EQ C_SPACE .
building field catlog for open items list
PERFORM f_fld_catlog_open_items.
first list display open items list
PERFORM f_dispaly_open_items.
Building Alv Layout
PERFORM f_alv_layout_open_items.
ENDIF.
Code to display only summary sheet P_OSST check box
IF P_OPIT EQ C_X
AND P_OSST EQ C_X.
building field catlog for open items Summary sheet
PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
first list display open items Summary sheet
PERFORM F_DISPALY_SUMSHEET_OPEN.
ENDIF.
ENDFORM. " F_ALV_DATA_RETRIVAL
*& Form F_GET_OPEN_SUMSHET
GET SUMMARY SHEET OPEN ITEM DATA
FORM F_GET_OPEN_SUMSHET .
SORT T_BSIS BY SGTXT.
UNASSIGN <FS_BSIS>.
LOOP AT T_BSIS ASSIGNING <FS_BSIS>.
MOVE SY-TABIX TO W_TABIX.
IF W_TABIX EQ C_1.
MOVE : <FS_BSIS>-SGTXT TO W_SGTXT,
<FS_BSIS>-PTIME TO W_PTIME,
<FS_BSIS>-DMBTR TO W_DMBTR,
<FS_BSIS>-IEDAT TO W_IEDAT.
W_COUNT = W_COUNT + C_1.
CONTINUE.
ELSE.
IF <FS_BSIS>-SGTXT EQ W_SGTXT.
W_PTIME = W_PTIME + <FS_BSIS>-PTIME.
W_DMBTR = W_DMBTR + <FS_BSIS>-DMBTR.
W_COUNT = W_COUNT + C_1.
W_IEDAT = W_IEDAT + <FS_BSIS>-IEDAT.
CONTINUE .
ELSE.
W_ATIME = W_PTIME / W_COUNT.
W_IEDAT = W_IEDAT / W_COUNT.
MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
W_COUNT TO E_SUMSHET_OPEN-COUNT,
W_ATIME TO E_SUMSHET_OPEN-ATIME,
W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
CLEAR: W_SGTXT,
W_PTIME,
W_DMBTR,
W_COUNT,
W_IEDAT.
MOVE : <FS_BSIS>-SGTXT TO W_SGTXT,
<FS_BSIS>-PTIME TO W_PTIME,
<FS_BSIS>-DMBTR TO W_DMBTR,
<FS_BSIS>-IEDAT TO W_IEDAT.
W_COUNT = W_COUNT + C_1.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
W_ATIME = W_PTIME / W_COUNT.
W_IEDAT = W_IEDAT / W_COUNT.
MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
W_COUNT TO E_SUMSHET_OPEN-COUNT,
W_ATIME TO E_SUMSHET_OPEN-ATIME,
W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
CLEAR E_SUMSHET_OPEN.
ENDFORM. " F_GET_OPEN_SUMSHET
*& Form F_TOP_OF_PAGE
ITEMS TOP OF PAGE DATA
FORM F_TOP_OF_PAGE .
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE W_HEADER-INFO.
CLEAR W_HEADER.
*TITLE
MOVE C_H TO W_HEADER-TYP.
MOVE C_TEXT TO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
MOVE C_S TO W_HEADER-TYP.
MOVE C_TEXT2 TO W_HEADER-KEY.
CONCATENATE SY-DATUM+6(2) C_SLASH
SY-DATUM+4(2) C_SLASH
SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR: W_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. " F_TOP_OF_PAGE
FORM F_DISPALY_SUMSHEET_OPEN .
CLEAR w_repname.
w_repname = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = w_repname
I_CALLBACK_PF_STATUS_SET = C_FSTAT
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = C_FTOPS
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = ' '
I_GRID_SETTINGS =
IS_LAYOUT = e_alv_layout
IT_FIELDCAT = i_catlog1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = C_A
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = i_alv_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_SUMSHET_OPEN
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FREE T_SUMSHET_OPEN.
ENDFORM. " F_DISPALY_SUMSHEET_OPEN
*& Form F_TOP_OF_PAGE_SUMSHET
TOP OF PAGE FOR SUMMARY SHEET
FORM F_TOP_OF_PAGE_SUMSHET .
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE W_HEADER-INFO.
CLEAR: W_HEADER,
T_HEADER,
T_LINE.
*TITLE
MOVE C_H TO W_HEADER-TYP.
MOVE C_TEXT1 TO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. " F_TOP_OF_PAGE_SUMSHET
*& Form F_PF_STATUS
GET PF STATUS
FORM F_PF_STATUS USING US_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS C_STAT EXCLUDING US_EXTAB.
ENDFORM. "F_PF_STATUS
*& Form F_USER_COMMAND
GET USER COMMAND
*FORM F_USER_COMMAND USING W_UCOMM LIKE SY-UCOMM
US_SELFIELD TYPE SLIS_SELFIELD.
FORM F_USER_COMMAND USING US_UCOMM LIKE SY-UCOMM
US_SELFIELD TYPE SLIS_SELFIELD.
CONSTANTS:C_NEXT(6) TYPE C VALUE '&NEXT'.
if sy-subrc eq c_0.
MOVE C_TEXT3 TO US_SELFIELD-TABNAME.
endif.
IF P_OPIT EQ C_X
AND US_UCOMM EQ C_NEXT .
PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
PERFORM F_DISPALY_SUMSHEET_OPEN.
ELSEIF P_CLIT EQ C_X
AND US_UCOMM EQ C_NEXT.
PERFORM F_FLD_CATLOG_SUMSHET_CLEAR.
PERFORM F_DISPALY_SUMSHET_CLEAR.
ELSEIF P_ALIT EQ C_X
AND US_UCOMM EQ C_NEXT.
PERFORM F_FLD_CATLOG_SUMSHET_TOTAL.
PERFORM F_DISPALY_SUMSHET_TOTAL.
ENDIF.
ENDFORM. "F_USER_COMMAND
*& Form f_alv_layout_open_items
text
----Hi,
Please refer to the sample code :
*& 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
Thanks,
Sriram Ponna. -
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. -
Problems with ALV grid refresh
Hello,
I am writing a relatively simple wd application, I enter a few values in the select-options and display the data in an ALV grid. My problem seems to be that the grid values do not refresh if I change the selection conditions.
On going through the forum I saw a few posts which ask me to call the Node->Invalidate( ) method, but on using that my grid refreshes completely and data does not appear again, even on changing the input values.
I have pasted the ALV portion of the code from my onAction method - could you suggest what I could do to correct this? I realise this is a relatively stupid question, but I am very new to this technology and am trying to learn. Thanks in advance.
***Database selection (this works fine, tested in debug)
Bind the data to the context
dyn_node = wd_context->get_child_node( name = 'TIME_ENTRY' ).
dyn_node->bind_table( icatsdb ).
Connect to the component Usage of the ALV
l_ref_cmp_usage = wd_this->wd_cpuse_display_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
Through the interface controller of the ALV Component set the DATA node dynamically
l_ref_interfacecontroller = wd_this->wd_cpifc_display_alv( ).
l_ref_interfacecontroller->set_data( r_node_data = dyn_node ).
SudhaHi,
Did you change the statement <b>SET PF-STATUS 'ZIMP'</b> to <b>SET PF-STATUS 'ZLIQ'</b> ? If not, please do that, and run the program after activation.
Reward points if the asnwer is helpful.
Regards,
Mukul -
Reg alv grid using module pool programming
Dear Friends,
I have a situation where i am using alv grid in module programming where in when i click the total button in the tool bar for any numeric column, the screen goes for a run time error.
I have giving all conditions such as made the column in the field structure of lvc_field_catalog as do_sum = 'X',
still goes for a dump...can anyone throw some hints to do more or the reason behind this and also have not excluded the function code for this total pushbutton while passing to the method set_table_for_first_display
thanks...hi,
check this up
internal tables
DATA: i_tab TYPE TABLE OF zchangereq,
w_tab TYPE zchangereq.
display field details
DATA: w_field_cat_wa TYPE lvc_s_fcat. " Field Catalog work area
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-020.
PARAMETERS: p_outs RADIOBUTTON GROUP g1,
p_comp RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
*MACROS
DEFINE add_field.
&1 = FIELDNAME &2 = HEADING &3 = Key field flag
clear w_field_cat_wa.
w_field_cat_wa-fieldname = &1.
lw_field_cat_wa-ref_table = p_ref_table.
lw_field_cat_wa-inttype = p_inttype.
lw_field_cat_wa-decimals = p_decimals.
lw_field_cat_wa-coltext = p_coltext.
lw_field_cat_wa-seltext = p_seltext.
lw_field_cat_wa-do_sum = p_do_sum.
lw_field_cat_wa-no_out = p_no_out.
lw_field_cat_wa-col_pos = p_col_pos.
lw_field_cat_wa-reptext = p_coltext.
lw_field_cat_wa-colddictxt = p_colddictxt.
w_field_cat_wa-scrtext_m = &2.
w_field_cat_wa-key = &3.
append w_field_cat_wa to i_field_cat.
END-OF-DEFINITION.
ALV specific Declarations...........................................
ALV specific Internal table declarations.............................
DATA: i_field_cat TYPE lvc_t_fcat, " Field catalogue
i_alv_sort TYPE lvc_t_sort. " Sort table
ALV variables........................................................
DATA: w_alv_layout TYPE lvc_s_layo, " ALV Layout
w_alv_save TYPE c, " ALV save
w_alv_variant TYPE disvariant. " ALV Variant
ALV Class definitions................................................
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS: handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
METHODS: handle_hotspot
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id.
ENDCLASS. " CLASS LCL_EVENT_HANDLER DEF..
ALV Class implementation............................................
In the Event of a Double Click drill down to the corresponding CHANGE REQUEST
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: l_tab LIKE LINE OF i_tab.
CHECK e_row-rowtype(1) EQ space.
READ TABLE i_tab INDEX e_row-index INTO l_tab.
SET PARAMETER ID 'ZTY' FIELD l_tab-ztype.
SET PARAMETER ID 'ZCR' FIELD l_tab-zcref.
CALL TRANSACTION 'ZCRT' AND SKIP FIRST SCREEN.
ENDMETHOD. " HANDLE_DOUBLE_CLICK
not working yet - hotspot seems to stay in the gui!!
METHOD handle_hotspot.
DATA: l_tab LIKE LINE OF i_tab.
CHECK e_row_id-rowtype(1) EQ space.
READ TABLE i_tab INDEX e_row_id-index INTO l_tab.
SET PARAMETER ID 'ZTY' FIELD l_tab-ztype.
SET PARAMETER ID 'ZCR' FIELD l_tab-zcref.
CALL TRANSACTION 'ZCRT' AND SKIP FIRST SCREEN.
ENDMETHOD. " HANDLE_DOUBLE_CLICK
ENDCLASS. " CLASS LCL_EVENT_HANDLER IMPL...
ALV Grid Control definitions........................................
DATA:
ALV Grid Control itself
o_grid TYPE REF TO cl_gui_alv_grid,
Container to hold the ALV Grid Control
o_custom_container TYPE REF TO cl_gui_custom_container,
Event handler (defined in the class above)
o_event_handler TYPE REF TO lcl_event_handler.
INITIALIZATION.
PERFORM create_field_catalogue. " Create ALV Field Catalog
START-OF-SELECTION.
Outstanding requests
IF p_outs = 'X'.
SELECT * FROM zchangereq
INTO TABLE i_tab
WHERE zstatus < 99.
ELSE.
completed requests
SELECT * FROM zchangereq
INTO TABLE i_tab
WHERE zstatus = 99.
ENDIF.
END-OF-SELECTION.
PERFORM list_output_to_alv. " Perform ALV Output operations
FORM LIST_OUTPUT_TO_ALV *
This subroutine is used to call the screen for ALV Output. *
There are no interface parameters to be passed to this subroutine. *
FORM list_output_to_alv.
CALL SCREEN 100.
ENDFORM. " LIST_OUTPUT_TO_ALV
Module STATUS_0100 OUTPUT *
This is the PBO module which will be processed befor displaying the *
ALV Output. *
MODULE status_0100 OUTPUT.
SET PF-STATUS '0100'. " PF Status for ALV Output Screen
IF p_outs = 'X'.
SET TITLEBAR 'STD'.
ELSE.
completed requests
SET TITLEBAR 'COMP'.
ENDIF.
CREATE OBJECT: o_custom_container
EXPORTING container_name = 'SC_GRID',
o_grid
EXPORTING i_parent = o_custom_container.
PERFORM define_alv_layout. " ALV Layout options definitions
PERFORM save_alv_layout_options. " save ALV layout options
PERFORM call_alv_grid. " Call ALV Grid Control
ENDMODULE. " STATUS_0100 OUTPUT
Module USER_COMMAND_0100 INPUT *
This is the PAI module which will be processed when the user performs*
any operation from the ALV output. *
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
may need to do this so display is refreshed if other report selected
CALL METHOD o_custom_container->free.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM DEFINE_ALV_LAYOUT *
This subroutine is used to Define the ALV layout. *
FORM define_alv_layout .
w_alv_layout-numc_total = 'X'. " Numc total line
w_alv_layout-cwidth_opt = 'X'. " Optimal column width
w_alv_layout-detailinit = 'X'. " Show values that are initial in
" detail list.
w_alv_layout-sel_mode = 'A'. " Column selection mode
w_alv_layout-no_merging = 'X'. " No merging while sorting columns
w_alv_layout-keyhot = 'X'.
ENDFORM. " DEFINE_ALV_LAYOUT
FORM SAVE_ALV_LAYOUT_OPTIONS *
This subroutine is used to Save the ALV layout options. *
FORM save_alv_layout_options.
See the ALV grid control documentation for full list of options
w_alv_save = 'A'.
w_alv_variant-report = sy-repid.
ENDFORM. " SAVE_ALV_LAYOUT_OPTIONS
FORM CALL_ALV_GRID *
This subroutine is used to call ALV Grid control for processing. *
FORM call_alv_grid.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_layout = w_alv_layout
i_save = w_alv_save
is_variant = w_alv_variant
CHANGING
it_outtab = i_tab[]
it_sort = i_alv_sort
it_fieldcatalog = i_field_cat.
Link used Events and Event Handler Methods
CREATE OBJECT o_event_handler.
Set handler o_event_handler->handle_top_of_page for o_grid.
SET HANDLER o_event_handler->handle_double_click FOR o_grid.
ENDFORM. " CALL_ALV_GRID
*& Form create_field_catalogue
set up field catalogue
FORM create_field_catalogue .
Fieldname Heading Key?
*eg add_field 'ZTYPE' 'Type' 'X'.
ENDFORM. " create_field_catalogue -
hi,
I have 2 views, input and output these two included in a MAIN views.
when user key in their input values in INPUT view and the search results will be displayed in OUTPUT view using ALV grid.
the problem i'm facing here is, when user changes search criteria once after search results displayed.. it is not displaying with new search results. every time i have to give F5(Refresh) it is certainly not comfortable to deliver it as it is.
i have tried same scenario with simple query in our local server.. where it is working very well.
i really clueless what would be the cause.. is there any with SAP patch issues.
i have tried with refresh method of ALV component.
please help me out of this, i cannot use TABLE control every time to avoid this.
thanks,
gupta.Hi Gupta,
Could you please let us know how you are filling the context node which is mapped to ALV table?
After the search criteria is changed, if you are doing it inside handler of the button or something like that, it should work.
Refer to the tutorial in the following link which shows an example similar to your scenario:
SAP List Viewer in Web Dynpro - Simple Example for Using ALV
please post the code also which you are using to fill the node in case if you still face the issue after referring to the above tutorial.
Hope this helps!
Regards.
Srilatha
Edited by: Srilatha M on Jul 19, 2010 7:57 AM -
ALV grid refresh while fcat and internal table change
Hi,
I am displaying an ALV output using OOPS ALV grid. It is displaying data from internal table t1.
Later I am changing fieldcat table content and I want to display with internal table t2. how can I do this.
It is not refreshing the fieldcat values in the ALV.
Which method I should call to refresh the ALV.
Thanks and regards,
Venkat.hi,
to refresh the alv display.
you can use the method refresh_table_display
of the class cl_gui_alv_grid.
regards. -
The Visible attribute on alv grid column is not changed after Change Layout
Setup:
I have a program that displays output in an ALV grid (using cl_salv_table).
The ALV grid is displayed within a custom control on a subscreen.
I have 4 subscreens being used on a tabstrip control. So I have 4 ALV grids total (one on each subscreen).
On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
I also allow the user to dowload the contents of all 4 grids to excel. To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
The Problem:
As I said I have 4 grids being displayed via a tab control. Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button. And then the user navigates to tab 2. If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet. When I call is_visible() for a column that was unhid it still comes back as false.
The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata. However, this is not the best option and requires training for the user that they have to do this for the download to work correctly.
The Question:
1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end? Is there a way to make it do this?
2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid? If there is a way to force the synchronization - where do I put that code? As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
Thanks in advance for any help.I was able to resolve this issue with a satisfactory solution.
In my program I had a local class definition to handle the grids' events. When the synchronization wasn't working I only had two events defined: for link_click and added_functions.
I created another definition for event after_salv_function:
on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done. -
Help on ALV GRID display outputting format for 2 internal tables
Hi,
I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
Regards,
MiraHi,
U can try out this code
REPORT zzz_test NO STANDARD PAGE HEADING
MESSAGE-ID zz.
The Data Declarations
INCLUDE zzm_test_alv_data.
The Selection Screen Definition
INCLUDE zzm_test_alv_selscrn.
The definition and implementation of the event reciever class
INCLUDE zzm_test_alv_class.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM f1000_load_itabs.
END-OF-SELECTION
END-OF-SELECTION.
IF NOT cb_disp IS INITIAL.
CALL SCREEN 9001.
ENDIF.
Include for getting data
INCLUDE zzm_test_alv_forms.
Include for PAI and PBO of screen
INCLUDE zzm_test_alv_screen.
INCLUDE ZZM_TEST_ALV_DATA *
This include has all the data declaration defined
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
Table Declarations:
TABLES: mara,
makt.
Internal Tables:
The following structure type must be defined in the data dictionary
DATA: i_fieldcat TYPE lvc_t_fcat,
i_fieldcat1 TYPE lvc_t_fcat,
i_output1 TYPE STANDARD TABLE OF mara,
i_output2 TYPE STANDARD TABLE OF makt,
Work Areas:
w_output1 TYPE STANDARD TABLE OF mara,
w_output2 TYPE STANDARD TABLE OF makt.
Variable:
DATA: lv_repid LIKE sy-repid.
lv_repid = sy-repid.
INCLUDE ZZM_TEST_ALV_SELSCRN *
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: cb_disp AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_main.
INCLUDE ZZM_TEST_ALV_CLASS *
This include has all the data declaration defined for ALV
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
INCLUDE <icon>.
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
cont_for_cognos1 TYPE scrfname VALUE 'BCALC_GRID_01_9100',
cont_for_cognos2 TYPE scrfname VALUE 'BCALC_GRID_01_9200',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
Work Area
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
Constants
CONSTANTS : c_lay(1) TYPE c VALUE 'A' . " All Layouts
CONSTANTS: BEGIN OF c_main_tab,
tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1', "
tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2', "
END OF c_main_tab.
INCLUDE ZZM_TEST_ALV_FORMS *
This Include has the various forms used in the program
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
*& Form f9001_build_field_cat
To Build Field Catalog
-->P_I_FIELDCAT text
-->P_0021 text
FORM f9001_build_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
" text-e05.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f9001_build_field_cat
*& Form f9000_objects_create
For creating Custom Containers
--> p1 text
<-- p2 text
FORM f9000_objects_create.
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_for_cognos1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_for_cognos2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT o_alvgrid1
EXPORTING i_parent = custom_container1.
CREATE OBJECT o_alvgrid2
EXPORTING i_parent = custom_container2.
ENDFORM. " f9000_objects_create
*& Form f9003_layout
To define the layout
-->P_SY_TITLE text
-->P_0030 text
-->P_0031 text
-->P_0032 text
FORM f9003_layout USING value(ptitle)
value(pzebra)
value(pmode)
value(pwidth).
w_layout-grid_title = ptitle.
w_layout-zebra = pzebra.
w_layout-sel_mode = pmode.
w_layout-cwidth_opt = pwidth.
w_variant-report = sy-repid.
ENDFORM. " f9003_layout
*& Form f9006_error_handle
To handle event
-->P_PTEXT text
FORM f9006_error_handle USING value(ptext).
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-e03 " Error Note
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f9006_error_handle
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD custom_container1->free.
CALL METHOD custom_container2->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
ENDFORM.
*& Form f1000_load_itabs
Select from Database
--> p1 text
<-- p2 text
form f1000_load_itabs.
SELECT * FROM mara
INTO TABLE i_output1
UP TO 50 rows.
SELECT * FROM makt
INTO TABLE i_output2
UP TO 50 rows.
endform. " f1000_load_itabs
INCLUDE ZZM_TEST_ALV_SCREEN *
2/ Description / Include functions
This include contains PBO and PAI events for the screen of report
ZZZJJ_TEST_ALV
3/ Responsibility
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS: main_tab TYPE TABSTRIP.
DATA: BEGIN OF i_main_tab,
subscreen LIKE sy-dynnr,
prog LIKE sy-repid VALUE
'ZZZ_TEST',
pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
END OF i_main_tab.
*& Module STATUS_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
IF custom_container1 IS INITIAL.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
Creating Object
PERFORM f9000_objects_create.
Building the field catalog
PERFORM f9001_build_field_cat TABLES i_fieldcat
USING 'MARA'.
PERFORM f9001_build_field_cat TABLES i_fieldcat1
USING 'MAKT'.
Modifying the field catalog
PERFORM f9002_modify_field_cat TABLES i_fieldcat.
For Layout
PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET OUTPUT
Call method to display in the output grid
MODULE main_tab_active_tab_set OUTPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
To display report
i_main_tab-subscreen = '9100'.
CALL METHOD o_alvgrid1->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output1[]
it_fieldcatalog = i_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN c_main_tab-tab2.
To display report
i_main_tab-subscreen = '9200'.
CALL METHOD o_alvgrid2->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output2[]
it_fieldcatalog = i_fieldcat1[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i005 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_GET INPUT
Check & Process the selected Tab
MODULE main_tab_active_tab_get INPUT.
CASE sy-ucomm.
WHEN c_main_tab-tab1.
i_main_tab-pressed_tab = c_main_tab-tab1.
WHEN c_main_tab-tab2.
i_main_tab-pressed_tab = c_main_tab-tab2.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_GET INPUT
*& Module USER_COMMAND_9001 INPUT
User Command
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
PERFORM exit_program.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANC'.
PERFORM exit_program.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. USER_COMMAND_9000 INPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET INPUT
Set sunscreen
MODULE main_tab_active_tab_set INPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
i_main_tab-subscreen = '9100'.
WHEN c_main_tab-tab2.
i_main_tab-subscreen = '9200'.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET INPUT
Thanks & Regards,
Judith. -
Hi,
i am getting data for MATNR,WERKS and few more fields in the ALV output.
in that for MATNR i put the edit option,so when i edit this matnr field and click on SAVE button the values should be saved in the output.
i wrote the function module popup_to_confirm but its going to dump.
how to write it? could you please help me out?
FORM it_out_user_command *
Description : Handling user commands
FORM it_out_user_command
USING
ucmd TYPE sy-ucomm " SY-UCOMM value
fieldinfo TYPE slis_selfield " Current ALV Cell & ALV Info
alv_fcat_dtel TYPE typ_t_fcat_dtel. " Table utilized by std ucmd
fieldinfo-refresh = c_x.
*--- User-commands
CASE ucmd.
WHEN 'SAVE'.
perform save_data.
WHEN 'EXIT'.
LEAVE SCREEN.
ENDCASE.
ENDFORM. "it_out_user_command
FORM it_out_pfstatus *
Description : Form to set PF status
FORM it_out_pfstatus USING rt_extab TYPE slis_t_extab.
DATA : lt_extab TYPE slis_t_extab,
lx_extab LIKE LINE OF lt_extab.
REFRESH lt_extab.
SET PF-STATUS 'ALV_MAIN' EXCLUDING lt_extab.
ENDFORM. " it_out_pfstatus
*& Form DATA_OUTPUT
*Download data to final internal table
FORM DATA_OUTPUT .
loop at it_ekpo into x_ekpo.
x_out_ekpo-ebeln = x_ekpo-ebeln.
x_out_ekpo-ebelp = x_ekpo-ebelp.
x_out_ekpo-matnr = x_ekpo-matnr.
x_out_ekpo-werks = x_ekpo-werks.
append x_out_ekpo to it_out.
endloop.
ENDFORM. " DATA_OUTPUT
*& Form SAVE_DATA
text
--> p1 text
<-- p2 text
FORM SAVE_DATA .
data: lv_answer type c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Do you want to save'
TEXT_BUTTON_1 = 'Yes'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'No'(008)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IV_QUICKINFO_BUTTON_1 = ' '
IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = lv_answer
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.
if lv_answer = '1'.
modify it_out.
endif.
ENDFORM. " SAVE_DATA
Regards,
ShaliniMaybe he didn't get the answer yet;)
Please see this link: [Editable ALV grid|https://www.sdn.sap.com/irj/sdn/wiki]
Ups. it seems link was just to SDN Wiki. Type there Eidatble ALV. First article is what you need
Edited by: Marcin Pciak on Oct 16, 2008 11:27 AM -
All the columns of an alv grid report are not downloading in excel in 1 lin
Hi All,
I have some 60 columns in my alv grid report and user can download the report using list->export->localfile->spreadsheet.
What the issue is that all the columns are not downloading in one line, instead they split in two rows.
Please help.
Regards,
Neha Patelhi,
just use this procedure it will solve your problem:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma -
ALV grid refresh problem - Icons briefly flashed on screen
Hi ,
I have an editable OO ALV grid which has a "New Entries" option. When the user clicks on that button a new blank row is appended at the bottom. The problem is on some monitors /screens when the user clicks on the button the ALV grid flashes for a brief moment and every cell has an image icon.
You can see this problem by going to Tcode SE16N choose a large table like VBAP and display 500 records or more. On the next screen press the page down button, you would see those icons.(the problem is as described above, except that the se16n ALV is not editable ).
Is this a buffering problem of ALV ? Or is there a way to avoid / fix this ?
Thanksyou will find a beginning of explanation here in [sap library - Using the ALV Grid Control in WANs|http://help.sap.com/saphelp_nw2004s/helpdata/en/32/d3e962f7fb11d2b48c006094192fe3/frameset.htm]
Maybe you are looking for
-
Can't open file--"not compatible with this version"
I can not open a photoshop file, although it was saved with the same version. "The file is not compatible with this version" can someone help me. thanks
-
Current date - 1 year in OBIEE
Hi Friends, I have a SR date column in OBIEE. Every day service requests will be submitted. I want to put a filter on the report every time when someone opens the report. I should always pull SR dates between current date and last year current d
-
Hi, In our legacy system, we are using separate gate pass system (using VB6 and MS Access). By using this gate pass system, the materials sent out as Returnable and Non-Returnable type. For this proper approval has also built in the system. All the a
-
Incorrect TIFF tags added to raw files
I have observed this on a CR2 raw file updated by Bridge on Mac. I don't know if the same error occurs on Windows as well. The tags XMP and Photoshop have the type UNDEFINED, but they are supposed to be of BYTE type.
-
I have following setup and ethernet card. But can't setup my internet. sooooo diffcult to do for so simple thing compare to WINDOWS. 1. ethernet card:d-link, compatible to realtek rtl8139 H/W assistant show DMA 1186,1400 installed driver/alias and re