Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xapi problem 1

Status
Not open for further replies.

Jo004060

Programmer
Sep 25, 2003
18
0
0
CA
Hello,

I have a problem with the xapi now...

I'm trying to create an order in OE 5.3, and i can open&compose the views, insert the header without problem.

But I have an issue inserting the details into the new PO:

xapiViewInsert and I get and error: 301 , 1180

According to the Accpac documentation, it is XAPI_VIEW_ERROR
The complete message (with xapiErrorGet) is:

Internalerror.
OrderDetail.
Operation not allowed.

If i open the new PO after the header insertion, I can manually add the item without problems.


Please help me !

Thanks
 
Simple answer is you are doing something wrong.
Might be your view compositions or you are missing some info for one of the fields.

OK, if you are creating an order in OE then you cannot insert a detail in PO, but I guess that is just a typo...
 
Is there a way to know all the fields required ? i'm pretty sure the compositions are allright (exactly like the macro) and yes, it was a typo.. i meant the new OE

do you think i can create an empty header, insert it, and THEN add the details ?

Thanks for the quick answer,
 
All you need is a customer number, an item number, and a quantity. Here's a 5.3 code snippet that's been working fine for years:

OEOrderHeader2.Init

OEOrderHeader2.Fields("CUSTOMER") = Me.fldCustomer

OEOrderDetail2.RecordGenerate False

OEOrderDetail2.Fields("ITEM").Value = Me.fldItem
OEOrderDetail2.Fields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command
OEOrderDetail2.Fields("QTYORDERED") = Me.txtQuantity

OEOrderDetail2.Process

OEOrderDetail2.Insert

OEOrderHeader2.Fields("POSTINV") = False
OEOrderHeader2.Insert


Jay Converse
IT Director
Systemlink, Inc.
 
Hi there again,

I think im getting closer, I was trying to update the QTYPO field. Now i tried with the QTYORDERED and I get this message after the PUT:

Order Detail
Attempt to change read-only field 'Quantity Ordered'

How can it be Read Only ?

and how can you OEOrderDetail2.RecordGenerate False
with the xapi ?

Thanks again guys,

Jo
 
ok, for unknown reasons, i can now put the 'Quantity Ordered' , but i still have the original when inserting:

Internal error. Order Detail. Operation not allowed.

Heres a part of my code:

Code:
strcpy(tag,"OE");
strcpy(view, "OE0520");
xapiViewLoad( m_Session, view, tag, &HeaderRVH);
xapiViewOpen( m_Session, HeaderRVH, &HeaderVH );

strcpy(view, "OE0500");
xapiViewLoad( m_Session, view, tag, &Detail1RVH);
xapiViewOpen( m_Session, Detail1RVH, &Detail1VH);

strcpy(view, "OE0740");
xapiViewLoad( m_Session, view, tag, &Detail2RVH);
xapiViewOpen( m_Session, Detail2RVH, &Detail2VH);

strcpy(view, "OE0180");
xapiViewLoad( m_Session, view, tag, &Detail3RVH);
xapiViewOpen( m_Session, Detail3RVH, &Detail3VH);

strcpy(view, "OE0680");
xapiViewLoad( m_Session, view, tag, &Detail4RVH);
xapiViewOpen( m_Session, Detail4RVH, &Detail4VH);

strcpy(view, "OE0526");
xapiViewLoad( m_Session, view, tag, &Detail5RVH);
xapiViewOpen( m_Session, Detail5RVH, &Detail5VH);

strcpy(view, "OE0522");
xapiViewLoad( m_Session, view, tag, &Detail6RVH);
xapiViewOpen( m_Session, Detail6RVH, &Detail6VH);

strcpy(view, "OE0501");
xapiViewLoad( m_Session, view, tag, &Detail7RVH);
xapiViewOpen( m_Session, Detail7RVH, &Detail7VH);

strcpy(view, "OE0502");
xapiViewLoad( m_Session, view, tag, &Detail8RVH);
xapiViewOpen( m_Session, Detail8RVH, &Detail8VH);

strcpy(view, "OE0504");
xapiViewLoad( m_Session, view, tag, &Detail9RVH);
xapiViewOpen( m_Session, Detail9RVH, &Detail9VH);

strcpy(view, "OE0503");
xapiViewLoad( m_Session, view, tag, &Detail10RVH);
xapiViewOpen( m_Session, Detail10RVH, &Detail10VH);

A4WAPI::VIEWDEF pArray[10];// = new LPVIEWDEF;
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10); //reset the array

//-----------1
pArray[0].rvh = Detail1RVH;
pArray[0].view = Detail1VH;

pArray[1].rvh = Detail4RVH;
pArray[1].view = Detail4VH;

pArray[2].rvh = Detail3RVH;
pArray[2].view = Detail3VH;

pArray[3].rvh = Detail2RVH;
pArray[3].view = Detail2VH;

pArray[4].rvh = Detail5RVH;
pArray[4].view = Detail5VH;

pArray[5].rvh = Detail6RVH;
pArray[5].view = Detail6VH;

WORD y = 6;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, HeaderRVH, HeaderVH, y, pArray))
    bValid = true;

//-----------2
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10); //reset the array

