How to change records in standard tables ?
how to change records in standard tables ?
HI,
If you are asking from program..Then you can use BDC or BAPI to update the records in teh standard tables..
OR
use the corresponding tcode to update the record
Thanks
Naren
Similar Messages
-
HOW TO CHANGE DATA IN STANDARD TABLE
PLEASE HELP AS PER ABOVE.
THANKS,
LALITHi,
You can use the statements UPDATE / MODIFY to change the DATA in a database table
UPDATE
The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed.
System fields
The statement UPDATE sets the values of the system fields sy-subrc and sy-dbcnt.
sy-subrc Meaning
0 At least one line has been changed.
4 At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.
The statement UPDATE sets sy-dbcnt to the number of changed lines.
The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback.
MODIFY
ex - modify <dbtab> from TABLE it_tab.
The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.
System fields
The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.
sy-subrc Meaning
0 At least one line is inserted or changed.
4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.
The MODIFY statement sets sy-dbcnt to the number of processed lines.
The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback. -
Inserting record in standard table
Dear Sapians
I want to insert a record in standard table PRPS for testing one scenario. we tried to insert through abap program but we are unable to insert data in the PSPNR field.
Best regards
Sukumaran.Ehi,
check this code it may help u,
TABLES : AFKO,
AFPO.
DATA : BEGIN OF GI_AFKO OCCURS 1,
AUFNR LIKE AFKO-AUFNR,
END OF GI_AFKO.
data gi_AFPO like ZPRODUCT occurs 0 with header line.
*DATA : BEGIN OF GI_AFPO OCCURS 100,
MANDT LIKE
MATNR LIKE AFPO-MATNR,
DWERK LIKE AFPO-DWERK,
END OF GI_AFPO.
DATA: gv_date(11)," LIKE ekpo-aedat,
gv_date1(11),
year(4),
month(2),
day(2),
flag(1),
read_flag(1).
START-OF-SELECTION.
gv_date1 = sy-datum.
year = gv_date1+0(4).
month = gv_date1+4(2).
day = gv_date1+6(2).
year = year - 3.
CLEAR gv_date1.
CONCATENATE year month day INTO gv_date1.
select aufnr
from afko
into table gi_afko
where ( GLTRP <= sy-datum AND gltrp >= gv_date1 ) .
IF SY-SUBRC = 0.
select matnr
dwerk
from afpo
into CORRESPONDING FIELDS OF table gi_afpo
for all entries in gi_afko
where aufnr = gi_afko-aufnr.
ENDIF.
SORT GI_AFPO BY MATNR.
IF NOT GI_AFPO[] IS INITIAL.
MODIFY ZPRODUCT FROM TABLE GI_AFPO.
IF SY-SUBRC = 0.
MESSAGE I003 WITH 'VALUES UPDATED IN TO TABLE ZPRODUCT'.
ELSE.
MESSAGE I003 WITH 'VALUES NOT UPDATED IN TO TABLE ZPRODUCT'.
ENDIF.
regards
siva -
How to update Records from Internal table to u2018Zu2019 table?
Hi Friends,
How to update Records from Internal table to u2018Zu2019 table.
I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
( my internal table & u2018 Zu2019 table structures are same.)
Thanking you.
Regards,
SubashHi,
loop at internal table.
modify <Z- table > from values < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
endloop.
or
UPDATE <Z- table > from table < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
Prabhudas -
How to change tablespace for a table in 10g?
Does anyone know how to change tablespace for a table (like changing tablespace for an index [alter index ... rebuild tablespace ... ])? Many thanks in advance.
alter table tablename move tablespace newtsname;
You need to rebuild the indexes after the move. -
How to make records to the table TRFCQIN
hi all,
anyone can tell me
how to make records to the table TRFCQIN
regardsHi Wanna,
Write a module pool program to enter record into table TRFCQIN.
Take fields to which u want to make entries in module pool.
Use insert command to append data in table TRFCQIN.
Refer this code :
CASE OK_CODE_101.
WHEN 'SAV1'.
TRFCQIN-QNAME = 'XYZ'.
TRFCQIN-QCOUNT = "Screen field name at which user will enter value
INSERT TRFCQIN.
if sy-subrc <> 0.
message e007.
else.
clear TRFCQIN.
clear ok_code_101.
endif.
endcase.
Reward points if helpful.
Regards,
Heamnt -
How to change GUI title in Table maintenance generator?
How to change GUI title in Table maintenance generator?
Thanks
PankajHi,
In table maintenance goto
Environment>Modification>Maintenance screen
Click on layout button
Make editable form
change the text property of column.
save and activate it.
check in sm30 headings.
Pankaj -
How can i use BAPI to insert a few records into standard table
Can anyone help me with how can i use BAPI to insert some records into a standard table from an internal table?
Hi,
First of All try to Explain your Question first.
This is a general question without mentioning the Table you want to Update.
Please give the details before posting a question so it will help people to understand your Problem.
Regards
Sandipan -
How can i use BAPI to insert a few records into standard table usobt_c
I needed to compare the records of this table on two different systems and update the records that were in system A but not in system B into system B. Please give your inputs.
Hi,
First of All try to Explain your Question first.
This is a general question without mentioning the Table you want to Update.
Please give the details before posting a question so it will help people to understand your Problem.
Regards
Sandipan -
How to update Records of SAP table from .CSV file
Hi,
I have written a code which takes a data from (,) delimited CSV file and adds it into the Internal table.
Now I want to update the all fields in SAP table with the Internal table.
I want to use Update statement.
Update <table Name> SET <field needs to update> WHERE connditon.
I don't want to iterate through thousand on record in sap table to check the where condition.
Could you please tell me how to do it.Hi. I thing you will not workaround the iterating of the internal table.
You can pre-load all the records into another internal table
check lt_csv[] is not initial. " important, otherwise next select would read all records of the table
select .... into lt_dbitab for all entries in lt_csv where key-fieds = lt_csv-key_fields...
check sy-subrc eq 0 and lt_dbitab[] is not initial.
then do in-memory update of the it_dbitab
loop at it_dbitab assign <fs>.
read table lt_csv assign <fs_csv> with key ... " lt_csv should be sorted table with key, or you should try to use binary search
if sy-subrc eq 0.
...change required lt_dbitab fields: <fs>-comp = <fs_csv>-comp...
endif.
endloop.
ant then you can do mass-update
update dbtab from table lt_dbitab.
From performance view, this solution should be much faster than iterating lt_csv directly and updating every single database record
Br
Bohuslav -
How to update records in a table based on user selection..
Hi all,
This time the above doubt is totally based on the logic of coding which I tried a lot but didn't get any solution. so atlast I come to sdn site.
please help..
The requirement is like that I have a table with 6 fields (1 primary key and other are nonkeys). If the user inputs some values in the fields on the screen, then a row will be added in the table. Upto this i have done well. but when the user want to change some value in the existing row of the table my program unable to do so. Because I couldn't get any logic to do that as there are 5 nonkey fields, so if any one field is modified then the respective row should be selected first based on the user selection and then it should be updated.
At this point I could not get any idea as it may take a lots of if conditions (I guess) to reach to that particular row.
Please help..
thanks ,
sekharHi Sekhar,
I am afraid, the whole design of your program is wrong, let me explain
Let us say you have two rows(5 non key fields) that the user wants to update and the data in these five non key fields are identical and in your program you are getting a number(which is the key) using a number range object. So you will have two entries in the table for the same data.
And on the update page when the user enters the non key fields, how will the program know(or for that matter any one of us) which record to pick, if you have two identical books and if asked for a book wouldn't you ask which one among these two do you want?
Possible Solution: Identify a possible key maintaining the integrity of the data, that is a combination of the non key fields which will help you identify a unique row and make these fields as key fields in the table.
A more costly solution(if you do not want to change the non key field keys to key fields) would be to, adding a check(using select statement) to see if the non key fields combination already exists in the Z table before inserting a record into the table.
If yes, throw a message to the user and just update the values in the table, else insert the record.
Another solution would be to, use the non key fields to generate a key(using some logic) and using this instead of the number range object.
regards,
Chen -
Is it possible to restrict changing records in customizing table in SM30?
Hi.
Is it somehow possible to set authorizations in a way, that a user could change only certain entries in a customizing table using SM30? What I want to achieve with this - we have an internationally used system, where consultants from different countries are working often on the same customizing tables and we would like to restrict tham to be able to change records only relevant for those countries, so they cannot change the records for other countries by mistake / on purpose. The records are usually identified by a certain "grouping" field (for instance MOLGA in table T511K or MOABW in T554S).
So far I couldn't find anything apart from the S_TABU_DIS object, which is too rough for this requirement.
Or maybe is there another way to achieve security in such a scenario?
Thanks in advance for any ideas.Hi dusan,
1. If u are talking about SM30 for standard table,
then i don't think there is any such standard feature / facility,
for restricting.
2. If its our own Z Table, then we can go for events in table maintenance
and write our code for same.
3. But if such restrictions/validations are required,
then its better to have a module pool for such thing.
SM30 is for very simple and basic table maintenance.
regards,
amit m. -
Update the change record in z table
Hi,
I am doing a module pool programming.If i change the particular record only changed record shd be updated in the z table.
How can i update only changed record in the database table in module pool.
RegardsHi Rasheed,
Use this code to update ztable from the module pool table control, its working.
At screen flow logic
PROCESS BEFORE OUTPUT.
MODULE STATUS_8001.
LOOP WITH CONTROL TAB.
MODULE PASS_DATA. "module to pass data into table control
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_8001.
LOOP WITH CONTROL TAB. "tab is the table control on the screen
MODULE MODIFY_DATA. "module to modify data in internal table
ENDLOOP.
MODULE SAVE_DATA. "module to save the modified data into database table
Design a PF-Status with a SAVE button with function code 'SAVE'.
In PBO
MODULE STATUS_8001 OUTPUT.
SET PF-STATUS 'Z_TABCT'. "pf-status with appropiate buttons
* SET TITLEBAR 'xxx'.
DATA : LINE_COUNT TYPE I.
DESCRIBE TABLE ITAB
LINES LINE_COUNT.
TAB-LINES = LINE_COUNT + 3. "increment the line of table control dynamically so that table control becomes scrollable
ENDMODULE. " STATUS_8001 OUTPUT
MODULE PASS_DATA OUTPUT.
SORT ITAB.
READ TABLE ITAB INDEX TAB-CURRENT_LINE.
ENDMODULE. " PASS_DATA OUTPUT
In PAI
MODULE USER_COMMAND_8001 INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE TO SCREEN 8000.
ENDCASE.
ENDMODULE. " USER_COMMAND_8001 INPUT
MODULE MODIFY_DATA INPUT.
MODIFY ITAB INDEX TAB-CURRENT_LINE.
ENDMODULE. " MODIFY_DATA INPUT
MODULE SAVE_DATA INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'SAVE'.
MODIFY ITAB INDEX TAB-CURRENT_LINE. "update modifed records
UPDATE ZTABLE FROM TABLE ITAB. "update database table from internal table
ENDCASE.
ENDMODULE. " SAVE_DATA INPUT
Hope this solves your problem.
Thanks & Regards
Tarun Gambhir -
How to insert record in sorted table
Hi,
Please tell me how to inser the record in the sorted internal table. This is the code which is not working properly. just tell me what r the changes need to b done.
Thanks,(reward points for sure)
DATA: BEGIN OF connection,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
distid TYPE spfli-distid,
distance TYPE spfli-distance,
END OF connection.
DATA connection_tab LIKE sorted TABLE OF connection
WITH KEY cityfrom
with header line.
SELECT cityfrom cityto distid distance
FROM spfli
INTO connection.
INSERT connection INTO connection_tab.
ENDSELECT.
loop at connection_tab.
write: / connection_tab-cityfrom, connection_tab-cityto, connection_tab-distid, connection_tab-distance.
endloop.
connection-cityfrom = 'Bangalore'.
connection-cityto = 'Delhi'.
connection-cityfrom = 'KL'.
connection-cityfrom = '2500'.
insert connection to connection_tab .
loop at connection_tab.
write: / connection_tab-cityfrom, connection_tab-cityto, connection_tab-distid, connection_tab-distance.
endloop.Hi,
sorry that's by mistake.. but i m getting runtime error if i insert record into sorted table
DATA: BEGIN OF connection,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
distid TYPE spfli-distid,
distance TYPE spfli-distance,
END OF connection.
DATA connection_tab LIKE sorted TABLE OF connection
WITH unique KEY cityfrom
with header line.
SELECT cityfrom cityto distid distance
FROM spfli
INTO connection.
INSERT connection INTO connection_tab.
ENDSELECT.
loop at connection_tab.
write: / connection_tab-cityfrom, connection_tab-cityto, connection_tab-distid, connection_tab-distance.
endloop.
connection-cityfrom = 'Bangalore'.
connection-cityto = 'Delhi'.
connection-distid = 'KL'.
connection-distance = '2500'.
insert connection into table connection_tab .
loop at connection_tab.
write: / connection_tab-cityfrom, connection_tab-cityto, connection_tab-distid, connection_tab-distance.
endloop. -
Activating change documents for standard tables
Hi all,
Can someone please tell me how I can activate change documents for a standard table.
I created a change document object in SCDO and included the standard table I am working with. This table does not have "LOG DATA CHANGES' enabled in its technical settings. I checked the data element of the field I am interested in and it has "Change Document" enabled.
Is there any way to activate change documents for a std table without writing code to create change documents?
Thanks.Hi,
Check this transaction SCU3, this is to activate the change logs for the tables.
Regards,
Satish
Maybe you are looking for
-
How to get recipient n# in pcsuite?
how to get recipient n# in pcsuite? im doing a program that will recieve and send message using C# programming language and pcsuite with my n95, i want to get n# of the recipient so that if my system will recieve a message it will automatically reply
-
My emails no longer show up unless I go to the mail app manually. Never had a problem before this. Help! I have shut off phone I have tried to change the time for how long the mail will show up but nothing is working
-
ERR_WIS_30270 ..when calling a Webi Report ..
Hello, after having installed Webi Clients Tools in XI 3.1 SP2 Version on WIN XP. Every time i try to open a webi Report with the rich Client i get following Error: openDocumentMDP-API (Error: ERR_WIS_30270) I reinstalled Client Tools XI 3.1 and SP2
-
How to recover my Standby databse
Hi every one, I need a suggestion in recovering a standby database which is not in sync with primary for last 2 months. due to server issues we brought down our standby down and made my primary to no archive log mode ( disabled archive log mode). Now
-
I am running MacOS10.3.9,and CS2. I am trying to create a pdf from an excel file, not password protected, and as a sample, only a couple of cells. I created and saved the doc, set up distiller to the settings I wanted, activated the doc, opened proje