发送数据给sap和接收
1.确保已经连通sap
2.发送数据:这是以表的形式发送,而且是批量发送给sap
3.接收sap返回信息:这个比较特别,碰到时试一试
package com.yiyezhiqiu.lyh.utils; import com.alibaba.fastjson.JSON;
import com.sap.conn.jco.*;
import com.yiyezhiqiu.lyh.domain.Job;
import com.yiyezhiqiu.lyh.service.IWorkTimeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j public class TestSap { @Autowired
IWorkTimeService workTimeService; public Map contextLoads(List<Job> jobList) { String xmlStr = "";
Map<String ,Object> maps = null;
for(Job list:jobList){
System.out.println("joblist"+list.getID()+"一叶知秋"+jobList.size()+list.getLSTAR());
} JCoDestination destination = null;
try{
SapConnection connection = new SapConnection();
destination = connection.connection();
}catch(Exception e){
return maps;
} log.info("JCoDestination: "+destination);
try {
if (destination != null) {
JCoFunction function;
try{
function = destination.getRepository().getFunction("ZFMMM_READ_XXXXX");
}catch(Exception e){
return maps;
} // function.getImportParameterList().setValue("I_DATA", jobList);
for(Job list:jobList){
JCoTable table = function.getTableParameterList().getTable("I_DATA");
table.appendRow();
table.setValue("ID",list.getID());
table.setValue("ARWKS",list.getARWKS());
table.setValue("VGE01",list.getVGE01());
table.setValue("TELPO",list.getTELPO());
table.setValue("PTYPE",list.getPTYPE());
table.setValue("BUDAT",list.getBUDAT());
table.setValue("CARDNAME",list.getCARDNAME());
table.setValue("CARDNO",list.getCARDNO());
table.setValue("ARBPL",list.getARBPL());
table.setValue("WRTNR",list.getWRTNR());
table.setValue("ZZPROJE",list.getZZPROJE());
table.setValue("WORKP",list.getWORKP());
table.setValue("AUFNR",list.getAUFNR());
table.setValue("JOBTYPENAME",list.getJOBTYPENAME());
table.setValue("JOBTYPE",list.getJOBTYPE());
table.setValue("LIFNR",list.getLIFNR());
table.setValue("LINEDNAME",list.getLINEDNAME());
table.setValue("LINED",list.getLINED());
table.setValue("ISDDZ",list.getISDDZ());
table.setValue("IEDDZ",list.getIEDDZ());
table.setValue("BGTYP",list.getBGTYP());
table.setValue("VGWRT",list.getVGWRT());
table.setValue("LSTAR",list.getLSTAR());
table.setValue("SJPNO",list.getSJPNO());
table.setValue("USNAM",list.getUSNAM());
table.setValue("CPUDT",list.getCPUDT());
table.setValue("AEDAT",list.getAEDAT());
table.setValue("FLAG",list.getFLAG());
table.setValue("TEXT",list.getTEXT());
table.setValue("ZDEL",list.getZDEL());
table.setValue("CPUDT1",list.getCPUDT1());
table.setValue("CPUTM1",list.getCPUTM1());
table.setValue("APUDT1",list.getAPUDT1());
table.setValue("APUTM1",list.getAPUTM1());
table.setValue("PHASE",list.getPHASE());
table.setValue("BATCH",list.getBATCH());
table.setValue("RUECK",list.getRUECK());
table.setValue("RMZHL",list.getRMZHL());
table.setValue("BLART",list.getBLART());
table.setValue("DSNAM",list.getDSNAM());
table.setValue("DEDAT",list.getDEDAT());
table.setValue("BELNR",list.getBELNR());
table.setValue("F01",list.getF01());
table.setValue("F02",list.getF02());
table.setValue("F03",list.getF03());
table.setValue("F04",list.getF04());
table.setValue("F05",list.getF05());
table.setValue("F06",list.getF06());
table.setValue("F07",list.getF07());
table.setValue("F08",list.getF08());
} function.execute(destination); // JCoParameterList tablePort = function.getTableParameterList(); //info = tablePort.toXML();
// System.out.println("info:"+info); // XmlParse xmlParse = new XmlParse();
//xmlStr = xmlParse.getXmlAttribute(info); JCoStructure r1 = function.getExportParameterList().getStructure("GS_XXXX"); String type = "";
String message = "";
type = r1.getString("TYPE");
message = r1.getString("MESSAGE");
maps = new HashMap<>();
maps.put("type",type);
maps.put("message",message);
return maps;
}
}catch (JCoException e){
e.printStackTrace();
} return maps; }
}
发送数据给sap和接收的更多相关文章
- C#使用HttpWebRequest发送数据和使用HttpWebResponse接收数据的一个简单示例
新建一个.NET Core控制台项目,代码如下所示: using System; using System.Text; using System.Net; using System.Collectio ...
- postman发送数据,django 获取接收数据
postman发起请求如下图 在django中使用如下方式获取token print(request.META) token = request.META.get('HTTP_X_TOKEN')
- AJAX中使用post,get接收发送数据的区别
如何发起请求 xhr.send(); 备注: 如果是get方式,send()命令中不用写任何参数 传递的数据可以写在url中,服务器用$_GEET["参数名"]接收 如果是post ...
- Http协议以及模拟http请求发送数据
1 为什么要使用http协议 假设我现在有两个客户端浏览器,一个是google,一个是IE浏览器:我现在有两个服务器,一个是tomcat,一个是JBoss;在最初的情况下是:如果google要往tom ...
- C# TCP socket发送大数据包时,接收端和发送端数据不一致 服务端接收Receive不完全
简单的c# TCP通讯(TcpListener) C# 的TCP Socket (同步方式) C# 的TCP Socket (异步方式) C# 的tcp Socket设置自定义超时时间 C# TCP ...
- STM32移植RT-Thread后的串口在调试助手上出现:(mq != RT_NULL) assert failed at rt_mq_recv:2085和串口只发送数据不能接收数据问题
STM32移植RT-Thread后的串口在调试助手上出现:(mq != RT_NULL) assert failed at rt_mq_recv:2085的问题讨论:http://www.rt-thr ...
- C#串口通信—向串口发送数据,同步接收返回数据
最近写C#串口通信程序,系统是B/S架构.SerialPort类有一个DataReceived事件,用来接收串口返回的数据,但这种方式在C/S架构下很好用,但B/S就不好处理了.所以写了一个同步模式接 ...
- Java基础知识强化之网络编程笔记06:TCP之TCP协议发送数据 和 接收数据
1. TCP协议发送数据 和 接收数据 TCP协议接收数据:• 创建接收端的Socket对象• 监听客户端连接.返回一个对应的Socket对象• 获取输入流,读取数据显示在控制台• 释放资源 TCP协 ...
- Java基础知识强化之网络编程笔记03:UDP之UDP协议发送数据 和 接收数据
1. UDP协议发送数据 和 接收数据 UDP协议发送数据: • 创建发送端的Socket对象 • 创建数据,并把数据打包 • 调用Socket对象的发送方法,发送数据包 • 释放资源 UDP协议接 ...
随机推荐
- 谈一谈php反序列化
1.序列化与反序列化 php中有两个函数serialize()和unserialize() 序列化serialize(): 当在php中创建了一个对象后,可以通过serialize()把这个对象转变成 ...
- Joomla 3.0.0 --> 3.4.6-RCE复现
Joomla是一款网站管理系统CMS,最近曝出其3.00-3.4.6的joomla版本存在一个RCE漏洞. 并且大佬已将exp放在了github上,下载地址:https://www.exploit-d ...
- 3.Docker Compose 部署 GitLab
什么是 GitLab GitLab 是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的 Git 项目仓库,可通过 Web 界面进行访问公开的或者私人项目.它拥有与 Githu ...
- linux100讲——71 if-else判断的使用
1.if-then-else语句: 语法: if [测试条件成立] then 执行相应的命令 else 测试条件不成立,执行相应的命令 fi 结束 示例:vim 9.sh #!/bin/bash #i ...
- z3学习档案
Reference: 看雪-z3巧解逆向 知乎:Z3一把梭 z3 solver学习 使用z3约束求解器解决CTF中的题目 Playing with Z3,hacking the serial chec ...
- python数据分析学习(2)pandas二维工具DataFrame讲解
目录 二:pandas数据结构介绍 下面继续讲解pandas的第二个工具DataFrame. 二:pandas数据结构介绍 2.DataFarme DataFarme表示的是矩阵的数据表,包含 ...
- react-native构建基本页面3---路由配置
安装路由 运行yarn add react-native-router-flux 路由官网 路由相关配置 路由简单的DEMO // Main 才是项目的根组件 import React, { Comp ...
- jQuery---动态创建节点
动态创建节点 js的方法 var box = document.getElementById("box"); var a = document.createElement(&quo ...
- Go-结构体,结构体指针和方法
https://cloud.tencent.com/developer/article/1482382 4.1.结构体 结构体:讲一个或多个变量组合到一起形成新的类型,这个类型就是结构体,结构体是值类 ...
- 从ASCII到Unicode再到UTF-8的历史原由
编码 大小 支持语言 ASCII 1个字节 英文 Unicode 2个字节(生僻字4个) 所有语言 UTF-8 1-6个字节,英文字母1个字节,汉字3个字节,生僻字4-6个字节 所有语言 具体解释: ...