Updating database table based on BAPI response in case of error
Dear Experts,
My scenario includes pulling records from database stagging table, and push one record at a time to BAPI_ALM_NOTIF_CREATE.
I am using sender JDBC adapter(with select query and update query to mark records as processed).
My question is : Once XI selects records, immediately status is updated in stagging table for the selected records as processed. what if BAPI could not create document? In this case I need to update status of that record as "Not processed".
What should I use?
If BPM, then please tell me the steps.
Is this possible without BPM?
What are the chances of failure between XI and BAPI?
Please provide your inputs.
Thank you.
Div
>
S.R.Suraj wrote:
> Hi Divyesh,
>
> Your steps are correct..
>
> 1. JBDC will read record with code = 0 and make it 1...
> 2. Once the bapi process is completed all these read records shoudl be made as 2 (if completed successful) else 0 if bapi went into some error.. so that again the jdbc adapter can poll these records and give back to bapi for processing...
>
> Now your questions
> >>So after selection and updation only proxy call will be done right? So for every polling of jdbc adapter ,proxy call will happen?
> YEs every poll of jdbc will result in a proxy call and every time it will contain next set of records (as the earlier one have already marked as 1)
>
> >>How to achieve this?
> Since this is a synchronous scenario JBDC->XI->Proxy and reverse, I have suggested to use responseonewaybean as a module in sender jdbc adapter (because sender jdbc cannot act synchronously thats why you need to use this module)..
>
> >>Do i need to use BPM? please suggest steps.
> and if this is not working then go for BPM..the steps as i mentioned in my first thread..
>
> Regards
> Suraj
Hi Suraj,
Thanks a lot for your support.
It would be good if you can provide your inputs.
Stagging table records status:
Flag = 0 (XI will poll records)
Flag = 1(XI has polled records and XI will se tthis flag by JDBC adapter)
Flag =2 (should be done based on response from Proxy Tables parameter) Proxy will set tables parameter which will include info on error message and type.
(Now based on new requiremets: for error records status should not be reset to 0 so that XI can poll records again, now stagging table should contain error records(for which proxy can not create notification in SAP) with error message and status flag 2)
Now scenario would be JDBC to Proxy.
Polling interval for JDBC adapter should be 1 minute.
So I think status 0 to 1 will be done by XI after immediately selecting records.
But how about Status 2 that has to be set only for error records only and with error information.
I have to update stagging table records with status 2 and error info based on proxy table response. How this can be done?
This updation will be done in case of error only.
I was thinking this aproach:
We can have two interfaces.
First interface will be jdbc to proxy:
JDBC adapter select and update records with flag =1 and then send to proxy call and create document in SAP. At SAP side if document can not be created then they will store that error info in some table.
Second Interfgace:
Client SAP Proxy will periodically run and send these error records info to XI and XI will update stagging table records accordingly.
Suraj, What is your sugestion in this solution? Do I need to use Responseonewaybean?
Thanks Suraj
Div
Similar Messages
-
To modify a field in a database table based record identification by primar
hi
i want to to modify a field in a database table based record identification by primary key filed and two more fields
ie customer (primary key
i want to modify record from intenal table the record existing with primary key field customer
the status field needs to be mofied as " value rolled"
the below code is happening
loop at it_record into wa_Record
wa_inv-customer (primary key) = wa_Record=custome
wa_inv-date = wa_Record-date
...so one
append wa_inv to it_invest
clear wa_inv
endloop.
if not it_invest is initial
modify TABle1 ( this table is data base table which needs to be mofified) based on the primary key field
and also date field and status field which is not primary key.
regards
aroraHi there.
Your requirement is to update a Z Database table from your internal table, right? You have several options:
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable
SET date = wa_inv-date
WHERE prim_key = wa_inv-prim_key
AND any_field = wa_inv-any_field.
ENDLOOP.
or
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable FROM wa_inv. "if wa_inv of same type of dbtable
ENDLOOP.
In the first example, I wrote any field because you can update dbase table, filtering for fields that don't belong to the primary key. However, remember that you will change all records that respect the key you used (so, in your case, use the primary key).
Regards.
Valter Oliveira. -
How to update database table !!!
hi all,
Please advice how to update database table with certain cndition needs to be checked.
Please consider below scenario.
have used enqueu and dequeue function to lock entries and also i have used BAPI so considering that return parameter . i want to update table
/tdk/st0027.
1. I want to update database table
2. there are certain condition needs to be checked like ,
loop at it_final into wa_final.
th_return-type = 'S'.
if th_final-vbeln = /tdk/st0027-vbeln and
th_final-posnr = /tdk/st0027-posnr and
th_final-etenr = /tdk/st0027-sdslno.
above condition which i need to check .and need to append below system fields need to be appended in table.
th_final-prstsind = '20'.
th_final-chgdate = g_date.
th_final-chgtime = g_uzeit.
th_final-chgprog = g_cprog.
th_final-chguser = g_uname.
append th_final to td_final.
update /tdk/st0027 FROM th_final.
endif.
endloop.
but i am getting error saying that "The type od database table and work area (TH_FINAL) are not unicode convertible"?
I am not able to understandwhat would be the solution for this ?
Thanks and regards,
Prasad K. NAralkarThe error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
try to create a structure w.r.t the DDIC table.
Eg: DATA: wa_temp TYPE /tdk/st0027.
MOVE-CORRESPONDING th_final TO wa_temp.
Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table. -
Deleting and updating database table
hi all,
i have to update the database table based on my internal table(both having same structure).
my database has 2 records having a key field 1 and 2 respectively.(2 records)
and my internal table has records with key fields 3, 4 and 5 respectively(3 records) .
i want to delete all data from database table first..
then i want to insert all the three records in the database table..
finally i want my database to have 3 records with key fields 3, 4 and 5 respectively that are in the internal table
what should be the correct way?Hi ,
to delete all the records from dbtab
DELETE dbtab.
to update the database by using internal table
-MODIFY dbtab FROM TABLE itab.
but as per my knowledge structures of internal table and database table should be same
if the database table is a Ztable please change the structure of database table as you said
Put fields 3,4and 5 as key fields
Thanks & Regards,
Sateesh. -
I have 1 million records in application server and I want to update database table from that.
Is UPDATE statement the best technique to do it.
Just wanted to know if there is any other better tehcniques.
Also i want to write the errors to job log. How can we do that?
Regards,
DNPIf they are all new records or all changes, it would be best to use INSERT or UPDATE. You will also want to do mass inserts/changes using an internal table. Since you have so many records, you will probably have to do this in chunks in order to avoid dumping on the rollback area.
Rob -
How to update one table based on another table ??
Hello Friends:
I am trying to run the following query in oracle but it won't run.
UPDATE BOYS
SET
BOYS.AGE = GIRLS.AGE
FROM GIRLS
WHERE
BOYS.FIRSTNAME = GIRLS.FIRSTNAME AND
BOYS.LASTNAME = GIRLS.LASTNAME;
This query runs fine in sql server but in oracle its saying can't find "SET". PLease tell me what is the correct syntax in oracle to update one table based on another table.
thanksSee if this helps.
If you wrote an SQL statement:
update boys set age = 10;
Every row in the boys table will get updated with an age of 10. But if you wrote:
update boys set age = 10
where firstname = 'Joe';
Then only the rows where the firstname is Joe would be updated with an age of 10.
Now replace the 10 in the above statements with (select g.age from girls g where g.firstname = b.firstname and g.lastname = b.lastname) and replace where firstname = 'Joe' in the second statement with where exists (select null from girls g where g.firstname = b.firstname and g.lastname = b.lastname). The same concepts apply whether 10 is an actual value or a query and whether you have a where clause with the update statement to limit rows being updated.
About the select null question regarding the outer where clause:
Since the query is checking to see if the row in the girls table exists in the boys table what the column is in this select statement doesn't matter, this column isn't being used anywhere. In this case Todd chose to use null. He could have also used a column name from the table or a lot of times you'll see the literal value 1 used here. -
Enqueue and Dequeue before updating Database table
Hi all,
We are updating database tables using INSERT, MODIFY and UPDATE statements. Since many people will be running the application at the same time we need to lock the table before updating database table. So we need to use ENQUEUE and DEQUEUE functionality for this purpose.
Can any plz explain what are the steps we should follow now?
Thanks in advance.Hi,
Any Database access should carefully handled as multiple applications may be accessing the database at the same time. To read a record from the database you don't need to implement a lock, but to write you need not only locks but also ideally should use the Update Function Modules to comply SAP "All or Nothing" Principle. This will prevent data inconsistency of the database and the data will be proper state. You need to use the COMMIT WORK and ROLLBACK WORK in you code to handle the consistency part of the database.
The best design approach would be seperate the Database Layer completely from the business layers. This will make your code robust and easy to maintain.
As, for the Locking Concepts, you will get multiple resources from SDN as how to create Locks and implement the Locking modules in your code. But more than that what matters is why and how to implement the SAP Locking concepts to make your application run better.
Have a look at the following link
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Hope this helps.
Thanks,
Samantak. -
Doubt in updating database table
hi all
i want to modify values ztable from a internal table ....
for eg : the ztable contains matnr and accept_qty
matnr qty
mat01
mat02
i need to modify qty of the table .. i am using where condition (ie modify where matnr = ) but where condition is not working for database tables .... how to proceed with this ..
thanks
lokeshhi,
before that :- modify statemnt will modify a record if there is record having the same key like that of record in work area.
if there is no record in itab with key of work area record, it will insert a new record in itab.
look this sample code.
*modify internal table
loop at itab into wa.
wa-field1 = data1.
wa-field2 = data2.
wa-field 3= data3.
modify itab from wa transporting field1 field2 field3 where key_field = wa-keyfield. "there shuld not be any chang in key field.
endloop.
*now update database table
*work area and data base structure shuld be same type
if itab[] is not initial.
modify ztable from table itab.
endif.
rgds
anver
if hlped pls mark points -
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. -
Browse and update database tables
I'm looking for a tool that will let me connect to an Oracle database, select a table and some fields off the table and build a simple java class to navigate / update the data.
Essentially, I'm looking for a tool that replicates the way Microsoft Access can build a form for navigation and update of a database table.
However, I want to use java, not MS Access.
Any ideas if such a tool is available ?
Thankshttp://squirrel-sql.sourceforge.net/
-
Update a table based on Min value of a column of a Another Table.Pls Help.
Dear All,
Wishes,
Actually I need update statement some thing like below scenario...
Data in table is like below:
I wrote a query to fetch data like below ( actually scenario is each control number can have single or multiple PO under it ) (i used rank by to find parent to tree like show of data)
Table: T20
Control_no P_no Col3
19950021 726473 00
19950036 731016 00
19950072 731990 00
731990 01
19950353 734732 00
734732 01
19950406 736189 00
736588 01
736588 02
736588 03
Table : T30
Control_no P_no col3
19950021 726473
19950036 731016
19950072 731990
731990
19950353 734732
734732
19950406 736189
736588
736588
736588
Now requirement is I need to update Table T30's col3 (which do have values in T20 but not this table) in such a way that , It should take MIN (COL3) from T20 and then update that value to related Col3)
Better I can explain through below new data format in T30 after update:
After update it should like:
Table : T30
Control_no P_no col3 (this is updated column)
19950021 726473 00 -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
19950036 731016 00 -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
19950072 731990 00 -- see here..both Pno should updated as '00' as MIN value col3 in Table T20 related to this
731990 00 record is '00' (out of 00,01 it should select 00 and update that value here)
19950353 734732 00 -- same again both Pno should updated as '00' as MIN value col3 in TableT20 related to this
734732 00 record is '00' (out of 00,01 it should select 00 and update that value here)
19950406 736189 00 -- As there is single col3 value in T20, 00 should be updated here.
736588 01 -- Here it should update col3 as '01' since for this pno(736588)
736588 01 -- Here too it should update col3 as 01 per requirement ,minimum value of this pno in T20
736588 01 -- same here too.. Sorry if my post formatting is not good...
Hope i am clear in my requirement..(update T30 col3 based on min value of col3 of related records)
Please suggest some update sql for this...(ideas would be great)
I am using oracle 10 g version soon will be migrated to 11g..
Regards
Prasanth
Edited by: Onenessboy on Oct 20, 2010 12:13 PM
Edited by: Onenessboy on Oct 20, 2010 12:15 PMOnenessboy wrote:
I am really sorry, my post so nonsense in look..
I used to use for actuall code..
the out put i tryped, i used [pre] , [/pre] but still does not look good..
hmm..thanks for your suggestion hoek..
so any ideas about my requirement...I would suggest spending a bit more time trying hoek's suggestion regarding {noformat}{noformat} tags instead of repeatedly asking for more help.
Because to understand your requirement, people are going to have to read it first. -
How to find out who updated database tables
Hi
We are using Oracle Database 10g Release 10.2.0.4.0.
A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?781424 wrote:
Hi
We are using Oracle Database 10g Release 10.2.0.4.0.
A user, via pl/sql developer, has been updating data on our database. This resulted in certain reports not balancing. At that time, we did not have database triggers on the tables concerned. We now need to go back at least a month or more to see who had updated these tables. We have a username, is there any script that we can use? How accurate is v$active_session_history? Would it give us all the info we need?It is little easy to know with AUDITING, or use Log miner to analyze log files. -
Question on updating a table based on report data
Hi all,
I am building a new stock request form for our site and I have a report that provides a listing of all requests that have a status of pending based on supv_approve flag being Null.
I want to be able to update the table BGNA_NEW_STOCK_REQUESTS and set SUPV_APPROVE Flag to either Y or N depending on what the user sets as the value in the report. (by changing the standard report column to a text field and setting it to a named LOV with values Y or N, I can change each row in the displayed report to either be Y or N - but have yet to figure out how you then update the table with those values)
Each row of the report has a unique ID - I just havent figured out how you update a table by chaging the values displayed in a report. I get that I can change the feild type from standard report column to text field but havent figured out how to get an update button to actually update the table once I changed the NULL value to Y or N
any help is greatly appreciated!
Edited by: user8607582 on Aug 10, 2009 1:51 PM
Edited by: user8607582 on Aug 10, 2009 1:58 PMHello Danny,
Add a column to the sql that is something like this:
select apex_item.checkbox(1,<keyfieldname> "Approved", (then the rest of your query for your report).
This will put a check-box on your report. Move it to the beginning of the line for a better user-interface.
When the user clicks the "Submit" button, ONLY those lines that have a check in the box are sent back. Create a process on your page that does the following:
for i in 1..apex_application.g_f01.count Loop
<do the processing of Approved transactions using this syntax for your update processing... where <keyfieldname> = apex_application.g_f01(i);
<set all of the remaining as "N" if you wish or leave the supervisor's approval as NULL>
end loop;
This will then allow you process all of those items that were checked.
I hope this helps,
Don.
You can reward this reply by marking it as either Helpful or Correct :) -
Not updating database table after editing using theADFapplicationJdev10.1.3
Hi
I created the Sample Browse and Edit JSF JSP page oracle ADF application as explained in the cuecards in Jdev10.1.3.
After editing the department table rows in browser i am checking the database tables for the changes.
But my table are still with the old data.they are not updating with the values i changed in the browser.
i followed the steps correctly as explained in cuecards.
where i am going wrong.
What i have to do to commit the changes in to database in my ADFApplication.Did i need anything to add my code.In Jdev 10.1.3,there is no operations folder directly under the Application data module control.
there is only constructors,merge entity,persist entity,refresh entity,remove entity and findalldepartments(),findallemployeeas() nodes under the application data module control.
In findalldepartments,findallemplloyees the operations node is there.under that i don't have the commit .i have only create,execute,first,previous,last,next,delete,removerowwithkey,setcurrentRowWithkey,setcurrentRowWithkeyValue under the operation node.
so how can i commit the operations in database.
Please help me. -
Hi,
My requirement is to update the table EBAN(Purchase Requisition). Let us suppose that there are 3 items in the purchase requisition. If I make any changes to any of the item, the other two items need to be updated with the same changes. I am using a MODIFY....FROM <Internal Table> statement to update the changes in the database,
Now the problem is if I am making any changes in the 3rd item and press save, the database gets updated for 2nd and 3rd item only but the 1st item is not modified in the database.
If I make changes to the 1st item, then the modifications are done to 1st, 2nd and 3rd item and is working fine. The problem is when I make changes to 2nd or 3rd item then the 1st item does not get updated. I tried using update statement, locking table EBAN using ENQUEUE_E_TABLE but nothing worked.
I tried to use MODIFY...FROM <Workarea> inside a loop but it didn't work.
Kindly suggest.
Regards,
Amit BeheraHi
After modifying u append that values work area to internal table.
Maybe you are looking for
-
XML message as input for webservice gives deserialization error
Hi, jDeveloper 10.1.3 BPEL PM 10.1.2.0.2 Carrental example Problem: For the Business Rule Engine I did the Carrental XML example. Based on the java application that connects to the BR engine, I created a webservice in jDeveloper and deployed it to my
-
Organize by Conversation in Mail 6.0 not Working??
Ever since installing Mtn Lion I have noticed a real problem using Mail 6.0 in that 'organize by conversation' seems broken compared to the last version of Apple Mail. Is it just me or have others noted the same problem? What I am now seeing is multi
-
Hi Gurus, When an invoice is created through LIV process(MIRO) , there is a posting to a VAT unpaid account, so for example Vendor Cr 1000, purchase a/c Dr 900, Vat Unpaid A/c 100 Dr. Requirement is that when the payment is made through F110, the ne
-
Dear Experts, I am using New GL Profit Centers. In KEAT activity all values are comparing properly I mean COPA to SD to FI. But PCA values are showing Zero values... I had checked in FI level all values are flowing to PCA properly through Docum
-
No Validity Date in BUS1065 Hired Event
Hi, when <b>bus1065</b> event <b>Hired</b> is triggered from PA40, the key <b>ValidityBegin</b> is not set. Does anybody know why this key is not set and how can I fix the problem? Thanks in advance. /Elvez