Editable ALV dumps when second save
Hi,
I have a editable ALV and possibility to save changed rows (atleast one changed cell content). First save goes ok, but second fails in following code,
*... Read the original rowID from frontend table
read table mt_roid_front into ls_row_no
with key row_id = ls_good_cells-row_id.
if sy-subrc ne 0.
-> message x000(0k).
endif.
this in in method SAVE_DATA of class CL_GUI_ALV_GRID.
It seems that on second loop it cannot find the original rowid.
Regs,
Pekka
Hi,
I implemented event data_changed_finished, code below, and I got no dump anymore. Another problem is that I lost some lines from ALV, mainly non-edited. I have not done these class-event things that many, so can you please guide me what to do?
Regards,
Pekka
METHOD handle_data_changed_finished.
IF NOT obj_alvgrid IS INITIAL.
DATA: lwa_lvc_s_stbl TYPE lvc_s_stbl.
lwa_lvc_s_stbl-col = 'X'.
lwa_lvc_s_stbl-row = 'X'.
obj_alvgrid->refresh_table_display( is_stable = lwa_lvc_s_stbl ).
cl_gui_cfw=>flush( ).
ENDIF.
Similar Messages
-
Editable ALV Dump: at setting non editable attribute
I have a problem with the ALV.
I have 2 fields in the ALV: a editable Key field and a non editable dependent text field.
I have binded a free programmed F4-Help at the key field.
In the F4Component I set the Key-field AND the text-field via :
lr_f4_context_element TYPE REF TO if_wd_context_element.
lr_f4_context_element = wd_comp_controller->listener->f4_context_element.
... set_static attribute.
The values are visible in the two alv columns.
But If I change the key after this manually I want to change the text field too.
I change at on eventhandler ON_DATA_CHECK trough set_static_attribute.
But I get later a dump for not assigned fieldsymbol:
Der Abbruch trat im ABAP-Programm "CL_SALV_WD_DATA_TABLE========
zwar in
"SET_TABLE_CELL_REF". Das Hauptprogramm war "SAPMHTTP ".
Im Quelltext befindet sich die Abbruchstelle in Zeile 8
des (Include-)Programms "CL_SALV_WD_DATA_TABLE=========CM00J".
1 method set_table_cell_ref.
2
3 field-symbols:
4 <l_value> type any.
5
6 assign r_value->* to <l_value>.
7
>>> me->set_table_cell(
9 index = index
10 attribute = attribute
11 value = <l_value> ).
12
13 endmethod.
How I can avoid the dump, but change the not editable text field, when the key field is changed?I could solve the problem with the context-mapping between the F4-component and the main-component.
The Approach to set data from the F4-Component to the main component directly was wrong! -
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: 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. -
Hello
How to lock an editable alv grid when a first user is processing this alv
and unlock it when the first leave this alv
i am using cl_gui_alv_grid.
Thank youThank you for your replies,
In fact i have to save the entered values in my alv grid and update a document via ME47 transaction.
I dont know if i have to lock the transaction ME47 or lock the entiere alv.
For the both solutions, i dont know how to do that
What the better solution for you?
i prefer to lock the editable alv to avoid two users working on it in the same time but the alv must always be available for display for any user -
Dear Friends,
I have editable ALV and capturing there save event its working properly.
so my problem is..
when i change there cell values can i capture that event like follows.
in my editable column only can be change 0-100 value cant be <0 or >100 values.
is it possible ....
please reply me....if possible give some sample plz....
Thanks in AdvanceHi Nelson,
Check out this code.
*& Report ZST_ALV_DATA_CHANGE_EVENT
REPORT ZST_ALV_DATA_CHANGE_EVENT.
CLASS lcl_grid DEFINITION
class lcl_grid DEFINITION.
PUBLIC SECTION.
methods: handle_data_changed
for event data_changed of cl_gui_alv_grid
IMPORTING er_data_changed.
endclass. "lcl_grid DEFINITION
CLASS lcl_grid IMPLEMENTATION
class lcl_grid IMPLEMENTATION.
method handle_data_changed.
perform validation using er_data_changed.
endmethod. "handle_data_changed
endclass. "lcl_grid IMPLEMENTATION
types: begin of ty_itab,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
netwr TYPE vbap-netwr,
end of ty_itab.
data: lt_itab TYPE TABLE OF ty_itab,
lw_itab TYPE ty_itab.
data: lt_fcat type lvc_t_fcat,
lw_fcat TYPE lvc_s_fcat.
data: l_grid TYPE REF TO cl_gui_alv_grid,
l_custom TYPE REF TO cl_gui_custom_container,
l_class TYPE ref to lcl_grid.
start-of-selection.
select vbeln
posnr
netwr
from vbap
into table lt_itab
up to 50 rows.
delete lt_itab where posnr ne '000010'.
perform build_fieldcatalog.
call screen 200.
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZST_GUI'.
SET TITLEBAR 'xxx'.
if l_custom is initial.
CREATE OBJECT L_CUSTOM
EXPORTING
PARENT =
CONTAINER_NAME = 'CUSTOM'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT L_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = l_custom
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
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 L_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 =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = lt_itab[]
IT_FIELDCATALOG = lt_fcat[]
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.
create OBJECT l_class.
endif.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
if sy-ucomm = 'EXIT'.
leave program.
elseif sy-ucomm = 'SAVE'.
set HANDLER l_class->handle_data_changed for l_grid.
data: l_char TYPE c.
CALL METHOD L_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = l_char.
endif.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM BUILD_FIELDCATALOG .
clear lw_fcat.
lw_fcat-fieldname = 'VBELN'.
lw_fcat-scrtext_l = 'Sales document'.
append lw_fcat to lt_fcat.
clear lw_fcat.
lw_fcat-fieldname = 'POSNR'.
lw_fcat-scrtext_l = 'Sales document'.
append lw_fcat to lt_fcat.
clear lw_fcat.
lw_fcat-fieldname = 'NETWR'.
lw_fcat-scrtext_l = 'Quantity'.
lw_fcat-edit = 'X'.
append lw_fcat to lt_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form VALIDATION
text
-->P_ER_DATA_CHANGED text
FORM VALIDATION USING er_data_changed TYPE REF TO
cl_alv_changed_data_protocol.
data: temp type vbap-netwr.
DATA: ls_good TYPE lvc_s_modi.
DATA wa LIKE LINE OF lt_good_cells.
CALL METHOD l_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'NETWR'. "Your fieldname
CALL METHOD er_data_changed->get_cell_value "Get the changed value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = temp. "Your temp variable
if temp > 1000000.
message e000(8i) with 'amount should not be greater than 200'.
endif.
"Make your validations here.
ENDCASE.
endloop.
ENDFORM. " VALIDATION
in the ZST_GUI
there are two function code 'SAVE' and 'EXIT'.
regards,
Santosh Thorat -
I have tried several times - but when I load a logo or image in to a form template - it shows up on the template in edit mode but when I save it for PDF final format and use - the image or logo disappears. What I am doing wrong?
Is this a form that you're creating in FormsCentral?
-
Handle deletion in an editable alv
Hi,
I have an editable alv . When I delete a record from this editable alv , I also want to delete it from the corresponding database .
Please could someone tell me how we can capture the particular record selected for deletion in this editable alv .
Regards,
Sushanth H.S.Hello Sushanth
Assuming that you can only delete entire rows but not modify rows (editable cells) you could use a simple approach by storing a PBO image of your data.
For a sample report have a look at report ZUS_SDN_ALV_EDITABLE_1A in Issue with CHECK_CHANGED_DATA method of CL_GUI_ALV_GRID class
By comparing GT_OUTTAB_PBO and GT_OUTTAB (PAI data) you can simply find out the deleted records.
Alternatively, you may use a more sophisticated approach:
[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]
This approach will also be helpful if the ALV rows can be modified because in this case you have to find out the MODIFIED rows.
Regards
Uwe -
No column heading in second page in alv report when save in excel file
Hi Expert,
How can i remove the column header from Alv report when program execute in background and save in excel file right now
its comming column header in each page. Client dont want header column in excel from second page. is this possible?
with regards
chandan_vijiHi Ravi,
thanks for reply i have solved this problm throug line count and NEW-PAGE LINE COUNT 10000 bcoz client want output in excel file only one page header.
with regards
chandan_viji -
Getting dump when using do_sum in alv field cat in the output of the report
Dear Freinds,
Iam getting the alv report when i click on the segma field (Sum) on my salary
field iam getting dump. and also if i try to print my alv output iam getting dump , only
happening to my custom report.
i have used the following code pleae correct me .
This perform is used for Layout settings
perform st_layout_build using gs_layout.
form st_layout_build using st_ls_layout type slis_layout_alv.
st_ls_layout-no_input = 'X'.
st_ls_layout-colwidth_optimize = 'X'.
st_ls_layout-zebra = 'X'.
st_ls_layout-detail_popup = 'X'.
endform. " st_layout_build
Field Catalog details
perform st_fieldcat_init changing gt_fieldcat.
form st_fieldcat_init changing fp_i_fieldcat type slis_t_fieldcat_alv.
clear ls_fieldcat.
ls_fieldcat-col_pos = 1.
ls_fieldcat-fieldname = 'ORGUNIT'.
ls_fieldcat-seltext_l = 'Orgunit'.
ls_fieldcat-no_out = 'X'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 2.
ls_fieldcat-fieldname = 'ORGTEXT'.
ls_fieldcat-seltext_l = 'Orgdesc'.
ls_fieldcat-no_out = 'X'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'SALARY'.
ls_fieldcat-seltext_l = 'Salary'.
ls_fieldcat-col_pos = 3.
ls_fieldcat-outputlen = 15.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'CURR'. "CURR
append ls_fieldcat to fp_i_fieldcat.
endform.
Variant
perform st_variant_init using gs_variant g_repid.
form st_variant_init using st_gs_variant type disvariant
st_repid like sy-repid.
clear st_gs_variant.
st_gs_variant-report = st_repid.
endform. " st_variant_init
g_repid = sy-repid.
perform st_comment_build using gt_list_top_of_page[].
form st_comment_build using st_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
Listenüberschrift: Typ H
clear ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = text-000.
append ls_line to st_lt_top_of_page.
endform. " st_comment_build
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_buffer_active = 'X'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_structure_name = 'i_final' "c_i_final "'objec'
i_save = g_save
is_variant = gs_variant
tables
t_outtab = fp_i_pyrol_final
exceptions
program_error = 1
others = 2.
if sy-subrc ne 0.
message e018. " Displaying the ALV GRID has failed
endif.
Please could any one let me know why iam getting dump when iam clicking for total
on my salary field.
Regards
lathaDear Chandu,
my code iam giving in details
types : begin of ty_output_data,
staffno type pernr_d,
staffname type emnam,
grade type stell,
orgunit type orgeh,
orgtext type hr_mcstext,
psgroup type trfgr, " Pay Scale Group
salary type maxbt, "PAD_AMT7S,
rrefunded type pad_amt7s,
leavepay type pad_amt7s,
mshortfal type pad_amt7s, " Medical Shortfall
echkshfal type pad_amt7s, " Execute checkup shortfall
ofindeduc type pad_amt7s, " Other Finance Deduction
mtyprem type pad_amt7s, " maternity premium
vpbonus type pad_amt7s, " VP/Bonus
gratuity type pad_amt7s, " Gratuity
vpay type pad_amt7s, " Variable pay
mallowance type pad_amt7s, " Meal Allowance
overtime type pad_amt7s, " overtime
other type pad_amt7s, " OTHER
pfundeecon type pad_amt7s, " PFund Employee's Contribution
banktrnsfer type pad_amt7s, " Bank Transfer
count type i,
end of ty_output_data.
data : i_final type standard table of ty_output_data.
iam getting all my data in the internal table I_FINAL.
perform get_final_alv using i_final.
form get_final_alv using fp_i_pyrol_final type ty_t_output_data.
*local variable declarations
data : l_v_idx type sy-tabix.
*local work areas
data : l_wa_final type ty_output_data.
g_save = 'A'.
This perform is used for Layout settings
perform st_layout_build using gs_layout.
Field Catalog details
perform st_fieldcat_init changing gt_fieldcat.
Variant
perform st_variant_init using gs_variant g_repid.
g_repid = sy-repid.
perform st_comment_build using gt_list_top_of_page[].
if not fp_i_pyrol_final is initial.
delete adjacent duplicates from fp_i_pyrol_final comparing all fields.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_buffer_active = 'X'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_structure_name = 'i_final' "c_i_final "'objec'
i_save = g_save
is_variant = gs_variant
tables
t_outtab = fp_i_pyrol_final
exceptions
program_error = 1
others = 2.
if sy-subrc ne 0.
message e018. " Displaying the ALV GRID has failed
endif.
endif.
endform. " get_final_alv
form st_layout_build using st_ls_layout type slis_layout_alv.
st_ls_layout-no_input = 'X'.
st_ls_layout-colwidth_optimize = 'X'.
st_ls_layout-zebra = 'X'.
st_ls_layout-detail_popup = 'X'.
endform. " st_layout_build
form st_fieldcat_init changing fp_i_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv.
clear ls_fieldcat.
ls_fieldcat-col_pos = 1.
ls_fieldcat-fieldname = 'ORGUNIT'.
ls_fieldcat-seltext_l = 'Orgunit'.
ls_fieldcat-no_out = 'X'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 2.
ls_fieldcat-fieldname = 'ORGTEXT'.
ls_fieldcat-seltext_l = 'Orgdesc'.
ls_fieldcat-no_out = 'X'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 5.
ls_fieldcat-fieldname = 'STAFFNAME'.
ls_fieldcat-no_out = 'X'.
ls_fieldcat-seltext_l = 'StaffName'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 4.
ls_fieldcat-fieldname = 'STAFFNO'.
ls_fieldcat-no_out = 'X'.
ls_fieldcat-seltext_l = 'StaffNo.'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 6.
ls_fieldcat-fieldname = 'GRADE'.
ls_fieldcat-seltext_l = 'Grade'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 3.
ls_fieldcat-fieldname = 'COUNT'.
ls_fieldcat-seltext_l = 'Headcount'.
append ls_fieldcat to fp_i_fieldcat.
if the field name is 'Salary' then do a sum on this field.
IF fp_fname = c_betrg.
l_wa_fieldcat-do_sum = c_x.
ENDIF.
NOTE : IAM GETTING PROBLEM IN THE BELOW SALARY.
IAM JUST CHECKING ITSELF NOT ALLOWING ME TO EXECUTE
clear ls_fieldcat.
ls_fieldcat-fieldname = 'SALARY'.
ls_fieldcat-seltext_l = 'Salary'.
ls_fieldcat-col_pos = 7.
ls_fieldcat-outputlen = 20.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'CURR'. "CURR
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 9.
ls_fieldcat-fieldname = 'LEAVEPAY'.
ls_fieldcat-seltext_l = 'Leave Pay'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 10.
ls_fieldcat-fieldname = 'MSHORTFAL'.
ls_fieldcat-seltext_l = 'Med.Sfall'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 11.
ls_fieldcat-fieldname = 'ECHKSHFAL'.
ls_fieldcat-seltext_l = 'EX.Chckup.Sfall'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 12.
ls_fieldcat-fieldname = 'OFINDEDUC'.
ls_fieldcat-seltext_l = 'Oth.Fin.Deduction'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 13.
ls_fieldcat-fieldname = 'MTYPREM'.
ls_fieldcat-seltext_l = 'Mat.Premium'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 14.
ls_fieldcat-fieldname = 'VPBONUS'.
ls_fieldcat-seltext_l = 'VP/Bonus'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 15.
ls_fieldcat-fieldname = 'GRATUITY'.
ls_fieldcat-seltext_l = 'Gratuity'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 16.
ls_fieldcat-fieldname = 'VPAY'.
ls_fieldcat-seltext_l = 'Variable Pay'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 17.
ls_fieldcat-fieldname = 'MALLOWANCE'.
ls_fieldcat-seltext_l = 'Meal.Allowance'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 18.
ls_fieldcat-fieldname = 'OVERTIME'.
ls_fieldcat-seltext_l = 'Overtime'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 19.
ls_fieldcat-fieldname = 'OTHER'.
ls_fieldcat-seltext_l = 'Other'.
append ls_fieldcat to fp_i_fieldcat.
pfundeecon
clear ls_fieldcat.
ls_fieldcat-col_pos = 20.
ls_fieldcat-fieldname = 'P FUND EMPLOYEES CONTRIBUTION'.
ls_fieldcat-seltext_l = 'P.Fund.Emp.Contrib'.
append ls_fieldcat to fp_i_fieldcat.
clear ls_fieldcat.
ls_fieldcat-col_pos = 21.
ls_fieldcat-fieldname = 'BANKTRNSFER'.
ls_fieldcat-seltext_l = 'Payment'.
append ls_fieldcat to fp_i_fieldcat.
endform. " st_fieldcat_init
form st_variant_init using st_gs_variant type disvariant
st_repid like sy-repid.
clear st_gs_variant.
st_gs_variant-report = st_repid.
endform. " st_variant_init
form st_comment_build using st_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
Listenüberschrift: Typ H
clear ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = text-000.
append ls_line to st_lt_top_of_page.
endform. " st_comment_build
FORM TOP_OF_PAGE *
form top_of_page.
data: l_i_detailheader type slis_t_listheader.
To get the header for ALV
perform detail_header changing l_i_detailheader.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = l_i_detailheader.
endform. "top_of_page
form detail_header changing fp_i_detailheader type slis_t_listheader.
data: l_wa_header type slis_listheader,
l_v_time type slis_edit_mask,
l_v_date type slis_edit_mask,
l_v_abkrs type char5,
l_v_pabrj type char8,
l_v_pagno type char10.
Local Constants
constants: l_c_h type char1 value 'H',
l_c_1 type i value '1',
l_c_edit type char10 value '__.__.____',
l_c_slash type c value '/'. " constant for slash
To display the report Header
l_wa_header-typ = l_c_h.
WRITE sy-repid TO l_wa_header-info LEFT-JUSTIFIED.
write text-014 to l_wa_header-info left-justified.
append l_wa_header to fp_i_detailheader.
clear l_wa_header.
To display the Page no
l_v_pagno = sy-pagno + l_c_1.
l_wa_header-typ = c_s.
l_wa_header-key = text-008. " Page No:
l_wa_header-info = l_v_pagno.
append l_wa_header to fp_i_detailheader.
clear l_wa_header.
To Display the User ID
l_wa_header-typ = c_s.
l_wa_header-key = text-009. " User ID
l_wa_header-info = sy-uname.
append l_wa_header to fp_i_detailheader.
clear l_wa_header.
To Display the Date/Time
l_wa_header-typ = c_s.
l_wa_header-key = text-010. " Date/Time:
l_v_time = sy-uzeit.
l_v_date = sy-datum.
write: sy-uzeit to l_v_time.
write sy-datum to l_v_date using edit mask l_c_edit.
concatenate l_v_date
l_c_slash
l_v_time into l_wa_header-info+0(25) separated by space.
append l_wa_header to fp_i_detailheader.
clear: l_wa_header, l_v_date.
To Display the Report Description
l_wa_header-typ = c_s.
l_wa_header-key = text-011. " Report Description
l_wa_header-info = text-012.
append l_wa_header to fp_i_detailheader.
clear l_wa_header.
append l_wa_header to fp_i_detailheader.
endform. " detail_header
I will be greatful if any one can please help me in removing me the dump.
REGARDS
LATHA. -
Dump when summing up CURR field in ALV GRID display
Hi All,
I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23. I am using classes and methods to display alv grid.
I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
Here is the part it is throwing dump:
ls_lvc_data-value = space.
clear ls_lvc_data-style.
loop at it_fcat_local assigning <ls_fcat>
where tech ne 'X' and no_out ne 'X'.
if l_invisible eq 'X'.
clear l_invisible.
if <ls_fcat>-do_sum is initial.
continue.
else.
clear ls_lvc_data-col_pos.
endif.
endif.
add 1 to ls_lvc_data-col_pos.
assign component <ls_fcat>-fieldname
of structure <ls_data> to <l_field_value>.
_if sy-subrc ne 0.
message x000(0k).
endif._
Regards,
GuruThomas,
Here is the dump:
Runtime Errors MESSAGE_TYPE_X
Date and Time 10/22/2010 23:30:53
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Long text of error message:
Technical information about the message:
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"SAPLSLVC" or "LSLVCF36"
"FILL_DATA_TABLE"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
Source Code Extract
Line
SourceCde
2708
is_subtottxt_info = ls_subtot_info
2709
ip_subtot_line = lr_data
2710
changing
2711
c_subtottxt = l_subtottxt.
2712
ls_lvc_data-value = l_subtottxt.
2713
2714
append ls_lvc_data to ct_lvc_data.
2715
endif.
2716
2717
2718
Column per Fieldcat Entry
2719
2720
ls_lvc_data-value = space.
2721
clear ls_lvc_data-style.
2722
loop at it_fcat_local assigning <ls_fcat>
2723
where tech ne 'X' and no_out ne 'X'.
2724
if l_invisible eq 'X'.
2725
clear l_invisible.
2726
if <ls_fcat>-do_sum is initial.
2727
continue.
2728
else.
2729
clear ls_lvc_data-col_pos.
2730
endif.
2731
endif.
2732
2733
add 1 to ls_lvc_data-col_pos.
2734
2735
assign component <ls_fcat>-fieldname
2736
of structure <ls_data> to <l_field_value>.
2737
if sy-subrc ne 0.
>>>>>
message x000(0k).
2739
endif.
2740
2741
*... work on average
2742
if <ls_fcat>-do_sum eq 'C'.
2743
Initialize average result and entries
2744
<l_field_value> = 0.
2745
clear l_entries.
2746
2747
retrive unit from fieldcatalog
2748
assign space to <l_unit>.
2749
if not <ls_fcat>-cfieldname is initial.
2750
assign component <ls_fcat>-cfieldname
2751
of structure <ls_data> to <l_unit>.
2752
endif.
2753
if not <ls_fcat>-qfieldname is initial.
2754
assign component <ls_fcat>-qfieldname
2755
of structure <ls_data> to <l_unit>.
2756
endif.
2757 -
Error message when running editable alv
Hi all,
I hava a problem with an editable ALV. I created it with the following method wddoinit:
METHOD wddoinit .
initialize ALV Component
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
Get model data
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA:
l_value TYPE REF TO cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model( ).
set read only mode to false (and display edit toolbar)
DATA: lr_table_settings TYPE REF TO
if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
set cell editor for input fields (~make colum editable)
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_column( 'SAMPLE' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'SAMPLE'.
lr_column->set_cell_editor( lr_input_field ).
ENDMETHOD.
But when I run the Web Dynpro Application I get an error message with the note:
"Access over "Null" Object Reference not possible" ( I translated it from german to english )
The error occures in the line:
lr_column->set_cell_editor( lr_input_field ).
But what is wrong?
Thanks for your help!!
Regards
IngmarSorry. I'm stupid. I didn't the "Sample" for column and field!!!
But:
How can I reach that not only one cell is editable, but the whole table? And how can I save the data that I put in, when I add a new line?
Thanks!! -
Explicit Search Helps Short-Dump in Editable ALV with included structure
I have an editable ALV grid defined as follows:
TYPES: BEGIN OF gs_outtab200.
TYPES: row_indx(4) TYPE n.
TYPES: multipurp TYPE c.
INCLUDE structure zxrfwc_test.
TYPES: end of gs_outtab200.
DATA:
gt_outtab200 TYPE TABLE OF gs_outtab200,
wa_outtab200 TYPE gs_outtab200.
The included structure zxrfwc_test has a component (field) which is defined with a data element that has an explicit search helps associated with it.
I know that this search help is working properly because it works fine in the program's selection screen.
But when I invoke the search help from within a column of the ALV itself, I get a short dump with a "GETWA_NOT_ASSIGNED" error.
I have done plenty of editable ALVs with search helps defined on the data elements and never encountered this problem.
Am I hitting this problem because the zxrfwc_test structure is defined within the
gs_outtab200 structure ??
If not, what is causing this problem. (Please note that I have set ls_fcat-F4AVAILABL = 'X' in the fieldcat routine - this doesn't seem to help at all.)
Please advise!!!!
I'm really stuck on this one because it's always worked before when I'm not dealing with a dictionary structure that's included within a larger ALV structure.
Thanks.Hi,
How you are creating your field catalog?
Try to create a field catalog in the following way giving reference to your structure. is it possible for you create a DDIC structure as same as
TYPES: BEGIN OF gs_outtab200.
TYPES: row_indx(4) TYPE n.
TYPES: multipurp TYPE c.
INCLUDE structure zxrfwc_test.
TYPES: end of gs_outtab200.
* Form f_generate_fieldcatalog *
* Form generate the field catalog table *
form f_generate_fieldcatalog.
* Private variable
data : v_structure like dd02l-tabname. " Table Name
v_structure = c_yatt_alv. " Structure Name
* Build the fieldcat according to DDIC structure YATT_ALV:
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = v_structure
i_client_never_display = c_x
changing
ct_fieldcat = i_fieldcat[].
endform. " F_generate_fieldcatalog
a® -
Dump when changing the value for a field (of 13 decimals) in alv grid.
Hi Group,
Its giving a dump when user is trying to change the value.
dump description: Unable to interpret "70,000 " as a number.
what is happening here is, the original value is 50,000 and he is deleting 5 and replacing it with 7, here its throwing the dump.
If he removes the complete number 50,000 and then gives 70000 its taking the value.
I tried to use, the decimals options in alv field catalog but to no joy.
Please can you give me an advice on this.
Many Thanks.the problem is the comma in the 70,000....that's an alpha character.... Normally, we expect SAP to display numeric fields in a appropriate format, based upon their numeric type, but trying to forcibly insert '70,000' into a true numeric-type field can generate an 'unable to interpret xxx,xxxx as number' error.
You could experiment with changing your ALV column to a char17 (or appropriate width) and putting your numeric value into that to display, then converting back to type P, or other field type in the table, in a column that is not displayed, when the user changes the value.... essentially two columns, one not displayed with a routine to copy/convert the numeric field into the alpha field and the reverse when the field is changed.
But, the better solution is probably for the user to understand that they're seeing a formatted numeric field, and that they need to replace the entire value with the only possible punctuation being a decimal and (if necessary) a negative sign. -
I have set up Photoshop Elements11 as the External Editor in iPhoto just as Terence Devlin said. However when I save the edited photo it does not appear in iPhoto. A drop down menu asks where I want to save the photo and I do not know what to choose. Also should I choose, "save" or "save as"? I should be really grateful for your help.
I suggest opening iPhoto and reverting back to iPhoto in the Preferences for photo editing. Quit iPhoto. Restart your Mac for good measure. Open iPhoto and again choose Photoshop Elements in Preferences as the editing app.
As far as editing, I don't have PE, but I have another editing app form the Mac App Store, ColorStrokes. I have been experimenting with using it for editing iPhoto photos and it works flawlessly. After setting ColorStroke as the editing app, I open a photo in iPhoto and click the Edit button in the menu bar below the photo. Color Stoke immediately opens with the photo and I complete my editing. When I have finished editing I choose to Save the photo, leave the name the same and agree to replace the iPhoto photo of the same name. I quit ColorStroke and the photo in iPhoto now has all of my edits from ColorStroke.
Should I decide that I prefer the original photo, I open the photo in iPhoto and choose Revert to Original in the Photos pulldown menu.
Maybe you are looking for
-
How to convert a .jad file to .class file in JAVA Swings.
Hi all, Sorry for the interruption.I am also facing the same problem.I am using DEJDecompiler.But my application is not J2ME But J2EE.( a Swing application).I opened .class file and made some changes but I dont know how to convert into a .class file
-
Can´t get SWF files to work in DW CS5
I´m doing a personal website with DW CS5. That´s the code for the index.htm page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <he
-
When I click on the stamp to get my e-mails, some of them come up but not all of them. I can open a window and log into aol and see that it shows I have a lot more e-mails that don't appear in my mail application. Also, some e-mails disappear befo
-
I recently updated my 3rd generation I touch to the iOS 5.0.1 and now the battery life is draining so quick. It shuts off with no warning, and I tried to restore the setting but that has not worked. Please help. Any advice would be greatly appreciate
-
Photoshop CS3 freezes up.. Help
Hello, I purchased a psd file from someone. I have purchased many, but I am trying to edit the text and it comes up with a error message and freezes after a while it shuts the program down. I tried this with a different file and it worked nothing fro