Skip to main content

How can I use the BAPI_CUSTOMER_HIERARCHIE_INS to end date some customers in a hierarchy?




  • Best answer
    DSP Expert

    PCardoso: SE37 is tricky. You need to explicitly call BAPI_TRANSACTION_COMMIT using Function Module > test > test sequence and chain the two BAPIs together. But this isn't your real issue. The core issue you are having with Integrate is likely due to the BAPI you are using has date fields.

    DSP Autogen generated sql tables with NVARCHAR(8) or NVARCHAR(6) for both Upload and Download tables. You need to change all the Date and Time fields to NVARCHAR(50) both in download and upload tables to resolve the issue. I don't bother trying to figure out which fields are date fields; just alter all the character 8- or 6-length fields to 50. Done!! This can be done using a script and building the ALTER TABLE command (e.g. SELECT TABLE_NAME, COLUMN_NAME, * FROM dswMM.INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME like '%_Upload' or TABLE_NAME like '%_Download') and data_type = 'nvarchar' and CHARACTER_MAXIMUM_LENGTH IN (8,6);)

  • DSP Expert

    DallasMonday: Try using BAPI_CUSTOMER_HIERARCHIE_DEL. We also provide a functional module /BOA/BAPI_CUST_HIER_MAINTAIN that provides a wrapper for the insert, delete, and update hierarchy functional modules. 

  • DSP User

    Dallas, I tried the BAPI_CUSTOMER_HIERARCHIE_DEL and did not see any update via SE37. When trying to execute in Integrate, I would ether

    1. Receive an error around the date format


    2. Receive the error 'An Exception was thrown: Staging table commit to database via bulk copy failed.,' but I could not determine precisely what caused this.

    Furthermore, here is what I have observed in our SAP environment/dspConduct:

    • Create new Corp group customer w/hierarchy. All data post correctly, hierarchy created
    • Maintain Hier – End date one record to TODAY. Existing record validity date: 10/1-10/25. New record validity date: 10/26-12/31/9999
    • Maintain Hier – Add customer into hier. New record added and data posted correctly
    • End date direct in SAP via VDH1N. Record, which is end dated for 10/25, is dropped from the Hier
    • End date via SE37 using the Hier INS BAPI – Set record to 10/25 for end date. No changes made
    • Run Hier DEL via se37. No changes made

Please sign in to leave a comment.