Troubleshooting error: "BapiGetOpenItems"

Troubleshooting error: "BapiGetOpenItems"

I'm a beginner in using BAPI's... The first BAPI I used is the
"BapiCreateFromDat1" and it's now running. Now, I am using the
"BapiGetOpenItems" but I always prompted for error. 
The error is... "Company code does not exist". 
This is how I implemented the Bapi:

<%
Set OpenI = Server.CreateObject("SMB.ARAccount.1") 

call OpenI.DimAs("BapiGetOpenItems", "KEYDATE", Key_date)

call OpenI.DimAs("BapiGetOpenItems", "LineItems", OpenILineItems)

call OpenI.DimAs("BapiGetOpenItems", "Return", BapiReturn)
  
Key_date = "09/25/2000"
  
OpenILineItems.Addnew
OpenILineItems.Fields("Comp_Code") = "0010"
OpenILineItems.Fields("CUSTOMER") = "0000100429"
OpenILineItems.Update 
  
OpenI.Destination = "BEER"

%>

<%
on Error Resume Next
call OpenI.BapiGetOpenItems( Key_date, OpenILineItems, , BapiReturn)
%>

Are my codes correct? Please help me. 

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.


a) "Keydate" is not a structure or table parameter so it makes no
sense to call DimAs for this parameter.

b) There is no reason to fill the "Lineitems" table parameter, 
it is filled by the BAPI.

c) You need to set the "CompanyCode" and "Customer" key fields by using
the InitKeys method of the proxy class. 

This was first published in July 2001