Updating Custom table when updating infotype
HI
A custom transaction needs to be created for maintenance of the table in future as the values could change. Whenever infotype 0015 values are changed are updated this custom table values should need to update.Could you please suggest me..
I also suggest you to lock only the entry that will be updated (and not the whole table!) : you will have then far less problems of conflict with updating this table.
For that, you have to create a lock object on your table (via SE11 - for example EZ_MY_TABLE). This will create 2 function modules named ENQUEUE_E<name of your lock object> (in my example ENQUEUE_EZ_MY_TABLE) and DEQUEUE_E<...>.
You can then call those FM like this :
CALL FUNCTION 'ENQUEUE_EZ_MY_TABLE'
EXPORTING
MODE_RSTABLE = 'S'
KEYFIELD1 = ld_keyfield1 " Here are the key values for the entry that you have to update
KEYFIELD2 = ld_keyfield2
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
Best regards,
Samuel
Similar Messages
-
Not Updating Customized Table when System having Performance Issue
Hi,
This is actually the same topic as "Not Updating Customized Table when System having Performance Issue" which is posted last December by Leonard Tan regarding the user exit EXIT_SAPLMBMB_001.
Recently we changed the program function module z_mm_save_hide_qty to update task. However this causes more data not updated. Hence we put back the old version (without the update task). But now it is not working as it used to be (e.g. version 1 - 10 records not updated, version 2 with update task - 20 records not updated, back to version 1 - 20 records not updated).
I tried debugging the program, however whenever I debugged, there is nothing wrong and the data is updated correctly.
Please advise if anyone has any idea why is this happening. Many thanks.
Regards,
JanetHi Janet,
you are right. This is a basic rule not to do any COMMIT or RFC calls in a user exit.
Have a look at SAP note 92550. Here they say that exit EXIT_SAPLMBMB_001 is called in the update routine MB_POST_DOCUMENT. And this routine is already called in UPDATE TASK from FUNCTION 'MB_UPDATE_TASKS' IN UPDATE TASK.
SAP also tells us not to do any updates on SAP system tables like MBEW, MARD, MSEG.
Before the exit is called, now they call 'MB_DOCUMENT_BADI' with methods MB_DOCUMENT_BEFORE_UPDATE and MB_DOCUMENT_UPDATE. Possibly you have more success implementing the BADI.
I don't know your situation and goal so this is all I can tell you now.
Good luck!
Regards,
Clemens -
How to capture userid,date in a custom table while updating a form
Hi,
I have a requirement to insert the userid, the form name and the date on which the record is saved in a custom table while updating a custom form.
We are using Form Builder 6.0.
I am new to Forms and can anyone help me with these?
I would also want to know under which trigger i should be writing the code in.
Thanks in advance.you can use:
usrid := get_application_property(username);
formname := get_application_property(current_form);
dt := to_char(sysdate,'dd/mm/yyyy hh:mi:ss');
you insert these values in on-update trigger at form level -
Best way to update custom table
Hello experts,
Iu2019m writing a report program and after pulling data from a custom table Iu2019m modifying certain fields within internal table and then eventually update custom table. The way Iu2019m updating custom table is working fine. However Iu2019m concern about performance issues because Iu2019m doing update on custom table within loop.
Here is my code for reference.
*& Form update_contracts
text
--> p1 text
<-- p2 text
FORM update_contracts .
Update record in an internal table first
loop at izsc_compliance into wa_zsc_compliance..
wa_zsc_compliance-zapproval = c_accepted.
wa_zsc_compliance-CHANGED_DT = sy-datum.
wa_zsc_compliance-CHANGED_TM = sy-uzeit.
wa_zsc_compliance-CHANGED_BY = sy-uname.
modify izsc_compliance from wa_zsc_compliance index sy-tabix.
write:/ sy-tabix, wa_zsc_compliance-vbeln_new, wa_zsc_compliance-zapproval.
if p_test is initial.
move wa_zsc_compliance to zsc_compliance.
update zsc_compliance.
endif..
endloop.
Write records to database
if p_test = 'X'.
skip.
write:/ 'Test mode'.
endif.
ENDFORM. " update_contracts
Iu2019m not certain if there is any better way by not doing update within loop and update custom table outside this loop.
Many thanks in advance.Hi,
Yes, there is a better way to update the custom table. That will be more performance oriented and will be a much cleaner approach. As, I am not much aware of the custom table structure which you have in your program, the best way that I can suggest is to remove the update statement from that check. I guess you are checking against the mode - test or production. Once you have done the check, put the selected entries in an internal table which is same as database table. And then in a single command - a single array operation as it is commonly called, you can update the custom table.
Have a look at the following link
[Overwriting Several Lines Using an Internal Table|http://help.sap.com/saphelp_bw33/helpdata/en/fc/eb3a94358411d1829f0000e829fbfe/content.htm]
[Inserting or Changing Lines|http://help.sap.com/saphelp_bw33/helpdata/en/fc/eb3ac8358411d1829f0000e829fbfe/content.htm]
You can also scan the forum for multiple links and references and sample examples.
Hope this will help. The above approach will be much more performance oriented and will help to optimize. Also, check where exactly you are providing the locking feature if at applicable in your business functionality.
Regards,
Samantak. -
Populate Custom Table when Posting an Invoice
Hi All,
I need to populate a custom table when an invoice is posted, the custom table needs to hold the actual FI document number. We post invocies via a variety of means, manually through the transactions FB60 and MIRO and in the background via BAPI's.
Does anyone know a user exist/BTE or BADI that can be used to populate a custom table at the time the SAP FI document is posted for an invoice?
Regards
ChrisHi
You can use BADI AC_DOC_POST.. Pardon me, i dont remember the name exactly.. You can search the badis in SE18 based on this name
Ask your abaper to write the code so that when the COMMIT happens, it also updates the Z table
Other Options: BTE 1120
br, Ajay M -
Effects of Updating GRPO table from Update Query..
Hi all,
Wanted to know what are the repercussions of updating GRPO table with Update statement, Basically the client is not selected Project field in the GRPO rows in some of the documents during the Posting. Now the same is to be updated, as Invoices are created for most of them and payments also made document is un-editable.
If i can update using UPDATE statement how will the system react? I know as per SAP guidelines, we cannot update the SAP Tables directly using INSERT or UPDATE statements but wanted to know what is the further effect on postings and SAP as a whole.
Regards
RohanHi,
The using of update, insert or delete are not allowed in SAP B1. If you use it in B1 db, the maintenance contract with you will be stopped and your money will not be returned. The consequence of using the statements is the database inconsistency.
Just an info, SAP AG support will use insert, update and delete statement only if the statements are needed and fix the db inconsistency. E.g., if your user is trying to add sales order and after add, the sales order row is empty and header is not empty. SAP will use the statement to fix the database only if the cause of the error is explained to them. E.g. the server is suddenly shutdown because the power supply is stopped and it made the sales order like that
JimM -
User exit/BADI for updating custom table in MB1B transaction-
Dear All,
When performing a material to material conversion in MB1B transaction for batch managed materials,system is creating a new batch by copying the characteristics of issuing material/batch.The details of the new batch created are updated in standard batch tables(MCH1,MCHA,MCHA).
The requirement is when the new batch is created,the batch details and characteristics has to be stamped in a custom table.
Kindly suggest a user exit/BAIi available for updating the same in the custom table.
Regards,
DeepakDeepak, Exits for MB1B are
MBCF0002 Customer function exit: Segment text in material doc. item
MBCF0005 Material document item for goods receipt/issue slip
MBCF0006 Customer function for WBS element
MBCF0007 Customer function exit: Updating a reservation
MBCF0009 Filling the storage location field
MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1
MBCF0011 Read from RESB and RKPF for print list in MB26
MB_CF001 Customer Function Exit in the Case of Updating a Mat. Doc. -
Updating custom table through table control in module pool
Hi
I am entering a data in the module pool screen in a table control . The functionality is that whatever i enter in a row gets updated in a custom table in the database with the same values . My problem is that when i enter some values and press the save button on the module pool screen , the data gets updated on the table but gets invisible from the module pool screen . The user wants the data to be displayed even after it has been saved ..if anyone can help on this ...
thankshi,
Check whether u have activated the report and screen. -
We have a requirement that when a document is posted, our custom table sould get updated with all details like BELNR and all other relevant details of the document.
Kindly let us know which function module to use. Also the procedure to activate it.
Regards,
Isha.>
Isha Rallan wrote:
> As per my Tech team, this BTE will not be called.
In my early project, i used the same BTE to default some values while posting document.
Not sure what your Tech team is checking. -
How to update the table when change list item in classic report
hi ,
i worked with apex 4.2 and i create normal classic report with one select list(named loved)Column ,now i want to update table when user change the list with new value ,i can't create dynamic action to do this,i create check box with primary key and loop for check item to update the table but i can't get the value of list item. and for more speed the user want to do this when change the list value.
my question
1- how to do this by javascript and get the value from list item and update the table with new value
2- is i must use API to create list item so i can get the value of item in report or what.
Thanks
AhmedI coded the following to give you direction:
1. In the "Element Attributes" section of the DEPTNO column, I call a javascript function as:
onchange = "javascript:updateTable(this);"2. I wrote a simple javascript function that shows an alert when the user changes the select list as:
<script language="JavaScript" type="text/javascript">
function updateTable(pThis)
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
alert('Row# - '+ vRow + ' has the value - ' + pThis.value);
</script>Now, you can call a AJAX on-demand process inside the javascript function to update the database value. -
I'm using a view and am able to create a grid that allows editing of one of the columns. Let's call the table where the column is updated "DepartmentFeeDetail." The view has several joins but up till now the column was editable.
Today I needed to join DepartmentFeeDetail with itself to pick up the debit side of a debit/credit pair. I want to show the gl account number for both
the debit and credit on the same row. I also need to update the value for both debit and credit.
I can no longer edit the column to no surprise. When updating using MSSQLMS I get the following error:
View or function 'MyTestView' is not updatable because the modification affects multiple base tables.
What should my strategy be in lightswitch? The grid is populated by a query that includes my lynq expressions in DepartmentFeeRateQuery_PreprocessQuery. The query may return 1000+ rows. I need to allow the accountant to edit either a single row's column
or enter a value in a field outside the grid and click a button "Apply fee rate to entire page."
All this was working fine until the requirement to show the debit side gl account number and to change the debit side value somehow.
I've tried adding a property to DepartmentFeeDetail but the "Is Computed" property wouldn't allow me to uncheck it. Is there a way to add an editable property for each grid row and initialize it to the
current value of the column returned by the view? I could then update a collection when one of the fields changes. If they change the global value and press "Apply fee rate to entire page"
I can update the collection as well.
Scott MitchellWhat I do is instead of using a View I use a updatable
WCF RIA Service.
This is an example of an updateable method:
public void UpdateQuestionDetailForUser(QuestionDetailForUser objQuestionDetailForUser)
// Get the current user
string strCurrentUserName = System.Web.HttpContext.Current.User.Identity.Name;
// We are under Forms Authentication so if user is blank then we
// are debugging and we are TestUser
if (strCurrentUserName == "")
strCurrentUserName = "TestUser";
// Check for an existing Answer for this Question for this User
var objSurveyAnswer = (from SurveyAnswers in this.Context.SurveyAnswers
where SurveyAnswers.SurveyQuestion.Id == objQuestionDetailForUser.QuestionId
where SurveyAnswers.UserName == strCurrentUserName
select SurveyAnswers).FirstOrDefault();
if (objSurveyAnswer != null)
try // This is an update ****
// Set values
objSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
objSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
// Update LightSwitch Database
this.Context.SaveChanges(
System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
catch (Exception ex)
throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
else // This is an Insert ****
// Query the GetAllQuestionsForUser method because it calculates if a Question
// is Active or not for the QuestionId being inserted
// If it is not in the collection, do not allow the insert
var objUserQuestion = (from QuestionForUser in this.GetAllQuestionsForUser()
where QuestionForUser.UserName == strCurrentUserName
where QuestionForUser.QuestionId == objQuestionDetailForUser.QuestionId
select QuestionForUser).FirstOrDefault();
if (objUserQuestion != null)
try
// Get the Survey Question
var objSurveyQuestion = (from SurveyQuestions in this.Context.SurveyQuestions
where SurveyQuestions.Id == objQuestionDetailForUser.QuestionId
select SurveyQuestions).FirstOrDefault();
// Create a SurveyAnswer object
SurveyAnswer objNewSurveyAnswer = this.Context.CreateObject<SurveyAnswer>();
// Set values
objNewSurveyAnswer.UserName = strCurrentUserName;
objNewSurveyAnswer.Choice = Convert.ToInt32(objQuestionDetailForUser.SelectedChoice);
objNewSurveyAnswer.Comment = objQuestionDetailForUser.Comments;
objNewSurveyAnswer.SurveyQuestion = objSurveyQuestion;
// Update LightSwitch Database
this.Context.SurveyAnswers.AddObject(objNewSurveyAnswer);
this.Context.SaveChanges(
System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
catch (Exception ex)
throw new Exception("Error inserting QuestionId " + objQuestionDetailForUser.QuestionId, ex);
else
throw new Exception("Error inserting Answer. Answer is not marked Active.");
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
http://LightSwitchHelpWebsite.com -
Can't update master table when creating a materialized view log.
Hi all,
I am facing a very strange issue when trying to update a table on which I have created a materialized view log (to enable downstream fast refresh of MV's). The database I am working on is 10.2.0.4. Here is my issue:
1. I can successfully update (via merge) a dimension table, call it TABLEA, with 100k updates. However when I create a materialized view log on TABLEA the merge statement hangs (I killed the query after leaving it to run for 8 hrs!). TABLEA has 11m records and has a number of indexes (bitmaps and btree) and constraints on it.
2. I then create a copy of TABLEA, call it TABLEB and re-created all the indexes and constraints that exist on TABLEA. I created a materialzied view log on TABLEB and ran the same update....the merge completed in under 5min!
The only difference between TABLEA and TABLEB is that the dimension TABLEA is referenced by a number of FACT tables (by FKs on the FACTS) however this surely should not cause a problem. I don't understand why the merge on TABLEA is not completing...even though it works fine on its copy TABLEB? I have tried rebuilding the indexes on TABLEA but this did not work.
Any help or ideas on this would be most appreciated.
Kind Regards
Mitesh
email: [email protected]Thats what I thought, the MVL will only read data that has changed since it was created and wont have the option to load in all the data as though it was made before the table was created.
From what I have read, the MVL is quicker than a Trigger and I have some free code that prooved to work from a MVL using it as a reference to know what records to update. There is not that much to a MVL, a record ID and type of update, New, Update or Delete.
I think what I will have to do is work on a the same principle for the MVL but use a Trigger as this way we can do a full reload if required at any point.
Many thanks for your help. -
Updating Custom Table Only in Debug Mode
Hi All!
I have been encountering issues in updating a custom table. It would work successfully only in debug mode otherwise it won't update an entry in the table.
This is the piece of code that would update an entry in the table specifically used in a user exit. The functionality of this code is to automatically remove a transportation block:
SELECT SINGLE *
INTO wa_zblock
FROM zblock
WHERE zzblknum EQ c_tr01
AND vbeln EQ p_lvbeln
AND zzprocessed EQ space.
IF sy-subrc EQ 0.
DO.
CALL FUNCTION 'ENQUEUE_E_TABLES'
EXPORTING
MODE_RSTABLE = 'S'
TABNAME = c_lzblock
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF sy-subrc EQ 0.
wa_zblock-zzprocessed = c_x.
wa_zblock-zzapproveby = sy-uname.
wa_zblock-zzapproveon = sy-datum.
MODIFY zblock FROM wa_zblock.
if sy-subrc EQ 0.
COMMIT WORK AND WAIT.
endif.
EXIT.
ENDIF.
ENDDO.
CALL FUNCTION 'DEQUEUE_E_TABLES'
EXPORTING
MODE_RSTABLE = 'S'
TABNAME = c_lzblock.
ENDIF.
How can I make this update the custom table successful in undebugged mode? Please let me know your thoughts on this.
Thanks!I also suggest you to lock only the entry that will be updated (and not the whole table!) : you will have then far less problems of conflict with updating this table.
For that, you have to create a lock object on your table (via SE11 - for example EZ_MY_TABLE). This will create 2 function modules named ENQUEUE_E<name of your lock object> (in my example ENQUEUE_EZ_MY_TABLE) and DEQUEUE_E<...>.
You can then call those FM like this :
CALL FUNCTION 'ENQUEUE_EZ_MY_TABLE'
EXPORTING
MODE_RSTABLE = 'S'
KEYFIELD1 = ld_keyfield1 " Here are the key values for the entry that you have to update
KEYFIELD2 = ld_keyfield2
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
Best regards,
Samuel -
Update customizing table on the production
Hi all,
Ik maked a customizing table on the development environment.
Evert time i need to update the data of this table , then i have to do it on the development and then tranport it to the production via a transport request.
Is it possible to change this (setting) table in the production, without using the transporting request ?
I changed the properties of the table from C (Customizing)
to A ( Application table), but it doenst help.
Anyone have a suggestion ?
Thanks,Goto Development system-> again change settings from C to A,use database utility ->activate and adjust database.
now delete table maintaince and re create table maintaince,now transport your request to production,it should be fine now.
Thanks
Seshu -
Strange issue in updating custom table after upgrade ECC6.0! Please help!
Hello everyone:
I have some code (shown below) that deletes and updates some SAP tables and one custom table:
DELETE T5UBV FROM TABLE DEL_T5UBV.
DELETE ZCHRZIP FROM TABLE DEL_ZCHRZIP.
MODIFY ZCHRZIP FROM TABLE WRITE_ZCHRZIP.
MODIFY T5UBV FROM TABLE WRITE_T5UBV.
COMMIT WORK.
For SAP table the code above works fine but for custom table it overrides all exisiting data! It should keep some existing data in custom table ZCHRZIP and append any extra data from internal table WRITE_ZCHRZIP. This functions as designed if I run in fore ground but in background it just overrides instead of modifying and appending! This is happening only after upgrade ECC6.0. Any thoughts? Please let me know.
Thanks.
MithunMithun,
Comment below code
DELETE ZCHRZIP FROM TABLE DEL_ZCHRZIP.
<b>Reward if it helps,</b>
Satish
Maybe you are looking for
-
Nautilus is not working in gnome3
Hello everyone, I'm trying to open a nautilus window in gnome3 but it's not working and I don't know what's going on. I've some folders in Desktop and I can open nautilus there but in Activities --> Files nothing happens. In the terminal I run nautil
-
Urgent : pROBLEM IN CONDITIONS in smart forms
Hello abapers I am giving condition for displaying of a text in smart form . the text is in secondary window. Previously I have given 3 conditions as var1 = value or val2 = value or val3 = value. but now when i am adding 4th condition i am getting wr
-
Document Management System API Required
helo can any one tell me that is there any Java API available for document management system plz tell me from where i have to download it plz its urgent
-
I have a blog on my site with Youtube embedded videos on it. I created a feed from feedburner. I now understand Youtube videos are not compatible with iTunes. blog is located at: http://www.productivitycubed.com/blog/ 2 questions: 1. Is there a v
-
Hi, I am getting the following error when trying to manage the Secure Store Service (CMA -> Application Management -> Service Applications -> Manage Service Applications) "Cannot complete this action as the Secure Store Shared Service is not respondi