JAVA调用SAP BAPI BAPI_SALESORDER_CREATEFROMDAT2创建销售订单

这里写自定义目录标题

  • JAVA 调用 BAPI_SALESORDER_CREATEFROMDAT2
  • 完美解决 SD document XXXX is not in the database or has been archived。

JAVA 调用 BAPI_SALESORDER_CREATEFROMDAT2

JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
	      destination.ping();
	      String SalesDocument = "";
	      JCoTable T_LOG = null;
	      JCoStructure S_HEADER = null;
	      JCoStructure S_HEADERX = null;
	      JCoTable T_PARTNERS = null;
	      JCoTable T_ITEMS= null;
	      JCoTable T_ITEMSX= null;
	      
	      JCoTable T_Message= null;
	      JCoTable T_SCHEDULES= null;
	      JCoTable T_SCHEDULESX= null;
	      JCoTable T_CONDITIONS= null;
	      JCoTable T_CONDITIONSX= null;
	      JCoFunction function = null;
	      JCoFunction commitFunction = null;
	      function =destination.getRepository().getFunction("BAPI_SALESORDER_CREATEFROMDAT2");
	      commitFunction = destination.getRepository().getFunction("BAPI_TRANSACTION_COMMIT");
	      if (function == null) {
   
		       throw new RuntimeException("SD_SALESDOCUMENT_CREATE not found in SAP.");
		    }
	     //SALES_HEADER_IN  /ORDER_HEADER_IN 
	      S_HEADER = function.getImportParameterList().getStructure("ORDER_HEADER_IN");
	      S_HEADERX = function.getImportParameterList().getStructure("ORDER_HEADER_INX");
	      T_PARTNERS= function.getTableParameterList().getTable("ORDER_PARTNERS");
	      T_ITEMS= function.getTableParameterList().getTable("ORDER_ITEMS_IN");
	      T_ITEMSX = function.getTableParameterList().getTable("ORDER_ITEMS_INX");
	      T_Message= function.getTableParameterList().getTable("RETURN");
	      T_SCHEDULES= function.getTableParameterList().getTable("ORDER_SCHEDULES_IN");  
	      T_SCHEDULESX= function.

你可能感兴趣的:(java,开发语言,后端,sap)