How to handle transaction control--- in the dbms query or in JDBC? or BOTH?
Hi all,
we have a servlet application which do insert, update to a few sybase tables. so far we don't have any transaction management control in either store procedure or in JDBC call. i like to know where should we enforce this control logic? in both place or either one is enough?
thanks!!
according to your answer, is it safe to say that we
should NOT
handle transaction control in both query and JDBC
call? i am on the side of JDBC
program control. However our manager feels that if we
handle it in two place, we could be more error-proof.
i don't know how to convince him that only one place
could make it work. Double your rollbacks double your fun! Odd that a manager is getting involved at this level...
Providing transaction control at both places, as a rule makes absolutely no sense at all (to me). I actually believe that this would be far more error-prone (not error-proof). It's really a logistics issue. When you are working on the Java code, you won't have the stored procedure(s) code right there. While you may design it masterfully at first, as maintenance occurs, the mastery can easily be lost as assumptions are made on when and where commit or rollback processing is going to take place. The end result would be a system that could easily corrupt the logical integrity of the database.
If you have to make a decision up front, and you believe performance will ultimately be a concern, then your decision should be to handle transaction management within the stored procedure(s). However, this decision will make the stored procedures far more complex than what the DBA or application staff is familiar with. You would also have to take some care to release resources as appropriate within the Java code.
If you decide to manage transactions within JDBC, it is possible that you will have to move a portion of transaction managment to one or two of the stored procedures. This would be a 'fix' for a poorly performing functionality, and you would simply take care to limit this as much as possible.
I wish I could guide you specifically, but I'm working at 20,000 feet related to your specific application needs.
Similar Messages
-
How to handle multiple selection in the Spark List control with checkbox as itemrenderer?
Hi All,
I am using checkbox as an ItemRenderer in spark list.
I have a query.
how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
how to retrieve the selected item label?
Thank you in advance.Hi there, I'll tweak your code a little bit to something like this:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.controls.CheckBox;
[Bindable]
private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
private function onChange(e:ListEvent):void
if(CheckBox(e.itemRenderer).selected){
mySelectedIndexes.addItem(e.rowIndex);
}else{
mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));
chkList.selectedIndices=mySelectedIndexes.toArray();
]]>
</mx:Script>
<mx:ArrayCollection id="collection">
<mx:Object label="Test A"/>
<mx:Object label="Test B"/>
<mx:Object label="Test C"/>
<mx:Object label="Test D"/>
<mx:Object label="Test E"/>
<mx:Object label="Test F"/>
<mx:Object label="Test G"/>
</mx:ArrayCollection>
<mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox" itemClick="onChange(event);" allowMultipleSelection="true"/>
</mx:Application> -
How to handle Table control in BDC? Difference between BDC & LSMW?
Hi
How to handle Table control in BDC? Difference between BDC & LSMW?
Regards,
RaghuHi ,
the diff b/w normal BDC and with table control is that with table control u can enter as many lineitems as u want..so during recording if u r entering 3 line items..then the program will show (1), (2) and (3) with that.
chane that fixed no to variable.
check that sample code.
in this for new customer...any no of items can be entered.
LOOP AT t_cusdata.
REFRESH t_bdcdata.
ON CHANGE OF t_cusdata-kunnr.
initial screen.
PERFORM bdc_dynpro USING 'SAPMV10A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MV10A-VTWEG'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MV10A-KUNNR'
t_cusdata-kunnr.
PERFORM bdc_field USING 'MV10A-VKORG'
t_cusdata-vkorg. "'HCL'.
PERFORM bdc_field USING 'MV10A-VTWEG'
t_cusdata-vtweg. "'HL'.
DATA: fnam(20) TYPE c,
fnam1(20) TYPE c,
idx(2) TYPE c.
MOVE 1 TO idx.
LOOP AT t_matdata WHERE kunnr = t_cusdata-kunnr.
PERFORM bdc_dynpro USING 'SAPMV10A' '0200'.
CONCATENATE 'MV10A-KDMAT(' idx ')' INTO fnam.
PERFORM bdc_field USING 'BDC_CURSOR'
fnam.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'MV10A-MATNR(' idx ')' INTO fnam1.
PERFORM bdc_field USING fnam1
t_matdata-matnr. "'FIN50'.
PERFORM bdc_field USING fnam
t_matdata-kdmat. "'ABCD'.
idx = idx + 1.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMV10A' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MV10A-MATNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
CALL TRANSACTION 'VD51' USING t_bdcdata MODE 'A' .
UPDATE 'S' MESSAGES INTO t_err_mes.
Regards,
Sonika -
Hi abapers how to handle table control in bdc
hi experts please guide me
how to handle table control in bdc? could u please explain me briefly
thanks and regardssayeed,
Go thru this code it may help you. check bold code for the table control..
report zsunil_bdc
no standard page heading line-size 255.
INTERNAL TABLES *
DATA: BEGIN OF IT_KNA1 OCCURS 0,
CUSTOMER LIKE RF02D-KUNNR,
COMPANY_CODE LIKE RF02D-BUKRS,
ACCOUNT_GROUP LIKE RF02D-KTOKD,
TITLE LIKE KNA1-ANRED,
NAME LIKE KNA1-NAME1,
SEARCH_TERM LIKE KNA1-SORTL,
STREET LIKE KNA1-STRAS,
CITY LIKE KNA1-ORT01,
POSTAL_CODE LIKE KNA1-PSTLZ,
COUNTRY LIKE KNA1-LAND1,
LANGUAGE_KEY LIKE KNA1-SPRAS,
CNTRY LIKE KNBK-BANKS,
BANK_KEY LIKE KNBK-BANKL,
BANK_ACCOUNT LIKE KNBK-BANKN,
REC_ACCOUNT LIKE KNB1-AKONT,
END OF IT_KNA1.
DATA: IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: IT_MESSAGES TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\CUSTOMER.TXT'
OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM HELP_FILE USING P_FILE.
START OF SELECTION *
START-OF-SELECTION.
*UPLOADING THE FILE FROM WORKSTATION
PERFORM UPLOAD_FILE USING P_FILE.
*POPULATING DATA.
PERFORM POPULATE_FILE.
*& Form HELP_FILE
text
-->P_P_FILE text
form HELP_FILE using p_p_file.
DATA: L_FILE TYPE IBIPPARMS-PATH.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = L_FILE.
P_P_FILE = L_FILE.
endform. " HELP_FILE
*& Form UPLOAD_FILE
text
-->P_P_FILE text
form UPLOAD_FILE using p_p_file.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'P_P_FILE'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
data_tab = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
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. " UPLOAD_FILE
*& Form POPULATE_FILE
text
--> p1 text
<-- p2 text
form POPULATE_FILE .
DATA: L_STRING TYPE STRING,
L_COUNTER(2) TYPE N,
V_INDEX TYPE SY-TABIX.
LOOP AT IT_KNA1.
V_INDEX = SY-TABIX.
AT NEW CUSTOMER.
READ TABLE IT_KNA1 INDEX V_INDEX.
IF SY-SUBRC = 0.
perform bdc_dynpro using 'SAPMF02D' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KTOKD'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
IT_KNA1-CUSTOMER.
perform bdc_field using 'RF02D-BUKRS'
IT_KNA1-COMPANY_CODE.
perform bdc_field using 'RF02D-KTOKD'
IT_KNA1-ACCOUNT_GROUP.
*PERFORM BDC_FIELD USING 'RF02D-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02D' '0110'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNA1-ANRED'
IT_KNA1-TITLE.
perform bdc_field using 'KNA1-NAME1'
IT_KNA1-NAME.
perform bdc_field using 'KNA1-SORTL'
IT_KNA1-SEARCH_TERM.
perform bdc_field using 'KNA1-STRAS'
IT_KNA1-STREET.
perform bdc_field using 'KNA1-ORT01'
IT_KNA1-CITY.
perform bdc_field using 'KNA1-PSTLZ'
IT_KNA1-POSTAL_CODE.
perform bdc_field using 'KNA1-LAND1'
IT_KNA1-COUNTRY.
perform bdc_field using 'KNA1-SPRAS'
IT_KNA1-LANGUAGE_KEY.
perform bdc_dynpro using 'SAPMF02D' '0120'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
PERFORM BDC_FIELD USING 'RF02D-D0130'
'X'.
perform bdc_field using 'BDC_CURSOR'
'KNBK-BANKN(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0210'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'KNB1-AKONT'
IT_KNA1-REC_ACCOUNT.
perform bdc_dynpro using 'SAPLRSFH' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'RSIODYNP4-LOW(01)'.
ENDIF.
ENDAT.
L_COUNTER = L_COUNTER + 1.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKS(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-CNTRY.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKL(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-BANK_KEY.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKN(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-BANK_ACCOUNT.
AT END OF CUSTOMER.
READ TABLE IT_KNA1 INDEX V_INDEX.
IF SY-SUBRC = 0.
CALL TRANSACTION 'FD01' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES
INTO IT_MESSAGES.
IF SY-SUBRC <> 0.
PERFORM EMPLOYEEID_ERROR.
*ELSE.
ENDIF.
WRITE: SY-SUBRC.
perform message_format_write.
*ENDIF.
*WRITE: SY-SUBRC.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
ENDIF.
ENDAT.
ENDLOOP.
endform. " POPULATE_FILE
*& Form bdc_dynpro
text
-->P_0224 text
-->P_0225 text
form bdc_dynpro using value(p_0224)
value(p_0225).
IT_BDCDATA-PROGRAM = P_0224.
IT_BDCDATA-DYNPRO = P_0225.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0229 text
-->P_0230 text
form bdc_field using value(p_0229)
value(p_0230).
IT_BDCDATA-FNAM = P_0229.
IT_BDCDATA-FVAL = P_0230.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
endform. " bdc_field
*& Form EMPLOYEEID_ERROR
text
--> p1 text
<-- p2 text
form EMPLOYEEID_ERROR .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'Z50583_REC1'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
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 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
dynprotab = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
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 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
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. " EMPLOYEEID_ERROR
*& Form message_format_write
text
--> p1 text
<-- p2 text
form message_format_write .
DATA: L_MSG(200).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = L_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE: / L_MSG.
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. " message_format_write
~~Guduri -
How to handle table control in BDC while uploading item details for anorder
How to handle table control in BDC while uploading item details for an order?
What is the use of CTU_PARAMS structure in BDC?
In Finance I have done some changes to the layout set by coping to a zscript(duning letter) and how can assign the print program?
What is the process to test the finance script?
How can I see the print preview whether it is coming correctly or not?
Thanks in advance.
Regards.
Abhilash.hi,
for the bdc control refer the following link:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
ctu_params:
refer to the link
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/dataTransfers-LSMW%2CALE%2C+BDC
reward if useful,
thanks and regards -
How to handle Table control in BDC
How to handle Table control in BDC
HI,
Table Control in BDC
HI,
Refer the link:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
The concept is easy: it has to indicate the index of the table control in the field name, so if you have to populate the first record of table control:
BDC-FIELDNAME = <FIELDNAME>(01).
If you fill the second row:
BDC-FIELDNAME = <FIELDNAME>(02).
and so....
Now the problem is usually on how many records you have to load, because u can fill only the rows of table control available in the screen, If you have more records than it can be displayed yuo have to simulate the command to go next page.
The number of recod can be displayed can depend on pc resolution and many program haven't command to go to next page (in this case it could be impossible create a BDC program9.
A way to create a bdc program resolution indipendent is to work on the first and second row.
- Place the first hit in the first row of bdc;
- Place the second insert in the second row of bdc;
- Place the last hit to the top of table control;
- Place the next hit in the second row;
- Place the last hit to the top of table control;
- Place the next hit in the second row;
- .... and so
For more info: Search in SDN with TABLE CONTROL IN BDC.
Will get a lot of related links.
<b>Reward points if this Helps.
Manish</b> -
How to handle table control in lsmw recording method
hi expert please tell me the procedure for how to handle table control in lsmw recording method
Locked for same reason as how to upload data for me01 using LSMW BDC METHOD
Edited by: Matt on May 9, 2011 8:52 AMSri,
just search in SDN search box by giving table control in lsmw you will get hell lot of threads for same.
Amit. -
How to handle Table controls with XD01 in BDC
How to handle Table controls with XD01 in BDC - If there are more than 5/6 records in Table control. - Can any one explain it with a piece of code plz..
Thanks & Regards,
Krishna ChaitanyaHi
check this code...viz for xko1....
DATA: BEGIN OF it_xk01 OCCURS 0,
f1(1),
f2(5),
f3(5),
f4(9),
f5(9),
END OF it_xk01.
DATA: v_count(2) VALUE '00',
v_koinh(14),
v_banks(14),
v_bankn(14),
v_bankl(14),
it_bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE,
wa_ctuparams type ctu_params.
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_f4.
START-OF-SELECTION.
PERFORM upload_data.
END-OF-SELECTION.
LOOP AT it_xk01.
IF it_xk01-f1 = 'H'.
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-KTOKK'
it_xk01-f2.
ENDIF.
IF it_xk01-f1 = 'N'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-PSTLZ'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFA1-ANRED'
'Mr'.
PERFORM bdc_field USING 'LFA1-NAME1'
it_xk01-f2.
PERFORM bdc_field USING 'LFA1-SORTL'
it_xk01-f3.
PERFORM bdc_field USING 'LFA1-PSTLZ'
it_xk01-f4.
PERFORM bdc_field USING 'LFA1-LAND1'
it_xk01-f5.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
ENDIF.
IF it_xk01-f1 = 'I'.
v_count = v_count + 1.
IF v_count le 5.
CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
CONDENSE v_koinh NO-GAPS.
CONDENSE v_banks NO-GAPS.
CONDENSE v_bankl NO-GAPS.
CONDENSE v_bankn NO-GAPS.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING v_banks
it_xk01-f2.
PERFORM bdc_field USING v_bankl
it_xk01-f3.
PERFORM bdc_field USING v_bankn
it_xk01-f4.
PERFORM bdc_field USING v_koinh
it_xk01-f5.
else.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
v_count = 1.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
CONDENSE v_koinh NO-GAPS.
CONDENSE v_banks NO-GAPS.
CONDENSE v_bankl NO-GAPS.
CONDENSE v_bankn NO-GAPS.
PERFORM bdc_field USING v_banks
it_xk01-f2.
PERFORM bdc_field USING v_bankl
it_xk01-f3.
PERFORM bdc_field USING v_bankn
it_xk01-f4.
PERFORM bdc_field USING v_koinh
it_xk01-f5.
ENDIF.
ENDIF.
CLEAR it_xk01.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
wa_ctuparams-DISMODE = 'A'.
wa_ctuparams-UPDMODE = 'S'.
wa_ctuparams-DEFSIZE = 'X'.
CALL TRANSACTION 'XK01' USING it_bdcdata MODE 'A'
UPDATE 'S'.
options from wa_ctuparams.
MODE 'A'
UPDATE 'S'.
*& Form upload_data
text
FORM upload_data .
DATA: lv_infile TYPE string.
lv_infile = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_infile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_xk01.
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. " upload_data
*& Form get_f4
text
FORM get_f4 .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
ENDFORM. " get_f4
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR it_bdcdata.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF FVAL <> NODATA.
CLEAR it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*H 0302
*N sdng dddsj 500020 IN
*I IN ICICI 734897597 xyz
*I IN SBH 768346687 abc
*I IN SBI 345687346 fgh
*I IN SBH 763846878 ujhgf
*I IN HSBC 797893778 fvdg
*I IN HDFC 723678638 fdgf
*I IN 4444 435645646 fgfg
*I IN 3400 763468768 gfgfg -
How to handle multiple request in the servlet
how to handle multiple request in the servlet...
Example:
java forum...
i'm login in the java forum at this time 1000 members make login in this....how happended in servlet?
if we use thread how to implement in servlet ?Serlets are already threaded. The application container instantiates the servlet, then uses this instance in a new thread for every use.
This is the reason that you should use (almost) no instance variables in a Servlet, but rather that (almost) everything should be local to the method. -
How to handle an update of the same record from two different user in JSP
how to handle an update of the same record from two different user
how do you handle an update of the same record from two different users in JSP... if one person updates the record from one drop downs should be updated as well.. is the possible.Usually, if two users try to update the same row at the same time, you want the first to commit to succeed, and when the second commits, they should fail with the error that the row was being concurrently updated. They you may want to show them the new row values and give them the opportunity to merge their values with the new row values...
How can you achieve this? Google optimistic locking. -
How to keep transaction control in a wizard of more than one page
How do I control a transaction across multiple pages with multiple row DML?
I have a complicated business process. I want to build a wizard in my application. For example, to apply for a loan from a bank. A sequence of pages to take the user through a series of steps in the process, click Next and Previous to navigate the pages, click Cancel to undo, click Ok on the final page to commit work.
I know there is a wizard widget in HTMLDB to generate pages 1 .. n in a wizard. But ...
My question is this? How do I control the transaction. How do I stop HTMLDB commiting the steps as I go along. Somehow I want HTMLDB to remember all the information. I want to save everyting or nothing at the end of the process.
I know this works if each page is a form with items. You can build a summary page. But what if a step requires multiple rows.
For example
Step 1 : A report to select Department to a form to Create/Update department
Step 2 : A report to Form to Create/Update/Delete all Employees for that department.
Step 3 : A report to Form to Create/Update/Delete some other thing for that department.
What if
I update department Sales, press Next, delete employee Rod, create employee Jane and Freddy, press Next. I have a change of heart to decide not to hire Jane and Freddy but keep Rod on to give him a second chance so I press Cancel on Step 3. HTMLDB has already saved the changes to the employees. How do I rollback to the original state of the world.
1 ) f_g memory structures? No. I know I can get at a data structure if I use a multiple row update tabular form. Using the htmldb_application.f_g0n index by tables in the database. But I do not think it is possible on page x to get at the arrays for both the current page and the previous page? I dont want to use a tabular form in any case.
2 ) Database Memory Structures ( in package x create type t is table of t%rowtype; ). No.
3 ) Global temporary table ( create global temporary table t .. on commit delete rows )? No.
2 + 3 is not an option because HTMLDB seems to me to use a connection pool. The session in the browser is constant. The session to the database USERENV('SESSIONID') may change every time you click something or refresh the page. In the web model every time you request an action you connect to the database with a new session.
3) My solution. Have a copy of all the relevant tables. Do dml on the copy using the htmldb session as a unique identifier. Then to move the data from the copy tables to the real tables at the end of the process. Hope I catch all the cancel events to delete data from the copy tables. Just in case run a batch job run in the night to clean out the copy tables assuming no one is using the process at the time.
My solution is ugly ! There must be a better way ?Ahhh, sorry for the confusion. What you need are "Collections". If you click the "Review Demonstration Applications" link then install the "Collections Showcase", this should give you a good working sample.
Collections are comprised of an HTMLDB_COLLECTIONS package and an associated table. Use the package for creating a collection and adding members (rows) and use the table to query what's in your collection.
Essentially, here's what you need to do. Let's assume your multi-row form is on page one and you have a confirmation page on page 2:
- Create a process that fires on submit of page one that uses create_or_truncate to create your collection.
- In the same process, loop over your collection items and add them (as members) to the collection.
- Make sure your multi-row form queries from the collections view. This way if you go to page 2, then back to page 1, you will see your rows. When you go to page 2 again, you can just over-write the existing collection. There's another option, but I'll list that later.
- Create a process on page 2 to loop over the collection view and insert the rows into a table. Make this conditional based on the button you press, such as "Save".
- Extra credit: Either the collections package or the htmlb_utilities package as an md5 function. You can call this when querying the data out of the collections table, then call it again as you are looping over the data on submit. Basically, you are checksumming the row on the way out, then again when the page is submitted. If the 2 are equal, the data is unchanged. If they are not equal, the data has changed. Based on your needs, you can use this technique to insert / update records. I have an app that uses this technique because I have a before update trigger on the table that I only want to fire if the user actually updates a particular row.
Hope this helps,
Tyler -
How to handle transaction exception
Hi,
I am using jdev 11g.
I need to catch the exception in my transaction like (table not found, column must not be null, column not found, ...)
hereunder is my code.
public void saveOsaUser(OsaUser osaUser) throws Exception {
EntityManager em = getEntityManager();
try {
utx.begin();
em.joinTransaction();
em.persist(osaUser);
utx.commit();
} catch (Exception ex) {
try {
utx.rollback();
throw new Exception(ex.getLocalizedMessage());
} catch (SQLException sqle) {
throw new Exception(sqle.getLocalizedMessage());
} catch (IllegalArgumentException iae) {
throw new Exception(iae.getLocalizedMessage());
} catch (EJBException ejbe) {
throw new Exception(ejbe.getLocalizedMessage());
} catch (RuntimeException re) {
throw new Exception(re.getLocalizedMessage());
} catch (Exception e) {
throw new Exception(e.getLocalizedMessage());
} finally {
em.close();
}Whatever the error type, i always get the message : Transaction does not exist.
Kindly advice how can handle these SQL error (table not found, column must not be null, column not found, ...)
Regards
Emile BITARRepost
-
How to handle transactions when two different databases are involved.
consider two tables namely Table-A and Table-B part of two different databases namely ORACLE and MYSQL.
Now the project requirement is updating the Table-A(ORACLE) and Table-B (MYSQL) as one transaction. i.e. either update both the tables or rollback both the tables.
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.NareshAnkuskani wrote:
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.No, that is not true.
But anyway, you need to use distributed (XA) transactions. i believe that the latest version (5.0) of mysql actually has support for XA transactions. you need to use a to setup a distributed transaction and attach the connections for the two databases to that transaction. then it should function as you desire. -
How to handle table controls using LSMW
Hi All,
how to use LSMW to handle table control like header and item details eg. VA01 , ME21 etc. To handle these kind of trnasactions can we use LSMW instead BDC to upload data. Please let me know.
Thanks in advance.
Regards,
KalpanaHi Kalpana,
You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
Its little bit complex. You need to register you custom program in table through SM30.
SDX0 - Program Definition ( BI or DI )
SDX1 - Program Assignment
SDX2 - Declaring Structures
SDX3 - Declaring field identifiers for structures
You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
<b>AS</b> -
How to handle transactional data?
Hello,
I try to do a customer analyse with ODM, for that
I collect from some different tables many of attributes,
some of them are transactional.
How I understand the ODM manual, I have to select for
the analyse that the data are in the transactional
format, but what I could do if there are not only 3
different columns, which define the transaction? Whit
other words I have more than one attribute which is
transactional.
Is the right Selection of the data format important for
the results, or could I use the single data format, if I
could not to do that, which alternative I have?
M. NeudeckHi,
What version of ODM are you using.
If you are using ODM 10.1, you have the option of either using the java api or the pl/sql api. Each api has a different approach for handling txn data.
The java api will accept only a single txn format table (case id, name, value). This table can contain a mixture of data that are not of the same metric. You could have quanities, counts, categoricals etc.
The plsql api has a custom object type for nested numericals or nested categoricals that you use to create a nested table as a column. You can create multiple columns as nested tables in your input table for model build.
As to data format, that issue is also api dependent. In java,you can specify the mining type in the mining function setting. In pl/sql, the mining type is based on the data type, so data type is very important.
Thanks, Mark
Maybe you are looking for
-
Battery, 920, drain
I have a Nokia Lumia 920. If I charge it up it may last 20 hours, it may last 4. Im not using the phone. I got an app several months ago i can see battery drain. someitmes its at 2.5%/hour other times it can be at 45%/hour. How can I track down what
-
Blank histories on iPhone 4S and iPad
Please help! I know how to find the history eyeglass icon on my iPad and the folder on my iPhone. But, they are always empty. I used to be able to review searches for a few days back. How do I get that back ?
-
Dear Sir/Madam, How is it possible to amend in Purchase Order when the Purchase order is already approved for Item as well as service order after finally Punching the PO after approval.\ Regards Niladri Bhusan Harichandan
-
Error when turning on Match on Phone, even with the same ID
Like many of you, I keep getting the "You are not currently subscribed to iTunes Match" error when attempting to activate the service on my iPhone and iPad. Initially the ID's were different; it was the confusion for those of us who had both .mac adr
-
IPod Touch Sync Issues - Fails, then 100% CPU
I've been having a problem where when I try to sync my iPod Touch on my computer, it fails some way through, then the CPU is cranked up to 100% and I have to forcibly restart my computer. Ever since I've installed Windows 7 64-bit I've been having sy