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: 

Internal table question

Former Member
0 Kudos

Hi Everybody-

I am very new to SAP and i have question regarding internal tables. I have struture called "ZMI_VENDOR_TO_BW_GENERIC_V_TAB" which i get from another sap system thru SAP XI. Now i need to traverse thru this structure and add these values into custom database table. So i have declared an internal table like below

<b>data:itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB occurs 10.

data vendorid type c.

itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.

LOOP AT itab_venkat.

vendorid = itab_venkat-generic_vendor_id1.

endloop.

</b>

i am getting an error saying occurs cannot be used and also getting an error at the loop statement, Can somebody please correct me, i am very new to SAP.in the loop i am getting the vendor id and then i should update the database table.

Please help me.

Thank you

Venkat

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If your TYPE is defined as a TABLE TYPE, then you don't need the OCCURS statement. You code seems to be incomplete as well. You are not selecting data anywhere and you are not updating any table.



<b>data: itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB .
data: wa_venkat like line of itab_venkat.</b>
data vendorid type c.

itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.

LOOP AT itab_venkat <b>into wa_venkat</b>.
vendorid = <b>wa_venkat-generic_vendor_id1</b>.
endloop.




Regards,

Rich Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If your TYPE is defined as a TABLE TYPE, then you don't need the OCCURS statement. You code seems to be incomplete as well. You are not selecting data anywhere and you are not updating any table.



<b>data: itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB .
data: wa_venkat like line of itab_venkat.</b>
data vendorid type c.

itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.

LOOP AT itab_venkat <b>into wa_venkat</b>.
vendorid = <b>wa_venkat-generic_vendor_id1</b>.
endloop.




Regards,

Rich Heilman

0 Kudos

Thank you Rich-

Are there any documents that you know which i can use to learn about ABAP i.e. internal tables,sql etc.

Regards

Venkat

0 Kudos

hi venkat,

check these links..

http://cma.zdnet.com/book/abap/index.htm

http://www.sapdevelopment.co.uk/

http://www.sap-img.com/

http://juliet.stfx.ca/people/fac/infosys/abap.htm

http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/d6/0db357494511d182b70000e829fbfe/frameset.htm

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

http://www.sapgenie.com/abap/example_code.htm

http://www.geocities.com/SiliconValley/Campus/6345/abapindx.htm

http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm

http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm

http://www.sap-img.com/abap-function.htm

http://www.sapgenie.com/abap/code/abap19.htm

http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm

http://www.planetsap.com/Tips_and_Tricks.htm

http://help.sap.com/saphelp_40b/helpdata/ru/d6/0dc169494511d182b70000e829fbfe/applet.htm

http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm

http://www.henrikfrank.dk/abapexamples/index.html

http://sap.ittoolbox.com/documents/document.asp?i=752

http://members.aol.com/_ht_a/skarkada/sap/

http://sappoint.com/abap/

http://members.tripod.com/abap4/SAP_Functions.html

http://members.ozemail.com.au/~anmari/sap/index.html

http://www.planetsap.com/Userexit_List.htm

http://www.planetsap.com/Tips_and_Tricks.htm

http://www.kabai.com/abaps/q.htm

http://www.planetsap.com/Userexit_List.htm

http://help.sap.com/saphelp_bw21c/helpdata/en/c4/3a8090505211d189550000e829fbbd/frameset.htm

http://www.sapgenie.com/abap/bapi/example.htm

http://help.sap.com/saphelp_45b/helpdata/en/65/897415dc4ad111950d0060b03c6b76/content.htm

http://www.sap-basis-abap.com/index.htm

http://help.sap.com/saphelp_40b/helpdata/en/fc/eb2c46358411d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/aa/aeb23789e95378e10000009b38f8cf/frameset.htm

http://www.geocities.com/ResearchTriangle/1635/system.html

http://www.sapdesignguild.org/resources/MiniSG/3_Managing/3_Functions_Table_Control.htm

http://help.sap.com/saphelp_45b/helpdata/en/d1/801bdf454211d189710000e8322d00/content.htm

http://www.sapfans.com/sapfans/repos/saprep.htm

http://www.planetsap.com/howdo_a.htm

http://help.sap.com/saphelp_util464/helpdata/en/69/c2516e4ba111d189750000e8322d00/content.htm

http://www.sapgenie.com/abap/smartforms_detail.htm

http://www.sap-img.com/abap.htm

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2d67358411d1829f0000e829fbfe/content.htm

http://www.geocities.com/victorav15/sapr3/abap.html

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

http://abap4.tripod.com/Other_Useful_Tips.html

http://help.sap.com/saphelp_45b/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm

http://www.sap-basis-abap.com/sapmm.htm

http://sap.ittoolbox.com/nav/t.asp?t=303&p=448&h1=303&h2=322&h3=448

http://sapfans.com/

http://cma.zdnet.com/book/abap/ch03/ch03.htm

http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm

http://sappoint.com/abap/

http://www.henrikfrank.dk/abapuk.html

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

http://www.sapgenie.com/abap/index.htm

http://www.sap-img.com/abap.htm

http://www.sapdevelopment.co.uk/tips/tipshome.htm

http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm

http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322

http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448

http://www.thespot4sap.com/

http://www.kabai.com/abaps/q.htm

http://www.geocities.com/mpioud/Abap_programs.html

http://www.sapgenie.com/abap/tips_and_tricks.htm

http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=

For FAQ

http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm

http://www.sapgenie.com/faq/abap.htm

Former Member
0 Kudos

Hi venkat,

do this way:

data:itab_venkat type table of ZMI_VENDOR_TO_BW_GENERIC_V_TAB .

to update database table use:

insert dbtable from it_table.

hope this helps u .

regards,

keerthi.

0 Kudos

Here is the code i have written. The screen shot of the structure that i have in proxy is .<a href="http://venkat.healthyplace2.com/">Structure Screen Shot</a>

The code i have written is..

method ZII_MI_VENDOR_TO_BW~EXECUTE_ASYNCHRONOUS.

      • **** INSERT IMPLEMENTATION HERE **** ***

*tables zmdm_vendor.<b>I am getting an error here that i cannot use tables statement in a method</b>

data: itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB.

data: wa_venkat like line of itab_venkat.

itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.

  • Delete all existing records in the table.

delete zmdm_vendor.<b>I am getting an error that i cannot delete,what is the correct way to do?</b>

  • Now loop thru all the records of the inbound record and insert into *

  • the table.

LOOP AT itab_venkat into wa_venkat.

zmdm_vendor-vendorid = wa_venkat-generic_vendor_id1.

zmdm_vendor_groupid = wa_venkat-group_id1.

zmdm_vendor_country = wa_venkat-country1.

modify zmdm_vendor.

endloop.

endmethod

Can someone correct my code and help me.

Thanks in advance.

Venkat

0 Kudos

This sounds like a INBOUND PROXY from XI, in which the parameters will be in the form of nested internal tables. So, you need to be careful while extracting data form the nested internal tables.

For Deleting the data, try this.

DELETE FROM ZMDM_VENDOR.

Regards,

Ravi

0 Kudos

1.

data wa_zmdm_vendor type zmdm_vendor.

LOOP AT itab_venkat into wa_venkat.

wa_zmdm_vendor-vendorid = wa_venkat-generic_vendor_id1.

wa_zmdm_vendor_groupid = wa_venkat-group_id1.

wa_zmdm_vendor_country = wa_venkat-country1.

modify zmdm_vendor from wa_zmdm_vendor.

endloop.

2. for the delete:

delete from zmdm_vendor.