Application Development 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: 

Reports-

former_member202957
Contributor
0 Kudos

hi all,

I have a requirement that i have to insert data which i am getting in internal table in the report to one database ztable.

<b>useful answers rewarded</b>

cheers,

sunil kumar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Dear Sunil,

Suppose you've the data stored in the internal table - ITAB.

You can simply fire the following statement.

ZCUSTOM FROM TABLE ITAB.

IF SY-SUBRC EQ 0.

MESSAGE S000(Z1) WITH 'Successfully inserted/updated in ZCUSTOM'.

ELSEIF SY-SUBRC EQ 4.

MESSAGE W000(Z1) WITH 'Not Successful'.

ENDIF.

Regards,

Abir

*************************************

  • Don't forget to Reward Points *

5 REPLIES 5

Former Member
0 Kudos

Hi,

From the Internal table, LOOP throught the internal table then Move the fields to the Z table then use the INSERT statment .

Regards

Sudheer

Former Member
0 Kudos

Dear Sunil,

Suppose you've the data stored in the internal table - ITAB.

You can simply fire the following statement.

ZCUSTOM FROM TABLE ITAB.

IF SY-SUBRC EQ 0.

MESSAGE S000(Z1) WITH 'Successfully inserted/updated in ZCUSTOM'.

ELSEIF SY-SUBRC EQ 4.

MESSAGE W000(Z1) WITH 'Not Successful'.

ENDIF.

Regards,

Abir

*************************************

  • Don't forget to Reward Points *

Former Member
0 Kudos

Sorry,

MODIFY ZCUSTOM FROM TABLE ITAB.

Regards,

Abir

**************************************

  • Don't forget to Reward Points *

varma_narayana
Active Contributor
0 Kudos

Hi Sunil ..

This is the syntax to INSERT internal table to Database table.

DATA: itab type table of <dbtable> with header line.

<<Fill the Data into internal table>>

INSERT <DB TABLE> FROM TABLE <ITAB> ACCEPTING DUPLICATE KEYS.

<b>Reward if Helpful.</b>

former_member202957
Contributor
0 Kudos

hi ,

Thanx for your quick reply.

Actually the requirement is bit complicated there is an internal table it_totstk1 which having all the total stock details in it. My report is to show the monthly stock details of YARN and Chemical. i have taken 2 radio buttons for YARN and chemical.

The internal table it_totstk1 having fields of both yarn and chemical.

if i select yarn and execute only yarn correspoinding details are shown and all the chemical related data is shown as zero. llly same for chemical also if i select chemical the internal table has only details of chemical and all the yarn correspoinding fields are shown as zero.

So now both the cases i have same loop but the data which is getting in internal table is varying by selectin yarn and chemical.

Now i have insert data so that if i select YARN only yarn data which ll get in the internal table must be inserted into table ZSTOCK and all the chemical related fields shoud be inserted as blanks. same for chemical also if i select chemical already there are yarn data in zstock now only chemical data should be inserted with out overwritting the yarn data because if i select chemcail all the yarn coreespoding details are shown zero in internal table. so the data which was already in the table should not be effect and new data i.e only some fields should be updated thats belong to chemical.

Hope u understood my requiremnt.

<b>useful answers rewarded</b>

regards,

sunil kumar