BAPI problem

Help
2006-04-06
2013-04-11
  • Hello.

    I try the exemple4a.py witch come with pysap and I have the following error message :
    Traceback (most recent call last):
      File "example4a.py", line 67, in ?
        print p
      File "C:\usr\Python24\lib\site-packages\pysap.py", line 559, in __str__
        s+='%s = %r\n' % (f[0],self[f[0]])
      File "C:\usr\Python24\lib\site-packages\pysap.py", line 381, in __repr__
        else: return repr(self.ext_value)
      File "C:\usr\Python24\lib\site-packages\pysap.py", line 374, in __get_value
        return _do_conversion_out(self,RfcGetBcd(self,self._length_,self._decs_))
      File "C:\usr\Python24\lib\site-packages\pysap.py", line 82, in RfcGetBcd
        else: return eval(vs)
      File "<string>", line 1
        :.000
        ^
    SyntaxError: invalid syntax

    the call is :
    client = '%010d' % 101084
    date_cde = '20050106'
    sales_orders=func(CUSTOMER_NUMBER=client,SALES_ORGANIZATION='2100',DOCUMENT_DATE=date_cde)

    what can I test to detect where come from the problem ?

    Thanks.

     
    • Hello,

      it took me some time to figure out what is going wrong. It seems that at least one of the decimal (packed) values in the result contains ':.000' which confuses the eval function - the collon at the start of the string raises SyntaxError. I have no idea where that strange value came from. Module uses the RfcConvertBcdToChar from the librfc32.dll to convert packed decimal values (aka BCD - format used by SAP to store decimal values internally) into strings. The ':.000' comes from this function.

      Regards,
      Klavdij

       
    • Thanks for your answer !
      This problem is very strange, because some lines are ok,
      but a few not. If I see the lines with problem in sap, I don't see an anomalie or or a common thing.
      Strange, very strange...

      For information we have an old version of sap (4.0B).