on 12-16-2014 7:56 AM
Hi There,
i have an error while trying to create a file with the Python-connector PyRFC.
When i call BAPI_DOCUMENT_CREATE2 the process crash at SCMS_DOC_CREATE_FILES with exception "bad_request".
The strange is: if i doesn't supply the structur DOCUMENTFILES to the FM i get no exception.
Structur DOCUMENTFILES looks like:
lt_files = list(
[{'STORAGECATEGORY':'Z_DVS',
'DOCFILE':'\\\mknpr3\\tmp\\test.pdf',
'WSAPPLICATION':'PDF',
}
]
)
sorry for the python-code 😉
Storing the file on my local client (c:\) give the same error.
Im thankful for every hint.
Thanks in advance
Sebastian
ECC6/ GUI 7.3 PL4/ Win7
Hi @all,
in my opinion, i can't use the SAPHTTP-Destination with PYTHON (or other external systems/interface) in background to upload files from my front-end-workstaion. When i store the original-file on the SAP-application-server and use the SAPHTTPA-Destination, it works.
When someone can give me an general advice to using SAPHTTP/ SAPHTTPA in background (a related SAP-NOTE or so), you are welcome.
Here are my sample PYTHON-code:
#!/usr/bin/env python
from pyrfc import *
from pprint import pprint
from ConfigParser import ConfigParser
import datetime
import sys
sys.path
ls_doc = dict(
DOCUMENTTYPE = u'ZPR',
DOCUMENTNUMBER = '0000000000000000000100014',
DOCUMENTVERSION = u'-',
DOCUMENTPART = '000',
STATUSEXTERN = u'FK',
)
lt_drat = list(
[{'DELETEVALUE':u' ',
'LANGUAGE_ISO':u'DE',
'DESCRIPTION':u'Test aus Python mit DocCreate2.py'
}
]
)
lt_files = list(
[{'DOCUMENTTYPE':u'ZPR',
'STORAGECATEGORY':u'Z_DVS',
'DOCFILE':u'/share/cdb/test.pdf',
#'DOCFILE':u'\\mkn1\Public_MKN_Progs\KB\GUIXT\scripts\test1.pdf',
#'DOCFILE':u'c:\test1.pdf',
#'DOCPATH':u'C:\\',
'WSAPPLICATION':u'PDF',
'DESCRIPTION':u'Test',
#'SOURCEDATACARRIER':u'DEFAULT',
}
]
)
lt_drad = list(
[{'OBJECTTYPE' :u'MARA',
'OBJECTKEY' :u'202040',
}
]
)
def main():
config = ConfigParser()
config.read('sapnwrfc.cfg')
params_connection = config._sections['connection']
try:
conn = Connection(**params_connection)
result = conn.call('BAPI_DOCUMENT_CREATE2',DOCUMENTDATA=ls_doc,OBJECTLINKS=lt_drad,DOCUMENTDESCRIPTIONS=lt_drat,DOCUMENTFILES=lt_files,PF_HTTP_DEST='SAPHTTPA',PF_FTP_DEST='SAPFTPA')
#result = conn.call('BAPI_DOCUMENT_CREATE2',DOCUMENTDATA=ls_doc,HOSTNAME='LP-213',OBJECTLINKS=lt_drad,DOCUMENTDESCRIPTIONS=lt_drat,DOCUMENTFILES=lt_files,PF_HTTP_DEST='SAPHTTP',PF_FTP_DEST='SAPFTP')
#result = conn.call('BAPI_DOCUMENT_CREATE2',DOCUMENTDATA=ls_doc,HOSTNAME='LP-213',OBJECTLINKS=lt_drad,DOCUMENTDESCRIPTIONS=lt_drat,DOCUMENTFILES=lt_files)#DOCUMENTFILES=lt_files,#OBJECTLINKS=lt_drad)
result2 = conn.call('BAPI_TRANSACTION_COMMIT')
pprint(result)
pprint(result2)
except CommunicationError:
print u"Could not connect to server."
raise
except LogonError:
print u"Could not log in. Wrong credentials?"
except (ABAPApplicationError, ABAPRuntimeError):
print u"An error occurred."
raise
if __name__ == '__main__':
main()
Thank's
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Sebastian ,
Can you check SLG1 traces which would give you hint on solving this error.
Regards
B. Sagar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the SLG1 says the same:
When calling the function module SCMS_DOC_CREATE_FILES with the document 548DE68F4DD26C9AE10000000A9704E7 class DMS_PCD1 the exception occurred with the number 2.
but im a step furhter:
on deeper debugging i figured out another error in FM: SYSTEM_START_REG_SERVER.
There is a CALL FUNCTION 'RFC_START_PROGRAM'
and the FM "RFC_START_PROGRAM" crash with the error-message:
Function RFC_START_PROGRAM not found and it's true
in SE37 - the FM doesn't exist.
Has somebody an idea?
Thnx
Hi Sagar,
thanx for your reply.
SNOTE brings no improvement.
It is possible that i have to customize an another part, that the FM BAPI_DOCUMENT_CREATE2 doesn't use the FM RFC_START_PROGRAM. Or must i pass another parameter to the first FM?!
What do you think about SNOTE 1279775? Sounds good but no correction instructions available.
Very Strange... is the FM RFC_START_PROGRAM in your system present?
Thnx
Sebastian
Hello,
As per my understanding FM 'RFC_START_PROGRAM' should trigger some RFC destination which would fetch the contents from file path and then pass it to the content server. Can you check which is RFC destination you are using and is that working ? Also you may decide to call another BAPI where you can pass the file contents instead of filepath
Regards
Hello again,
i use the RFC-Dest SAPHTTP and this one is working.
My problem is, that our vendor sell us a software with an sap-interface (python to sap) that doesn't work.
Now i program my own interface to reproduce the error...and thats the reason why i can't use an another FM. The vendor sell the software to many customers where the interface works.
Any other ideas?
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.