如何将 SAP 表中的数据导入到 Excel 工作表

发布于 2024-12-16 20:20:52 字数 309 浏览 3 评论 0原文

我是 Excel VBA 新手。 我不知道如何将数据从 SAP 表获取到 Excel 工作表。

查询是。 我有一张包含 10 个字段的 Excel 工作表。
根据pcode字段(在Excel中),PL将从SAP表中导入。

例子

ID | name  | pcode | PL (from SAP)
---+-------+-------+-----------------
1  | kiran | 1234  | 
2  | karan | 5001  | 

I am new to Excel VBA.
I don't know how to get the data from SAP table to Excel sheet.

The query is.
I have one Excel sheet containing 10 fields.
Basing on pcode field (in Excel), PL will be imported from SAP table.

Example

ID | name  | pcode | PL (from SAP)
---+-------+-------+-----------------
1  | kiran | 1234  | 
2  | karan | 5001  | 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鲸落 2024-12-23 20:20:52

网上有很多关于从 VB 写入 Excel 表格的文档,因为有很多关于将 SQL 表数据读入 VB 的文档,您可以 google 这些东西并找到您需要的内容。
您可能无法通过 Google 找到如何找到您实际需要的表。
SAP 数据全部来自我喜欢称为“背景”表的表。虽然SAP以一种很好看的格式呈现所有数据,但它实际上只是一组又大又丑的SQL表。
假设我想提取所有库存商品(据 SAP 所知),然后将此信息写入 Excel 工作表,从这里开始:

首先打开系统信息。为此,请按 Ctrl + Shift + I(或转到查看 -> 系统信息),现在当您将鼠标悬停在字段上时,SAP 屏幕底部的栏会告诉您所有您需要的背景信息。您需要在 SQL 中找到数据的位置。

将鼠标悬停在某处并查看此处!

当您将光标悬停在字段上时,此图像中突出显示的栏应显示类似this:

Manual [Form = 142 Item = 38 Pane = 1 Column = 14700021 Row = 1 Variable = 11 POR1,UomCode]

这里我们感兴趣的部分是“POR1, UomCode" 这里,“POR1”将是包含您要查找的数据的 SQL 表的名称,“UomCode”是列名称。

此示例针对采购订单,但对于物料主数据,此信息会有所不同,表名称将为 OITM,物料详细信息保存在 ITM1 中。

因此,您将构建一个 SQL 查询,它将从表中获取您需要的所有信息,用您选择的任何编程语言(我使用 VB.NET)将其打包到变量中,然后将其输出到 Excel 中。

希望这有帮助!

There's a lot of documentation online for writing into Excel sheets from VB, as there is a lot of documentation for reading SQL table data into VB, you can google these things and find what you need.
Something you might not find through Google is how to track down the tables you actually require.
SAP data all comes from tables that I like to call "Background" tables. Although SAP presents all the data in a nice format which is easy on the eyes, it is all actually just a set of big ugly SQL tables.
Lets say I want to extract all of the items that I have in stock (as far as SAP knows), then write this info into an excel sheet, here's where to begin:

Firstly TURN ON SYSTEM INFORMATION. To do this, press Ctrl + Shift + I (or go to View -> system information), now when you hover over a field, the bar at the bottom of the SAP screen will tell you all of the background information that you'll need to find the location of the data in SQL.

Hover mouse somewhere and look here!

When you hover your cursor over a field, the bar highlighted in this image should show something like this:

Manual [Form = 142 Item = 38 Pane = 1 Column = 14700021 Row = 1 Variable = 11 POR1,UomCode]

Here the parts we are interested are the "POR1, UomCode" Here, "POR1" will be the name of the SQL table which contains the data you're after, and "UomCode" is the column name.

This example was for a purchase order, but for item master data this information will be different, the table name will be OITM, with item details being held in ITM1.

And so you would contruct a SQL query which will bring through all the info you need from the tables, package it up into variables in whatever programming language you choose (I use VB.NET), then spit it out into Excel.

Hope this helped!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文