Giter Club home page Giter Club logo

Comments (9)

gkralik avatar gkralik commented on August 25, 2024

The error messages are indeed not ideal, I'll have a look at improving them. Most of them already state the parameter name when an error occurs, but some of the TABLE methods do not currently.

The RFC_ILLEGAL_STATE return code in RfcDestroyFunctionDesc should not be an issue. There's definitely a problem worth investigating there, but I think your problem lies somewhere else.

I'll have a look at the BAPI. I'm using it in one of my projects, so I should find a clue...

from php7-sapnwrfc.

gkralik avatar gkralik commented on August 25, 2024

Can you upload the full trace somewhere (make sure to wipe credentials and the like)?

from php7-sapnwrfc.

studio2222 avatar studio2222 commented on August 25, 2024

You bet - thanks much for the help. Here you go.
rfc09564_09388.salesorder.usb.failed.txt

from php7-sapnwrfc.

gkralik avatar gkralik commented on August 25, 2024

Actually, I can't reproduce your error. Using this code:

<?php

$config = include "tests/sapnwrfc.config.inc";

$c = new \SAPNWRFC\Connection($config);

$f = $c->getFunction('BAPI_SALESORDER_CREATEFROMDAT2');
$r = $f->invoke([
    'ORDER_HEADER_IN' => [
                'DOC_TYPE' => 'Y0OR',
                'SALES_ORG' => '3310',
                'DISTR_CHAN' => '00',
                'DIVISION' => '00',
                'PURCH_NO_C' => '',
                'COLLECT_NO' => '',
    ],
    'ORDER_PARTNERS' => [
        [
            'PARTN_ROLE' => 'AG',
            'PARTN_NUMB' => '0020040938',
        ]

    ],
    'ORDER_ITEMS_IN' => [
        [
            'ITM_NUMBER' => '00010',
            'MATERIAL' => 'BC535R',
        ],
        [
            'ITM_NUMBER' => '00020',
            'MATERIAL' => 'B0020017',
        ],
        [
            'ITM_NUMBER' => '00030',
            'MATERIAL' => 'B0020017',
        ]
    ],
    'ORDER_CONDITIONS_IN' => [
        [
            'ITM_NUMBER' => '00020',
            'COND_TYPE' => 'Y0M1',
            'COND_VALUE' => 11.111,
        ]
    ],
    'ORDER_TEXT' => [
        [
            'TEXT_ID' => '004',
            'LANGU' => 'EN',
            'FORMAT_COL' =>'*',
            'TEXT_LINE' => '',
       ]
    ],
    'ORDER_SCHEDULES_IN' => [
        [
            'ITM_NUMBER' => '00010',
            'REQ_QTY' => 1.0,
        ],
        [
            'ITM_NUMBER' => '00020',
            'REQ_QTY' => 2.0
        ],
        [
            'ITM_NUMBER' => '00030',
            'REQ_QTY' => 1.0
        ]
    ]
]);

var_dump($r);

I only get errors about the sales document not existing, etc. (which was expected), but the source line that produces the error you mentioned executes cleanly.

I'll poke around a little more though. Can you show me a code snippet that reliably reproduces the error for you?

from php7-sapnwrfc.

studio2222 avatar studio2222 commented on August 25, 2024

Thanks I'll try your code snippet in the morning and get back to you. Best,

from php7-sapnwrfc.

gkralik avatar gkralik commented on August 25, 2024

I updated the exception messages to be more clear.

Consider this code, passing a wrong parameter type to ORDER_PARTNERS:

// [...]
$r = $f->invoke([
   // [...]
    'ORDER_PARTNERS' => [
            // ORDER_PARTNERS is a table, but we are not passing rows here
            'PARTN_ROLE' => 'AG',
            'PARTN_NUMB' => '0020040938',
    ],
  // [...]
]);

// [...]

Instead of only
Failed to set TABLE row, expected array
the message is now
Failed to set TABLE row, expected array for parameter ORDER_PARTNERS

I'll release a new version in the next days, so @ThaDafinser can (hopefully?) provide new builds for Windows.

from php7-sapnwrfc.

studio2222 avatar studio2222 commented on August 25, 2024

Thanks so much for your help. We FINALLY figured out the issue, and your example code was instrumental in doing so. Please see below -- when the header contains a reference this triggers the "Failed to set TABLE row, expected array". We were using a reference within our code to simplify some of our logic : ). When we remove the reference... boom.... it works great : )

The following minor adjustment to your code triggers the error:

image

from php7-sapnwrfc.

gkralik avatar gkralik commented on August 25, 2024

Happy to hear it works.

I'll definitely have a look at why it doesn't work with references though. I rarely use them, so there are no test using references that could have caught this issue. I'll open another ticket to track progress...

from php7-sapnwrfc.

szabizs avatar szabizs commented on August 25, 2024

So the problem with this is that you have to define an array, but watch out how you define it

This will not work because the array does not have an index.
$customersData = [ 'LOW' => $sap->populateKunnrWithZeros($customer->kunnr), 'HIGH' => $sap->populateKunnrWithZeros($customer->kunnr) ];

This will work because the array has an index.
$customersData[0] = [ 'LOW' => $sap->populateKunnrWithZeros($customer->kunnr), 'HIGH' => $sap->populateKunnrWithZeros($customer->kunnr) ];

from php7-sapnwrfc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.