pArray[0].rvh = HeaderRVH;
pArray[0].view = HeaderVH;

pArray[1].rvh = Detail7RVH;
pArray[1].view = Detail7VH;

pArray[2].rvh = Detail10RVH;
pArray[2].view = Detail10VH;

pArray[3].rvh = Detail8RVH;
pArray[3].view = Detail8VH;
y=4;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail1RVH, Detail1VH, y, pArray))
    bValid = true;

//-----------3
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = HeaderRVH;
pArray[0].view = HeaderVH;
y=1;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail2RVH, Detail2VH, y, pArray))
    bValid = true;

//-----------4
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = HeaderRVH;
pArray[0].view = HeaderVH;

pArray[1].rvh = Detail1RVH;
pArray[1].view = Detail1VH;

y=2;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail3RVH, Detail3VH, y, pArray))
    bValid = true;

//-----------5
if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail4RVH, Detail4VH, y, pArray))
    bValid = true;

//-----------6
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = HeaderRVH;
pArray[0].view = HeaderVH;

y=1;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail5RVH, Detail5VH, y, pArray))
    bValid = true;

//-----------7
if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail6RVH, Detail6VH, y, pArray))
    bValid = true;

//-----------8
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = Detail1RVH;
pArray[0].view = Detail1VH;

y=1;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail7RVH, Detail7VH, y, pArray))
    bValid = true;

//-----------9
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = Detail1RVH;
pArray[0].view = Detail1VH;

pArray[1].rvh = Detail9RVH;
pArray[1].view = Detail9VH;

y=2;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail8RVH, Detail8VH, y, pArray))
    bValid = true;

//-----------10
memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = Detail8RVH;
pArray[0].view = Detail8VH;

y=1;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail9RVH, Detail9VH, y, pArray))
    bValid = true;

//-----------11

memset( pArray, 0, sizeof(A4WAPI::VIEWDEF)*10);

pArray[0].rvh = Detail1RVH;
pArray[0].view = Detail1VH;

y=1;

if ( XAPI_SUCCESS == xapiViewCompose( m_Session, Detail10RVH, Detail10VH, y, pArray))
    bValid = true;


xapiViewInit  ( m_Session, HeaderRVH, &HeaderVH );


//---CUSTOMER
memcpy(szTemp,strCustomerNo,strCustomerNo.GetLength());  
xapiViewPut( m_Session, HeaderRVH, HeaderVH, 3, szTemp, 12, true );
memset(szTemp, 0, 255);

//---Item
memcpy(szTemp,strItemNo,strItemNo.GetLength());  
xapiViewPut( m_Session, Detail1RVH, Detail1RVH, 4, szTemp, 24, true );
memset(szTemp, 0, 255);

//---PROCESSCMD
iTemp = 1;
memcpy(&szTemp,&iTemp,4);      
xapiViewPut( m_Session, Detail1RVH, Detail1RVH, 151, szTemp, 4, false );
memset(szTemp, 0, 255);

//---QTYORDERED
LPSTR szBuff;
szBuff=(LPSTR)(LPCSTR)strQty;
A4WAPI::strToBcd(szBuff, szTemp, 10, 4);            
xapiViewPut( m_Session, Detail1RVH, Detail1RVH, 15, szTemp, 10, false );
memset(szTemp, 0, 255);

xapiViewProcess ( m_Session, Detail1RVH, Detail1VH);

xapiViewInsert  ( m_Session, Detail1RVH, Detail1VH);

please let me know if you find something that might be wrong..

Thanks again for your help
 
Sorry about that .RecordGenerate, it's a 5.3 Comapi thing. I stopped using the Xapi years ago, so I don't know the equivalent.

Jay Converse
IT Director
Systemlink, Inc.
 
xapiViewInit is the equivalent of RecordGenerate, except for the insert record parameter.

I think you are missing a location code in the header, unless you are using a default template to set the location. Try entering an order manually and take note of the fields you have to fill in on the screen - these same fields need to be populated in your code.

Also try xapiViewInit the detail before you xapiViewPut the Item.

If the QTYORDERED is read only then it means the detail record is not correctly initialized with all the correct fields, most likely the location code.
 
I added the detail xapiViewInit before the xapiViewPuts: same error.

I also added the Location code to the header and to the item:
same error.

I tried using the default template, same thing.

If I open Accpac, there is only 2 fields i need to enter manually to post, Customer and Item number.

** I found a way to create the Order, but i'm afraid it may cause some problems in the future:

I kept only the first 5 compose. that way, all the xapi calls are returning VALID, and I have no issue seeing the Order in Accpac. I'm wondering, why the other composes if they are not needed ? also, do you think i might run into data integrity problems that way ?

Thank you very much for your help guys

Jo
 
Looking at the AOM for OE0520 which is the OEORDH table I only see 6 compositions: OE0500, OE0680, OE0180, OE0740, OE0526, OE0522.
So where did you get the others from?
OE0522 is the order optional fields, so if you never use optional fields then you can actually leave that one out. Likewise OE0501 ~ OE0504 have to do with kitts and BOM's and things, so if you do not touch them then you do not need them.
Looks like you are making some progress.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top