Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Insert a single column record

Former Member
0 Likes
1,254

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

14 REPLIES 14
Read only

Former Member
0 Likes
1,231

Yes you can do that, you can have entries in just one column.

For eg: ITAB-FIELD1 = <NAME1>.

INSERT ITAB.

Hope this helps.

ashish

Read only

0 Likes
1,231

okie...i gt another pro here. My table is a dynamic table. Hw can i do to insert a column?

Read only

0 Likes
1,231

You can use field symbols for the same. It will be easy to tell if you tell your complete requirement.

Read only

0 Likes
1,231

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

Read only

0 Likes
1,231

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

Read only

0 Likes
1,231

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?

Read only

0 Likes
1,231

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

Read only

0 Likes
1,231

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

Read only

0 Likes
1,231

okie... quite logic... do u have a sample code for this?

Read only

0 Likes
1,231

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

Read only

0 Likes
1,231

okie...thank for yr advise

Read only

Former Member
0 Likes
1,231

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

Read only

Former Member
0 Likes
1,231

if you make address not obligatory or a key field then yes you can

kind regards

arthur

Read only

Former Member
0 Likes
1,231

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.