Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CVAPI_DOC_CHECKIN error

Former Member
0 Likes
1,574

Hi All,

I have written a "Z" function moudle which uses API_DOCUMENT_MAINTAIN2 to attach a docoment to a WBS element and CVAPI_DOC_CHECKIN to check in the same document in one of our IXOS Server. This "Z" BAPI/Function module is getting called from a VB code. When this function module is getting executed via SE37 transaction it works fine no errors.

When I run this from a VB code I get the error "RFC Partner does not allow to start the required P", The last "P" I think is "program".

But the stange thing is, When I debug the VB Code (With ABAP Debug On - I.e from VB it open a new abap window - This I achived by setting RFC_DEBUG = 1 in the Environment variables) it works fine no erros are reported. I am not sure why the same function module call from VB is behaving differently in Debug mode and Normal Mode.

Kindly help.

Here is the ABAP Code which calles these 2 APIs

CALL FUNCTION 'API_DOCUMENT_MAINTAIN2'

EXPORTING

PF_TRANSACTION = 'CV01'

PS_API_CONTROL = LIT_API_CONTROL

DOCUMENTDATA = LIT_DOCUMENTDATA

IMPORTING

DOCUMENTNUMBER = LV_DOC_NUMBER

DOCUMENTPART = LV_DOC_PART

DOCUMENTVERSION = LV_DOC_VERSION

RETURN = LIT_RETURN2

TABLES

OBJECTLINKS = LIT_OBJECTLINKS

DOCUMENTFILES = LIT_DOCUMENTFILES.

LIT_PT_FILES-APPNR = '1'.

LIT_PT_FILES-STORAGE_CAT = LV_STORAGECATEGORY.

LIT_PT_FILES-PATHNAME = LV_CVPATHNAME.

LIT_PT_FILES-FILENAME = LV_FILENAME.

APPEND LIT_PT_FILES.

CALL FUNCTION 'CVAPI_DOC_CHECKIN'

EXPORTING

PF_DOKAR = LV_DOKAR

PF_DOKNR = LV_DOC_NUMBER

PF_DOKVR = LV_DOC_VERSION

PF_DOKTL = LV_DOC_PART

PS_API_CONTROL = LIT_API_CONTROL

PF_FTP_DEST = 'SAPFTPA'

PF_HTTP_DEST = 'SAPHTTPA'

IMPORTING

PSX_MESSAGE = LIT_PSX_MESSAGE_1

TABLES

PT_FILES_X = LIT_PT_FILES.

I have read other postings which tells that SAPFTP.exe and SAPHTTP.exe should be placed in WINDOWS/SYSTEM32 folder. I have done that as well.

Another Post tells about putting

ReturnCode = RfcAllowStartProgram("sapftp;saphttp") in the VB code I have done this as well.

Kindly help me out in resolving this issue as to why in Debug mode the Document is getting attached and Archived. But in normal mode it is failing in Checkin BAPI.

3 REPLIES 3
Read only

christian_wohlfahrt
Active Contributor
0 Likes
709

Hi Sunil,

very good preparation of this question.

I don't think, your coding has a bug. I guess, it's either a authority or foreground / background problem.

When you are testing in SAP (and via debug?), you are using a different user than with default RFC login. Check in transaction SM59, which user is assigned to your RFC. Then have a look in log of transaction SU53 (after testrun).

To get an additional information in the other question: test your function module in R/3 starting in background (and as RFC); -> write little test report.

I hope, these tests might bring a new idea about what's going wrong.

Regards,

Christian

Read only

Former Member
0 Likes
709

I was able to do it and now it's working fine. The issue was the VB code was not making the call to RfcAllowStartProgram Function in LIBRFC32 DLL properly. Once I fixed that issue, I am able to CHECKIN document from VB Code.

Private Const RAccess As String = " "

Private Declare Function RfcAllowStartProgram Lib "librfc32" (ByVal RAccess As String) As Integer

ReturnCode = RfcAllowStartProgram("sapftp;saphttp")

Above is the VB code to call the RfcAllowStartProgram and it worked.

Read only

0 Likes
709

Hello Sunil,

I am also trying to checkin an original to a document in SAP, by using the BAPI document_checkin2 in VBA, but it doesn´t work. I think the Problem is the wrong declaration for using the librfc32.dll. You wrote that you solved the problem, could you maybe post your VB-Code for the checkin? These two posted lines don´t help very well, because I don´t know where to put them.

Regards

Robert Barnebeck