Automate

  • 1.  Central Contract (ME31K) stalls on error message

    Posted 11-23-2018 04:39

    Hi community,

    I try to create a script for creating central contracts (ME31K), i. e. a contract for an entire company code instead of just for a single plant. For organisational reasons we do not assign purchasing organisations to company codes. That is, when I leave out the plant number in the initial screen of ME31K the systems asks in a popup to state a company code instead.

    ME31K

    Now the problem is, when I confirm/enter that popup the following header dynpro already processes any checks. That is, the error message Fill out all required entry fields is processed, although all required field values have been supplied. This leads to an error in the Winshuttle validation run.

    ME31K (2)

    In the debug mode, if I simply process the OK-Code, the transaction proceeds to the next step since all required fields are already supplied correctly, and I can move on with the debug session.

    ME31K (3)

    However, the validation run brings subsequent errors that are caused by the main problem. The contract is not created at all. (Field EKKO-KDATE is formatted correctly. This is not the cause.)

     validation log

    OSS Note 301968 addresses this issue stating that the OK-Code for the initial dynpro should be =KOPF instead of /00. However, that solution does not help because the popup's OK-Code =ENTER always processed that (unwanted) first check for obligatory fields.

    How can I overcome this deadlock?



    ------------------------------
    José Andujar Garcia | IT Consultant Source-to-Pay
    K+S Aktiengesellschaft | [City] | +4956193011770
    ------------------------------


  • 2.  RE: Central Contract (ME31K) stalls on error message

    Employee
    Posted 11-28-2018 09:35
    Hi Jose ,
    I cannot reproduce the issue in our  SAP system, as the behavior is different - we do have purchasing orgs assigned to company codes.  Is it possible to ask your SAP Basis team to change the t-code behavior to change the error to a warning instead? 
    If that cannot be done, you might look for a BAPI to use instead.  I tried using BAPI_CONTRACT_CREATE, and it worked for a simple test.  You'd have to check it out to see if it can work for you.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------



  • 3.  RE: Central Contract (ME31K) stalls on error message

    Employee
    Posted 11-28-2018 10:27
    PS:  Attached is a simple example BAPI to create a quantity purchasing contract.  Hope it's helpful.

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------