Updating record using table contorl
hi ABAPers,
i have a problem while updating the record to a database table from table control,
please,check the code writtern,
Code in Top include:
Tables: MARA,
MAKT.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX,
END OF ITAB.
*data:ok_code(20).
CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 2000.
*DATA: cols LIKE LINE OF TC1-cols,
lines TYPE i.
Screen_1000:Code in PAI:
module USER_COMMAND_1000 input.
CASE SY-UCOMM.
WHEN 'DISPLAY'.
SELECT SPRAS MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = MARA-MATNR.
IF SY-DBCNT IS INITIAL.
MESSAGE I127(ZKC_MSGCLS).
ELSE.
SET SCREEN 2000.
ENDIF.
WHEN 'EXIT'.
LEAVE PROGRAM.
SET SCREEN 0.
ENDCASE.
endmodule. " USER_COMMAND_1000 INPUT
Screen_2000:Code in PBO:
module ctrl_pai output.
MOVE-CORRESPONDING ITAB TO MAKT.
endmodule. " ctrl_pai OUTPUT
Screen_2000:Code in PAI:
module USER_COMMAND_2000 input.
CASE SY-UCOMM.
WHEN 'UPDATE'.
LOOP AT TC1-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY TC1-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'EXIT'.
LEAVE PROGRAM.
SET SCREEN 0.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
endmodule. " USER_COMMAND_2000 INPUT
Screen_2000:Code outside PBO
LOOP AT itab WITH CONTROL TC1 CURSOR TC1-TOP_LINE.
MODULE ctrl_pai.
ENDLOOP.
Screen_2000:Code outside PAI
LOOP AT itab.
ENDLOOP.
regards,
vinod
Hi,
Go thro' the coding in this link.It will help you.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
Message was edited by:
Jayanthi Jayaraman
Similar Messages
-
How to update record in Table control
Dear Friends,
I have table control that has space for 10 records but i need to update 15 record from the flat file which is getting into the table how can i do this.
Regards,
MAHENDRA.Hi,
you record for an item and then click on page down and save it.use the loop on this bdc to populate the the bdc table no need to do manually.
LOOP AT l_i_dettab_item INTO l_wa_dettab_item..
l_cursor = l_cursor + 1.
IF l_cursor GT 1.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
ENDIF.
PERFORM cursor_pos_notation USING 'V_EAN_DET001- GTIN_VARIANT_TYP'
l_cursor
CHANGING l_cursor_notation.
PERFORM cursor_pos_notation USING 'V_EAN_DET001-VTWEG'
l_cursor
CHANGING l_cursor_notation.
PERFORM bdc_field USING l_cursor_notation
l_wa_dettab_item-vtweg.
PERFORM cursor_pos_notation USING 'V_EAN_DET001-DATEFROM'
l_cursor
CHANGING l_cursor_notation.
PERFORM bdc_field USING l_cursor_notation
l_v_date.
PERFORM bdc_field USING 'BDC_CURSOR'
l_cursor_notation.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
ENDLOOP.
Here my ok code for page down is =P+ so i am looping on the table control data and then populating the bdc table after this i will populate the remaing info required for the call transaction and refresh bdcdata.
thats it no need to do recording 1000 times.
now if u do like this it doesn't depend on the number of records on table control.
it will take all the records.
Reward if useful.
Regards,
sasi
Regards,
sasi -
Update record using SQL statement
I have VB6.0 and Oracle 10G Express Edition in Windows 2000 Server. My procedure in VB 6.0 can't update record in the table using SQL statement, and the Error Message is " Missing SET keyword ".
The SQL statement in VB6.0 look like this :
General Declaration
Dim conn as New ADODB.Connection
Dim rs as New ADODB.Recordset
Private Sub Command1_Click()
dim sql as string
sql = " UPDATE my_table " & _
" SET Name = ' " & Text3.Text & " ' " & _
" AND Unit = ' " & Text2.Text & " ' " & _
" WHERE ID = ' " & Text1.Text & " ' "
conn.Execute (sql)
Private Sub Form Load()
Set conn = New ADODB.Connection
conn.Open "Provider=MSDASQL;" & "Data Source=my_table;"& "User ID =marketing;" & "Password=pass123;"
I'm sorry about my language.
What's wrong in my SQL statement, I need help ........ asap
Best Regards,
/Harso AdjieThe syntax should be
UPDATE TABLE XX
SET FLD_1 = 'xxxx',
FLD_2 = 'YYYY'
WHERE ...
'AND' is improperly placed in the SET. -
Create / update record in table T499S - Locations
Hello,
I would like to update/create some records in table t499s but cannot find a BAPI for this. Does someone know how to change the table and related addresses or do I have to change the tables the hard way via modify?
Thanks a lot,
VanessaHello Vanessa,
I have created a program that create / modify / delete Locations in T499S.
Creation:
- Create an address with a standard FM
- Create a line in T499S
Modification or deletion
- Modify or delete a line in T499S
I also add the modification in a transport order.
In my opinion, the better way is to do a call transaction.
Please reward if useful.
René -
Hi,
By registering the populated java object with the unit of work will insert a new record in the database.How about updating an existing record using UOW?
If any sample code, it will be very helpful.
thanks
vasuhttp://otn.oracle.com/products/ias/toplink/technical/unitOfWorkWP.pdf
http://otn.oracle.com/products/ias/toplink/index.html
http://download-west.oracle.com/docs/cd/B10464_01/index.htm -
Updated records using Dynamic FORMS_DDL
Hello everybody:
I need help for you guys. I'm working with Form9i and created a push button that when I press it, it should be updated some record depending of some conditions. I read that with dynamics FORMS_DDL, I can able to perform it, but when I put the below code in the âWHEN-BUTTON-PRESSEDâ trigger I get an âErrorâ that meaning that the forms was not success. Please, somebody tell me where is the error. Thanks.
if (:CONTROL_BTN.CHK_FINAL = 'N') then
forms_ddl('update aapt_checklists
set achk_reviewed_date = ' || :CONTROL_BTN.DATE_LETTER ||
' where achk_item in (select achk_item
from aapt_checklists, aapt_reviews
where ' || :global.where_updated ||
' and achk_reviewed_date is null
and achk_1st_notification_date is null
and arev_seq = achk_arev_seq)
and achk_1st_notification_date is null
and achk_reviewed_date is null');
end if;
if (form_success) then
message('OK');
else
message('Error');
end if;You don't need dynamic SQL for that. Here is what you can do (Note the new v_fmt variable, and the update SQL below):
DECLARE
def_where varchar2(500) := NULL;
v_month varchar2(2) := :CONTROL_BLOCK.Q_MONTH;
v_day varchar2(2) := :CONTROL_BLOCK.Q_DAY;
v_year varchar2(4) := :CONTROL_BLOCK.Q_YEAR;
v_fmt varchar2(10);
v_date varchar2(20) := NULL;
PROCEDURE check_date (in_date IN varchar2) IS
al_id Alert;
al_button Number;
temp_date date := NULL;
BEGIN
temp_date := to_date(in_date, 'MM/DD/YYYY');
EXCEPTION
when others then
al_id := Find_Alert('CFG_ERROR');
Set_Alert_Property(al_id, alert_message_text, 'You have selected an Invalid Date');
al_button := Show_Alert( al_id );
raise FORM_TRIGGER_FAILURE;
END;
BEGIN
-- Criteria entered as MM/DD/YYYY
if (v_month <> '00') and (v_day <> '00') and (v_year <> '0000') then
v_date := v_month||'/'||v_day||'/'||v_year;
v_fmt := 'MM/DD/YYYY';
check_date (v_date);
-- Criteria entered as MM/DD
elsif (v_month <> '00') and (v_day <> '00') and (v_year = '0000') then
v_date := v_month||'/'||v_day;
v_fmt := 'MM/DD';
check_date (v_date||'/'||'2000'); -- Hardcoded 2000 to check all possible MM/DD combos including Leap Year
def_where := ' to_char(arev_appl_received_date, ''MM/DD'') = ''' || v_date || '''';
-- Criteria entered as MM/YYYY
elsif (v_month <> '00') and (v_day = '00') and (v_year <> '0000') then
v_date := v_month||'/'||v_year;
v_fmt := 'MM/YYYY';
def_where := ' to_char(arev_appl_received_date, ''MM/YYYY'') = ''' || v_date || '''';
-- Criteria entered as MM
elsif (v_month <> '00') and (v_day = '00') and (v_year = '0000') then
v_date := v_month;
v_fmt := 'MM';
def_where := ' to_char(arev_appl_received_date, ''MM'') = ''' || v_date || '''';
-- Criteria entered as DD/YYYY
elsif (v_month = '00') and (v_day <> '00') and (v_year <> '0000') then
v_date := v_day||'/'||v_year;
v_fmt := 'DD/YYYY';
def_where := ' to_char(arev_appl_received_date, ''DD/YYYY'') = ''' || v_date || '''';
-- Criteria entered as DD
elsif (v_month = '00') and (v_day <> '00') and (v_year = '0000') then
v_date := v_day;
v_fmt := 'DD';
def_where := ' to_char(arev_appl_received_date, ''DD'') = ''' || v_date || '''';
-- Criteria entered as YYYY
elsif (v_month = '00') and (v_day = '00') and (v_year <> '0000') then
v_date := v_year;
v_fmt := 'YYYY';
def_where := ' to_char(arev_appl_received_date, ''YYYY'') = ''' || v_date || '''';
end if;
update aapt_checklists
set achk_reviewed_date = :CONTROL_BTN.DATE_LETTER
where achk_item in
in (select achk_item
from aapt_checklists, aapt_reviews
where to_char(arev_appl_received_date,v_fmt) = v_date
and achk_reviewed_date is null
and achk_1st_notification_date is null
and arev_seq = achk_arev_seq)
and achk_1st_notification_date is null
and achk_reviewed_date is null;
--Condition for updated records in aapt.checklists table
:global.where_updated := def_where;
--Only when "INCOMPLETE - NEED ADD'L INFO" Status is selected
def_where := def_where || ' and arev_status = 1427';
END; -
Unable to update records in table
Hi all,
While updating particular set of records in a table system gets hanged however it is allowing to update rest of record.i checked lock using
v$locked_object ,v$session but i cud't find any..is there any way to find lock at all levels.
thanksGrab your sid of the session that you are running via sys_context('USERENV','SID') or something else and then check out the wait events, and locks:
select * from gv$lock where sid = <sid>;
select * from gv$session_wait where sid = <sid>;P.S. Watch for triggers... YUCK!
Message was edited by:
JoeC -
Update data using table contol in bdc
please anyone can help me in this code i.e how to update the database yusing table control please make changes in my code if required
this is my code
report ZTEST_XK01
no standard page heading line-size 255.
*include bdcrecx1.
***************PARAMETERS DECLERATIONS*********
PARAMETERS : P_file type rlgrap-filename, P_FILE1 TYPE RLGRAP-FILENAME
**************internal table decleration*******
data : bdcdata type standard table of bdcdata with header line.
data : begin of t_lfa1 occurs 0,
lifnr like RF02K-LIFNR,
BUKRS LIKE RF02K-BUKRS,
EKORG LIKE RF02K-EKORG,
KTOKK LIKE RF02K-KTOKK,
ANRED LIKE LFA1-ANRED,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
AKONT LIKE LFB1-AKONT,
ZTERM LIKE LFB1-ZTERM,
END OF T_LFA1.
DATA : BEGIN OF T_LFBK OCCURS 0,
BANKS LIKE LFBK-BANKS,
BANKL LIKE LFBK-BANKL,
END OF T_LFBK.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE1
start-of-selection.
data : v_file type string.
move p_file to v_file.
data : e_file type string.
move p_file1 to e_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = v_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_LFA1
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
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 FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = E_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_LFBK
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at t_lfa1.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
t_lfa1-lifnr.
perform bdc_field using 'RF02K-BUKRS'
t_lfa1-bukrs.
perform bdc_field using 'RF02K-EKORG'
t_lfa1-ekorg.
perform bdc_field using 'RF02K-KTOKK'
t_lfa1-ktokk.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SORTL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-ANRED'
t_lfa1-anred.
perform bdc_field using 'LFA1-NAME1'
t_lfa1-name1.
perform bdc_field using 'LFA1-SORTL'
t_lfa1-sortl.
perform bdc_field using 'LFA1-LAND1'
t_lfa1-land1.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
loop at t_lfbk .
data : val(2) type c.
data :v_fil type c.
concatenate 'lfbk-banks(' val ')' into v_fil.
perform bdc_field using v_fil
t_lfbk-BANKS.
concatenate 'lfbk-bankl(' val ')' into v_fil.
perform bdc_field using v_fil
t_lfbk-BANKl.
val = 01.
val = val + 1.
if val > 5.
val = 5.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKL(val)'.
perform bdc_field using 'BDC_OKCODE'
'ENTR'.
perform bdc_field using 'LFBK-BANKL(val)'
v_fil.
perform bdc_field using 'LFBK-BANKS(val)'
v_fil.
*perform bdc_field using 'LFBK-BANKS(02)'
'IN'.
*perform bdc_field using 'LFBK-BANKS(03)'
'in'.
*perform bdc_field using 'LFBK-BANKS(04)'
'in'.
*perform bdc_field using 'LFBK-BANKS(05)'
'in'.
*perform bdc_field using 'LFBK-BANKL(02)'
'00000142'.
*perform bdc_field using 'LFBK-BANKL(03)'
'sunny'.
*perform bdc_field using 'LFBK-BANKL(04)'
'sunny'.
*perform bdc_field using 'LFBK-BANKL(05)'
'sunny'.
*perform bdc_dynpro using 'SAPMF02K' '0130'.
*perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
endif.
endloop.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
'160000'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-ZTERM'
'0001'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'Hi,
you can check the following piece of code.
*Batchinputdata of single transaction
DATA : tbl_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
*Input records
DATA : BEGIN OF tbl_input OCCURS 0,
lifnr LIKE lfa1-lifnr, "Account number of vendor or
banks LIKE lfbk-banks, "Bank country key
bankl LIKE lfbk-bankl, "Bank key
bankn LIKE lfbk-bankn, "Bank account number
koinh LIKE lfbk-koinh, "Account holder name
bvtyp LIKE lfbk-bvtyp, "Partner bank type
banka LIKE bnka-banka, "Name of bank
stcd3 LIKE lfa1-stcd3, "Tax number 3
scacd LIKE lfa1-scacd, "Standard carrier access code
zwels LIKE lfb1-zwels, "List of the Payment Methods to be
"Considered
lnrzb LIKE lfb1-lnrzb, "Alternate payee
iban LIKE tiban-iban, "IBAN (International Bank Account
" Number)
valid_from(10) TYPE c, "Start of IBAN validity
swift LIKE bnka-swift, "SWIFT Code for International
"Payments
bukrs LIKE zgroup_code_xref-bukrs,
"Company code
land1 LIKE t001-land1, "Country
END OF tbl_input.
*Constants
*CONSTANTS
CONSTANTS: c_tcode TYPE tstc-tcode VALUE 'XK02', "For holding
"the TCODE
c_keep(1) TYPE c VALUE 'X', "To hold X
c_tabctrl TYPE i VALUE '6', "For holding
c_and TYPE c VALUE '&',
c_tab TYPE x VALUE '09'.
START-OF-SELECTION *
START-OF-SELECTION.
IF p_appser NE 'X' .
*Download from presentation server
PERFORM pres_file_download .
ELSE.
*Download from application server
PERFORM appl_file_download.
ENDIF.
DESCRIBE TABLE tbl_input LINES w_rec.
*Banking details upload
IF p_bank = 'X'.
IF NOT tbl_input[] IS INITIAL.
PERFORM data_fetching.
ELSE.
WRITE : text-017.
EXIT.
ENDIF.
PERFORM data_validation.
PERFORM final_data_prep.
IF p_test NE 'X'.
<b> PERFORM bdc_data_load</b>.
ENDIF.
*Linking alternate payee
ELSE.
IF NOT tbl_input[] IS INITIAL.
PERFORM data_fetching_zalt.
ENDIF.
PERFORM data_validation_zalt.
PERFORM final_data_prep_zalt.
PERFORM zalt_data_load.
ENDIF.
*& <b>Form bdc_data_load</b>
FORM bdc_data_load.
PERFORM open_group.
DATA : l_cnt(2) TYPE n. "TIR-70118
SORT tbl_final BY lifnr bukrs.
SORT tbl_lfbk BY lifnr.
LOOP AT tbl_final.
AT NEW bukrs.
PERFORM 1_screen.
PERFORM cursor_location.
ENDAT.
PERFORM table_control.
l_cnt = l_cnt + 1. "TIR-70118
AT END OF bukrs.
*Begin of addition for TIR-70118
MOVE l_cnt TO tbl_lfbk-cnt.
tbl_lfbk-lifnr = tbl_final-lifnr.
COLLECT tbl_lfbk.
SORT tbl_lfbk BY lifnr.
CLEAR l_cnt.
*End of addition for TIR-70118
PERFORM last_screen.
PERFORM insert_bdc.
REFRESH tbl_bdcdata.
ENDAT.
ENDLOOP.
PERFORM close_group.
ENDFORM. " bdc_data_load
*& <b> Form 1_screen</b>
FORM 1_screen.
PERFORM bdc_dynpro USING 'SAPMF02K' '0101'.
PERFORM bdc_field USING : 'BDC_CURSOR'
'RF02K-D0215',
'BDC_OKCODE'
'/00',
'RF02K-LIFNR'
tbl_final-lifnr,
'RF02K-BUKRS'
tbl_final-bukrs,
'RF02K-D0110'
'RF02K-D0120'
'X',
'RF02K-D0130'
'X',
'RF02K-D0215'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING : 'BDC_CURSOR'
'LFA1-TXJCD',
'BDC_OKCODE'
'/00'.
*Begin of changes for TIR-70118
IF NOT tbl_final-stcd3 IS INITIAL.
PERFORM bdc_field USING : 'LFA1-STCD3'
tbl_final-stcd3.
ENDIF.
IF NOT tbl_final-scacd IS INITIAL.
PERFORM bdc_field USING : 'LFA1-SCACD'
tbl_final-scacd.
ENDIF.
*End of changes for TIR-70118
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
ENDFORM. " 1_screen
*& <b> Form cursor_location</b>
FORM cursor_location.
DATA : l_times TYPE i.
CLEAR tbl_lfbk. "TIR-70118
READ TABLE tbl_lfbk WITH KEY lifnr = tbl_final-lifnr
BINARY SEARCH.
IF sy-subrc = 0.
l_times = tbl_lfbk-cnt DIV 5.
w_count = ( tbl_lfbk-cnt MOD 5 ) + 1.
DO l_times TIMES.
PERFORM page_down.
ENDDO.
ELSE.
w_count = 1.
ENDIF.
CLEAR l_times.
ENDFORM. " cursor_location
*& <b> Form table_control</b>
FORM table_control.
CONCATENATE 'LFBK-BANKS(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING 'BDC_CURSOR'
w_fld1.
CLEAR w_fld1.
IF NOT ( tbl_final-banks IS INITIAL ). "TIR-70118
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
CONCATENATE 'LFBK-BANKS(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-banks.
CLEAR w_fld1.
CONCATENATE 'LFBK-BANKL(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-bankl.
CLEAR w_fld1.
CONCATENATE 'LFBK-BANKN(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-bankn.
CONCATENATE 'LFBK-KOINH(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-koinh.
CONCATENATE 'LFBK-BKONT(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-bkont.
CONCATENATE 'LFBK-BVTYP(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-bvtyp.
CONCATENATE 'LFBK-BKREF(' w_count ')'
INTO w_fld1.
PERFORM bdc_field USING w_fld1
tbl_final-bkref.
CLEAR w_fld1.
IF NOT tbl_final-swift IS INITIAL.
PERFORM swift_screen.
ENDIF.
IF NOT tbl_final-iban IS INITIAL.
PERFORM iban_screen.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
<b> w_count = w_count + 1.
IF w_count EQ c_tabctrl.
w_count = 1.
PERFORM page_down</b>.
ENDIF.
ENDIF.
ENDFORM. " table_control
*& <b> Form page_down</b>
FORM page_down.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_dynpro USING 'SAPMF02K'
'0130'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDFORM. " page_down
*& Form <b>Insert_BDC</b>
This form takes the transaction code and populates the data
FORM submit_bdc .
**Function module that takes the TCODE and populate the data
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = c_tcode
TABLES
dynprotab = tbl_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
*Incase of error while populatin data
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. "End of Submit_bdc
I think this code can help for you, let me know if any doubts.
Reward with points, if it helpful for u.
Regards,
Vijay -
Update records using Pl/Sql procedure
Hi
I have wriitten a stored procedure to update the Organisation_Name in a table based on the Full_Org_Nm of an another table.
Though the procodure got executed sucessfully but it is not updating the records.
I even tried executing the procedure by writing Execute <Procedure name>,the database got hanged.
Please find my procedure below.
Create or Replace
PROCEDURE UPDT_ISSUE_USR_ROLE
As
Cursor cur_user_role Is
Select a.org_id,a.user_id
from prts_user a,issue_user_role b
where a.user_id=b.user_id;
v_rows_processed Number:=0;
Begin
For rec in cur_user_role Loop
update Issue_user_role
set User_org_nm=(Select full_org_nm from VW_Org where org_id=rec.org_id)
Where Issue_User_Role.rowid in
(select issue_user_role.rowid
FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
Where Issue_User_Role.Issue_Id=Issue.Issue_id
And Issue_User_Role.Issue_id=issue_workflow.issue_id
And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
And Issue.Issue_id=Issue_workflow.Issue_Id
And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And issue_workflow.primry_workflow_flag='Y'
And issue_user_role.user_id = rec.user_id
And issue.issue_status_id in (1636,50738,275,50737,2090)
And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
End Loop;
COMMIT;
dbms_output.enable;
dbms_output.put_line('There were '||v_rows_processed||' rows updated');
End;
Please let me know where i am wrong.
Thanks in advance.
CheersHi Blushadow
Now if i want to update say only 10 records at a time what should i put into my Proc?
Please go thru my Proc below..
CREATE OR REPLACE PROCEDURE PRTS.UPDT_ISSUE_USR_ROLE
As
Cursor cur_user_role Is
Select a.org_id,a.user_id
from prts_user a,issue_user_role b
where a.user_id=b.user_id;
upd_rec cur_user_role%rowtype;
v_rows_processed Number:=0;
Begin
Open cur_user_role;
Loop
Fetch cur_user_role into upd_rec;
If cur_user_role%NOTFOUND
Then
Exit;
Else
update Issue_user_role
set User_org_nm=(Select full_org_nm from VW_Org where org_id=upd_rec.org_id)
Where Issue_User_Role.rowid in
(select issue_user_role.rowid
FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
Where Issue_User_Role.Issue_Id=Issue.Issue_id
And Issue_User_Role.Issue_id=issue_workflow.issue_id
And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
And Issue.Issue_id=Issue_workflow.Issue_Id
And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And issue_workflow.primry_workflow_flag='Y'
And issue_user_role.user_id = upd_rec.user_id
And issue.issue_status_id in (1636,50738,275,50737,2090)
And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
If Mod (v_rows_processed,v_rows_processed)=10
then
COMMIT;
End if;END IF;
End Loop;
Commit;
dbms_output.enable(1000000);
dbms_output.put_line('There were '||v_rows_processed||' rows updated');
Close cur_user_role;
End;
I would appreciate if you can let me know any other alternative way to meet this requirment.
Cheers
Vineet -
DataProvider unable to update records in table
Hi guys,
as above, I have got this piece of code below.
What happen is I am unable to update the records in one of the dataprovider - "objectidsDataProvider" (used to keep track of no. of items in itemsDataProvider).
If I take away the objectidsDataProvider coding; I am able to update the itemsDataProvider.
Please kindly advice and let me know if any additional info needed. Thanks in advance.
CODE:
int newItemId = 0;
if (itemsDataProvider.canAppendRow()) {
try {
RowKey rowKey = itemsDataProvider.appendRow();
itemsDataProvider.setCursorRow(rowKey);
// put the new data in the data provider
itemsDataProvider.setValue("ITEMS.ID", new Integer(0));
itemsDataProvider.setValue("ITEMS.USERNAME", uname);
itemsDataProvider.setValue("ITEMS.TITLE", title);
newItemId = ((Integer)objectidsDataProvider.getValue("MAXITEMID")).intValue();
objectidsDataProvider.setValue("OBJECTIDS.ID", new Integer(newItemId));
objectidsDataProvider.commitChanges();
// Navigate through rows with data provider
if (itemsDataProvider.getRowCount() > 0) {
itemsDataProvider.cursorFirst();
do {
if (itemsDataProvider.getValue("ITEMS.ID").equals(new Integer(0))) {
itemsDataProvider.setValue("ITEMS.ID", new Integer(newItemId));
} while (itemsDataProvider.cursorNext());
itemsDataProvider.commitChanges();
} catch (Exception e) {
log("Cannot add new DVD", e);
error("Cannot add new DVD: " + e.getMessage());
return "success";
} else {
return "fail";
SELECT * FROM DVD.OBJECTIDS
TABLE_NAME ID
items 28
SELECT * FROM DVD.ITEMS
ID USERNAME TITLE
1 John 300
...RowKey rowKey = itemsDataProvider.appendRow();
itemsDataProvider.setCursorRow(rowKey);
// put the new data in the data provider
itemsDataProvider.setValue("ITEMS.ID", new Integer(0));
itemsDataProvider.setValue("ITEMS.USERNAME", uname);
itemsDataProvider.setValue("ITEMS.TITLE", title);try to use this :
RowKey rowKey = itemsDataProvider.appendRow();
itemsDataProvider.setCursorRow(rowKey);
// put the new data in the data provider
itemsDataProvider.setValue("ITEMS.ID", rowKey ,new Integer(0));
itemsDataProvider.setValue("ITEMS.USERNAME", rowKey ,uname);
itemsDataProvider.setValue("ITEMS.TITLE",rowKey , title);and dont forget to end ur code with ,,, commiteChanges();
Hope this will help
Good luck
Mohammed -
UPDATE records using Database Conectivity toolset
I´m using LabVIEW 8.5 & Database Connectivity toolset ver 1
When I try to update a record of a MS ACCESS 2003 with the SQL UPDATE TablenName SET field1=newvalue, field2=newvalue........WHERE condition=x, I get the error -2147217900 Exception occurred in Microsoft Jet DataBase engine: Sintax error in the instruction UPDATE.vi ComExec (8.5 bug Workaround)vi.
I ´dont think I have made a sintax error. If the field is an string I use the 'newvalue' following by a comma, in case of numeric field just the coma. For instance :
UPDATE TableName SET Name='John', Age=22,Hair='blond' WHERE height=1.85
I have discarded the reserved word´s problem, as I can insert records in the data base without any problem
Any idea to solve the problem
Thanks
SimbaniDid you try it like this?
UPDATE TableName SET TableName.Name='John', TableName.Age=22,TableName.Hair='blond' WHERE TableName.height=1.85 -
Updating records using self join or row number function
IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
GO
CREATE TABLE #Temp
ID INT
, CYear INT
, Val INT
, Descrp Varchar(10) NULL
, Cd INT
, ToBeUpdated Varchar(5) NULL
INSERT INTO #Temp
ID
, CYear
, Val
, Descrp
, Cd
, ToBeUpdated
SELECT 2014, 2013, 111, 'ABC', 2, NULL
UNION
SELECT 2014, 2014, 111, 'XYZ', 2, NULL
UNION
SELECT 2014, 2014, 222, 'TTT', 3, NULL
UNION
SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
UNION
SELECT 2014, 2014, 333, 'VVV', 5, NULL
SELECT * FROM #Temp
ORDER BY Val, CYear
All, I have the above #table. You'll notice that there are duplicate values in "Cd" column i.e. "Cd=2".
If the values in ID, Val and Cd are same then, I want to update the "CodeFlag" column for those records with "Descrp" column of
the recent CYear. So, my "ToBeUpdated" column would have a value of "XYZ" for both the records where Cd=2 (Since, XYZ is the Descrp for CYear 2014(the latest one))
Also, if the values in ID and Val column are same but values in "Cd" is different, then ToBeUpdated = Descrp of that particular record. In my case the "ToBeUpdated" value for Cd=4 would be "ZZZ" and for Cd=5, it would be "VVV"
since the ID and Val column values are same for those records. Let me know if you have any questions.IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
GO
CREATE TABLE #Temp
ID INT , CYear INT , Val INT , Descrp Varchar(10) NULL , Cd INT , ToBeUpdated Varchar(5) NULL)
INSERT INTO #Temp
ID , CYear , Val , Descrp , Cd , ToBeUpdated)
SELECT 2014, 2013, 111, 'ABC', 2, NULL
UNION
SELECT 2014, 2014, 111, 'XYZ', 2, NULL
UNION
SELECT 2014, 2014, 222, 'TTT', 3, NULL
UNION
SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
UNION
SELECT 2014, 2014, 333, 'VVV', 5, NULL
;with mycte as (SELECT *, row_number() Over(partition By ID, Val , Cd order by CYear DESC) rn
, row_number() Over(partition By ID, Val order by Descrp) rn1
FROM #Temp)
SELECT m1.ID ,m1.CYear,m1.Val,m1.Descrp , ToBeUpdated=d.descrp from mycte m1
Cross apply (Select Top 1 descrp from mycte m2 WHERE m2.id=m1.ID AND m1.Val=M2.Val AND m1.cd=m2.cd AND m1.rn>=m2.rn) d(descrp) -
How can I delete and update records using where conditions?
I want to delete and update the coherence records with some conditions, I describe it to use SQL as follows:
delete from "contacts" where getStreet() = "dsada";
update contacts set getStreet() = "dddd" where getCity() = "ssss";
Can I use the filter like query to achieve this requirement as follows:
ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
ChainedExtractor::createExtractors("getHomeAddress.getState"));
Object::View voStateName = String::create("MA");
Set::View setResults = hCache->entrySet(
EqualsFilter::create(vHomeStateExtractor, voStateName));
I know I can use get and put to achieve this requirement , but it Requires a two-interaction between the client and coherence server. Does it have And another way?
Thanks very much, and please Forgive my English is not very good.Hi,
You have a couple of options for updating or deleting using a Filter.
For deleting you can use an Entry Processor and the cache invokeAll method. Using "out of the box" Coherence you can use the ConditionalRemove entry processor. I'm a Java person so the C++ below might not be exactly right but you should get the idea.
ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
ChainedExtractor::createExtractors("getHomeAddress.getState"));
Object::View voStateName = String::create("MA");
hCache->invokeAll(EqualsFilter::create(vHomeStateExtractor, voStateName),
ConditionalRemove::create(AlwaysFilter.getInstance());For update you would either need to write custom Entry Processor implementations that perform the updates you require or you can use out of the box POF or Reflection ValueUpdaters that update specific fields of the entries in the cache. These valueUpdaters would be wrapped in an UpdaterProcessor so the call would be very similar to the code above.
JK -
Hello,
I have two tables, ROAD and ROAD_PARSED. I have created a view ROAD_V that contains the fields from ROAD and ROAD_PARSED that I want to to update in ROAD.
CREATE VIEW ROAD_V AS SELECT A.ID, A.PREF, A.NAME, A.TYPE, A.DIR, B.PREF "BPREFIX", B.NAME "BNAME", B.TYPE "BTYPE", B.DIR "BDIR"
FROM ROAD A, ROAD_PARSED B
WHERE A.ID=B.ID;
Then I entered my update statement: UPDATE ROAD_V SET PREF=BPREFIX, NAME=BNAME, TYPE=BTYPE, DIR=BDIR;
I got this error: +"ORA-01779: cannot modify a column which maps to a non key-preserved table".+ ROAD has a spatial index on ID and ROAD_PARSED has a unique on ID, and there are not other unique fields in my table. How do I go about adding a unique index to ROAD when i have already indexed ID?
The only thing I can think of to work around it is to create a new field in ROAD, populate it with a sequence starting at 1 and assign a unique index to it, insert those values into ROAD_PARSED, and then run the update. This sounds unnecessary...but is it the right way?Hi Beaver,
You can find examples and explanations regarding your error here:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:548422757486
and/or
http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22ORA-01779%22 -
JDBC- How Update record using preparedStatement() into MS Access?
Actually i got an error when i update the record,The setString() Parameter are stored in terms of arrays .
The Error is
ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC Microsft Access Driver] Syntax Error in UPDATE StatementActually i got an error when i update the record,The
setString() Parameter are stored in terms of arrays
The Error is
ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC
Microsft Access Driver] Syntax Error in UPDATE
Statement
Believe the error message - your SQL syntax is wrong.
Either fix it or post what you have and get some advice.
%
Maybe you are looking for
-
My iPad no longer appears in the iTunes desktop app, so I can't sync or transfer files? I also have an iPod Touch. It appears in iTunes but willnot sync... "unknown error 1723" This is a recent problem. Everything was fine initially, and I don't thin
-
Why can't I add anything from my library to my iPhone?
I have some music on my computer in my iTunes library. When I try to add it to my iPhone I get an error message which says no songs in the iTunes library can be copied to my iPhone. The only thing I could think of was to make sure the computer is aut
-
I have been trying to figure out how to parse a String that I receive from a remote server. I receive the String as an InputStream which I then wrap in a BufferedReader. //make URL connection //populate requestString //send requestString to URL conne
-
Error in proxy servlet implementation
Hi all, I have implemented a simple proxy servlet. My requirement is whenever a call is made to the servlet , the servlet must make a http call to the particular site, make a request for the content and then display the same in the browser. At presen
-
Abap guys working on HR module
hi all, i got a form named- DEVP (Standard remuneration form (India) ) this form is standard one and in this how i can get the logo of the company. this form is related to HR module for indian payroll. thanks