Error in updating custom database table using UPDATE SET Command
Hi,
I developed an automated collection system program in one of our clients simulating FBE1 (Payment Advice Creation) and F-28 (Posting of Incoming Payments) transaction codes. Upon posting, we encountered an error in PRD server wherein, for some of the posted items, the STATUS field in our custom table was not successfully updated. We tried to reverse the clearing document and debug the program. Upon posting, we were able to successfully update the status. We could not simulate the error in QAS since all the postings in QAS were successful and all status' relating to these postings were updated as well. We tried posting multiple times and the program seems to be working fine. In PRD, this behavior is just random and there is no specific pattern as to how the error occured. Provided below is the code I used for updating custom table ZFIACSF28. The STATUS field should be equal to '4' once the posting is successful. We are not sure if this is a database related issue. 7 users are authorized to do the postings in PRD and they are using the same user account.
CODE:
CALL TRANSACTION 'F-28' USING gt_bdcdata
MODE 'E'
UPDATE 'S'
MESSAGES INTO gt_messtab.
READ TABLE gt_messtab INTO wa_messtab WITH KEY msgtyp = 'S'
msgnr = '312'.
IF sy-subrc EQ 0.
update status for items cleared bearing the same OR Number*
UPDATE zfiacsf28 SET status = '4'
zsapdocument = wa_messtab-msgv1(10)
zruntime = sy-uzeit
zrundate = sy-datum
WHERE zor = gv_zor
AND customer = gv_customer.
COMMIT WORK.
ENDIF.
Hi,
it's not possible that status isn't updated in zfiacsf28 while date and time are updated there, because it's hard coded.
There must be other programs that also change your table zfiacsf28 and maybe clear those fields. Maybe the key fields zor and customer cannot provide duplicate access, what is the meaning of field zor ?
Please check the where used list of table zfiacsf28 to find other update programs.
Regards,
Klaus
Similar Messages
-
How to update the database table using webdynpro??
Hi,
Can anybody helm me in updating database table....by entering the values on the output screen of webdynpro component??should i use any commit statement in function module ,which i used to update.hi martina....
consider you are having two input fields bound to attr1 and attr2.
now after pressing the save button:
just read teh two attributes to field1, field2 using code wizard. then
<db name>-<fieldname1> = <field1>.
<db name>-<fieldname2> = <field2>.
insert <dbname>.
---regards,
alex b justin -
Add entries to database tables using update function module
Hi All,
I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
Please guide me how to achieve this technically.
Thanks in advance,
Pradipta .Hi,
I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring.... -
I'm new to VS. I have run the following code. It does not produce any error, and it does not add or update data to my Access database table.
dbUpdate("UPDATE prgSettings SET varValue='test' WHERE varSetting='test'")
Function dbUpdate(ByVal _SQLupdate As String) As String
Dim OleConn As New OleDbConnection(My.Settings.DatabaseConnectionString.ToString)
Dim oleComm As OleDbCommand
Dim returnValue As Object
Dim sqlstring As String = _SQLupdate.ToString
Try
OleConn.Open()
MsgBox(OleConn.State.ToString)
oleComm = New OleDbCommand(sqlstring, OleConn)
returnValue = oleComm.ExecuteNonQuery()
Catch ex As Exception
' Error occurred while trying to execute reader
' send error message to console (change below line to customize error handling)
Console.WriteLine(ex.Message)
Return 0
End Try
MsgBox(returnValue)
Return returnValue
End Function
Any suggestions will be appreciated.
Thanks.You code looks pretty good, at a quick glance. Maybe you can simplify things a bit.
For Insert, please see these samples.
http://www.java2s.com/Code/CSharp/Database-ADO.net/Insert.htm
For Update, please see these samples.
http://www.java2s.com/Code/CSharp/Database-ADO.net/Update.htm
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.
Best to keep samples here to VB.NET
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Regardig error while updating the database table
hi experts,
i m trying to update the database table from the values containig in my internal table ,,,but the system is giving this error plz help me::::
The type of the database table and work area (or internal table)
"ITAB_UPDATE" are not Unicode convertible. Unicode convertible.
my internal table name itab_update and the database table name yitab.i m using this statement::
modify yitab from itab_update.Hi
1. You have to Declare the Itab with the same structure as DB table.
2. Use the statement
Modify <DBtable> from TABLE <itab>.
or
Update <DBtable> from TABLE <itab>.
Hope this will solve.
Reward .....if so.
Regards. -
How to update field values in a database table using module pool prg?
hi
how to update field values in a database table using module pool prg?
we created a customized table, and we put 2 push buttons in screen painter update and display.
but update is not working?
data is enter into screen fields and to internal table, but it is not updated in database table.
thanks in adv
vidyaHI,
we already used the update statement. but its not working.
plz check this.
*& Module Pool ZCUST_CALL_REC
PROGRAM ZCUST_CALL_REC.
TABLES: ZCUST_CALL_REC,ZREMARKS.
data: v_kun_low like ZCUST_CALL_REC-kunnr ,
v_kun_high like ZCUST_CALL_REC-kunnr,
v_bud_low like ZCUST_CALL_REC-budat,
v_bud_high like ZCUST_CALL_REC-budat.
ranges r_kunnr for ZCUST_CALL_REC-kunnr .
ranges r_budat for zcust_call_rec-budat.
DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
*data:begin of itab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of itab.
*data:begin of Jtab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of Jtab.
CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
*start-of-selection.
*& Module USER_COMMAND_9000 INPUT
text
MODULE USER_COMMAND_9000 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'ENQUIRY'.
perform multiple_selection.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9001'.
WHEN 'UPDATE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
perform update on commit.
WHEN 'DELETE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module STATUS_9000 OUTPUT
text
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE USER_COMMAND_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
endcase.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Module STATUS_9001 OUTPUT
text
MODULE STATUS_9001 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9002 INPUT
text
module USER_COMMAND_9002 input.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'UPDATE'.
perform move_data.
UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
ENDIF.
WHEN 'DELETE'.
perform move_data.
DELETE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
ENDIF.
endcase.
endmodule. " USER_COMMAND_9002 INPUT
*& Module STATUS_9002 OUTPUT
text
module STATUS_9002 output.
SET PF-STATUS 'ZCUSTOMER1'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_9002 OUTPUT
*& Module update_table OUTPUT
text
module update_table output.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
endmodule. " update_table OUTPUT
***Selection Data
FORM SELECT_DATA.
SELECT mandt kunnr budat code remarks FROM zcust_call_rec INTO
table itab
WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
ENDFORM.
****append vendor code
FORM APPEND_CUSTOMER_CODE.
clear r_kunnr.
clear itab.
clear r_budat.
refresh r_kunnr.
refresh itab.
refresh r_kunnr.
IF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_high
IMPORTING
OUTPUT = r_kunnr-high.
r_kunnr-option = 'BT'.
r_kunnr-sign = 'I'.
append r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
CALL SCREEN '9000'.
ENDIF.
PERFORM V_BUDAT.
ENDIF.
ENDFORM.
FORM V_BUDAT.
IF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'BT'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-HIGH = v_bud_HIGH.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
CALL SCREEN '9000'.
r_budat-low = ''.
r_budat-option = ''.
r_budat-sign = ''.
ENDIF.
ENDIF.
ENDFORM.
*& Form update
text
--> p1 text
<-- p2 text
form update .
commit work.
endform. " update
*& Form move_data
text
--> p1 text
<-- p2 text
form move_data .
clear itab.
refresh itab.
move-corresponding zcust_call_rec to itab.
MOVE ZCUST_CALL_REC-MANDT TO ITAB-MANDT.
MOVE ZCUST_CALL_REC-KUNNR TO ITAB-KUNNR.
MOVE ZCUST_CALL_REC-BUDAT TO ITAB-BUDAT.
MOVE ZCUST_CALL_REC-CODE TO ITAB-CODE.
MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
APPEND ITAB.
delete itab where kunnr is initial.
endform. " move_data
thanks in adv
vidya -
Using Tabstrip update the database table
Hi Guy's,
I created two screens(100 & 110).
Click 1 pushbutton HRP1000 related information is displayed.
Click 2 pushbutton it displays HRP1001 relatd information.
worked to read the data from the Database tables and output displayed sucessfuly . However i want to entered data in those fields wants to update to database table.
Please friends help me how to work this senario.
Thanks and Regards,
Sai.Hi Guy's,
To update the database records, wrote the logic in PAI
WHEN 'SAVE'.
INSERT HRP1001.
INSERT INTO HRP1001 VALUES wa_P2.
it displaying an error message " the work area wa_p2 is not long enough.
and also i tried using it_p2
it displaying an error message " you can't use internal table as work area".
Please help me friends it is very urgent.
Thanks and Regards,
Sai. -
Hi,
I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
I have used program BCALV_EDIT_04 as an example.
I am able to successfully processed inserted or deleted lines using the attributes
MT_DELETED_ROWS
MT_INSERTED_ROWS
but I also want to process modified lines.
I was just wondering whether anyone out there has some example code for this.
I can see that there are the following attributes available
MT_MOD_CELLS
MP_MOD_ROWS.
I would ideally like to use MP_MOD_ROWS rather than MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
If anyone has any example code for this sort of thing, please let me know.
Thanks,
Rubyhi Ruby,
Yes we can use that *data reference variable *.
It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
Check the below code for example -> method refresh_changed_data
screen flow logic.
PROCESS BEFORE OUTPUT.
MODULE pbo.
PROCESS AFTER INPUT.
MODULE pai.
main program.
* CLASS lcl_event_responder DEFINITION *
CLASS lcl_event_responder DEFINITION.
PUBLIC SECTION.
DATA : ls_changed_cell TYPE lvc_s_modi,
lv_language TYPE spras..
METHODS refresh_changed_data FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm.
ENDCLASS. "event_responder DEFINITION
TYPES tt_makt TYPE STANDARD TABLE OF makt.
DATA: go_handler TYPE REF TO lcl_event_responder,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcat TYPE lvc_t_fcat,
gv_language TYPE spras VALUE 'E',
gt_outtab TYPE tt_makt,
gs_tableline TYPE LINE OF tt_makt.
FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'BASIC'.
PERFORM create_and_init_alv CHANGING gt_outtab[]
gt_fieldcat.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
LEAVE PROGRAM.
ENDMODULE. "pai INPUT
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
pt_fieldcat TYPE lvc_t_fcat.
CHECK go_grid IS NOT BOUND.
CREATE OBJECT go_grid
EXPORTING
i_parent = cl_gui_container=>default_screen.
PERFORM build_display_table.
PERFORM build_fieldcat CHANGING pt_fieldcat.
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
* raises the 'data_changed' event when we select another cell/any action after changing the data
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
CREATE OBJECT go_handler.
SET HANDLER go_handler->refresh_changed_data FOR go_grid.
ENDFORM. "CREATE_AND_INIT_ALV
FORM build_display_table.
FREE gt_outtab.
SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
ENDFORM. "build_display_table
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'MAKT'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
ls_fcat-edit = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
ENDLOOP.
ENDFORM. "build_fieldcat
* CLASS event_responder IMPLEMENTATION *
CLASS lcl_event_responder IMPLEMENTATION.
METHOD refresh_changed_data.
ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
LOOP AT <changed_rows> INTO gs_tableline.
BREAK-POINT.
ENDLOOP.
ENDMETHOD. "click
ENDCLASS. "event_responder IMPLEMENTATION
Cheers,
Jose. -
Problem while updating a database table
Hi experts,
I've used the FM 'HR_INFOTYPE_OPERATION' to update the database table. In that i used the MOD operation to update the Infotype PA0315. But it return an error message like "Infotype does not exist". What could be the reason for this error?.
regards,
Shanthi.Hi,
Here is my code for updation.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = P0315-pernr
IMPORTING
RETURN = wf_returne.
Update Mode
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0315'
NUMBER = P0315-PERNR
SUBTYPE = P0315-SUBTY
OBJECTID = P0315-OBJPS
LOCKINDICATOR = P0315-SPRPS
VALIDITYEND = P0315-ENDDA
VALIDITYBEGIN = P0315-BEGDA
RECORDNUMBER = P0315-SEQNR
RECORD = P0315
OPERATION = 'MOD'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = wf_return.
Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0315-PERNR. -
New ABAP Program to check Direct UPDATE in Database Table
Hi all,
As per customer requirement , I have to develop ONE Program which find out that in which ABAP Program , Programmer has used Open Sql command like UPDATE , DELETE , INSERT , MODIFY to direct update in Database Table.
Have a look on all Z-ABAPs, find out if there are statements with "update", "delete", "insert" or "modify" in the coding, then find out if updates to sap-Tables are done
How can I achived that ?
Please , If anybody is having idea , than please let me know..
Thanks You ,Hi
Kindly refer to the below link. This has step by step how you can achieve the checks.
[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/12659a90-0201-0010-c18b-9d014f9bed0d]
But if you want to check if any program they have used 'UPDATE' then you can do like below.
Go to SE38
Utilities---> Find in Source Code-
Find --- UPDATE
In program - Z* or ZX* if you want to search only in Exits
Regards,
Vijay V . -
Update the database table inside an user exit.
Hi Experts,
I have a issue where i have to update a custom table in an User exit.
I am using Lock object for ENQUE/DEQUE.
I have tried to use statements like UPDATE/MODIFY inside the user exit.
But the problem is that it's not updating the database table at the same time.
I know if i use COMMIT WORK it can update at the same time but it's not advisable to use COMMIT inside a work.and also it gives a short dump.
The real issue is that this custom table is read for batch creation at the same time for different users.
Now if it the program does not update the database table at the same time then other users also read the same data and create the same Batch number..
While requirement is to create a different/unique batch numbers.
Program is updating the table but it's taking time..so in between other users are creating the same batch number.
Please guide me what would be the best solution for this.
Regards,
Amit Kumar SinghThanks for your quick reply.
My actually requirement is like that.
I have to create a Process Order using tcode COR1.
After passing some input value it goes inside an User Exit.
There one Custom table is maintained which stores some fields like month,year,numeric key field,etc.
The new batch number is created using the combination of these table fields.
Once a new batch number is created it increment the numeric key field number by one.
Issue is we have to update this new numeric field value into the database field so that other users can read a diffrent numeric field value.hence it will create a new/different batch number.
Here i am not able to update the database table inside this User Exit.
Table is geeting updated but after some time and out of this User Exit.
Please suggest what's required in that case?
Regards,
Amit Kumar Singh
Edited by: Amit Singh on Feb 3, 2009 11:33 AM -
Check which column in database table is updated without hard code
Hi ,
I have a requirement to detect if there is a particular column in the database table is updated , and this column name is found in mapping table ( business logic ) , it will do an insertion to another special table.
My idea is to introduce a trigger before update or delete on this table
However , i would like to make it as dynamic as possible
i dont want to use things as below in trigger if possible
1. if ( old.name <> new.name ) then {
if( 'name' is inside the mapping table ) {
// do some insertion
I want things like
2. if ( there is a column updated on this table ){
1. select column name and updated value that is updated
2. if the column name that is updated is inside the mapping table {
// do some insertion
I am not really sure if the pseudo code listed in no 2 is achieveable in oracle using simple pl/sql or sql ?
if possible , how to do it ?
ThanksHi,
Check the link given below
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm
and search for
IF UPDATING THEN*009* -
Change the data in fieldcat and update the database table in alv oops
Hi,
my requirement is i have displayed a fieldcat in change mode and when i change the data and click on save it has to be updated the database table..
this has to be done using alv oops...Hi,
This code will reflect all the changes into the internal table that is being displayed.
* 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.
Now after this code is executed the internal table is modified as per the changes done in alv output.
Now you can use this internal table to update the database table.
Hope this helps you.
Regards,
Tarun -
Hi All,
i need to do direct update to the database table and the table has apprx 60,000 records . i am getting all records from database table to internal table and has to chnage the one of the field value and pass it to the database table . So i am looping the internal table and what is the best approach to update the database table is it to use UPDATE Pa0001 SET KOSTL = it_0001-KOSTL from table it_0001 each time in the loop to update each record and commit work which hits database for each record or use the statement UPDATE pa0001 from table it_0001 and if count = 1000 then COMMIT work in this way it will hit the database for every 1000 records . Appreciate your suggestions,
Thanks,
Latha.My Code to update PA0006 is :
DATA: t_pa0006 TYPE STANDARD TABLE OF pa0006 INITIAL SIZE 0,
wa_pa0006 LIKE LINE OF t_pa0006,
w_lin TYPE i.
FIELD-SYMBOLS: <fs_pa0006> LIKE LINE OF t_pa0006.
SELECT * FROM pa0006 INTO TABLE t_pa0006 WHERE uname = 'PKHAROR'.
LOOP AT t_pa0006 ASSIGNING <fs_pa0006>.
<fs_pa0006>-stras = 'My Street'.
ENDLOOP.
DESCRIBE TABLE t_pa0006 LINES w_lin.
UPDATE pa0006 FROM TABLE t_pa0006.
IF sy-subrc EQ 0.
COMMIT WORK.
WRITE:/ w_lin, ' Records have been updated..'.
ENDIF.
Reward points for useful answers
Regards
Pradeep
Regards
Pradeep -
Regarding updating of database table..
Halo All,
I have actually done the program successfully for updating the database table QMFE some days back, now we needed to update some more records and i have just changed the path of the text files but the problem is that all the values are being uploaded but the update statement is not executing successfully
I have also tried to debug the program and saw that the sy-subrc value is 4 instead of 0.
I am pasting my code here.
Please solve this asap.
*& Report Y_UPDATE_QMFE_01 *
*& Program Y_UPDATE_QMFE_01 *
*& Author RAMA KRISHNA BASA *
*& Date 02-04-2007 *
*& Description REPORT FOR Update of Table QMFE *
*& Includes *
*& Tables QMFE *
*& Program Maintenance History *
*& Date Author Change Request Number SAP Release *
*& 02-04-2007 BASA EF7K919575 6.10 *
REPORT Y_UPDATE_QMFE .
Tables: qmfe.
data: begin of gt1_qmfe occurs 0,
qmnum like qmfe-qmnum,
fenum like qmfe-fenum,
/itml/usr20 like qmfe-/itml/usr20,
end of gt1_qmfe.
data: begin of gt2_qmfe occurs 0,
qmnum like qmfe-qmnum,
fenum like qmfe-fenum,
/itml/usr21 like qmfe-/itml/usr21,
end of gt2_qmfe.
data: begin of gt3_qmfe occurs 0,
qmnum like qmfe-qmnum,
fenum like qmfe-fenum,
/itml/usr19 like qmfe-/itml/usr19,
end of gt3_qmfe.
data: begin of gt4_qmfe occurs 0,
qmnum like qmfe-qmnum,
fenum like qmfe-fenum,
/itml/usr07 like qmfe-/itml/usr07,
end of gt4_qmfe.
data: gs1_qmfe like line of gt1_qmfe,
gs2_qmfe like line of gt2_qmfe,
gs3_qmfe like line of gt3_qmfe,
gs4_qmfe like line of gt4_qmfe.
data: ls_lines1 type i,
ls_lines2 type i,
ls_lines3 type i,
ls_lines4 type i.
parameters: ip_file1 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\StoDt.txt' obligatory, " usr20
ip_file2 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\RcDtCust.txt' obligatory, " usr21
ip_file3 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\DockDate.txt' obligatory, " usr19
ip_file4 type RLGRAP-FILENAME default 'C:\Urgent\New\Text Files\AWB.txt' obligatory. " usr07
field-symbols: <fs1> like gs1_qmfe,
<fs2> like gs2_qmfe,
<fs3> like gs3_qmfe,
<fs4> like gs4_qmfe.
perform upload_gt1_qmfe.
perform upload_gt2_qmfe.
perform upload_gt3_qmfe.
perform upload_gt4_qmfe.
perform update_qmfe.
*& Form upload_gt1_qmfe
text
--> p1 text
<-- p2 text
FORM upload_gt1_qmfe .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = ip_file1
FILETYPE = 'DAT'
TABLES
DATA_TAB = gt1_qmfe.
describe table gt1_qmfe lines ls_lines1.
write: / ls_lines1.
ENDFORM. " upload_gt1_qmfe
*& Form upload_gt2_qmfe
text
--> p1 text
<-- p2 text
FORM upload_gt2_qmfe .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = ip_file2
FILETYPE = 'DAT'
TABLES
DATA_TAB = gt2_qmfe.
describe table gt2_qmfe lines ls_lines2.
write: / ls_lines2.
ENDFORM. " upload_gt2_qmfe
*& Form upload_gt3_qmfe
text
--> p1 text
<-- p2 text
FORM upload_gt3_qmfe .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = ip_file3
FILETYPE = 'DAT'
TABLES
DATA_TAB = gt3_qmfe.
describe table gt3_qmfe lines ls_lines3.
write: / ls_lines3.
ENDFORM. " upload_gt3_qmfe
*& Form upload_gt4_qmfe
text
--> p1 text
<-- p2 text
FORM upload_gt4_qmfe .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = ip_file4
FILETYPE = 'DAT'
TABLES
DATA_TAB = gt4_qmfe.
describe table gt4_qmfe lines ls_lines4.
write: / ls_lines4.
ENDFORM. " upload_gt4_qmfe
*& Form update_qmfe
text
--> p1 text
<-- p2 text
FORM update_qmfe .
data: ls_cnt1 type i,
ls_cnt2 type i,
ls_cnt3 type i,
ls_cnt4 type i.
*refresh gt1_qmfe.
*clear gt1_qmfe.
loop at gt1_qmfe assigning <fs1> .
*concatenate <fs1>-/itml/usr206(2) '.' <fs1>-/itml/usr204(2) '.' <fs1>-/itml/usr20+2(2) into <fs1>-/itml/usr20.
data wa_qmfe type qmfe.
*select single * from qmfe into wa_qmfe where qmnum = <fs1>-qmnum
and fenum = <fs1>-fenum.
*wa_qmfe-/itml/usr20 = <fs1>-/itml/usr20.
update QMFE set /itml/usr20 = <fs1>-/itml/usr20
where qmnum = <fs1>-qmnum
and fenum = <fs1>-fenum.
*modify qmfe from wa_qmfe.
if sy-subrc = 0.
commit work.
add 1 to ls_cnt1.
endif.
endloop.
write: / ls_cnt1.
*refresh gt2_qmfe.
*clear gt2_qmfe.
loop at gt2_qmfe assigning <fs2>.
*concatenate <fs2>-/itml/usr216(2) '.' <fs2>-/itml/usr214(2) '.' <fs2>-/itml/usr21+2(2) into <fs2>-/itml/usr21.
update qmfe set /itml/usr21 = <fs2>-/itml/usr21
where qmnum = <fs2>-qmnum
and fenum = <fs2>-fenum.
if sy-subrc = 0.
commit work.
add 1 to ls_cnt2.
endif.
endloop.
write: / ls_cnt2.
*refresh gt3_qmfe.
*clear gt3_qmfe.
loop at gt3_qmfe assigning <fs3>.
*concatenate <fs3>-/itml/usr196(2) '.' <fs3>-/itml/usr194(2) '.' <fs3>-/itml/usr19+2(2) into <fs3>-/itml/usr19.
update qmfe set /itml/usr19 = <fs3>-/itml/usr19
where qmnum = <fs3>-qmnum
and fenum = <fs3>-fenum.
if sy-subrc = 0.
commit work.
add 1 to ls_cnt3.
endif.
endloop.
*top_of_page.
write: / ls_cnt3.
*refresh gt4_qmfe.
*clear gt4_qmfe.
loop at gt4_qmfe assigning <fs4>.
update qmfe set /itml/usr07 = <fs4>-/itml/usr07
where qmnum = <fs4>-qmnum
and fenum = <fs4>-fenum.
if sy-subrc = 0.
commit work.
add 1 to ls_cnt4.
endif.
endloop.
write: / ls_cnt4.
ENDFORM. " update_qmfe
Thanks in advance,
rama.Hi,
Thanks for the reply..
But last time the update was successfull and the program was transported onto the productive system
after that now i need to update the new records into QMFE
so what i did is just changed the path of the text files since they are of same format as of the old text files.
Does it have any problems.
How can i do that using what u have suggested......
i need to update the database table QMFE
is there any bapi to update the data base table
Maybe you are looking for
-
After reinstalling Windows Server 2008 R2 EE my SQL 2008 R2 Sp2 Instances have some connection issues. The server were installed under the same hostname, but he got a new sid in my active directory. On the server there one DB Engine MSSQLSERVER, two
-
Silverlight 4 update is not working with Firefox 6.0 (OSX 10.5.8)
I've been trying to install the silverlight 4 plugin, but it doesn't seem to be working with my current version of Firefox (6.0). I've repeatedly attempted to install the silverlight 4 plugin, but each time I go to check and see what version of silve
-
GUI_UPLOAD - Problem in uploading xml file
Hi, I have problem in uploading xml file into itab. Here is the code begin of GS_STRING, STR(72) type C, end of GS_STRING, GT_STRING like standard table of GS_STRING, call function 'GUI_UPLOAD' EXPORTING FILENAME
-
I got a new Mac Mini last week. For some reason, Quicktime never showed up on the preference pane, therefore I cannot add the code I purchased to upgrade it to Pro. I ended up going to another site, and it said a quick fix is to reinstall Quicktime.
-
Multiple Droplets in one pass?
Hello, I've been using Photoshop for a while now, since v.5.5. I'm not new to Actions, batches, droplets and the like. However, I've run into the need to process mulitple files, in a multitude of ways and seem to be hitting a roadblock. The current w