OO ALV Issue
Hi All,
I have four buttons on the ALV toolbar of screen 100 and I am calling screen 200 when the user clicks on them. Each button will display different data. And every time when you click on the button I am refreshing the Outtab and Field Catalog.
The Data got filled correclty in the Outtab everytime you click on any of the four ALV toolbar buttons.
The data is displayed well and correct when the report is executed for the first time in a popup screen 200.
Now when I click on Back to Overview button on the Popup . The screen 100 data is displayed again. And now I click on the Second button from the ALV toolbar the data got filled correctly in OUTTAB. But not reflecting in the popup ALV 200 Instead it is displaying previous button's data which we clicked.
If I completely come back to Selection screen of the report and execute the same step I am getting correct data displayed.
Please help.
Even though I destroyed the ALV completely tthe output is Not changed.
Please find my code below
Form To Display Data for Statistics Button
Perform DISPLAY_STATISTICS Using TB_DISPLAY.
FORM DISPLAY_STATISTICS USING TB_DISPLAY Type Any.
Clear : G_CONT_STAT. -
> Every Time the code goes into If Part only.
IF G_CONT_STAT is initial.
Create a custom container control for our ALV Control
CREATE OBJECT G_CONT_STAT
EXPORTING
container_name = G_CONT_ON_DIALOG_STAT
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
Creating ALV Grid instance
CREATE OBJECT G_GRID_STAT
EXPORTING
i_parent = G_CONT_STAT
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5 .
IF sy-subrc <> 0.
Exception handling
ENDIF.
Display Data
CALL METHOD G_GRID_STAT->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_SAVE = 'X'
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_VARIANT = GS_VARIANT
CHANGING
IT_OUTTAB = TB_DISPLAY
IT_FIELDCATALOG = TB_FCAT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
Refresh Table Display
CALL METHOD G_GRID_STAT->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDFORM. " DISPLAY_STATISTICS
Edited by: VENKAT SESHA on Sep 20, 2011 11:57 AM
Similar Messages
-
Numerous ALV Issues - Saved Initial View shows table with no columns
Saved a personal View and made it initial. View was saved by Sorting and FIltering certain columns. When I retrive the view, it shows the tabke has no columns at all.
This is in addition to the Problem in getting DropdownbyKey inside a ALV Table Cell in DropdownByKey inside ALV Table - Problem with Value set
Regards,You have forgotten to set a cell variant. I had the same with setting a ProgressIndicator cell-editor to a table column as default editor. This causes the column to be hidden on the table while it did show up in the settings dialog. I removed the set_editor( lr_progressindicator) and created a cell variant instead with this lr_progressindicator. You then need to add this cell variant to your column. By default it will select the standard viewtext-cell-editor (which can only be textview and inputfield, like when you create a table yourself in a view), but if you use a cell variant, it will display the required cell editor if you set it (last line of the code).
<b>In your case, replace lr_progressindicator by your ref_dropdownkey.</b>
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lr_column_header TYPE REF TO cl_salv_wd_column_header,
lr_cellvar TYPE REF TO cl_salv_wd_cv_standard,
l_cellvar TYPE string,
lr_progress_indicator TYPE REF TO cl_salv_wd_uie_progr_indicator.
lr_column_settings ?= wd_this->mr_table.
lr_column = lr_column_settings->get_column( 'STATUSBAR' ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( 'Completed' ).
CREATE OBJECT lr_cellvar.
l_cellvar = 'CV_SB'.
lr_cellvar->set_key( l_cellvar ).
CREATE OBJECT lr_progress_indicator.
lr_progress_indicator->set_percent_value_fieldname( 'STATUSBAR' ).
lr_progress_indicator->set_tooltip( 'completed' ).
lr_cellvar->set_editor( lr_progress_indicator ).
lr_column->add_cell_variant( lr_cellvar ).
lr_column->set_selected_cell_variant( l_cellvar ).
I hope this will solve your issues. -
Rows missing in ALV output compared to internal table (was "ALV issue")
Hi guys,
I am getting an ALV for 70 rows whereas the internal table I am passing has 120 rows.
Any idea why I could be facing this issue.Has anyone ever faced something similar?
Thanks,
Chirantan
Moderator message: please use more descriptive subject lines for your posts.
Edited by: Thomas Zloch on May 9, 2011 9:51 AMBY default, maximum number of coulmns displayed in ALV is 90.
You can increase it by setting the parameter NO_OUT as initial for the remaining fields in their field catalog.
Please check below sample code:
"Build Field catalog using structure of QALS
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'QALS'
CHANGING
ct_fieldcat = g_t_fcat " Internal table contains more than 90 fields
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
"Only first 90 fields will be displayed in output. So, set NO_OUT as initial for remaining fields.
LOOP AT g_t_fcat INTO g_r_fcat WHERE no_out = 'X'.
g_r_fcat-no_out = ''. " Set NO_OUT as initial
MODIFY g_t_fcat FROM g_r_fcat INDEX sy-tabix TRANSPORTING no_out.
ENDLOOP. -
WD ALV Issue after the upgrade
Hi,
We have upgraded the SAP ECC 6.0 systems basis component SAP BASIS 700 from support pack 10 to 20.
After the upgrade webdynpro ABAP ALV table rows are not getting selected when we click on the rows, But it is getting selected when we we use CNTRL+Click.
I would really appreciate if you can provide me a note or route cause for this issue.
Thanks
BasavaHi Jawahar,
Below is my suggestion regarding your query:
Edit existing Job server and update the details regarding Local reporsitory and save it.
Now try to map the same job server in scheduled jobs and check it was working or not
Or Else
Create new Job server and assign it to local repository.
In this case you have to update your all real time & batch Job configuration.
Thanks,
Daya -
Editable ALV issue: When Delete/Modify a row, ztable doesnt reflect changes
Greeting Fellow Abapers,.
I have been running into an issue that I need some advice on. I am allowing users to edit a Ztable via ALV. When the quantity field is updated everything is fine. However, when the field "lic_plate" is edited the code appends another row into the Ztable instead of modifying it. Also, when the delete row functionality of the grid is used the row is not deleted from the Ztable.
Here is the ztable structure. The fields I allow to be edited are in BOLD...
ZPALLET-VBELN
ZPALLET-MATNR
ZPALLET-LINE_NUM
ZPALLET-LIC_PLATE
ZPALLET-LOT_NUMBER
ZPALLET-PAL_TYPE
ZPALLET-MAN_DATE
ZPALLET-QUANTITY
ZPALLET-PROC_DATE
Here is the source code that the APPEND is taking place...
FORM save_database .
Getting the selected rows index*
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = i_selected_rows.
Through the index capturing the values of selected rows*
LOOP AT i_selected_rows INTO w_selected_rows.
READ TABLE itab INTO wa INDEX w_selected_rows-index.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa TO w_modified.
APPEND w_modified TO i_modified.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
MODIFY zpallet FROM TABLE i_modified.
ENDIF.
ENDFORM.
Please help. I am in your debt.
...as always, points will be awarded.
Best,
DanHello Dan
When you are using an editable ALV for table maintenance you have to take care that the users
- cannot edit the key fields of existing DB records and
- every new record (row) does not match any existing record (i.e. has identical key field values)
Instead of relying on selected rows for the DB update I would recommend to store a "PBO image" of your data and compare this with the "PAI image" of the data as soon as the user pushes the SAVE button.
Example:
DATA:
gt_outtab_pbo TYPE < your table type>, " PBO image
gt_outtab TYPE < your table type>. " PAI image
" 1. Select data from DB table and store in both itabs:
SELECT * ... INTO TABLE gt_outtab.
gt_outtab_pbo = gt_outtab.
" 2. Display editable ALV list -> user modifies gt_outtab
" 3. SAVE function requested
" ... compare gt_outtab vs. gt_outtab_pbo
" .... INSERT, UPDATE, or DELETE DB records
" Finally set:
gt_outtab_pbo = gt_outtab.
" 2. User continues with editing
In order to compare PBO vs. PAI data you may have a look at my sample coding:
[Comparing Two Internal Tables - A Generic Approach|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/comparing%2btwo%2binternal%2btables%2b-%2ba%2bgeneric%2bapproach]
Regards,
Uwe -
ALV: Issue with double click event after sorting the ALV
Hello Experts,
I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
There is one more paramter in HANDLE_DOUBLE_CLICK for row id. It is coming blank in debugging . what is the purpose of this parameter and how i can make use of it ?
Regards
VivekHi,
I am Posting The Code Which Uses Double Click Event.
And This Code will provide the total information to you.
REPORT ZALVGRID_PG.
TABLES: SSCRFIELDS.
DATA: V_BELNR TYPE RBKP-BELNR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: IRNO FOR V_BELNR.
PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA: WA TYPE ZALVGRID_DISPLAY,
ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
TYPE-POOLS: SLIS,SDYDO.
DATA: L_LOGO TYPE SDYDO_VALUE,
L_LIST TYPE SLIS_T_LISTHEADER.
END-OF-SELECTION.
CLASS CL_LC DEFINITION.
PUBLIC SECTION.
METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
ENDCLASS.
CLASS CL_LC IMPLEMENTATION.
METHOD DC.
DATA: WA1 TYPE ZALVGRID_DISPLAY.
READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
BREAK-POINT.
SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
CALL TRANSACTION 'FB02'.
ENDMETHOD. "DC
ENDCLASS.
DATA: OBJ_CL TYPE REF TO CL_LC.
START-OF-SELECTION.
PERFORM SELECT_DATA.
IF SY-SUBRC = 0.
CALL SCREEN 100.
ELSE.
MESSAGE E000(0) WITH 'DATA NOT FOUND'.
ENDIF.
INCLUDE ZALVGRID_PG_STATUS_0100O01.
INCLUDE ZALVGRID_PG_LOGOSUBF01.
INCLUDE ZALVGRID_PG_SELECT_DATAF01.
INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'AB'.
* SET TITLEBAR 'xxx'.
IF IDENTITY IS INITIAL.
CREATE OBJECT IDENTITY
EXPORTING
CONTAINER_NAME = 'ALVCONTROL'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = IDENTITY.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'ZALVGRID_DISPLAY'
CHANGING
IT_OUTTAB = ITAB.
CREATE OBJECT OBJ_CL.
SET HANDLER OBJ_CL->DC FOR GRID.
ENDIF.
IF L_IDENTITY IS INITIAL.
CREATE OBJECT L_IDENTITY
EXPORTING
CONTAINER_NAME = 'LOGO'.
CREATE OBJECT L_TREE
EXPORTING
I_PARENT = L_IDENTITY.
PERFORM LOGOSUB USING L_LOGO.
CALL METHOD L_TREE->CREATE_REPORT_HEADER
EXPORTING
IT_LIST_COMMENTARY = L_LIST
I_LOGO = L_LOGO.
ENDIF .
ENDMODULE. " STATUS_0100 OUTPUT
***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
FORM LOGOSUB USING P_L_LOGO.
P_L_LOGO = 'ERPLOGO'.
ENDFORM. " LOGOSUB
***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
FORM SELECT_DATA .
SELECT RBKP~BELNR
RBKP~BLDAT
RSEG~BUZEI
RSEG~MATNR
INTO TABLE ITAB
FROM RBKP INNER JOIN RSEG
ON RBKP~BELNR = RSEG~BELNR
WHERE RBKP~BELNR IN IRNO
AND RBKP~GJAHR = P_GJAHR.
ENDFORM. " SELECT_DATA
***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
EXIT.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Warm Regards,
PavanKumar.G
Edited by: pavankumar.g on Jan 19, 2012 5:30 AM -
ALV issue: when save list using Local File command will get run time error!
help!!!!
report list using ALV method when to save this list using Local File.
i will get GETWA_NOT_ASSIGNED run time error information.
how resolve it?
source code :
REPORT ZIFT0103.
TABLES : MARA,MARC,CDHDR,CDPOS,MAKT.
******DEVK909212****************
****利用工厂来区分不同的SERVER的FTP ADDRESS ,user ,PASSWORD
DATA: FTP_WERKS LIKE MARC-WERKS.
********定义一个RANGE用来抓取MARC的信息
RANGES:R_MATNR FOR MARA-MATNR OCCURS 0.
********定义一个INTERNAL TABLE 来抓取MARC 的信息
DATA:BEGIN OF IT_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
FLAG_UI TYPE C,
END OF IT_MARC.
*******定义存放北京的数据的变量
DATA : BEGIN OF FTP_BEIJING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_BEIJING .
******定义福清的数据变量
DATA : BEGIN OF FTP_FUQING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_FUQING .
*******DEVK909212*****************
DATA : BEGIN OF FTP_ITEMDOC1 OCCURS 0 ,
MATNR(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC1 .
DATA : BEGIN OF FTP_ITEMDOC OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC .
DATA: WA_ZMSGTA TYPE ZMSGTA ,
l_ersda like MARA-ERSDA .
***********DEVK909553********************
****用来决定执行FTP还是显示LIST**********
DATA:g_tcode_flag.
***********DEVK909553********************
Error message process ******************************
DEFINE EXPLAIN_MSG.
break soe_richard.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = &1 "SY-MSGID
NUMBER = &2 "SY-MSGNO
LANGUAGE = SY-LANGU
TEXTFORMAT = &3
LINKPATTERN =
MESSAGE_V1 = &4 "SY-MSGV1
MESSAGE_V2 = &5 "SY-MSGV2
MESSAGE_V3 = &6 "SY-MSGV3
MESSAGE_V4 = &7 "SY-MSGV4
IMPORTING
MESSAGE = &8 "WA_ZMSGTA-MSE1
RETURN =
TABLES
TEXT =
END-OF-DEFINITION.
DEFINE ERROR_MSG_UPDATA.
CALL FUNCTION 'ZINSERT_MSG' "IN UPDATE TASK
EXPORTING
XZMSGTA = &1 "WA_ZMSGTA
EXCEPTIONS
UPDATE_ERROR = 1
OTHERS = 2.
END-OF-DEFINITION.
IF SY-TCODE = 'ZIFT103' .
g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = '请耐心等候,系统正在抓数据'.
ENDIF.
l_ersda = sy-datum - 1 . "取前一天产生的物料号码。
DATA:BEGIN OF it_change OCCURS 0,
OBJECTID TYPE CDHDR-OBJECTID,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
TABKEY TYPE CDPOS-TABKEY,
END OF it_change.
DATA:BEGIN OF it_cDhdr OCCURS 0,
OBJECTID type CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
END OF it_cdhdr.
DATA:search_len TYPE I.
DATA:BEGIN of it_insert OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
END OF it_insert.
DATA:BEGIN OF it_MAKT OCCURS 0,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF it_makt.
DATA IT_MARA TYPE TABLE OF MARA WITH HEADER LINE.
DATA:BEGIN OF IT_OUT OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MATKL TYPE MARA-MATKL,
MAKTX TYPE MAKT-MAKTX,
PSTAT TYPE MARA-PSTAT,
BRGEW TYPE MARA-BRGEW,
NTGEW TYPE MARA-NTGEW,
GEWEI TYPE MARA-GEWEI,
FERTH TYPE MARA-FERTH,
KZUMW TYPE MARA-KZUMW,
ERNAM TYPE MARA-ERNAM,
ERSDA TYPE MARA-ERSDA,
END OF IT_OUT.
*-- DECLARE DATA FOR ALV
TYPE-POOLS: slis.
DATA : g_variant LIKE disvariant,
g_save(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE, "
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
gs_print TYPE slis_print_alv,
gs_layout TYPE slis_layout_alv .
******只能抓出系统有做更改的数据***************
******而第一次INSERT MARA的数据抓不出来********
START-OF-SELECTION.
SELECT AOBJECTID AUSERNAME AUDATE BTABKEY
INTO TABLE it_change
FROM ( CDPOS AS B INNER JOIN CDHDR AS A ON
AOBJECTCLAS = BOBJECTCLAS AND
AOBJECTID = BOBJECTID AND
ACHANGENR = BCHANGENR )
WHERE A~OBJECTCLAS = 'MATERIAL'
AND A~UDATE = l_ersda
AND B~TABNAME = 'MARC'
AND B~CHNGIND = 'I'.
LOOP AT it_change.
search_len = STRLEN( it_change-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = it_change-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = it_change-objectid+0(18).
IT_MARC-USERNAME = it_change-username.
IT_MARC-UDATE = It_change-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
****CDPOS is Cluster TABLE 所以没有办法用INNER JOIN******
SELECT OBJECTID CHANGENR USERNAME UDATE
INTO TABLE it_cdhdr
FROM CDHDR
WHERE OBJECTCLAS = 'MATERIAL'
AND UDATE = l_ersda.
AND TCODE = 'MM02'.
LOOP AT IT_cdhdr.
SELECT * FROM CDPOS
WHERE OBJECTCLAS = 'MATERIAL'
AND OBJECTID = IT_CDHDR-OBJECTID
AND CHANGENR = IT_CDHDR-CHANGENR
AND TABNAME = 'MARC'
AND CHNGIND = 'I'.
search_len = STRLEN( CDPOS-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = CDPOS-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = IT_cdhdr-objectid+0(18).
IT_MARC-USERNAME = IT_cdhdr-username.
IT_MARC-UDATE = IT_cdhdr-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
CLEAR IT_MARC.
ENDSELECT.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 20
TEXT = '处理好当天CHANGE的数据'.
ENDIF.
*******抓当天做了INSERT的数据*************
*******不需要***********************
SELECT BMATNR BWERKS INTO TABLE IT_INSERT
FROM MARC AS B JOIN MARA AS A
ON AMATNR = BMATNR
WHERE A~ERSDA = l_ersda.
LOOP AT IT_INSERT.
IT_MARC-MATNR = IT_INSERT-MATNR.
IT_MARC-WERKS = IT_INSERT-WERKS.
IT_MARC-FLAG_UI = 'I'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 40
TEXT = '处理好当天INSERT的数据'.
ENDIF.
IF g_tcode_flag = 'L'.
PERFORM get_MAKTX.
PERFORM get_mara.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 100
TEXT = '处理好数据,并开始显示数据'.
PERFORM do_data.
PERFORM display_alv.
ELSE.
PERFORM get_MAKTX.
PERFORM do_ftp.
ENDIF.
*& Form get_marktx
text
FORM get_maktx.
SELECT MATNR MAKTX INTO TABLE IT_MAKT FROM MAKT
WHERE MATNR IN R_MATNR AND SPRAS = '1'.
ENDFORM. "get_marktx
*& Form get_mara
text
FORM get_mara.
SELECT * INTO TABLE it_mara FROM MARA
WHERE MATNR IN R_MATNR.
ENDFORM. "get_mara
*& Form do_data
text
FORM do_data.
SORT IT_MARC BY MATNR WERKS.
DELETE ADJACENT DUPLICATES FROM IT_MARC COMPARING MATNR WERKS.
LOOP AT IT_MARC.
CLEAR IT_MAKT.
CLEAR IT_MARA.
READ TABLE IT_MAKT WITH KEY MATNR = IT_MARC-MATNR.
READ TABLE IT_MARA WITH KEY MATNR = IT_MARC-MATNR.
MOVE-CORRESPONDING IT_MARA TO IT_OUT.
IT_OUT-MAKTX = IT_MAKT-MAKTX.
IT_OUT-WERKS = IT_MARC-WERKS.
IF IT_MARC-FLAG_UI = 'U'.
IT_OUT-ERNAM = IT_MARC-USERNAME.
ENDIF.
APPEND IT_OUT.
CLEAR IT_OUT.
ENDLOOP.
ENDFORM. "do_data
*SELECT AMATNR BMAKTX INTO CORRESPONDING
*FIELDS OF FTP_ITEMDOC1 FROM MARA AS A JOIN MAKT AS B
*ON AMATNR = BMATNR WHERE A~ERSDA = l_ersda
*AND B~SPRAS = '1' . "代表为中文说明。
APPEND FTP_ITEMDOC1.
*******DEVK909212****************
*******添加RANGE*****************
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = FTP_ITEMDOC1-MATNR.
APPEND R_MATNR.
CLEAR FTP_ITEMDOC1.
*******DEVK909212****************
*ENDSELECT.
*******DEVK909212****************
****get WERKS information from MARC*******
*SELECT MATNR WERKS INTO TABLE IT_MARC
*FROM MARC
*WHERE MATNR IN R_MATNR.
*******DEVK909212****************
******DEVK909212****************
**MARK**************************
*LOOP AT FTP_ITEMDOC1 .
MOVE : FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_ITEMDOC-MAKTX.
APPEND FTP_ITEMDOC.
CLEAR FTP_ITEMDOC.
*ENDLOOP.
******DEVK909212****************
******DEVK909212***********************************
**根据IT_MARC中信息,往北京和福清的TABLE写数据*****
FORM do_ftp.
LOOP AT IT_MARC.
***福清的
IF IT_MARC-WERKS = '1010' OR IT_MARC-WERKS = '1020'
OR IT_MARC-WERKS = '1023' .
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_FUQING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_FUQING-MATNR,
IT_MARC-MATNR TO FTP_FUQING-MATNR1,
IT_MAKT-MAKTX TO FTP_FUQING-MAKTX.
APPEND FTP_FUQING.
CLEAR FTP_FUQING.
ENDIF.
***北京的
IF IT_MARC-WERKS = '1041' OR IT_MARC-WERKS = '1042'.
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_BEIJING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_BEIJING-MATNR,
IT_MARC-MATNR TO FTP_BEIJING-MATNR1,
IT_MAKT-MAKTX TO FTP_BEIJING-MAKTX.
APPEND FTP_BEIJING.
CLEAR FTP_BEIJING.
ENDIF.
ENDLOOP.
****清楚重复的数据**********
SORT FTP_FUQING.
DELETE ADJACENT DUPLICATES FROM FTP_FUQING.
SORT FTP_BEIJING.
DELETE ADJACENT DUPLICATES FROM FTP_BEIJING.
***传送数据********
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_FUQING[].
FTP_WERKS = '1010'.
PERFORM ftp_work.
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_BEIJING[].
FTP_WERKS = '1041'.
PERFORM ftp_work.
******DEVK909212***********************************
ENDFORM. "do_ftp
*& Form ftp_work
把以前FTP的工作做一个FORM
*******DEVK909212**************************
FORM ftp_work.
*******DEVK909212**************************
CHECK FTP_ITEMDOC[] IS NOT INITIAL.
FTP function *****************************************************
DATA : HDL TYPE I,
L_SLEN TYPE I ,
ERROR,
KEY TYPE I VALUE 26101957,
DEST TYPE RFCDES-RFCDEST VALUE 'SAPFTPA'.
DATA: FTP_RESULT TYPE TABLE OF TEXT.
DATA: P_FILE TYPE RLGRAP-FILENAME.
DATA: L_USER(16) TYPE C VALUE 'SFIS',
L_PWD(16) TYPE C VALUE 'SFIS',
L_HOST(16) TYPE C VALUE '172.16.31.17'.
*******DEVK909212**************************
*****根据不同的工厂来抓FTP的信息
CALL FUNCTION 'Z_FTP_SFIS'
EXPORTING
BLART = 'S'
WERKS = FTP_WERKS
IMPORTING
HOST = L_HOST
USER1 = L_USER
PASS1 = L_PWD.
*******DEVK909212**************************
CONCATENATE l_ersda '.KP' INTO P_FILE.
SET EXTENDED CHECK OFF.
ERROR = 0.
CHECK HDL IS INITIAL.
Connect to server
L_SLEN = STRLEN( L_PWD ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = L_PWD
SOURCELEN = L_SLEN
KEY = KEY
IMPORTING
DESTINATION = L_PWD.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Connect to FTP Server'.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = L_USER
PASSWORD = L_PWD
HOST = L_HOST
RFC_DESTINATION = DEST
IMPORTING
HANDLE = HDL
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = HDL
COMMAND = 'ascii'
TABLES
DATA = FTP_RESULT
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = HDL
FNAME = P_FILE
CHARACTER_MODE = 'X'
TABLES
TEXT = FTP_ITEMDOC
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
*******DEVK909212**************************
*******CLOSE FTP******************
CHECK NOT HDL IS INITIAL.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = HDL.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
DESTINATION = DEST
EXCEPTIONS
OTHERS = 1.
CLEAR HDL.
ENDFORM. "ftp_work
*******DEVK909212**************************
FORM DISPLAY_ALV .
*-- PREPARE ALV DATA
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*-- LAYOUT SETTING
PERFORM PREPARE_ALV_FIELD USING GT_FIELDCAT[].
*-- ALV DISPLAY
PERFORM CALL_REUSE_ALV_GRID_DISPLAY.
ENDFORM. " display_alv
*& Form eventtab_build
text
-->P_GT_EVENTS[] text
FORM EVENTTAB_BUILD USING PT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = PT_EVENTS.
READ TABLE PT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
LS_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY PT_EVENTS FROM LS_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " eventtab_build
*& Form comment_build
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM COMMENT_BUILD USING PT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
L_DATE(30),
l_v_BWKEY like T001W-BWKEY, "Valuation area
l_v_BUKRS like T001K-BUKRS. "Firm/Company
Listenerschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
select single BWKEY
into l_v_BWKEY
from t001w
where WERKS IN s_WERKS.
select single BUKRS
into l_v_BUKRS
from t001k
where BWKEY = l_v_BWKEY.
SELECT SINGLE butxt INTO LS_LINE-INFO
FROM t001
WHERE bukrs = l_v_BUKRS.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '报表名称:'.
LS_LINE-INFO = SY-TITLE.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印日期:'.
WRITE SY-DATUM TO LS_LINE-INFO.
ls_line-info = sy-datum.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印時間:'.
WRITE SY-UZEIT TO LS_LINE-INFO.
ls_line-info = sy-uzeit.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '使用者:'.
LS_LINE-INFO = SY-UNAME.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
ENDFORM. " comment_build
*& Form prepare_alv_field
text
-->P_GT_FIELDCAT[] text
FORM PREPARE_ALV_FIELD USING P_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_LINE TYPE SLIS_FIELDCAT_ALV.
*-- DEFINE MARCO
DEFINE APPEND_ALV_FIELD.
CLEAR LS_LINE.
LS_LINE-FIELDNAME = &1.
LS_LINE-TABNAME = &2.
LS_LINE-REPTEXT_DDIC = &3.
LS_LINE-SELTEXT_L = &3.
LS_LINE-SELTEXT_M = &3.
LS_LINE-SELTEXT_S = &3.
LS_LINE-QFIELDNAME = &4.
LS_LINE-QTABNAME = &5.
LS_LINE-NO_OUT = &6.
LS_LINE-NO_ZERO = &7.
LS_LINE-OUTPUTLEN = &8.
APPEND LS_LINE TO P_FIELDCAT.
END-OF-DEFINITION.
APPEND_ALV_FIELD: 'MATNR' 'IT_OUT' '料号'
'O' 'X' ''.
APPEND_ALV_FIELD: 'WERKS' 'IT_OUT' '工厂'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MTART' 'IT_OUT' 'MTyp'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MEINS' 'IT_OUT' 'BUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKL' 'IT_OUT' '物料组\分群码'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKX' 'IT_OUT' '物料描述'
'O' 'X' ''.
APPEND_ALV_FIELD: 'PSTAT' 'IT_OUT' '维护状态'
'O' 'X' ''.
APPEND_ALV_FIELD: 'BRGEW' 'IT_OUT' '毛重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'NTGEW' 'IT_OUT' '净重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'GEWEI' 'IT_OUT' 'WUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'FERTH' 'IT_OUT' '对外机种名'
'O' 'X' ''.
APPEND_ALV_FIELD: 'KZUMW' 'IT_OUT' '高关税标识'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERNAM' 'IT_OUT' '创建者'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERSDA' 'IT_OUT' '创建日期'
'O' 'X' ''.
ENDFORM. " prepare_alv_field
*& Form call_reuse_alv_grid_display
text
--> p1 text
<-- p2 text
FORM CALL_REUSE_ALV_GRID_DISPLAY .
gs_layout-f2code = 'DISPLAY'.
gs_print-no_print_listinfos = 'X'.
gs_layout-colwidth_optimize = 'X'. "列宽度自动根据内容优化
gs_layout-f2code = '&ETA'. "double check弹出详细信息
gs_layout-zebra = 'X'. "清单条纹显示
gs_layout-no_vline = ''. "是否显示列间隔线
gs_layout-box_fieldname = ''. "是否显示checkbox
gs_layout-confirmation_prompt = ''. "推出清单是否提示
gs_layout-detail_titlebar = '详细信息'."详细清单的标题
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PF_STATUS_SET = 'ALV_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'ALV_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = GT_LIST_TOP_OF_PAGE[]
IT_FIELDCAT = GT_FIELDCAT[]
IT_EVENTS = GT_EVENTS[]
I_STRUCTURE_NAME = 'IT_OUT'
I_SAVE = 'A'
IS_LAYOUT = GS_LAYOUT
IS_PRINT = GS_PRINT
TABLES
T_OUTTAB = IT_OUT
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. " call_reuse_alv_grid_display
*& Form PREPARE_ALV_FIELD
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "TOP_OF_PAGEHi,
Please check your field catalog and refer field names once again.
Check spelling, or Check strucutre properly.
There are something wrong in your catalog definition
aRs. -
Hi,
I have developed a program to create records in the custom Z table. In this utility program i show the data on an ALV to the user, once the user confirms the data an d clicks on 'SAVE' the data gets updated to the table successfully. Now if the user goes back to the selection screen and tries to create a new record, the new data which should be displayed on the ALV for user to confirm and save is not displaying the new records instead it shows the old record which i last updated into the database. I checked in the debug mode the data in the internal table before displaying to ALV is the new one but as soon as i call the Set_table_for first display method it shows me the old data on the ALV.
is it because the container is not getiing cleared, although i am call the method container->free.
Plz HelpUse something like :
IF go_container IS NOT BOUND.
CREATE OBJECT go_container
EXPORTING
container_name = 'CUSTOM_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_container.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = x_save
is_layout = gs_layout
CHANGING
it_outtab = itab
it_fieldcatalog = gt_fieldcat.
ELSE.
go_grid_conceptos->refresh_table_display( ).
ENDIF. -
ALV issue - capturing user changes in editable fields using custom button?
Hi,
I created a custom button in ALV tool bar. And also in my ALV grid I have couple of fields Editable option. User can change values for these 2 fields.
My question is -
After changing values for these editable fields(more than 1 record) , user will click on custom button and then I have to update all the user changed values in to my internal table(lt_tab) and then I have to process logic.
Problem is when user click on Custom button in ALV tool bar it is not having the changed values in lt_tab table.
Only when user clicks some thing on ALV grid records or fields then it is getting all the changed values in to lt_tab.
Can any one tell me how I can get changed values when user clicks on custom button?
1. Can we place custom button in ALV Grid? instead of ALV tool bar?
or
How I can capture user changes when they click on custom button?
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
TABLES
T_OUTTAB = lt_tab
Please check this logic-
CASE r_ucomm.
WHEN '&IC1'.
- It_tab having all changed field values
WHEN 'custom button'.
lt_tab - not having any changed values - showing all initial lt_tab values.
I highly appreciate your answers on this.
Thanks.
Rajesh.Hi,
Use this code, its working:-
*& Form ALV_DISPLAY
* SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
* FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
* AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
* DISPLAYED IN THE GRID FORMAT
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort " sort info
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
is_variant = wa_variant " variant name
* IT_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 = it_final " internal table
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. " ALV_DISPLAY
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is EXECUTE then process the selected records
WHEN 'EXECUTE'. "user-defined button
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
ENDCASE.
ENDFORM.
This will reflect all the changes in the internal table. Now you can include your logic as per your requirement.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
ALV: issue in truncating decimal values (rounding up)
Hi,
I have been receiving a problem truncating decimal values in alv environment using this abap code.
WRITE gwa_komv-kwert TO gv_out_tax CURRENCY rte0143sf-currency
DECIMALS l_decimals LEFT-JUSTIFIED.
where l_decimals = 0.
More exactly the value is rounded up but this is not my expectation.
Any idea?
Thanks.
GiovanniStandard behaviour with DECIMALS 0: rounding up or own.
And when you use the addition DECIMALS, then the CURRENCY addition is ignored as well. -
hi all experts
plz help
i have an alv based on object oriented method
in the output i am gettin a toolbar in which i have two buttons like print and export
problem is
when i click on these buttons i am gettin short dump
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLKKBL" had to be terminated because
come across a statement that unfortunately cannot be executed.
plz tel me for printing do i need to wwrite any seperate event or any method for it
plz guide me
thanx in advance .*& Report ZMULTIPLE_ALV
*REPORT ZMULTIPLE_ALV.
report zrich_0006.
tables: mara.
type-pools: slis.
Internal Tables
data: begin of ialv occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of ialv .
Internal Tables
data: begin of ialv2 occurs 0,
matnr type mard-matnr,
werks type mard-werks,
lgort type mard-lgort,
end of ialv2 .
CLASS lcl_event_receiver DEFINITION Handles Double Click
class lcl_event_receiver definition.
public section.
methods handle_hotspot_click
for event hotspot_click of cl_gui_alv_grid
importing e_row_id.
private section.
endclass.
CLASS lCL_EVENT_RECEIVER IMPLEMENTATION Handles Double Click
class lcl_event_receiver implementation.
method handle_hotspot_click.
perform get_details using e_row_id-index.
endmethod.
endclass.
data: alv_container type ref to cl_gui_custom_container,
event_receiver type ref to lcl_event_receiver,
alv_grid type ref to cl_gui_alv_grid,
alv_container2 type ref to cl_gui_custom_container,
alv_grid2 type ref to cl_gui_alv_grid,
ok_code like sy-ucomm,
fieldcat type lvc_t_fcat,
gs_layout type lvc_s_layo,
fieldcat2 type lvc_t_fcat.
select-options: s_matnr for mara-matnr.
start-of-selection.
perform get_data.
call screen 100.
Module status_0100 OUTPUT
module status_0100 output.
data: variant type disvariant.
data: lt_exclude type ui_functions.
data: ls_fcat type lvc_s_fcat.
set pf-status '0100'.
set titlebar '0100'.
check alv_container is initial.
Code for first ALV Grid
Create Controls
create object alv_container
exporting container_name = 'ALV_CONTAINER'.
create object alv_grid
exporting i_parent = alv_container.
create Event Receiver
create object event_receiver.
clear fieldcat. refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Number'.
ls_fcat-coltext = 'Material Number'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'IALV'.
ls_fcat-hotspot = 'X'.
ls_fcat-outputlen = '18'.
ls_fcat-col_pos = 1.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Description'.
ls_fcat-coltext = 'Material Description'.
ls_fcat-fieldname = 'MATKX'.
ls_fcat-ref_table = 'IALV'.
ls_fcat-outputlen = '40'.
ls_fcat-col_pos = 2.
append ls_fcat to fieldcat.
gs_layout-grid_title = 'Flights'(100).
CALL METHOD alv_grid->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = ialv[]
IT_FIELDCATALOG = fieldcat[]
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
call method alv_grid->set_table_for_first_display
changing
it_outtab = ialv[]
it_fieldcatalog = fieldcat[].
handler for ALV grid
set handler event_receiver->handle_hotspot_click for alv_grid.
Code for second ALV Grid
Create Controls
create object alv_container2
exporting container_name = 'ALV_CONTAINER2'.
create Event Receiver
create object alv_grid2
exporting i_parent = alv_container2.
clear fieldcat. refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Number'.
ls_fcat-coltext = 'Material Number'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'IALV2'.
ls_fcat-outputlen = '18'.
append ls_fcat to fieldcat2.
clear: ls_fcat.
ls_fcat-reptext = 'Plant'.
ls_fcat-coltext = 'Plant'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'IALV2'.
ls_fcat-outputlen = '4'.
append ls_fcat to fieldcat2.
clear: ls_fcat.
ls_fcat-reptext = 'Store Loc'.
ls_fcat-coltext = 'Store Loc'.
ls_fcat-fieldname = 'LGORT'.
ls_fcat-ref_table = 'IALV2'.
ls_fcat-outputlen = '4'.
append ls_fcat to fieldcat2.
call method alv_grid2->set_table_for_first_display
changing
it_outtab = ialv2[]
it_fieldcatalog = fieldcat2[].
endmodule.
Module USER_COMMAND_0100 INPUT
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'CANC'.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
if not alv_container2 is initial.
call method alv_container2->free.
clear: alv_container2.
free : alv_container2.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
else.
leave program.
endif.
endcase.
endmodule.
FORM GET_DATA.
form get_data.
select maramatnr maktmaktx
into corresponding fields of table ialv
from mara
inner join makt
on maramatnr = maktmatnr
where mara~matnr in s_matnr
and makt~spras = sy-langu.
sort ialv ascending by matnr.
endform.
FORM GET_MORE_DATA.
form get_more_data.
select matnr werks lgort
into corresponding fields of table ialv2
from mard
where matnr = ialv-matnr.
sort ialv2 ascending by matnr.
endform.
GET_DETAILS
form get_details using index.
read table ialv index index.
if sy-subrc = 0.
perform get_more_data.
call method alv_grid2->refresh_table_display.
endif.
endform. -
Hi experts
plz help
i have createed an alv using slis method
in the output there must come a header
in this header i ill have to show som details
like on the left side of the header i want to show the details of the user and on the right side i want to show he data of vendor .
i am able to get the data in the left side but i am not able to show the data of vendor on the right side
the data of vendor is by default coming on left side only just below the details of user but i want to show those details on the right side of the header .
plz tell me how to do it .
thanx in advance.Hi Anit,
I am attaching here the whole Code. It is somewhat big code so go through it thoroughly.If you still face problem reply this thread otherwise <b>REWARD POINT</b>.
REPORT test
MESSAGE-ID zzrefn01
NO STANDARD PAGE HEADING
*** Portrait: 93x80
LINE-SIZE 150
LINE-COUNT 80.
*** Landscape: 132x65
LINE-SIZE 132
LINE-COUNT 65.
INCLUDES **
INCLUDE zbc_i00. "Customer Standard Include
INCLUDE <icon>. "For Button on the ALV Tool Bar
INCLUDE yyef_check_isp_top.
INCLUDE yyef_check_isp_f01.
INCLUDE yyef_check_isp_o01.
INCLUDE yyef_check_isp_i01.
CLASS zcl_event_handler IMPLEMENTATION
CLASS zcl_event_handler IMPLEMENTATION.
Top-of-page event
METHOD top_of_page.
PERFORM event_top_of_page
USING z_dyndoc_id.
ENDMETHOD. "METHOD top_of_page
Change Status Button
METHOD handle_toolbar.
IF NOT pa_prodr IS INITIAL.
DATA: lz_toolbar TYPE stb_button.
CLEAR lz_toolbar.
MOVE 'CHANGE_STATUS' TO lz_toolbar-function.
MOVE text-001 TO lz_toolbar-text.
APPEND lz_toolbar TO e_object->mt_toolbar.
ENDIF. "IF NOT pa_prodr IS INITIAL
ENDMETHOD. "METHOD handle_toolbar
Handle User Command
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'CHANGE_STATUS'.
LOOP AT it_output
INTO wa_output.
IF wa_output-chk_box EQ kc_x.
z_flag = 1.
EXIT.
ENDIF. "IF wa_output-chk_box EQ kc_x
ENDLOOP. "LOOP AT it_output INTO wa_output
IF z_flag EQ 1.
PERFORM display_selected_data.
ELSE.
MESSAGE i001(zzrefn01)
WITH text-023.
ENDIF. "IF z_flag EQ 1
ENDCASE. "CASE e_ucomm
ENDMETHOD. "METHOD handle_user_command
ENDCLASS. "zcl_event_handler IMPLEMENTATION
Processing of selection screen **
First time initialization *
Get Default variant *
INITIALIZATION.
z_repid = sy-repid.
PERFORM variant_init.
zx_variant = z_variant.
CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
EXPORTING
i_save = kc_u
CHANGING
cs_variant = zx_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc EQ 0.
pa_vari = zx_variant-variant.
ELSE.
MESSAGE i001(zzrefn01)
WITH text-021.
ENDIF. "IF sy-subrc EQ 0
*** First time initialization in online mode except calls with variant
*** (is not processed on return from prog to selection screen)
pa_xyz = ....
so_xyz.....
SET PF-STATUS 'STAT1000'.
*** An example for select options restrictions is available
*** in TT1/YYKA_EXPORT_START_HOST (remove comment)
Selection screen PBO *
Comment........ *
AT SELECTION-SCREEN OUTPUT.
*** Init selection screen, also on variants
*** (only for online reports)
IF NOT zn_init_seldynp IS INITIAL
AND sy-batch IS INITIAL "Not on batch calls (e.g. AutoSys)
AND sy-slset IS INITIAL. "Not on calls with variant
IF NOT pa_prodr IS INITIAL.
CLEAR: pa_prodr.
MESSAGE w999(zbcc). "Flag prod.run reseted
ENDIF.
CLEAR: pa_start.
ENDIF.
CLEAR: zn_init_seldynp.
*** Process dynpro fields
LOOP AT SCREEN.
*** --> Read-Only fields
IF screen-group1 EQ 'RDO'
AND screen-input NE '0'
AND screen-group3 NE 'VPU'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Selection screen PAI *
Comment........ *
*AT SELECTION-SCREEN ON so_xyz.
AT SELECTION-SCREEN.
PERFORM pai_of_selection_screen.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
PERFORM f4_for_variant.
PERFORM btci_at_sel_screen. "Call BTCI checks (optional)
Program **
Main routine *
START-OF-SELECTION.
PERFORM fetch_data.
PERFORM build_data.
PERFORM prepare_field_catalog
CHANGING it_fieldcat.
CALL SCREEN 100.
End routine *
END-OF-SELECTION.
Interactive Reporting **
Comment........ *
AT LINE-SELECTION.
*** Good example in TT1/YIIHART (remove comment)
Comment........ *
AT USER-COMMAND.
PERFORM handle_user_command.
Comment........ *
AT PFN.
iNCLUDE YYEF_CHECK_ISP_F01
*& Include YYEF_CHECK_ISP_F01 *
*& Form pai_of_selection_screen
Check Variant Exist or not
FORM pai_of_selection_screen .
IF NOT pa_vari IS INITIAL.
MOVE z_variant TO zx_variant.
MOVE pa_vari TO zx_variant-variant.
CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'
EXPORTING
i_save = kc_u
CHANGING
cs_variant = zx_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc EQ 2.
MESSAGE i001(zzrefn01)
WITH text-024.
ENDIF. "IF sy-subrc EQ 2
z_variant = zx_variant.
ELSE.
PERFORM variant_init.
ENDIF. "IF NOT pa_vari IS INITIAL
ENDFORM. "pai_of_selection_screen
*& Form variant_init
Initialization of Variant
FORM variant_init .
CLEAR z_variant.
z_variant-report = z_repid.
ENDFORM. " variant_init
*& Form f4_for_variant
F4 Help for Layout
FORM f4_for_variant .
CALL FUNCTION 'LVC_VARIANT_F4'
EXPORTING
is_variant = z_variant
i_save = kc_u
IMPORTING
e_exit = z_exit
es_variant = zx_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 1.
MESSAGE i001(zzrefn01)
WITH text-022.
ELSE.
IF z_exit = space.
pa_vari = zx_variant-variant.
ENDIF. "IF z_exit = space
ENDIF. "IF sy-subrc EQ 1
ENDFORM. "f4_for_variant
*& Form fetch_data
Fetch data from DB tables.
FORM fetch_data .
SELECT *
FROM yyeft1200
INTO TABLE it_yyeft1200
WHERE id_rech IN so_idrec
AND fnumkred IN so_fnumk
AND status IN so_stat
AND erdat IN so_erdat
ORDER BY PRIMARY KEY.
IF sy-subrc EQ 0.
SELECT *
FROM yyeft1201
INTO TABLE it_yyeft1201
FOR ALL ENTRIES IN it_yyeft1200
WHERE id_rech EQ it_yyeft1200-id_rech
AND artnr_bp IN so_artnr
ORDER BY PRIMARY KEY.
IF sy-subrc EQ 0.
SELECT *
FROM yyeft1008
INTO TABLE it_yyeft1008
FOR ALL ENTRIES IN it_yyeft1201
WHERE bp_refnr EQ it_yyeft1201-bprefnr.
IF sy-subrc EQ 0.
SORT it_yyeft1008[] BY bp_refnr.
ENDIF. "IF sy-subrc EQ 0.
ENDIF. "IF sy-subrc EQ 0.
ELSE.
zn_cancel = kc_x.
ENDIF. "IF sy-subrc EQ 0.
ENDFORM. " fetch_data
*& Form build_data
Gather the data from all the internal tables into one.
FORM build_data .
LOOP AT it_yyeft1200
INTO wa_yyeft1200.
CLEAR wa_output.
wa_output-id_rech = wa_yyeft1200-id_rech.
wa_output-fnumkred = wa_yyeft1200-fnumkred.
wa_output-status = wa_yyeft1200-status.
wa_output-erdat = wa_yyeft1200-erdat.
wa_output-bukrs = wa_yyeft1200-bukrs.
wa_output-belnr = wa_yyeft1200-belnr.
wa_output-gjahr = wa_yyeft1200-gjahr.
IF wa_yyeft1200-status GE kc_status10
AND wa_yyeft1200-belnr IS INITIAL.
wa_output-com_delfnd = 'FI Doc NOT found'(t03).
ENDIF.
IF wa_yyeft1200-status LT kc_status10
AND NOT wa_yyeft1200-belnr IS INITIAL
AND wa_output-com_delfnd IS INITIAL
AND NOT pa_det IS INITIAL.
wa_output-com_delfnd = 'FI Doc should be empty'(t01).
ENDIF.
LOOP AT it_yyeft1201
INTO wa_yyeft1201
WHERE id_rech EQ wa_yyeft1200-id_rech.
wa_output-bprefnr = wa_yyeft1201-bprefnr.
wa_output-lfdat = wa_yyeft1201-lfdat.
wa_output-artnr_bp = wa_yyeft1201-artnr_bp.
READ TABLE it_yyeft1008
WITH KEY bp_refnr = wa_yyeft1201-bprefnr
BINARY SEARCH
TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
LOOP AT it_yyeft1008
INTO wa_yyeft1008
FROM sy-tabix.
IF wa_yyeft1008-bp_refnr NE wa_yyeft1201-bprefnr.
EXIT.
ENDIF.
wa_output-id_anlief = wa_yyeft1008-id_anlief.
IF NOT pa_det IS INITIAL
OR NOT wa_output-com_delfnd IS INITIAL.
APPEND wa_output TO it_output.
ENDIF.
ENDLOOP. "LOOP AT it_yyeft1008
ELSE.
CLEAR wa_output-id_anlief.
wa_output-com_delfnd = 'Deliv. NOT found'(t06).
APPEND wa_output TO it_output.
ENDIF.
ENDLOOP. "LOOP AT it_yyeft1201
IF sy-subrc NE 0.
wa_output-com_delfnd = 'No Detail records in YYEFT1201'(e01).
APPEND wa_output TO it_output.
ENDIF. "IF sy-subrc NE 0.
ENDLOOP. "LOOP AT it_yyeft1200
Checkbox Editable for Production Run
IF pa_prodr IS INITIAL.
LOOP AT it_output
INTO wa_output.
zs_style-fieldname = 'CHK_BOX'.
zs_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT zs_style INTO TABLE wa_output-celltab.
MODIFY it_output FROM wa_output
TRANSPORTING celltab.
ENDLOOP. "LOOP AT it_output INTO wa_output.
ENDIF. "IF pa_prodr IS INITIAL
LOOP AT it_output
INTO wa_output.
IF wa_output-status GE kc_status10
AND wa_output-belnr IS INITIAL
AND NOT pa_prodr IS INITIAL.
zs_style-fieldname = 'CHK_BOX'.
zs_style-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT zs_style INTO TABLE wa_output-celltab.
MODIFY it_output FROM wa_output
TRANSPORTING celltab.
ENDIF. "IF wa_output-status GE kc_status10
ENDLOOP. "LOOP AT it_output INTO wa_output
ENDFORM. "build_data
*& Form prepare_field_catalog
Field Catalog Preparation
<--PIT_FIELDCAT Field catalog
FORM prepare_field_catalog
CHANGING pit_fieldcat TYPE lvc_t_fcat.
DATA: ls_fcat TYPE lvc_s_fcat.
IF it_output1 IS INITIAL.
Check Box
CLEAR ls_fcat.
ls_fcat-fieldname = 'CHK_BOX'.
ls_fcat-datatype = 'CHAR'.
ls_fcat-intlen = '1'.
ls_fcat-edit = kc_x.
ls_fcat-coltext = text-014.
ls_fcat-checkbox = kc_x.
ls_fcat-outputlen = '5'.
APPEND ls_fcat TO pit_fieldcat.
ENDIF. "IF it_output1 IS INITIAL
ID RECH
CLEAR ls_fcat.
ls_fcat-fieldname = 'ID_RECH'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = text-002.
APPEND ls_fcat TO pit_fieldcat.
BP Reference
CLEAR ls_fcat.
ls_fcat-fieldname = 'BPREFNR'.
ls_fcat-outputlen = '15'.
ls_fcat-coltext = text-003.
APPEND ls_fcat TO pit_fieldcat.
Delivery date
CLEAR ls_fcat.
ls_fcat-fieldname = 'LFDAT'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = text-004.
APPEND ls_fcat TO pit_fieldcat.
Article
CLEAR ls_fcat.
ls_fcat-fieldname = 'ARTNR_BP'.
ls_fcat-outputlen = '18'.
ls_fcat-coltext = text-005.
APPEND ls_fcat TO pit_fieldcat.
Account Payable invoice
CLEAR ls_fcat.
ls_fcat-fieldname = 'FNUMKRED'.
ls_fcat-outputlen = '16'.
ls_fcat-coltext = text-006.
APPEND ls_fcat TO pit_fieldcat.
Status
CLEAR ls_fcat.
ls_fcat-fieldname = 'STATUS'.
ls_fcat-outputlen = '2'.
ls_fcat-coltext = text-007.
APPEND ls_fcat TO pit_fieldcat.
Create date
CLEAR ls_fcat.
ls_fcat-fieldname = 'ERDAT'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = text-008.
APPEND ls_fcat TO pit_fieldcat.
Comment
CLEAR ls_fcat.
ls_fcat-fieldname = 'COM_DELFND'.
ls_fcat-outputlen = '25'.
ls_fcat-coltext = text-009.
APPEND ls_fcat TO pit_fieldcat.
Delivery ID
CLEAR ls_fcat.
ls_fcat-fieldname = 'ID_ANLIEF'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = text-010.
APPEND ls_fcat TO pit_fieldcat.
Company Code
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUKRS'.
ls_fcat-outputlen = '4'.
ls_fcat-coltext = text-011.
APPEND ls_fcat TO pit_fieldcat.
Accounting Document Number
CLEAR ls_fcat.
ls_fcat-fieldname = 'BELNR'.
ls_fcat-outputlen = '10'.
ls_fcat-coltext = text-012.
APPEND ls_fcat TO pit_fieldcat.
Financial Year
CLEAR ls_fcat.
ls_fcat-fieldname = 'GJAHR'.
ls_fcat-outputlen = '4'.
ls_fcat-coltext = text-013.
APPEND ls_fcat TO pit_fieldcat.
ENDFORM. " prepare_field_catalog
*& Form EVENT_TOP_OF_PAGE
TOP-OF-PAGE Preparation
-->z_dyndoc_id Text of TOP-OF-PAGE
FORM event_top_of_page
USING z_dyndoc_id TYPE REF TO cl_dd_document.
DATA : lz_text(255) TYPE c.
System ID
CLEAR : lz_text.
CONCATENATE text-015
sy-sysid
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
Title
CLEAR : lz_text.
CONCATENATE text-016
sy-title
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
Date
CLEAR : lz_text.
WRITE sy-datum TO lz_text.
CONCATENATE text-017
lz_text
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
User ID
CLEAR : lz_text.
CONCATENATE text-018
sy-uname
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
Time
CLEAR : lz_text.
WRITE sy-uzeit TO lz_text.
CONCATENATE text-019
lz_text
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
Program Name
CLEAR : lz_text.
WRITE sy-repid TO lz_text.
CONCATENATE text-020
lz_text
INTO lz_text
SEPARATED BY space.
PERFORM add_text
USING lz_text.
CALL METHOD z_dyndoc_id->new_line.
Populating data to TOP-OF-PAGE
PERFORM top-of-page.
ENDFORM. " EVENT_TOP_OF_PAGE
*& Form ADD_TEXT
Add Text To TOP-OF-PAGE
FORM add_text
USING p_text TYPE sdydo_text_element.
CALL METHOD z_dyndoc_id->add_text
EXPORTING
text = p_text.
ENDFORM. " ADD_TEXT
*& Form TOP-OF-PAGE
TOP-OF-PAGE
FORM top-of-page.
CALL METHOD z_dyndoc_id->display_document
EXPORTING
reuse_control = kc_x
parent = z_parent_top
EXCEPTIONS
html_display_error = 1.
IF sy-subrc NE 0.
MESSAGE i001(zzrefn01)
WITH text-036 ' '.
ENDIF. "IF sy-subrc NE 0
ENDFORM. "TOP-OF-PAGE
*& Form handle_user_command
Handle the user command
FORM handle_user_command .
DATA lzi_lin TYPE i.
REFRESH ra_id_rech[].
CLEAR ra_id_rech.
ra_id_rech-sign = kc_include.
ra_id_rech-option = kc_equal.
CASE sy-ucomm.
WHEN kc_ucomm-upd.
DESCRIBE LIST NUMBER OF LINES lzi_lin.
DO lzi_lin TIMES.
CLEAR wa_output.
READ LINE sy-index
FIELD VALUE wa_output-chk_box
wa_output-id_rech.
IF sy-subrc NE 0.
EXIT.
ELSE.
IF wa_output-chk_box EQ kc_x.
ra_id_rech-low = wa_output-id_rech.
APPEND ra_id_rech.
ENDIF.
ENDIF.
ENDDO.
IF NOT ra_id_rech IS INITIAL.
SORT ra_id_rech BY low.
DELETE ADJACENT DUPLICATES FROM ra_id_rech
COMPARING low.
IF NOT pa_prodr IS INITIAL.
UPDATE yyeft1200
SET status = kc_status00
WHERE id_rech IN ra_id_rech.
IF sy-subrc EQ 0.
MESSAGE s900(zbcc)
WITH 'Status change successful'(m08)
space
space
space.
ELSE.
MESSAGE i900(zbcc)
WITH 'Status change failed'(m09)
space
space
space.
ENDIF. "IF sy-subrc EQ 0.
ELSE.
MESSAGE i900(zbcc)
WITH 'TEST RUN: NO databases will be changed'(m03)
space
space
space.
ENDIF. "IF NOT pa_prodr IS INITIAL.
ELSE.
MESSAGE i900(zbcc)
WITH 'Atleast one line should be selected'(m01)
'in order to update.'(m02)
space
space.
ENDIF. "IF NOT ra_id_rech IS INITIAL
WHEN kc_ucomm-back
OR kc_ucomm-exit
OR kc_ucomm-cancel.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE. "CASE sy-ucomm
ENDFORM. " handle_user_command
*& Form display_selected_data
Display Selected Data
FORM display_selected_data.
LOOP AT it_output
INTO wa_output
WHERE chk_box EQ kc_x.
MOVE-CORRESPONDING wa_output TO wa_output1.
APPEND wa_output1 TO it_output1.
ENDLOOP. "LOOP AT it_output
call dialog screen and display new alv control
IF NOT it_output1[] IS INITIAL.
CALL SCREEN 101 STARTING AT 10 5.
ENDIF. "IF NOT it_output1[] IS INITIAL
ENDFORM. " change_status
iNCLUDE YYEF_CHECK_ISP_I01
*& Include YYEF_CHECK_ISP_I01 *
*& Module USER_COMMAND_0100 INPUT
Handle user command for screen 0100
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN kc_ucomm-back.
LEAVE TO SCREEN 0.
WHEN kc_ucomm-exit.
LEAVE TO SCREEN 0.
ENDCASE. "CASE sy-ucomm.
ENDMODULE. "USER_COMMAND_0100 INPUT
*& Module USER_COMMAND_0101 INPUT
Handle User Command for screen 0101
MODULE user_command_0101 INPUT.
CASE sy-ucomm.
WHEN kc_ucomm-back.
LEAVE TO SCREEN 0.
ENDCASE. "CASE sy-ucomm
ENDMODULE. " USER_COMMAND_0101 INPUT
Include YYEF_CHECK_ISP_O01
*& Include YYEF_CHECK_ISP_O01 *
*& Module PBO OUTPUT
OO ALV Display
MODULE pbo OUTPUT.
CREATE OBJECT z_container
EXPORTING container_name = kc_container.
Create TOP-Document
CREATE OBJECT z_dyndoc_id
EXPORTING style = kc_alv.
Create Splitter for custom_container
CREATE OBJECT z_splitter
EXPORTING parent = z_container
rows = 2
columns = 1.
For TOP-OF-PAGE
CALL METHOD z_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = z_parent_top.
For ALV Display
CALL METHOD z_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = z_parent_grid.
Set height for g_parent_html
CALL METHOD z_splitter->set_row_height
EXPORTING
id = 1
height = 20.
CREATE OBJECT z_grid
EXPORTING i_parent = z_parent_grid.
Set Handler for TOP-OF-PAGE
CREATE OBJECT z_handler.
SET HANDLER z_handler->top_of_page FOR z_grid.
z_repid = sy-repid.
z_variant-report = z_repid.
Display ALV
zs_layout-stylefname = kc_style.
CALL METHOD z_grid->set_table_for_first_display
EXPORTING
is_layout = zs_layout
i_save = kc_u
is_variant = z_variant
CHANGING
it_outtab = it_output[]
it_fieldcatalog = it_fieldcat.
Processing TOP-OF-PAGE Event
CALL METHOD z_grid->list_processing_events
EXPORTING
i_event_name = kc_top
i_dyndoc_id = z_dyndoc_id.
Set handler for ALV Tool Bar
SET HANDLER z_handler->handle_toolbar FOR z_grid.
SET HANDLER z_handler->handle_user_command FOR z_grid.
CALL METHOD z_grid->set_toolbar_interactive.
ENDMODULE. " PBO OUTPUT
*& Module STATUS_0100 OUTPUT
Set the GUI status
MODULE status_0100 OUTPUT.
SET PF-STATUS kc_status.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module STATUS_0101 OUTPUT
Display selected records on screen 0101
MODULE status_0101 OUTPUT.
SET TITLEBAR kc_title.
CREATE OBJECT z_container1
EXPORTING container_name = kc_container1.
CREATE OBJECT z_grid1
EXPORTING i_parent = z_container1.
PERFORM prepare_field_catalog
CHANGING it_fieldcat1.
Display ALV
CALL METHOD z_grid1->set_table_for_first_display
EXPORTING
is_layout = zs_layout
CHANGING
it_outtab = it_output1[]
it_fieldcatalog = it_fieldcat1.
ENDMODULE. " STATUS_0101 OUTPUT
INCLUDE YYEF_CHECK_ISP_TOP
*& Include YYEF_CHECK_ISP_TOP *
DATA DEFINITIONS **
Class declarations *
*class zcl_xyz definition deferred.
CLASS :cl_gui_alv_grid DEFINITION LOAD,
cl_gui_custom_container DEFINITION LOAD.
Tables (old SAP style, please avoid and use workareas instead) *
TABLES: yyeft1200,
yyeft1201.
*tables: xyz.
Controls *
*controls: ctrl_xyz.
Types *
TYPES: BEGIN OF ty_output,
chk_box(1) TYPE c,
celltab TYPE lvc_t_styl,
id_rech TYPE yyeft1200-id_rech,
bprefnr TYPE yyeft1201-bprefnr,
lfdat TYPE yyeft1201-lfdat,
artnr_bp TYPE yyeft1201-artnr_bp,
fnumkred TYPE yyeft1200-fnumkred,
status TYPE yyeft1200-status,
erdat TYPE yyeft1200-erdat,
com_delfnd TYPE char25,
id_anlief TYPE yyeft1008-id_anlief,
bukrs TYPE yyeft1200-bukrs,
belnr TYPE yyeft1200-belnr,
gjahr TYPE yyeft1200-gjahr,
END OF ty_output.
TYPES: BEGIN OF ty_output1,
celltab TYPE lvc_t_styl,
id_rech TYPE yyeft1200-id_rech,
bprefnr TYPE yyeft1201-bprefnr,
lfdat TYPE yyeft1201-lfdat,
artnr_bp TYPE yyeft1201-artnr_bp,
fnumkred TYPE yyeft1200-fnumkred,
status TYPE yyeft1200-status,
erdat TYPE yyeft1200-erdat,
com_delfnd TYPE char25,
id_anlief TYPE yyeft1008-id_anlief,
bukrs TYPE yyeft1200-bukrs,
belnr TYPE yyeft1200-belnr,
gjahr TYPE yyeft1200-gjahr,
END OF ty_output1.
TYPES: BEGIN OF ty_status,
id_rech TYPE yyeft1200-id_rech,
END OF ty_status.
*TYPES-POOLS: xyz.
*TYPES: ty_xyz.
Internal tables *
*DATA: it_xyz.
DATA: it_yyeft1200 TYPE STANDARD TABLE OF yyeft1200,
it_yyeft1201 TYPE SORTED TABLE OF yyeft1201
WITH UNIQUE KEY id_rech posnr,
it_yyeft1008 TYPE STANDARD TABLE OF yyeft1008,
it_output TYPE STANDARD TABLE OF ty_output,
it_output1 TYPE STANDARD TABLE OF ty_output1,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat.
Workareas *
*DATA: wa_xyz.
DATA: wa_yyeft1200 TYPE yyeft1200,
wa_yyeft1201 TYPE yyeft1201,
wa_yyeft1008 TYPE yyeft1008,
wa_output TYPE ty_output,
wa_output1 TYPE ty_output1.
*****OO ALV DATA DECLARATION
DATA: zs_style TYPE lvc_s_styl,
zs_layout TYPE lvc_s_layo,
z_container TYPE REF TO cl_gui_custom_container,
z_container1 TYPE REF TO cl_gui_custom_container,
z_grid TYPE REF TO cl_gui_alv_grid,
z_grid1 TYPE REF TO cl_gui_alv_grid,
z_dyndoc_id TYPE REF TO cl_dd_document,
z_splitter TYPE REF TO cl_gui_splitter_container,
z_parent_grid TYPE REF TO cl_gui_container,
z_parent_top TYPE REF TO cl_gui_container.
Constants *
*constants: kc_xyz value ... "character
*constants: kn_xyz value ... "numeric
*constants: ki_xyz value ... "integer
*constants: kp_xyz value ... "packed
*constants: kx_xyz value ... "hex
CONSTANTS: kc_status00 TYPE yyeft1200-status VALUE '00',
kc_status10 TYPE yyeft1200-status VALUE '10',
kc_x TYPE char01 VALUE 'X',
kc_include TYPE char01 VALUE 'I',
kc_equal(2) TYPE c VALUE 'EQ',
kc_status(11) TYPE c VALUE 'ZGUI_STATUS',
kc_container TYPE char10 VALUE 'ZCONTAINER',
kc_container1 TYPE char11 VALUE 'ZCONTAINER1',
kc_u TYPE char01 VALUE 'U',
kc_top TYPE char30 VALUE 'TOP_OF_PAGE',
kc_alv TYPE char50 VALUE 'ALV_GRID',
kc_style TYPE char07 VALUE 'CELLTAB',
kc_title TYPE char07 VALUE 'ZTITLE'.
CONSTANTS: BEGIN OF kc_ucomm,
upd TYPE sy-ucomm VALUE 'UPD',
back TYPE sy-ucomm VALUE 'BACK',
exit TYPE sy-ucomm VALUE 'EXIT',
cancel TYPE sy-ucomm VALUE 'CANCEL',
END OF kc_ucomm.
Sentence counters *
*data: cnt_xyz type i value 0.
Calculation variables (Rechenfelder) *
*data: r_xyz.
Switches *
*data: sw_xyz(1) type n value 0.
Misc variables *
*DATA: z_xyz.
*** Initialization of parameters at call of/return to
*** selection dynpro (for Online-only-reports)
DATA: zn_init_seldynp(1) TYPE n
VALUE 1. -
ALv to excel download problems
HI friends,
Probelm I'm facing while saving an ALV report to Excel Sheet by clicking
on the 'Save as File Icon' button on the ALV output.=0D
Here data is going into a new Line after 65 columns.I've used Function
Module 'RSAQ_ALV'.This function module is ultimately using
'REUSE_ALV_GRID_DISPLAY' and 'REUSE_ALV_LIST_DISPLAY' function
modules.ALV output I'm getting correctly but when I save this ALV output
to Excel,columns are getting wrapped and going into 2nd row after 65
columns.=0D
Could anybody tell me what could be the reason ?=0D
Thanks,
Sreekanth.G
Moderator message: duplicate post locked.
Edited by: Thomas Zloch on Jul 9, 2010 12:36 PMch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
ch_alv_layout-colwidth_optimize = 'X'.
try commenting the above values.and also check the Fieldcatlog.
Check the issue similar issue was resolve by checking catalog and layout:
[ALV Issue solution|Re: Problem when export ALV.]
Regards,
Gurpreet -
ALV problems, trying to click Back button, Filtering, download (Excel)
Hi
When I try to click Back button, Filtering or download (Excel) on ALV grid this dumps appear:
Runtime Error MOVE_TO_LIT_NOTALLOWED_NODATA
Error analysis
The program tried to assign a new value to the field "<L_BOX>" even though
it is protected against changes.
The following objects are protected:
- Character or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions
and methods
- Untyped field symbols to which a field has not yet been assigned
using ASSIGN
- TABLES parameters if the corresponding actual parameter is protected
against changes
- USING reference parameters and CHANGING parameters for FORMs if
the actual parameter for this is protected against changes
- Field symbols if the field assigned using ASSIGN or ASSIGNING
is protected against changes
- External write accesses to READ-ONLY attributes
- Key components of lines in internal tables of the type HASHED or
SORTED TABLE
SORTED TABLE.
Line SourceCde
681 * set/unset <box> of all items
682 if l_ucomm eq '&SAL' or l_ucomm eq '&ALL'.
683 if l_ucomm eq '&SAL'.
684 loop at t_outtab.
685 l_tabix = l_tabix + 1.
->>> <l_box> = ' '.
687 modify t_outtab index l_tabix.
688 endloop.
689 endif.
690 if l_ucomm eq '&ALL'.
691 loop at t_outtab.
692 l_tabix = l_tabix + 1.
693 <l_box> = 'X'.
694 modify t_outtab index l_tabix.
695 endloop.
696 endif.
What I must check on my ALV settings:
ch_alv_layout-zebra = 'X'.
ch_alv_layout-box_fieldname = 'SELE'.
ch_alv_layout-box_tabname = v_nametab.
ch_alv_layout-reprep = 'X'.
ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
ch_alv_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ch_alv_layout
it_fieldcat = ch_alv_fieldcat
it_sort = ch_alv_sortinfo
i_save = 'X'
it_events = ch_slis_event
TABLES
t_outtab = p_control
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks in advance.ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
ch_alv_layout-colwidth_optimize = 'X'.
try commenting the above values.and also check the Fieldcatlog.
Check the issue similar issue was resolve by checking catalog and layout:
[ALV Issue solution|Re: Problem when export ALV.]
Regards,
Gurpreet -
ABAP Container Element Hotspot Issue
Hi Friends
I developed a report using container element and added the HOTSPOT functionality for the field Partner Number.
Partner number have 4, 5 fields like Sold-to-party,ship-to-party, reseller, end user.While executing this report, some time all the fields have value, some times few fields will come with blank value.In that case I need to enter the value for Blank fields.But if I activate HOTSPOT, its not allowing me to enter the value under partner function column.
Kindly give me your suggestion to achieve this functionality.
Thanks
GowrishankarHi Gowrishankar,
Use double click event to handle the same scenario as hotspot, because hotspot are not meant for changing,
also you have a single click event on a row, you just have to pass row, column, sender these three parameters in that event to trigger similar event such as an hotspot. There you can handle editable ALV issues.
Best Regards,
Tapodipta Khan.
Maybe you are looking for
-
If I buy an ipad 2 with more memory, can i transfer everything from my old ipad to the new one
If I purchase an ipad 2 with more memory, can I transfer all the contents of the old ipad to the new one?
-
Help needed in tuning this query
This is the SQL i would like to tune for performace... The table structure is given below. The table has about 2 million rows. From the second day onwards only around 10% of records will be between Load_Start_Time and Load_End_Time. Among these aroun
-
Macbook Pro i7 17"
-
HOW TO UNLOCK MY ITOUCH IF I FORGOT MY PASSCODE
i just found my itouch after having it been lost for about 3 years and i do not remeber my password so i hooked it up to itunes and they say they cant open it because there is a password on it. how can i get it unlocked????
-
Iphone crashes after click yes for update
Hi there, what a **** i try to install the update for my iphone. Butm when i press YES, my itunes crashes... I try on 2 diffrent computers. Vista 64 bit and Vista 32 bit. Any help out there? Gimei