cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic publish to ERP

Former Member
0 Kudos

Hi,

I am using SAP sourcing7. We have a requirement where we need to automatically publlsh master agreements to ERP. For this, we have created a custom variable through workbook and used below document lifecycle script. However, I get error saying "Typed variable declaration : Class: ExporterIfc not found in namespace"

I have checked the SAP integration jar and the classes ExporterIfc, SmartExporter all seem to be same and belonging to right packages. Can you please help.

*********************************************************************************************

import java.util.HashMap;

import com.frictionless.sap.integration.exporter.ExporterIfc;

import com.frictionless.sap.integration.exporter.SmartExporter;

PROP_DATACONV_ENABLED = "data.conversion.enable";

PROP_SET = "custom";

// Get logger

logMsg =Logger.createLogMessage(session);

void publishOA(){

Logger.info(logMsg.setLogMessage("*********Starting publishOA**********"));

HashMap map = new HashMap();

map.put("mode", "export");

ExporterIfc exporter = new SmartExporter(doc,map);

exporter.process();

}

//*********** Main Method **********

Logger.info(logMsg.setLogMessage("*********STARTING AUTOMATIC PUBLISH TO ERP**********"));

dcInProg =IapiSystemUtilities.getSystemProperty(session,PROP_SET,PROP_DATACONV_ENABLED,"false");

Logger.info(logMsg.setLogMessage("*********dcInProg**********" + dcInProg));

if(Boolean.valueOf(dcInProg)){

publishOA();

}

*********************************************************************************************

Regards

Moumita

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Moumita,

What release of Sourcing are you on? In 5.x release, the Publish to ERP is a toolbar script. In 5.1, if you want to perform auto publish you could essentially take the toolbar script and use it where appropriate. In the past, Iu2019ve built a custom jar file that reads a file and iterates through a list of MA idu2019s and publishes each MA to ERP. The custom jar was called from a schedule task of type IAPI task Execution which was triggered on demand.

In 7.0, Publish to ERP is not a toolbar script but is implemented as part of the core product. So unfortunately the toolbar script option is ruled out here. In your code I believe you are using internal classes which are not exposed in the IAPI which is not a recommended approach. You might want to raise a message with SAP so the required IAPIs are enabled to perform auto publish.

Hope this helps.

Regards,

Vikram

Former Member
0 Kudos

Hi,

Thanks for your response. I am using sourcing 7.

Yes as you mentioned, I found out that SAP now supports this automatic publish to ERP as part of the standard package and the ExporterIfc and SmartExporter classes have different packages now than sourcing 5.x. So, I was just trying to use the below script by changing the import definitions with current package names.

Now, the script does get fired when we upload our agreements through workbook and try to publish to ERP, but then fails with error message

"1003:Standard Legacy SOW - ValidatingParent=-8388607:1003:Standard Legacy SOW - com.sap.odp.api.common.exception.ApplicationException: Sourcing successfully connected to ERP server and sent request(s) to publish document(s). ERP server has returned error(s) for request to publish Standard Legacy SOW: ID: Please enter vendor or supplying plant

No instance of object type PurchasingContract has been created. External reference: # 1

00001:Please enter Incoterm DDP with details of location

Please contact your system administrator.".

The workbook has vendor and plant details though.

Meanwhile I understand that this might not be a recommended way of doing and am going to raise this question with SAP too but any pointers will be appreciated.

*****************************************************

import java.util.HashMap;

import com.sap.eso.sapintegration.exporter.ExporterIfc;

import com.sap.eso.sapintegration.exporter.HTTPExporter;

PROP_DATACONV_ENABLED = "data.conversion.enable";

PROP_SET = "custom";

// Get logger

logMsg =Logger.createLogMessage(session);

void publishOA(){

HashMap map = new HashMap();

map.put("mode", "export");

ExporterIfc exporter = new HTTPExporter(doc,map);

exporter.process();

}

//*********** Main Method **********

dcInProg =IapiSystemUtilities.getSystemProperty(session,PROP_SET,PROP_DATACONV_ENABLED,"false");

if(Boolean.valueOf(dcInProg)){

publishOA();

}

Former Member
0 Kudos

This is resolved.

Regards

Moumita

Former Member
0 Kudos

Hi,

could you please share the solution for this? We are facing a similar issue at a client for the vendors.

Thanks,

Bram

Former Member
0 Kudos

Hi Bram,

What is the exact issue you are facnig? Is it in autopublish script or you are getting validation errors when trying to publish to ERP.

In case, it is in autopublish in SAP sourcing 7.0, you should use below script in collection validation with class as Agreement/Master Agreement and target as Collection Validation.

Please let me know if you want more information.

*******************************************************************************

import java.util.HashMap;

import com.sap.eso.sapintegration.exporter.ExporterIfc;

import com.sap.eso.sapintegration.exporter.SmartExporter;

PROP_DATACONV_ENABLED = "data.conversion.enable";

PROP_SET = "custom";

// Get logger

logMsg =Logger.createLogMessage(session);

void publishOA(){

Logger.info(logMsg.setLogMessage("*********Starting Publish to ERP**********"));

HashMap map = new HashMap();

map.put("mode", "export");

ExporterIfc exporter = new SmartExporter(doc,map);

doc.getExtensionField("Z_MIGRATION_VAR").set(true);

Logger.info(logMsg.setLogMessage("*********Setting migration flag to**********" + Z_MIGRATION_VAR));

exporter.process();

Logger.info(logMsg.setLogMessage("*********Ended Publish to ERP**********"));

}

//*********** Main Method **********

dcInProg =IapiSystemUtilities.getSystemProperty(session,PROP_SET,PROP_DATACONV_ENABLED,"false");

Logger.info(logMsg.setLogMessage("*********Migration is enabled**********" + dcInProg));

lineItemsCollection = doc.getLineItems();

isExported=doc.getExtensionField("Z_MIGRATION_VAR").get();

Logger.info(logMsg.setLogMessage("******isExported******" + isExported));

collectionsize = lineItemsCollection.size();

// If there are lineitems, then only publish to ERP

if (collectionsize>0) {

Logger.info(logMsg.setLogMessage("******Number of Lineitems******" + collectionsize));

if(Boolean.valueOf(dcInProg)){

if(!isExported) {

publishOA();

}

}

}

*******************************************************************************

Regards

Moumita

Former Member
0 Kudos

In case you are referring to the issue----


>

"1003:Standard Legacy SOW - ValidatingParent=-8388607:1003:Standard Legacy SOW - com.sap.odp.api.common.exception.ApplicationException: Sourcing successfully connected to ERP server and sent request(s) to publish document(s). ERP server has returned error(s) for request to publish Standard Legacy SOW: ID: Please enter vendor or supplying plant

No instance of object type PurchasingContract has been created. External reference: # 1

00001:Please enter Incoterm DDP with details of location

Please contact your system administrator.".

This was a because of incorrect data in our workbook.

Regards

Moumita

Answers (0)