Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Connection of companies in loop

Hi all,

i have a problem regarding multiple connection to companies....here iam able to connect to multiple companies individually by one by one(by static declaration)..iam using below code.....

 oCompany.CompanyDB = Combo1.Text
        oCompany.UserName = Text1.Text
        oCompany.Password = Text2.Text
 
        lRetCode = oCompany.Connect
   
        oItem.ItemCode="I0001"
        oItem.ItemName=Inventory1 
        oItem.Add()
  
       oCompany1.CompanyDB = Combo2.Text
        oCompany1.UserName = Text3.Text
        oCompany1.Password = Text4.Text
 
        lRetCode = oCompany1.Connect

       oItem.ItemCode="I0002"
        oItem.ItemName=Inventory2 
        oItem.Add()
 
       oCompany2.CompanyDB = Combo3.Text
        oCompany2.UserName = Text5.Text
        oCompany2.Password = Text6.Text
 
        lRetCode = oCompany2.Connect

        oItem.ItemCode="I0003"
        oItem.ItemName=Inventory3 
        oItem.Add()

but by the above coding i can't connect to 'n' no.of companies during run-time...the above given is static testing.....but i want to create dynamically(creating multiple connections at runtime & adding different items).....can anybody suggest me some ideas????

regards,

shangai.

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question