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

Entering data into custom table programmatically

Former Member
0 Likes
4,020

Hi,

I want to send data in internal table to a custom Z-table through a report program. How can I do this?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
2,571

Hi,

Just refer the code I have posted, & try coding your code according to your requirement. You will find an answer.

Otherwise write the details of your requirement, will suggest you an exact anwer.

Regards

Abhii...

10 REPLIES 10
Read only

Former Member
0 Likes
2,571

Hi,

Please search on SCN. You will get many threads.

Or write Insert and press F1 in abap editor.

Insert statement is used for this purpose.

Regards,

Dhan

Read only

Former Member
0 Likes
2,571

Hi,

You can use INSERT statement to do the same.

Please refer below code for reference :-

DATA: wa TYPE scustom.

wa-id = '12400177'.

wa-name = 'Robinson'.

wa-postcode = '69542'.

wa-city = 'Heidelberg'.

wa-custtype = 'P'.

wa-discount = '003'.

wa-telephone = '06201/44889'.

INSERT INTO scustom VALUES wa.

Please set to resolved if it answers your question.

Read only

RahulKeshav
Active Contributor
0 Likes
2,571

Hi,

Create internal table of type z custom table.

populate the data into internal table.

then...

insert Zcutom from table internal_table.

thnx

RK

Read only

Former Member
0 Likes
2,571

Hi K V Subbarao,

I guess your requirement is to save the data present in internal table into a custom table.

If so,

create the internal table type as custom z table and use the INSERT command to create entries in the z table.

Read only

Former Member
2,574

Hi,

Just refer the code I have posted, & try coding your code according to your requirement. You will find an answer.

Otherwise write the details of your requirement, will suggest you an exact anwer.

Regards

Abhii...

Read only

0 Likes
2,571

Hi

I have written this code:

LOOP AT it_status INTO wa_status.

IF wa_status-m_typ = 'E'.

wa_ztable-mandt = sy-mandt.

wa_ztable-aufnr = wa_status-aufnr.

wa_ztable-objnr = wa_status-objnr.

wa_ztable-charg = wa_status-charg.

wa_ztable-matnr = wa_status-matnr.

wa_ztable-autyp = wa_status-autyp.

wa_ztable-auart = wa_status-auart.

wa_ztable-m_typ = wa_status-m_typ.

wa_ztable-msg = wa_status-msg.

wa_ztable-user_id = sy-uname.

wa_ztable-date_occur = sy-datum.

wa_ztable-aufnr = sy-uzeit.

INSERT into zqm_qn_testorder values wa_ztable.

CLEAR wa_ztable.

ENDIF.

ENDLOOP.

But the records are not appended.

The database table zqm_qn_testorder doesn't have a table maintainence generator created.

Is it require to create parameter transaction and then pass these vales by calling the transaction?

Thanks.

Read only

0 Likes
2,571

just get all teh data into one internla table like ..

gt_ztable ...

like...

LOOP AT it_status INTO wa_status.

IF wa_status-m_typ = 'E'.

wa_ztable-mandt = sy-mandt.

wa_ztable-aufnr = wa_status-aufnr.

wa_ztable-objnr = wa_status-objnr.

wa_ztable-charg = wa_status-charg.

wa_ztable-matnr = wa_status-matnr.

wa_ztable-autyp = wa_status-autyp.

wa_ztable-auart = wa_status-auart.

wa_ztable-m_typ = wa_status-m_typ.

wa_ztable-msg = wa_status-msg.

wa_ztable-user_id = sy-uname.

wa_ztable-date_occur = sy-datum.

wa_ztable-aufnr = sy-uzeit.

append wa_ztable to gt_table.

CLEAR wa_ztable.

ENDIF.

ENDLOOP.

if gt_table[] is not initial.

insert zcustom_table from table gt_table.

endif.

thats it...

Thanks

RK

Read only

0 Likes
2,571

Please post the full code. I need to check.

Regards

Abhii...

Read only

0 Likes
2,571

Hi,

Use Rahul Keshav code and have a COMMIT WORK. after the insert .

Then the database will get modified

Thanks

Read only

0 Likes
2,571

Hi

Thanx I have solved the proble. The error is

wa_ztable-time_occur = sy-uzeit.

here. the field name should be this but initally I had given key field aufnr and hence data is not posted properly.

Thax once again.