Skip to Content
0

JournalVouchers

Feb 28, 2017 at 01:17 AM

72

avatar image
Former Member

Ho Johan.

I want to create a JournalVoucher from an xml file but I have problems uploading it, I really need help and I can not, I know that you are very good at this and maybe it is very easy for you to tell me where I am wrong.

Enclosed my code.ojournalvouchers.txtejecutor.txt

Regards Johan.

10 |10000 characters needed characters left characters exceeded

Hi Alvaro,

Could you explain what is your exact problem? What part of your code doesn't work correctly? What happens?

Kind Regards,

Diego Lother

1
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Mar 01, 2017 at 01:22 AM
0

Hi Diego.Thanks for answering. Basically the problem is that when I start to read the xml file It shows me the error in the content of the object OJournalVoucher. The error message is:

D: \ Work \ Servinomina \ XML \ JournalEntries35.xml, possible cause: Property 'U_HBT_Tercero' of 'JournalVoucher' is invalid

This shows it in all fields too:

D: \ Work \ Servinomina \ XML \ JournalEntries17.xml, possible cause: Property 'TransactionCode' of 'JournalVoucher' is invalid.

Debugging the code step by step the error shows me here:

Switch (ObjectTypes) {
Case SAPbobsCOM.BoObjectTypes.oJournalVouchers:

SAPbobsCOM.JournalVouchers JournalVouchers = (SAPbobsCOM.JournalVouchers)SapCompany.GetBusinessObjectFromXML (Xml file, index);

OJournalVouchers = new oJournalVouchers (JournalVouchers, sapCompany, Contexto.company, Context.key, index);
Break;

I really have many doubts in this part of the code because I am not very expert but I have developed many BoObjectTypes and this one if that has given me problems.
Enclosed documents as txt file.ojournalvouchers.txtejecutor.txt

I hope you can help me.

Thanks Diego


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Alvaro,

Probably the errors that you describe occured in this code:

SAPbobsCOM.JournalVouchers JournalVouchers = (SAPbobsCOM.JournalVouchers)SapCompany.GetBusinessObjectFromXML (Xml file, index);

This xml that you try to import is from where?

When you create an xml from some register of SAP Busines One all information of the database as default fields and user fields are populated on the xml, then in your first error, your xml has one field 'U_HBT_Tercero' that doesn't exist in the database the you want import the xml, in this case you need create this field before or remove this tag from your xml.

For the second error, you need to create the transaction code that are referenced in your journal voucher xml, this error can occur for other fields like Business Partner or some account of your chart of accounts. So, before you import your xml, you should guarantee that all information is consistent with your database.

Kind Regards,

Diego Lother

1
avatar image
Former Member Mar 01, 2017 at 08:29 PM
0

Hi DiegoThe error is exactly where you say it.The field exists, if I remove that field the same thing happens with the following field, the problem is as if this part of the code is not right:
Switch


(ObjectTypes) {
Case SAPbobsCOM.BoObjectTypes.oJournalVouchers:
SAPbobsCOM.JournalVouchers JournalVoucherss = (SAPbobsCOM.JournalVouchers)
SapCompany.GetBusinessObjectFromXML (Xml file, index);
OJournalVouchers = new oJournalVouchers (JournalVoucherss, sapCompany, Contexto.company, Context.key, index);
Break;
What I do is get the xml from an FTP site and then move them to a folder as long as the result is satisfactory.I would like to generate an xml directly from SAP and compare it with mine, I am really sure that the xml information exists since I took it from the OBTF table.I'm stuck .... if you want I can send the code to an email.

Thank you very much Diego.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Alvaro,

"The field exists, if I remove that field the same thing happens with the following field, the problem is as if this part of the code is not right"

Keep in mind this is one field, you have to do the same thing for all user fields that is presented on the xml and doesn't exist in your company database.

P.S: I never used GetBusinessObjectFromXML with Journal Vouchers, but I believe that works like the others objects.

Kind Regards,

Diego Lother

1