BAPI / RFC with Delphi(系列之六)--TSAPFunctions使用BAPI创建PO(有登录对话框的delphi源代码)

本文主要是介绍BAPI / RFC with Delphi(系列之六)--TSAPFunctions使用BAPI创建PO(有登录对话框的delphi源代码),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1、新建一个Form,并在form上添加下列控件

Component

Function

SAPFunctions1SAP ActiveX-component to connect RFC/BAPI
Button1Button to start the procedure
Panel1not relevant!

2、源代码如下(使用BAPI_PO_CREATE函数创建PO) 

unit PO_Create;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls, OleCtrls, SAPFunctionsOCX_TLB, ExtCtrls;

type
  TForm1 = class(TForm)
  SAPFunctions1: TSAPFunctions;
  Button1: TButton;
  Panel1: TPanel;
  procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;

var
Form1: TForm1;
Funct,
Header,
POItems,
Schedules,
ItemsRow,
SchedulesRow: Variant;

implementation
{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var MLDText : String;
begin
  Button1.Enabled:=false;
  Panel1.Caption := 'RFC ist running, please wait.....';
  (* define function *)
  Funct := sapFunctions1.add('BAPI_PO_CREATE');

(*** define tables, use structures of the dictionary ***)

  (* table for the purcaseorder header *)
  Header := funct.exports('PO_HEADER');

  (* table of the purcaseorder items *)
  POItems := funct.tables.item('PO_ITEMS');

  (* table of the schedules *)
  Schedules := funct.tables.item('PO_ITEM_SCHEDULES');

(*** filling the PO_Header-table ***)

  (* purcasing document type *)
  Header.Value[2] := 'NB ' ;

  (* purcasing document category *)
  Header.Value[3] := 'F' ;

  (* purcasing organisation *)
  Header.Value[5] := '600' ;

  (* purcasing group *)
  Header.Value[6] := '610' ;

  (* vendor account number, on numeric values don't *)
  (* forget the leading zeroes!!!                     *)
  Header.Value[8] := '0099000123';

(*** filling the PO_Items-table ***)

  (* add new row to the table *)
  ItemsRow := POItems.rows.add;

  (* item number of purcasing document *)
  ItemsRow.Value[2]:='00010';

  (* material-number, on numeric values don't forget *)
  (* the leading zeros !!!                            *)
  ItemsRow.Value[5]:='000000000000001161';

  (* storage location *)
  ItemsRow.Value[11]:='100';

  (* plant *)
  ItemsRow.Value[17]:='0001';

  (* netprice in purcasing document, *)
  (* in document currency              *)
  ItemsRow.Value[21]:='10,00';

(*** filling the PO_Items_Schedules-table ***)

  (* add new row to the table *)
  SchedulesRow := Schedules.rows.add;

  (* item number of purcasing document *)
  SchedulesRow.Value[1]:='00010';

  (* category of delivery date *)
  SchedulesRow.Value[3]:='1';

  (* item delivery date *)
  SchedulesRow.Value[4]:='30.05.2000';

  (* scheduled quantity *)
  SchedulesRow.Value[6]:='10';

(*** call function ***)

  if not funct.call then

    (* on error show message *)
    showMessage(funct.exception)

  else
  begin

    (* show number of the purcaseorder *)
    MLDText:= funct.imports('PURCHASEORDER');
    MessageDlg('purcaseorder '+MLDText+' created.',
    MTInformation,[mbOK],0);
  end;
end;

 



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


这篇关于BAPI / RFC with Delphi(系列之六)--TSAPFunctions使用BAPI创建PO(有登录对话框的delphi源代码)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

python使用fastapi实现多语言国际化的操作指南

《python使用fastapi实现多语言国际化的操作指南》本文介绍了使用Python和FastAPI实现多语言国际化的操作指南,包括多语言架构技术栈、翻译管理、前端本地化、语言切换机制以及常见陷阱和... 目录多语言国际化实现指南项目多语言架构技术栈目录结构翻译工作流1. 翻译数据存储2. 翻译生成脚本

Android 悬浮窗开发示例((动态权限请求 | 前台服务和通知 | 悬浮窗创建 )

《Android悬浮窗开发示例((动态权限请求|前台服务和通知|悬浮窗创建)》本文介绍了Android悬浮窗的实现效果,包括动态权限请求、前台服务和通知的使用,悬浮窗权限需要动态申请并引导... 目录一、悬浮窗 动态权限请求1、动态请求权限2、悬浮窗权限说明3、检查动态权限4、申请动态权限5、权限设置完毕后

C++ Primer 多维数组的使用

《C++Primer多维数组的使用》本文主要介绍了多维数组在C++语言中的定义、初始化、下标引用以及使用范围for语句处理多维数组的方法,具有一定的参考价值,感兴趣的可以了解一下... 目录多维数组多维数组的初始化多维数组的下标引用使用范围for语句处理多维数组指针和多维数组多维数组严格来说,C++语言没

在 Spring Boot 中使用 @Autowired和 @Bean注解的示例详解

《在SpringBoot中使用@Autowired和@Bean注解的示例详解》本文通过一个示例演示了如何在SpringBoot中使用@Autowired和@Bean注解进行依赖注入和Bean... 目录在 Spring Boot 中使用 @Autowired 和 @Bean 注解示例背景1. 定义 Stud

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

使用Python快速实现链接转word文档

《使用Python快速实现链接转word文档》这篇文章主要为大家详细介绍了如何使用Python快速实现链接转word文档功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 演示代码展示from newspaper import Articlefrom docx import

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

SpringBoot中使用 ThreadLocal 进行多线程上下文管理及注意事项小结

《SpringBoot中使用ThreadLocal进行多线程上下文管理及注意事项小结》本文详细介绍了ThreadLocal的原理、使用场景和示例代码,并在SpringBoot中使用ThreadLo... 目录前言技术积累1.什么是 ThreadLocal2. ThreadLocal 的原理2.1 线程隔离2

Python itertools中accumulate函数用法及使用运用详细讲解

《Pythonitertools中accumulate函数用法及使用运用详细讲解》:本文主要介绍Python的itertools库中的accumulate函数,该函数可以计算累积和或通过指定函数... 目录1.1前言:1.2定义:1.3衍生用法:1.3Leetcode的实际运用:总结 1.1前言:本文将详

浅析如何使用Swagger生成带权限控制的API文档

《浅析如何使用Swagger生成带权限控制的API文档》当涉及到权限控制时,如何生成既安全又详细的API文档就成了一个关键问题,所以这篇文章小编就来和大家好好聊聊如何用Swagger来生成带有... 目录准备工作配置 Swagger权限控制给 API 加上权限注解查看文档注意事项在咱们的开发工作里,API