‎2007 Oct 17 4:12 PM
Hi all.
Issit possible to insert only one column of record in the table.
Assume i had this student table. Inside this table there are 2 column call: Name and address.
Can i jus insert the 5 name in this name column without insert any value to the address column.
Example
Name | address
ken
peter
john
Ali
Jan
‎2007 Oct 17 4:14 PM
Yes you can do that, you can have entries in just one column.
For eg: ITAB-FIELD1 = <NAME1>.
INSERT ITAB.
Hope this helps.
ashish
‎2007 Oct 17 4:17 PM
okie...i gt another pro here. My table is a dynamic table. Hw can i do to insert a column?
‎2007 Oct 17 4:19 PM
You can use field symbols for the same. It will be easy to tell if you tell your complete requirement.
‎2007 Oct 17 4:23 PM
I create a dynamic table . I will fetch out all the fields from the table. Next i will validate the field if that particular field need to insert a default value. How can i do it? Hope i am clear in my explanation
‎2007 Oct 17 4:28 PM
not really ? what do you mean with dynamic table ?? is it really a table or is it just a variable of type table ??
if its a variable use append to add values
kind regards
arthur
‎2007 Oct 17 4:38 PM
The dynamic table is create because the user can enter any tablename in the input field. The dynamic table will contain the structure of the tablename. Later my code will retrieve all the field from the table. All the field will go thru a validation if the field need to insert a default value.
example
all the field retrieve out, and only field contact need a default value. the default value is 999.
Contact | Name | Age
999
999
999
999
999
I need to insert 999 in my contact 5 time.
hw can i do it?
‎2007 Oct 17 4:48 PM
I believe you have all fields of a table in an internal table.
Declare a field symbol - assign value of the dbtable-fieldname to this field symbol.
Now to this field whatever value you want to assign, do the assignment.
Then use insert command to insert the record. You need another field-symbol which will contain dynamic db table name.
ashish
‎2007 Oct 17 4:51 PM
what's the purpose of a user creating a name for a table in SAP and create a table with that name ??
kind regards
arthur
‎2007 Oct 17 4:51 PM
‎2007 Oct 17 4:55 PM
No, i don't have a code for this. But with the flow logic i think you can go ahead. If you face any problems, post here and we will be able to help you out.
ashish
‎2007 Oct 17 4:56 PM
‎2007 Oct 17 4:14 PM
Hi,
Yes you can do that Just don't pass any value to that field in internal table which you will be using to update the table.
Regards,
Atish
‎2007 Oct 17 4:14 PM
if you make address not obligatory or a key field then yes you can
kind regards
arthur
‎2007 Oct 17 4:19 PM
Hi,
You can insert values into one column in the table using below code :
Insert the customer Robinson in the current client:
DATA: wa TYPE student.
wa-name = 'Robinson'.
INSERT INTO scustom VALUES wa.
Thanks,
Sriram Ponna.