7 Replies - 316 Views - Last Post: 28 January 2019 - 07:45 AM Rate Topic: -----

#1 Steve7419   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 34
  • Joined: 19-November 18

import multiple data

Posted 25 January 2019 - 02:59 PM

Hi Guys,

I have a problem to import bulk data from other applicaiton.

I am using this following code to insert the data from other application to erp application.

 inv = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
inv.Lines.BaseEntry = doc_entry
inv.Lines.BaseType = 202
inv.Lines.Quantity = qty
inv.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete
inv.Lines.WarehouseCode = store
inv.Lines.Add()
inv.Lines.BaseEntry = doc_entry
inv.Lines.BaseType = 202
inv.Lines.Quantity = qty1
inv.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntReject
inv.Lines.WarehouseCode = store
inv.Lines.Add()





The import is failed because my data have difference quantity and some of the reject and complete. in the above code, my data entry no. is filled in the doc_entry.

I have made some changes as follows:
if oRec2.Fields.Item("TransactionType").value = 'C' then
inv.Lines.BaseEntry = doc_entry
inv.Lines.BaseType = 202
inv.Lines.Quantity = qty
inv.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete
inv.Lines.WarehouseCode = store
inv.Lines.Add()
end if
if oRec2.Fields.Item("TransactionType").value = 'R' then 
then 
inv.Lines.BaseEntry = doc_entry
inv.Lines.BaseType = 202
inv.Lines.Quantity = qty1
inv.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntReject
inv.Lines.WarehouseCode = store
inv.Lines.Add



but the import proces is failed. I appreciate your help so much. Thank you


Rgds,
Steve

Is This A Good Question/Topic? 0
  • +

Replies To: import multiple data

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: import multiple data

Posted 25 January 2019 - 03:48 PM

Please post relevant error messages.
Was This Post Helpful? 1
  • +
  • -

#3 Steve7419   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 34
  • Joined: 19-November 18

Re: import multiple data

Posted 25 January 2019 - 07:09 PM

Thanks for your reply.

The error message is illegal value entered.

I have tried to manage to solve this issue but still not success. there comes another error message:
object reference not set to an instance of an object.

I attach the data that I exported from database table for your review.

Regards,
Steve

Attached image(s)

  • Attached Image

This post has been edited by Steve7419: 25 January 2019 - 07:20 PM

Was This Post Helpful? 0
  • +
  • -

#4 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 201
  • View blog
  • Posts: 1,125
  • Joined: 05-December 13

Re: import multiple data

Posted 25 January 2019 - 07:15 PM

SAP are known for storing certain values such as time as integers. I'd assume this is likely or if not, a similar case. There is a debugger link in my signature. Expand the spoiler, and its the last link. Put a break point on the line spouting the error, and tell us what the value is.
Was This Post Helpful? 1
  • +
  • -

#5 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 201
  • View blog
  • Posts: 1,125
  • Joined: 05-December 13

Re: import multiple data

Posted 25 January 2019 - 07:28 PM

Are ordercode, stockcode, stockname, not importing? Which line of code are you getting the error on?> I've currently got my hands full with a live project, so I don't have a lot of time to dig into this. Also, can you show us an example of what these fields data looks like :: ordercode, stockcode, stockname?
Was This Post Helpful? 0
  • +
  • -

#6 Steve7419   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 34
  • Joined: 19-November 18

Re: import multiple data

Posted 25 January 2019 - 10:43 PM

View PostSheepings, on 25 January 2019 - 07:28 PM, said:

Are ordercode, stockcode, stockname, not importing? Which line of code are you getting the error on?> I've currently got my hands full with a live project, so I don't have a lot of time to dig into this. Also, can you show us an example of what these fields data looks like :: ordercode, stockcode, stockname?


I import Seq . No to avoid duplicating in the erp application. The other columns are docentry and quantity also imported.
The order code, stock code and stock name is not imported. meanwhile the codetran is indicator to choose whether complete or reject in the erp application. Thanks.
Was This Post Helpful? 0
  • +
  • -

#7 Steve7419   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 34
  • Joined: 19-November 18

Re: import multiple data

Posted 28 January 2019 - 03:49 AM

I managed to solve this problem but without all of your guidance guys, it is impossible. :)/>

...
For i = 0 To DocOrder.Lines.Count - 1

oRec3.DoQuery("select yyyy")
If oRec3.RecordCount = 0 Then
Throw New Exception("No Data")
End If
If oRec3.Fields.Item("Qty").Value > "0" Then
                                        DocOrder.Lines.BaseEntry = oRec3.Fields.Item("BaseRef").Value
                                        DocOrder.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete
                                        DocOrder.Lines.Quantity = oRec3.Fields.Item("Qty").Value
                                        DocOrder.Lines.WarehouseCode = "WHSE"
                                        DocOrder.Lines.BaseType = "202"

            'line reject
                                        oRec5.DoQuery("SELECT YYYY")
                                        If oRec5.Fields.Item("Qty").Value > "0" Then
                                            DocOrder.Lines.BaseEntry = oRec5.Fields.Item("BaseDoc").Value
                                            DocOrder.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntReject
                                            DocOrder.Lines.Quantity = oRec5.Fields.Item("Qty").Value
                                            DocOrder.Lines.WarehouseCode = "WHSE"
                                            DocOrder.Lines.BaseType = "202"

                                            
                                        End If
                                    End If
                                    DocOrder.Lines.Add()
                                Next

...




The result is sucessful.

Best Regards,
Steve

This post has been edited by Steve7419: 28 January 2019 - 03:51 AM

Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,272
  • Joined: 12-June 08

Re: import multiple data

Posted 28 January 2019 - 07:45 AM

What ended up being the issue?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1