Shortdump @ alv grid program
Hi,
we have a problem with our alv grid program.
Here is the coding:
*Varibalendeklaration
DATA: wa_buero TYPE zd06_buero.
DATA: it_buero LIKE TABLE OF wa_buero.
*Selectierung und Sortierung
SELECT agencynum COUNT( * ) AS zcount
INTO CORRESPONDING FIELDS OF TABLE it_buero
FROM sbook
GROUP BY agencynum
ORDER BY zcount DESCENDING.
*Den Dynpro aufrufen
CALL SCREEN 103.
*& Module STATUS_0103 OUTPUT
* text
MODULE status_0103 OUTPUT.
*Aufrufen des von Hendrik erstellten Funktionsbaustein zum Aufruf des
*Alv Grids
CALL FUNCTION 'ZD06_06_ALV'
EXPORTING
container_name_in = 'CONTAINER_1'
i_structure_name_in = 'ZD06_BUERO'
CHANGING
it_outtab_in = it_buero.
ENDMODULE. " STATUS_103 OUTPUT
We have just create an new DDIC Structure with the points we need.
Our referent can't solve the problem and know I need your help.
Thanks.
Best Regards,
Marcus
Hi,
thank you for answering.
The programm take a travelagencynumber from dbtab sbook. There also is a counter who sort and count the agencynumbers. The programm should tell us, how many books are done with this agency. e.g.: Travelagency 98565 1358 books
ZD06_06_ALV is a function for alv grid. The code for this function is:
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(CONTAINER_NAME_IN) TYPE CHAR30
*" REFERENCE(I_STRUCTURE_NAME_IN)
*" CHANGING
*" REFERENCE(IT_OUTTAB_IN)
DATA: container_r TYPE REF TO cl_gui_custom_container,
grid_r TYPE REF TO cl_gui_alv_grid.
CREATE OBJECT container_r
EXPORTING container_name = container_name_in.
CREATE OBJECT grid_r
EXPORTING i_parent = container_r.
CALL METHOD grid_r->set_table_for_first_display
EXPORTING
i_structure_name = i_structure_name_in
CHANGING
it_outtab = it_outtab_in.
ENDFUNCTION.
The dump reason is
Runtime error: DBIF_RSQL_INVALID_RSQL
We set a breakpoint at the select statement and there is the problem. exactly there is the dump.
Best Regards.
Marcu
Similar Messages
-
Help needed for editable alv grid program
hi,
Can you please tell me how to set a update button in application toolbar of alv griv without suppressing it and how to write the code for that update button so that if I change my editable column data and press the update button my updated data should be stored in my database table.
the code what i wrote is:
TABLES: vbak,vbap.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_final,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
matnr LIKE vbap-matnr,
posnr LIKE vbap-posnr,
END OF t_final.
DATA: i_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0,
wa_final TYPE t_final.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'sales order'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'date'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'material no.'.
fieldcatalog-col_pos = 2.
fieldcatalog-edit = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'POSNR'.
fieldcatalog-seltext_m = 'line item no.'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
INNER JOIN vbap AS b ON avbeln = bvbeln
INTO TABLE i_final WHERE avbeln = bvbeln.
ENDFORM. " DATA_RETRIEVAL
thanks in advance.hi sudhir,
thanks for ur reply.
after seeing the code u send to me i made changes to my program.but still when i click on update button,nothing is happening.can u please suggest me an idea.
TABLES: vbak,vbap.
TYPE-POOLS: slis. "ALV Declarations
TYPES: BEGIN OF t_final,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
matnr LIKE vbap-matnr,
posnr LIKE vbap-posnr,
END OF t_final.
DATA: i_final TYPE STANDARD TABLE OF t_final WITH HEADER LINE,
wa_final TYPE t_final.
*DATA:i_final LIKE vbap OCCURS 0.
*DATA:wa_final LIKE vbap.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'sales order'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'date'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'material no.'.
fieldcatalog-col_pos = 2.
fieldcatalog-edit = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'POSNR'.
fieldcatalog-seltext_m = 'line item no.'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'GUI_STAT'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = it_events
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
INNER JOIN vbap AS b ON avbeln = bvbeln
INTO TABLE i_final WHERE avbeln = bvbeln.
ENDFORM. " DATA_RETRIEVAL
FORM GUI_STAT *
--> RT_EXTAB *
FORM gui_stat USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'UPDATE' EXCLUDING rt_extab.
ENDFORM.
FORM USER_COMMAND *
--> U_COMM *
--> RS_SELFIELD *
FORM user_command USING u_comm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA:selfield TYPE slis_selfield.
CASE u_comm.
WHEN 'UPDATE'.
LOOP AT i_final ."into wa_final.
i_final-matnr = vbap-matnr.
update (vbap) from table i_final.
IF sy-subrc = 0.
MESSAGE s000(0) WITH 'records updated successfully'.
ENDIF.
ENDLOOP.
ENDCASE.
ENDFORM. -
Functionality of queries to be added to custom ALV GRID program
I have got a requirement in which we have created a custom program. Earlier it used to be a query for that. Now the customer wants the same options such as ABC analysis , Graphics , Import to excel, word processing etc., options to be added to the custom program. What I have observed is that these are present in the PF status of the ALV grid display which I am using . Is there any way to trigger the functionality of them directly after displaying the ALV. i.e. If the user wants to see the ABC analysis checks the option and we need to get the ABC analysis which is there in the ALV display
Varun,
I have never tried this but try callig the function LVC_ABC_ANALYSIS and pass the field catalog and the field on which you want to do the analysis, after the SET_TABLE_FOR_FIRST_DISPLAY method or the REUSE* function.
Regards,
Ravi
Note : Please mark the helpful answers -
How to make transfer request for ALV Grid programs in SE38.
Hy All experts.
Pl give me idea of hw to make transfer request ALV list grid programe in SE38.
i made program in Develope SVR and wnt to transfer it to Production SVR.
Thnks
Bhavesh Panchal.Hy
Thnks for reply ,
I made a sales report in se38 development svr. and use local object. i wnt transfer it program in Production.
also i need to create new request in development svr and transfer it to production svr.
Please help me hw to create / select object for Sales document reports.
Also guide me about Object selection with different modules.
Thnks
Bhavesh. -
ALV Grid Dialog Program Variant Problem
Hi Gurus-
Please help!!! I got the following problem-
The ALV dialog screen will have fields with display options as well as a number of fields as input options (editable). Based on user inputs in the input fields and other displayed fields, the user selects "Process"/F8 and it calls the BAPI_MATERIAL_EDIT functions to update material.
The problem is, I want to use variants in the input fields (Maybe REUSE_ALV_VARIANT_F4) when I select a variant it loops through the selected rows and fills out the input fields with the values stored in the variant. I want to use sample ALV grid program such as BCALV*.
The question is, can I use variants in ALV grid dialog program and if yes, how do I define variants to loop through and fill out the values in the input/editable fields on the ALV grid?
Any help will be greatly appreciated! Rep points for sure!
Thanks!!!hi james ,
look at this link u will get an idea .
http://www.sapfans.com/forums/viewtopic.php?f=13&t=229912
http://sgstocks.tripod.com/alvgrid_control.htm
thanks,
Gaurav.
Edited by: gaurav.singh on Apr 20, 2010 7:53 AM -
Can i change the values in total column in ALV Grid program. I had made one report with 3 hirerchy level and for first hirerchy i need different total values just for one column as total values are misleading the users. is it possible to change the value total field in ALV?
hi
make the fields for which u r displaying total as editable.
so when ever u make changes in the column,
see the sample code, i have done a similar program
FORM DATA_CHANGED_MATRIX USING P_ER_DATA_CHANGED TYPE REF TO
CL_ALV_CHANGED_DATA_PROTOCOL P_ONF4 type C E_UCOMM TYPE SY-UCOMM.
DATA: VALUE LIKE YRECORDINGD_QDMS-SCORE.
CLEAR VALUE.
data: begin of wa_tot,
TOTAL_SCORE like yrecordingd_qdms-score,
end of wa_tot.
DATA: BEGIN OF WA_DATA,
SRNO type i,
LOCATION LIKE YCONCERNS_QDMS-LOCATION,
LOC_DESC LIKE YLOCATION_QDMST-LOC_DESC,
TOTAL_SCORE LIKE YRECORDINGD_QDMS-SCORE,
END OF WA_DATA.
FIELD-SYMBOLS: <LS_VALUE1> TYPE ANY,
<LS_VALUE2> TYPE ANY.
DATA: L_VALUE TYPE LVC_VALUE,
ls_mod_cell type lvc_s_modi.
SORT P_ER_DATA_CHANGED->MT_MOD_CELLS BY ROW_ID.
LOOP AT P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LS_MOD_CELL.
CALL METHOD P_ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = LS_MOD_CELL-row_id
I_FIELDNAME = LS_MOD_CELL-fieldname
IMPORTING
E_VALUE = L_VALUE.
VALUE = L_VALUE.
IF VALUE < 100.
READ TABLE <TEMP_TAB> INTO <TEMP_WA> INDEX LS_MOD_CELL-ROW_ID.
MOVE-CORRESPONDING <TEMP_WA> TO WA_TOT.
WA_TOT-TOTAL_SCORE = WA_TOT-TOTAL_SCORE + VALUE.
MOVE-CORRESPONDING WA_TOT TO <TEMP_WA>.
MODIFY <TEMP_TAB> FROM <TEMP_WA> INDEX LS_MOD_CELL-ROW_ID.
CALL METHOD GO_GRID->REFRESH_TABLE_DISPLAY.
ELSE.
CLEAR WA_DATA.
ENDIF.
CLEAR:WA_TOT,VALUE.
ENDLOOP.
ENDFORM. -
Hi,
I have a requirement in ALV:
I need to display a button on the top of alv grid list.Could you please help me out with this.
Thanks,
SandeepHi,
In the below links some ALV GRID programs are there.Once u check this.I think this is very helpful to u.
http://www.abap-tutorials.com/tag/alv-grid/
TO achieve this you should copy the u2018STANDARDu2019 GUI status from program SAPLKKBL using transaction SE90 u2013>Programming SubObjectsu2013> Gui Status.
Steps:
1). Using SE80/SE41 you can copy a GUI status from one program to another. It mentions which one in the FMu2019s help.
2). Create a form named like so:
Code:
Form Set_pf_status
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS u2018ZSTANDARDu2019.
ENDFORM. u201CSet_pf_status
In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called u2018%DELETEu2019.
3). Create the following report:
Code:
Form User_command
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
Detects whether the icon/button for
u2018Return Tag Deletionu2019 has been pressed. If it has then
detect whether any rows have been highlighted and then
set the delete flag.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ u2018%DELETEu2019.
LOOP AT %g00 WHERE mark EQ u2018Xu2019.
ADD 1 TO li_count.
ENDLOOP.
IF li_count GT 0.
gc_delete_flag = u2018Xu2019.
r_ucomm = u2018&F03u2032. u201CBack arraow
ELSE.
MESSAGE W000 WITH u2018Please highlight the rows to be deleted!u2019.
ENDIF.
ENDIF.
ENDFORM. u201CUser_command
As Iu2019ve added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.
Then when you call the ALV function you to specify the following extra details:
Code:
call function u2018REUSE_ALV_GRID_DISPLAYu2019
exporting i_callback_program = gc_repid
I_CALLBACK_PF_STATUS_SET = u2018SET_PF_STATUSu2019
I_CALLBACK_USER_COMMAND = u2018USER_COMMANDu2019
i_grid_title = lc_grid_title
is_layout = lc_layout
it_fieldcat = gt_fieldcat
it_sort = sort
i_save = l_save
is_reprep_id = l_bbs_id
is_variant = l_variant
tables t_outtab = %g00
exceptions program_error = 1
others = 2.
The parameters in capitals are the extra ones that need to be added. -
ALV grid display problem...
can you please help me tell what is missing in this program....
its giving run time error NO_FIELDCATALOG_AVAILABLE.
Also if possible give a good example for ALV grid program
TABLES: bsak.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS : p_bukrs TYPE bsak-bukrs,
p_augdt type bsak-augdt.
thanks!!
points willl be awarded
SELECTION-SCREEN END OF BLOCK B1.
TYPES : BEGIN OF st_bsak ,
bukrs type bsak-bukrs,
lifnr type bsak-lifnr,
augdt type bsak-augdt,
augbl type bsak-augbl,
gjahr type bsak-gjahr,
belnr type bsak-belnr,
budat type bsak-budat,
bldat type bsak-bldat,
hkont type bsak-hkont,
saknr type bsak-saknr,
zlsch type bsak-zlsch,
zlspr type bsak-zlspr,
hbkid type bsak-hbkid,
END OF st_bsak.
DATA it_bsak LIKE bsak OCCURS 0 WITH HEADER LINE.
SELECT bukrs
lifnr
augdt
augbl
gjahr
belnr
budat
bldat
hkont
saknr
zlsch
zlspr
hbkid
FROM bsak
INTO (it_bsak-bukrs,
it_bsak-lifnr,
it_bsak-augdt,
it_bsak-augbl,
it_bsak-gjahr,
it_bsak-belnr,
it_bsak-budat,
it_bsak-bldat,
it_bsak-hkont,
it_bsak-saknr,
it_bsak-zlsch,
it_bsak-zlspr,
it_bsak-hbkid) UP TO 10 ROWS "need to change it to 65000 rows
WHERE bukrs = p_bukrs.
endselect.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'st_bsak'
I_GRID_TITLE = 'SALES ORDER INFO'
TABLES
T_OUTTAB = it_bsak
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.hi,
try this.
*& Report ZALV_DS
REPORT zalv_ds.
TYPE-POOLS:slis.
TABLES:mara,
makt,
marc.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
werks LIKE marc-werks,
rowcolor(4) TYPE c,
cellcolors TYPE lvc_t_scol,
END OF itab.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event.
DATA : st_layout TYPE slis_layout_alv.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cata USING t_fcat.
PERFORM build_event.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_data.
*& Form build_cata
text
-->TEMP_FCAT text
FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
wa_fcat-key = 'X'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
wa_fcat-key = ''.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
ENDFORM. "build_cata
*& Form build_event
text
FORM build_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "build_event
*& Form data_retrieval
text
FORM data_retrieval.
SELECT maramatnr maktmaktx marc~werks INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt ON
maramatnr = maktmatnr
INNER JOIN marc ON
maramatnr = marcmatnr
WHERE mara~matnr IN mat.
SORT itab BY matnr.
DELETE ADJACENT DUPLICATES FROM itab.
ENDFORM. "data_retrieval
*& Form display_data
text
FORM display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_DS'
it_fieldcat = t_fcat
it_events = t_eve
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_data -
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 -
ALV Grid throwing dump in total function
Hi,
My ALV grid program, is working fine in development server, for the total and subtotal function. However, the same program is throwing a short dump in Quality server when we try to get the total.Please help!
Regards,
Anita JeyanHi ,
Please go to ST22 and check what is the reason for error.
Let me know the error.
The reason might be due to some less data size or some data type mismatch.
Regards,
Uma
Edited by: UmaDave on Jun 9, 2010 12:10 PM
Edited by: UmaDave on Jun 9, 2010 12:10 PM -
ALV Grid Subtotal text and Total text display
Hello ABAPGuru's
I want to display the subtotal and Total texts. alv grid program runing on background.
Regards
Sweety(Sri)Hello Neil,
Here I have attached my routines.anyway my confusion. I have wrote the routine subtotal_text .but i am not passing ALV GRID FM.
*& Form eventtab_build
&---- This is used to get the list of events
---- <--RI_EVENTS Internal table
FORM eventtab_build CHANGING ri_events TYPE slis_t_event.
Structure for event handling.
DATA: rs_event TYPE slis_alv_event.
Returns table of possible events for a list type.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ri_events. " Table of events to perform
Read the internal table with the TOP_OF_PAGE and move the
form name to the internal table
READ TABLE ri_events
WITH KEY name = slis_ev_top_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_end_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_form_eop_name TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_subtotal_text INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO rs_event-form. " Formname
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
*&-- Delete all unneeded events:
DELETE ri_events WHERE form IS INITIAL.
ENDFORM. " eventtab_build
*& Form SUBTOTAL_TEXT
text
--> p1 text
<-- p2 text
FORM SUBTOTAL_TEXT USING ep_subtot_line TYPE type_data
e_event_data TYPE slis_subtot_text.
IF NOT e_event_data-criteria IS INITIAL.
E_EVENT_DATA-DISPLAY_TEXT_FOR_SUBTOTAL = 'Account Total'.
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form initialise_layout
Initialise Layout
FORM initialise_layout .
i_layout-colwidth_optimize = c_x.
i_layout-group_change_edit = c_x.
*i_layout-subtotals_text = ' a'.
i_layout-detail_popup = c_x.
i_layout-zebra = c_x.
i_layout-no_vline = 'X'.
i_layout-no_hline = 'X'.
i_layout-totals_text = 'Account Total'.
ENDFORM. " initialise_layout
Call the function module to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_program
i_callback_top_of_page = 'TOP_OF_PAGE' "Top Of Page
is_layout = i_layout
it_fieldcat = i_fieldtab
it_sort = i_sort
it_events = i_events " Events
is_print = i_print
i_default = c_x
i_save = c_save
is_variant = v_variant
TABLES
t_outtab = i_data
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.
Regards
Sweety (Sri) -
Alv grid display with dynamic colums
Hi,
i have an alv grid program in which i have to display the 22 fields as rows and i want to freeze them.i also want to display data for the 22 fields for a variable date range i.e. if you consider i have colums A to Z then i have have this sort of display:
Sel screen:
year(select-options):
alv output:
Year1 Year2 ...........................Year N
A
B
C
D
E
F
Z
Please help me.
i tried using fieldcatalog-row_pos = my row numbers i.e. 1,2....22.
Thanks,
Anand.Hi Anand,
U need to create a dynamic field catalog as well as internal table to handle the year select option and to display the grid.
See the below code creating dynamic field catalogue and internal table. The same requirement like urs.
LOOP AT i_month.
CASE i_month-date+4(2).
WHEN '01'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual JAN-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With JAN-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '02'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual FEB-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With FEB-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '03'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual MAR-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With MAR-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '04'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual APR-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With APR-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '05'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual MAY-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With MAY-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '06'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual JUN-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With JUN-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '07'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual JUL-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With JUL-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '08'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual AUG-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With AUG-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '09'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual SEP-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With SEP-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '10'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual OCT-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With OCT-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '11'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual NOV-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With NOV-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
WHEN '12'.
IF i_month-tag = 'A'.
CONCATENATE 'Actual DEC-'
i_month-date(4)
' Surcharge'
INTO i_month-desc.
ELSE.
CONCATENATE 'With DEC-'
i_month-date(4)
' Pricing'
INTO i_month-desc.
ENDIF.
ENDCASE.
MODIFY i_month.
IF i_month-tag = 'A'.
Field for reference month surcharge
CONCATENATE i_month-tag i_month-date(6) INTO
fs_fldcat-fieldname.
fs_fldcat-datatype = 'CHAR'.
fs_fldcat-intlen = 18.
CONDENSE fs_fldcat-fieldname NO-GAPS.
APPEND fs_fldcat TO i_fldcat.
ELSE.
Fields for Compared month surcharge
CONCATENATE i_month-tag i_month-date(6) INTO
fs_fldcat-fieldname.
fs_fldcat-datatype = 'CHAR'.
fs_fldcat-intlen = 18.
CONDENSE fs_fldcat-fieldname NO-GAPS.
APPEND fs_fldcat TO i_fldcat.
Field for indicator
CONCATENATE 'I' i_month-date(6) INTO fs_fldcat-fieldname.
fs_fldcat-datatype = 'CHAR'.
fs_fldcat-intlen = 1.
CONDENSE fs_fldcat-fieldname NO-GAPS.
APPEND fs_fldcat TO i_fldcat.
Field for difference surcharge
CONCATENATE 'D' i_month-date(6) INTO fs_fldcat-fieldname.
fs_fldcat-datatype = 'CHAR'.
fs_fldcat-intlen = '18'.
CONDENSE fs_fldcat-fieldname NO-GAPS.
APPEND fs_fldcat TO i_fldcat.
ENDIF. " IF i_month-tag = 'A'.
ENDLOOP. " LOOP AT i_month.
ENDIF. " IF NOT i_month[] IS INITIAL.
Method to create dynamic table.
IF NOT i_fldcat[] IS INITIAL.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fldcat[]
IMPORTING
ep_table = i_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF. " IF sy-subrc <> 0.
ASSIGN i_table->* TO <i_output>.
CREATE DATA fs_line LIKE LINE OF <i_output>.
ASSIGN fs_line->* TO <fs_output>.
ENDIF. " IF NOT i_fldcat[] IS INITIAL. -
Need help in ALV grid editable cells
Hi,
I have created a ALV Grid program in which i made certain cells as editable cells.Now my question is if suppose i have 2 rows in my output then if i change the 2nd rows some cells, then some calculation has to perform till this it is fine but nw i want to modify the 3rd rows some cells as per the changes in 2nd row.
How to do it with ALV oops concepts.
I have refered BCALV_EDIT_02 and BCALV_EDIT_03 these std programs.
Thanks & Regards
MadhuriHello Madhuri
I recommend to do any post-processing of the changed data OUTSIDE your event handler method (HANDLE_DATA_CHANGED).
Within the event handler method do all required validations and the trigger PAI by calling method CL_GUI_CFW=>SET_NEW_OK_CODE (for an example refer to my sample report ZUS_SDN_TWO_ALV_GRIDS in alv)
Now at PAI of your screen you can do any kind of post-processing, calculation, etc. within the itab used for the ALV list.
Regards
Uwe -
EDIT limit of a column in ALV grid
I want to have an editable column in my ALV grid program.
i am using below code while creating field catalog.
gwa_fieldcat-tabname = text-02. "'GIT_BOM_REP'.
gwa_fieldcat-fieldname = COMMENT. "'Comment'.
gwa_fieldcat-seltext_l = text-058. "'Comment'.
gwa_fieldcat-edit = gc_x.
APPEND gwa_fieldcat TO git_fieldcat.
CLEAR gwa_fieldcat.
I am able to write in the output, but the problem is i can write only upto 10 characters.
Field length for this editable column is 200 and type is C.
Please suggest.
Thanks in Advance,
James.Thanks for your reply.....
I am using this code also:
*Layout to set width.
gwa_layout-colwidth_optimize = gc_x.
gwa_layout-box_fieldname = 'BOX'.
gwa_layout-box_tabname = 'GIT_BOM_REP'.
GIT_BOM_REP-COMMENT length is 200 and typ is C.
this is the 20th column in my ALV report. and i am using REUSE_ALV_GRID_DISPLAY FM.
Regards,
James -
SET parameter on ALV grid with container
Hi,
I need to SET PARAMETER ID to acess the transaction CJ40, in an ALV grid program with screen container for the ALV.
I'm using a method handle_double_click to select a line and pass the value to the parameter ID like this:
METHOD handle_double_click.
DATA: l_project TYPE prps-pspnr.
READ TABLE it_out INDEX e_row-index INTO wa_out.
CHECK sy-subrc = 0.
WRITE wa_out-pspnr TO l_project.
SET PARAMETER ID 'PRD' FIELD l_project.
CALL TRANSACTION 'CJ40' AND SKIP FIRST SCREEN.
CLEAR wa_out-pspnr.
ENDMETHOD. "handle_double_click
But this doesn't work. No value at all is passed to the transaction.
What is missing?
Thanks in advance,
RuiParameter ID PSP is attached to the Project Definition field.
SET PARAMETER ID 'PSP' FIELD l_project.
CALL TRANSACTION 'CJ40' AND SKIP FIRST SCREEN.
Regards,
Naimesh Patel
Maybe you are looking for
-
Multiple email accounts on Mail issue
Hi there, just wondering if anyone cn help with my Mail email issue. I have scoured the net but can't find anyone with the exact same or similar issue. For simplicitys sake, letes say I have 3 email accounts, [email protected], [email protected] and
-
I moved to this house in 2006 and was with BT for phone and broadband. I had all sorts of problems and after several engineer visits and a few replacement routers, I switched to Talktalk. Since then I have had intermittent service problems, with DSL
-
Sharing objects between different tabs on a JTabbedPane
Does anyone know how to share objects on different tabs of a JTabbedPane? I.e., I want the same buttons/corporate logo to appear on each tab in the same location, and thus the same functionality, locations, look, etc... Currently, if I invoke the add
-
Schedule Line "CS" for Third Party
Hi, Please guide me which triggers in creating PR (Purchase Requisition) in the case of third party order processing. The following fields: Order type "NB" Item Category "5" for Third party Acct. Assgt Cat. X for All aux acct. assgts. and in the
-
I have had my daughter's eMac in repair three times now and am my wit's end. Every time I turn it on, it works for a while, and then when I cold boot, the power button will not turn the computer back on. And then we go back to the Apple store again f