Post a transaction and the appropriate status to the IDoc.

2024-01-17 09:32

本文主要是介绍Post a transaction and the appropriate status to the IDoc.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

2006年12月24日 08:53:00
On inbound function modules processing IDocs the following template can be used to post a transaction and the appropriate status to the IDoc.
*---- Data definition -------------------------------------------------
DATA: BEGIN OF BDCDATA OCCURS 5.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDCDATA.
DATA: C_TCODE LIKE BKPF-TCODE VALUE 'FB01'.
DATA BEGIN OF MESSTAB OCCURS 10.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF MESSTAB.
*---- Call transaction ------------------------------------------------
FORM Main_Program
REFRESH BDCDATA.
PERFORM APPEND_BDC USING 'SAPMF05A' '0100' ' ' ' '.
PERFORM APPEND_BDC USING ' ' ' ' 'BKPF-BLDAT' '09031998'.
PERFORM APPEND_BDC USING ' ' ' ' 'BDC_OKCODE' '/00'.
PERFORM APPEND_BDC USING 'SAPMF05A' '0300' ' ' ' '.
PERFORM APPEND_BDC USING ' ' ' ' 'BSEG-WRBTR' '*'.
PERFORM APPEND_BDC USING ' ' ' ' 'BDC_OKCODE' 'BU'.
CALL TRANSACTION 'FB01' USING BDCDATA MODE 'N' UPDATE 'S'.
PERFORM UPDATE_IDOC_STATUS.
ENDFORM.
*--- Call transaction with errors to BDC -----------------------------
REFRESH MESSTAB.
CALL TRANSACTION C_TCODE USING BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO MESSTAB.
RETURN_CODE = SY-SUBRC.
IF RETURN_CODE = 0.
LOOP AT MESSTAB.
IF MESSTAB-MSGTYP = 'E'.
RETURN_CODE = MESSTAB-MSGNR.
SY-MSGID = 'B1'.
SY-MSGNO = 999.
SY-MSGV1 = 'Error: Check BDC'.
ENDIF.
ENDLOOP.
ENDIF.
*--- Here we check the return code, if there was an error, we put the
* transaction in a BDC session for the user to review and correct.
IF RETURN_CODE NE 0.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'ZKJW'
USER = SY-UNAME
KEEP = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_TCODE
TABLES
DYNPROTAB = BDCDATA.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
ENDIF.
*--- Append BDCDATA internal table ------------------------------------
FORM APPEND_BDC USING VALUE(P_PROG)
VALUE(P_SCREEN)
VALUE(P_NAM)
VALUE(P_VAL).
CLEAR BDCDATA.
IF P_PROG NE SPACE.
BDCDATA-PROGRAM = P_PROG.
BDCDATA-DYNPRO = P_SCREEN.
BDCDATA-DYNBEGIN = 'X'.
BDCDATA-FNAM = P_NAM.
BDCDATA-FVAL = P_VAL.
ELSE.
BDCDATA-FNAM = P_NAM.
BDCDATA-FVAL = P_VAL.
ENDIF.
APPEND BDCDATA.
ENDFORM.
*&---------------------------------------------------------------------*
FORM UPDATE_IDOC_STATUS.
*--- Now we check the CALL TRANSACTION return code and set IDOC status
CLEAR IDOC_STATUS.
IF RETURN_CODE = 0.
WORKFLOW_RESULT = '0'.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '53'.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ELSE.
WORKFLOW_RESULT = '99999'.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ENDIF.
APPEND IDOC_STATUS.
ENDFORM. " UPDATE_IDOC_STATUS


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1458018


这篇关于Post a transaction and the appropriate status to the IDoc.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/615592

相关文章

10 Source-Get-Post-JsonP 网络请求

划重点 使用vue-resource.js库 进行网络请求操作POST : this.$http.post ( … )GET : this.$http.get ( … ) 小鸡炖蘑菇 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-w

Unity Post Process Unity后处理学习日志

Unity Post Process Unity后处理学习日志 在现代游戏开发中,后处理(Post Processing)技术已经成为提升游戏画面质量的关键工具。Unity的后处理栈(Post Processing Stack)是一个强大的插件,它允许开发者为游戏场景添加各种视觉效果,如景深、色彩校正、辉光、模糊等。这些效果不仅能够增强游戏的视觉吸引力,还能帮助传达特定的情感和氛围。 文档

项目一(一) HttpClient中的POST请求和GET请求

HttpClient中的POST请求和GET请求 一、HttpClient简述 HttpClient是Apache Jakarta Common下的子项目,用来提供高效的、最新的、功能丰富的支持HTTP协议的客户端编程工具包,并且它支持HTTP协议最新的版本和建议。HttpClient已经应用在很多的项目中,比如Apache Jakarta上很著名的另外两个开源项目Cactus和HTMLU

Post-Training有多重要?一文带你了解全部细节

1. 简介 随着LLM学界和工业界日新月异的发展,不仅预训练所用的算力和数据正在疯狂内卷,后训练(post-training)的对齐和微调方法也在不断更新。InstructGPT、WebGPT等较早发布的模型使用标准RLHF方法,其中的数据管理风格和规模似乎已经过时。近来,Meta、谷歌和英伟达等AI巨头纷纷发布开源模型,附带发布详尽的论文或报告,包括Llama 3.1、Nemotron 340

ajax xmlhttprequest使用post传参数并向后台获取数据

ajax xmlhttprequest向后台传数据有两种方式,一种是直接在地址URL后面加入参数,后台用Request.QueryString来获取,另外一种是采用POST来传,send方法发送参数对,比如send("a=3&b=4"),后台用Request.Form[“a”]来获取3,同理Request.Form["b"]获取4   前台代码: <%@ Page Titl

Flutter-使用dio插件请求网络(get ,post,下载文件)

引入库:dio: ^2.1.13可直接运行的代码:包含了post,get 下载文件import 'package:flutter/material.dart';import 'package:dio/dio.dart';void main() {runApp(new MaterialApp(title: 'Container demo',home: new visitNetPage(),)

org.hibernate.transaction.JDBCTransaction cannot be cast to javax.transaction.Transaction

org.hibernate.transaction.JDBCTransaction cannot be cast to javax.transaction.Transaction 这部分的具体地方为Transaction tr =(Transaction) session.beginTransaction();  错误原因:包倒错了,应该导入的包是hibernate的Transaction包

【python 爬虫】python如何以request payload形式发送post请求

普通的http的post请求的请求content-type类型是:Content-Type:application/x-www-form-urlencoded, 而另外一种形式request payload,其Content-Type为application/json import jsonurl = 'https://api.github.com/some/endpoint'payload

Python实现requests-post(Multipart/form-data格式)boundary=----WebKitForm

这种模式相比于普通post,实在太烦了,这种基本都是用来上传文件(包括图片、excel、doc等) import requestsfrom requests_toolbelt.multipart.encoder import MultipartEncoderimport jsonurl = 'http://www.requests-post.com'headers = {'Accept':

Delphi XE10,Json 生成和解析,再利用indyhttp控件Post

--不多说,直接上代码 procedure TFrmMain.Brand; var   JSONObject, jsonparam: TJSONObject; // JSON类   jsonArray: TJSONArray; // JSON数组变量   i: Integer;   Flag_Do: Boolean;   jsonToSend: TStringStream;   jsonStr,