SAP 几种查表的方法

合集下载

SAP系统18种查询表的方法

SAP系统18种查询表的方法

18 T echniques for Locating the Underlying Data of a Screen Field Dennis BarrettDennis Barrett is an applications consultant with SAP America who focuses on Service Management/ Customer Service and the Picture this. An Operations Manager wants a special report of her service orders. She gives you a sketch of what she wants it to look like (columns, rows, headings, grouping, subtotals, totals, and the like), and points to fields on the Service Management transaction screens that have the data she wants you to show in the report.What do you do? Most likely, you would check to find any existing reports delivered with the system (or already written for this client) that provide the information the Operations Manager wants, or that can be copied and revised to fit her needs. If you don’t find any, you might then look into the appropriate reporting system — in this case, the Plant Maintenance Information System (PMIS) — to see if you can adapt it. In this case, however, you can’t find the report, and you can’t cobble one together from existing ones. You must write a report or an ABAP Query to fulfill the requirements.Now, suppose the Operations Manager asks if you can somehow add just one more little function to her Create Measurement Docu-ments transaction: paste the associated sales order number into the MDoc text field. This scenario requires you to create an enhance-ment. In both the first and second scenario, you’ll need access to specific data from the database tables. How do you find that data with just the screen fields as your guide? We all know the information associated with a transaction is stored in several (sometimes many) related tables. So, when you need several fields from a transaction for a report or an enhancement, you may need to find many of the transaction’s tables and establish the links among them. Those links are often not obvious.(complete bio appears on page 18)I’ve come across these very situations on numer-ous occasions while working for several clients with the SD, MM, IM, WM, and Service Management (now called Customer Service) modules. Over time I have gathered suggestions from colleagues and developed some techniques myself to find the data I needed. I will share these techniques — 18 of them in all — with you now.The Starting Gate and Finish Line I will be presenting a wide variety of techniques for reaching the “finish line” of this exercise — namely, locating the table and field that stores the underlying data of a screen field. You’re unlikely to need all of them; you’ll probably be successful within the first four techniques. I include the remaining techniques because some fields can be very hard to chase down, and any one of these other tools just might do the trick.The Starting PointThe starting point for this set of techniques is always the Technical Information screen, because it is here that you learn the screen field’s name, and can dis-cern whether or not the underlying data object is a structure, view, or table.If the underlying data object is a table, your search is over. The field name shown on the Technical Information screen, plus this table name,arm you with the details you need. If the data object is a view, just one more click and you’ve got that table name. If the data object is a structure, you still have to unearth the name of the table. Technique #1:Check the Technical Information ScreenI always start my search for the underlying data object by getting the names of the field and Data Dictionary object from the transaction screen. Call up the Technical Information screen by positioning your cursor in the target screen field and then press-ing F1 or clicking on the ? button. This will bring up the initial Help screen. From within the Help screen, press F9 or click on the Technical info button.Take a look now at Figure 1. It shows the Technical Information screen for the Sold-to party field in the Create Standard (Sales) Order screen for Release 4.0B. You see in the “Field data” block that the Table name is KUAGV and the Field name is KUNNR.1 In Releases 4.0B and below, this screen calls the associated object a “table,” whether it’s a table, view, or structure. Notice in Figure 2 that the 4.5B release (and above) informs you that KUAGV is actually a structure.1The examples herein mention names of tables, structures, and fields that I found in my searches. You may find a different name in the same search — particularly a different structure’s name. For example, the Sold-to party field in the Sales Order initial screen may beKUAGV-KUNNR or RV45S-KUNNR (or maybe something else).I’ll show one name in this article; don’t worry if you find another.It’s a reflection of the continual enhancement of R/3, not (I hope) anerror in the article.In Releases 4.0B and below, to ascertain whether or not an object is a structure you must take one more step. Drill into the Table name field in the Technical Information screen to see the Data Dictionary screen for the object.Figure 3 shows those screens for the table VBAK, the view VIVEDA, and the structure KUAGV. Corresponding screens in Releases 4.5 and 4.6 look very similar. As you can see, the object type is easy to recognize in these screens.If the underlying object is a table, you’re home free. The information is stored in that table in the field with the same name as the one shown on the Technical Information screen. Success! When you write your report or ABAP Query, or when you program your enhancement, you can refer to the data using these table and field names.If the object is a view, then scroll to the View field in the view with the same name as the one shown in the Technical Information screen. See Figure 4; the Table and Field name associated with the View field is your goal. Success again!Figure 3The Release 4.0B Data Dictionary Screens forTable “VBAK,” View “VIVEDA,” and Structure“KUAGV”StructureStructures are Data Dictionary objects that have fields but do not carry data. A structure is Figure 4Locating the “Table” and “Field name” Associated with the “View field”TableTables store data. If your screen field points to a table,or you are able to drill down toTables, Views, and StructuresViewViews used in screens are linked groups of tables. If the field is in a view, you can drill A screen field is associated with a table, view, or structure. While each of these is a Data Dictionary object, only the table actually stores data. This is why the goal of all these techniques is to find the table that actually stores the information that you can see displayed in the screen.Figure 5The Suggested Sequence of TechniquesIf the object is a structure, then you have more digging to do, and you must proceed to one or more of the remaining 17 techniques described here. These techiques follow an order that should get you to the finish line in the fewest number of steps. Remember, as soon as you find the associated table, you’re done with the search. Look at the flowchart in Figure 5 to see my suggested sequence of techniques. Racing Toward the Finish Line: Techniques 2-13Remember, the finish line, or goal, of this exerciseis to locate the table and field names in which the underlying data for a screen field is stored. At this point, we know only that the underlying data object is a structure. Techniques 2-13, which I detailin this section, will most likely hold the answer. If techniques 2-13 do not hold the answer, try tech-niques 14-18 — the measures of last resort! I suggest you hold off trying these last five tactics until you’ve exhausted the other possibilities. If none of these 18 techniques work, you have an unusually difficult problem; I wish you good luck. I hope you find your table quickly and easily.Technique #2: Text FieldsIf the screen label is “Short text”, or the field name is STTXT, or its data element is CO_STTXT, then you are looking for the source of a text field. As Figure 6shows, the Short text field often has a “Maintain long text” icon stuck at the end that may look like a sheet of paper with a pencil. Click on that icon to get to the Long text screen.Texts are stored all over the place in R/3, but frequently in tables STXH and STXL, which are the text header and text line, respectively. Their texts are stored in raw (i.e., non-ASCII) form, so you must use function modules to get them. There are several function modules for processing these texts, including Read_Text, which reads text lines from the database. In the Long text screen, follow GoTo→Header (see Figure 7) to get the Text name, Text ID, and Text object parameters that you’ll need to execute the function module.If the field is not a text field, then you must con-tinue to search.Technique #3: “INCLUDE” TableA structure may contain one or more INCLUDEs. An INCLUDE may actually be a table or another structure. So, if the structure you are working with includes an INCLUDE, and that INCLUDE is a table that contains your field, then you have won again. For example, in a Sales Order Item Overview, the Condition Type is listed as KOMV-KSCHL, but KOMV is a structure. KOMV does contain the INCLUDE KONV, which is a table that contains the field KSCHL. That table and field are your goal, andFigure 7Retrieving the Text Name, Text ID, and Text Object Parameterswe need not go any further. If the structure doesn’t contain an INCLUDE, or if the INCLUDE is not a table, then we must keep searching. The next tech-nique you should apply is described in technique 4 because it’s easy and, quite likely, will get youyour answer.Technique #4: Reports, Queries, Infostructures If you know of any ABAP Queries, already-existing reports, or Infostructures that use the field you need, then you can dig into them to find the source table. Before you started this search, you may have found a report or query that didn’t provide the result that the Operations Manager needs, but that uses the field you are looking for. Now that you have the field name from the Technical Information screen, you can review those reports and queries to see if the search has already been done for you. If you find your field in one of those reports or queries, you can examine the code and find the table that it uses to pull that field; you will have successfully concluded your search.If you don’t find your table and field here, then you must continue searching. Technique 5 is a powerful one for those who know how to use it, and can very often find the result.You may have found a report or querythat uses the field you are looking for.Now that you have the field name, youcan review those reports and queries tosee if the search has already been donefor you. If you find your field in one ofthose reports or queries, you canexamine the code and find the tablethat it uses to pull that field, whichsuccessfully concludes your search.Technique #5: Debug WatchpointIf you are searching in Release 4.0B or above, and want to go to the heavy artillery immediately, then get the Program name (under “Screen data”) from the Technical Information dialog box and debug the program. Go to Tools→ABAP Workbench→ABAP Editor→Program=[the program name]→Debugging. Click on the Watchpoint button on the task bar and enter the program and field names into the Local watchpoint fields, then click on Enter and F8. Any change in the variable triggers the watchpoint, presenting you with the code immedi-ately below the line that changed the variable. Read the code above the watchpoint carefully, and you can probably find the name of the Data Dictionary object that the field is in. Again, it may be a table, view, or structure, but you are getting very close.Ken Greenwood (author of Teach Yourself ABAP/4 in 21 Days) says he always jumps immedi-ately to this technique if the Technical Information screen doesn’t produce the table. Ken further sug-gests that this technique finds the table right away —with the only exception being the IMPORT statement. If the watchpoint doesn’t trigger, then debug again using a breakpoint on IMPORT and you will find it in a maximum of three steps.If you can’t find the table reference you need in the code, then you must continue your search, and the next natural technique for you to use is described in technique 6.Technique #6: Value TableIf debugging didn’t give you what you need or you don’t want to debug a program, then back out to the Technical Information dialog box and double-click on the Data element field under “Field data”. This will show you the value table, if there is one. If you’re just looking for master data like customer name — whose field name is KUNNR — then a value table will probably be defined, and it will give you what you want. You’ll find that transactiondata like Order Quantity — whose field name is KWMENG — has no value table, and you get to keep looking. From here on, techniques 7-13 all have about the same likelihood of revealing your table name. Use them in any order you like. You’llprobably find that you like some more than others, so use those first.If debugging didn’t give you what youneed or you don’t want to debug aprogram, then back out to the TechicalInformation dialog box and double-clickon the Data element field under “Fielddata”. This will show you the value table,if there is one.Technique #7: “Where-Used” Data Element When R/3 moves data from one table (or structure) to another, it often (not always) moves it into a target field having the same data element as the source field. From the Technical Information dialog box, double-click on the Data element field under “Field data” and follow Utilities→Where-used List→ Table fields→Enter (see Figure 8). This will list the tables, views, and structures that use this data element. If your field is a commonly usedFigure 8“Where-used List Data element”Request Screen in Release 4.0Bone, this list may be so large that it’s hard to find your data storage location. For example, KUNNR shows up in 743 objects in Release 4.0B. An infre-quently used field may show up in fewer objects, and you can find your data source in the list.Note also that the list includes structures; some-times, lots of structures. When you drill into a field name in the list, you’ll see the table display that will identify it as a structure or a transparent table. If it’s a structure, you’ll have to keep looking.Technique #8: “Z_DATA_ELEMENT”Since the “Where-used” list for a data element generally contains so many (non-data carrying) structures, the list is not terribly useful for our purpose. Take a look at Figure 9, for example. It has 77 hits.You can create the Data Dictionary viewZ_DATA_ELEMENT, which will show only the data tables that use your data element.Figure 9Data Element “Where-used”ListFigure 10 Components of a View for Searching Data ElementsCreate the view with Tools→ABAP Workbench→ Dictionary→Objectname=Z_DATA_ELEMENT →Views→Create, then enter the values shown in Figure 10.Use this tool with Tools→ABAP Workbench→ Dictionary→Object name=Z_DATA_ELEMENT→Views→Display →Utilities→[Display data or Table contents]→DATA_ELEM=[the name of the data element you are searching for]→[Execute or F8].This view will give you a list of only the tables that use your data element.Technique #9: ViewsTransaction data is normally stored in several hierar-chically connected tables, and R/3 may have one or more views defined for the transaction you’re dealing with. You can search through those views to find other associated tables. Any one of those might store your data. For example, assume you want the Order Quantity data from the Sales order: Single-Line Overview screen. It’s listed as RV45A-KWMENG, but you find that RV45A is a structure. You already know that Order is VBAK-VBELN, so you lookfor views in the Where-used list for VBAK. View VIVEDA connects VBAK, VBUK, and VBAP, and you find KWMENG in the VBAP table. Technique #10: Logical DatabasesTables that are related in a business processare frequently connected in logical databases.The VBAK “Where-used” list for logical databases, for example, includes AAV, which also shows the connection to VBAP.Technique #11: Other Screen FieldsOne or more of the other fields in the same transac-tion may be directly connected to their database tables. If you can discover the Header table of the transaction, it may include the field you want. For example, assume you want the Sold to data from the Sales Order initial screen. It’s listed as RV45S-KUNNR, but you find that RV45S is a structure. Its data element is KUNAG, but Release 4.0B uses that data element in 276 tables, so it would be tough to find it there. On the same screen, the Order or Standard Order is listed as VBAK-VBELN. When you look up the VBAK table, you find that it also includes KUNNR.Technique #12: Application HierarchyIn 4.0B or above, go to Tools→ABAP Workbench →Overview→Data Browser. Press F4 in the empty Table name field, then click on SAP Applica-tions→Application Hierarchy. Drill down through the menu tree to find the tables associated withyour application. Your field may well be in one of those tables.Technique #13: GraphicsIn 4.0B or above, go to Tools→ABAP Workbench → Dictionary, then type in the name of a table you believe is related to your field. Follow the path Display →[Extras or Utilities]→Graphics. You’ll see a graphical representation of the selected table and its links to other tables. You can use this to see the entire family of tables related to a business object, and you may be able to find where your field is located.The Last Resort:Techniques 14-18These are the techniques of last resort, which you should turn to only if you’ve exhausted all other possibilities.Technique #14: Change RecordsR/3 allows for changes that are made to many documents to be recorded in change records, and frequently the change information includes the name of the table and field affected. If change recording is turned on, you can change the field you’re looking for in such a document, and then read the change record to find the table and field name. Depending on theR/3 release, here are some examples of menu paths to change records:•In Plant Maintenance or Service Management Technical Objects: Extras→[Display Changes or Environment]→Display ChangesOrder: Extras→Order documents→[Changes or Extras]→Display ChangesNotification: Extras→Notification documents→ChangesContracts & Planning: Environment→Changes•In Sales and DistributionOrder: Environment→ChangesDelivery: Environment→ChangesIf more than one change is shown, drill into the change you’re interested in (generally the most recent). Tables TCDOB and TCDOBT list allthe available object classes for change document creation. You can get clues there about whether your application supports change documents. Technique #15: Change DocumentsIf you can’t find the change record in your transac-tion, have a look in the change document tables CDHDR and CDPOS (now there’s a mix of English and German naming conventions: “Change Document Header” and “Change Document Position”!) as fol-lows. After you have changed and saved the field you’re searching for, open CDHDR in the ABAP Workbench dictionary, then follow Utilities→Table contents to find the change record. In the selection screen enter today’s date, time range, and your user name. It should pull the one matching record.Ctrl+C (copy) the value of CHANGENR, and use it to pull the appropriate record from CDPOS (Figure 11). This record contains the names of the table and field affected, as well as the new and old values, so you can ensure that you’re looking at the right record.Figure 11Change Table Illustration in Release 4.0BTechnique #16: SQL TraceIf all else fails, it’s time for some serious archeology. In one session, go to your transaction but don’t run it yet. In another session, go into Tools→ABAP Workbench→Test→SQL Trace→Trace On→Ok. Switch to your transaction session and run your transaction. Switch back to the trace session and click Trace off→List trace→[Execute or Ok]. You’ll have a list of all the SQL calls to the tables with their parameters. It may be easier to download it into a word processor document for searching. Use System → List→Save→Local file→unconverted→Enter→Filename=[c:\mypath\filename.doc]→Transfer. Open “filename.doc” in Word, search for your field name, and notice the tables it is associated with. It may involve detective work to determine which table actually stores the data. This approach requires an understanding of SQL commands and principles. Technique #17: Runtime Analysis Alternatively, use runtime analysis withSystem→Utilities→Runtime Analysis→Execute→[Transaction=your_transcode or Program=your_program_name]→F8. Afteryou post the transaction or complete the program, the system will return you to the Runtime Analysis screen. Choose Analyze, then Tables or Table Hit List (F6) to see all the transparent and pool tables that were accessed during the transaction. Hit List (F5) will show you all the program calls and specify the ABAP program that was running. Sometimes the Where-used list from the “Structure” display with Programs checked will list a program in which the field is associated with the database. Compare the programs in that list to those you found in the Runtime Analysis Hit List to narrow your search. Technique #18: Data ContentsFinally, extract some data from the set of tables asso-ciated with your transaction, and copy those records into a text file. Use the “Search” function in your word processor to find data flows by content where the source and destination fields may have different names and data elements. R/3 often uses internal numbers that you’d never think of, such as Object ID and Object Type, to link records. Their values, how-ever, can be quite distinctive, and you may be able to find the path of data flow by searching for the values (ignoring the field names) when you have pulled data from several transactions.For example, to find Measurement documents associated with a service order, we needed to trace the connections shown in Figure 12. There was nothing obvious about which fields linked the data.We created a service order and several Measure-ment documents in R/3. Then we pulled out the records starting with the service order numbers, and chased through the various joins to pull all the associ-ated records. While displaying each table in SE11 we used Utilities→Table contents to extract the data.Figure 12Data Path from Service Order to Measurement DocumentWe exported the records as text documents using System→List→Save→Local file and merged them all into a single Word document. We then used Word’s “Find” function to follow the data through the tables by following the value of the contents. OBJID, OBJNR, and MPOBJ contain internal numbers that “mean” nothing to the transaction, yet they linkedthe records.Helpful Hints✔ Many transactions have header informationand detail or item lines in separate linked tables. Remember that R/3 is a German product. “Kopf” is German for “head,” and “position” can be interpreted in German as “detail” or “item.” You’ll often find header/item table pairs with “K” and “P” in their names, such as VBAK and VBAP. When you are looking for linked tables containing the data for a transaction, this tip may help you identify one ifyou have the other.✔ There are small differences between R/3 Releases 3.1I, 4.0B, 4.5B, and 4.6B for the menu paths and directions used in this article. For example, Release 3.1I menus refer to the ABAP/4 (Workbench, Editor, etc.) whereas higher releases refer to ABAP. The Release 4.0B ABAP Workbench→ABAP Editor menu path shows up in Release 4.6B with the extra step ABAP Workbench→Development→ABAP Editor. The figures in this article were taken from a 4.0B system unless there was an important difference in appearance on another release. Many installations today are still using Release 3.1, and most are running 4.0 or below, so those images are important. The corresponding 4.5 and 4.6 screens are virtually identical to Release 4.0B except for Figure 2, so there’s no need to show the other figures in those releases as well.✔ Release 3.1I and below can’t execute technique 5 because they don’t have the watchpoint functionality in their debuggers, or techniques 12 and 13 because they don’t have the application hierarchy or graphics functions.ConclusionSAP’s three-tiered architecture is the backbone of an R/3 infrastructure. It’s what makes an R/3 system flexible, reliable, and open, all at the same time. It’s also what makes locating underlying data, at times, so inherently difficult. Hopefully the techniques presented here will help. Opt for the ones that you find easiest and most convenient to use. Leave the others as techniques of last resort. Some fields may still resist these techniques; there are no doubt other ways yet to chase them down. If you know of other techniques (or corrections to these techniques), please e-mail me at dennis.barrett@. AcknowledgementsThank you to the many SAP and partner consultants who gave me suggestions and feedback, and to those who reviewed this article.Dennis Barrett is an applications consultantwith SAP America who focuses on Service Management/Customer Service and the Service Provider solution. He has been consulting in computers for over 15 years, always blending applications and programming. He’s a certified ABAP programmer and often facilitates communications between business process owners and programmers. Dennis is the author of “SAP R/3 ABAP/4 Command Reference,” published by Que/MacMillan, and wrote “Customer Service ABAP Tables for Programmers,” published this spring in the PM/CS e-Newsletter, which is sent to all SAP consultants in Plant Maintenance and Customer Service. Dennis maintains a personal Web site at ~dennis.barrett, which includes copies of the PM/CS articles as well as white papers and other items of interest to ABAP programmers and CS consultants. You can reach him at dennis.barrett@.。

sap查表方法

sap查表方法

sap查表方法
在SAP系统中,可以使用多种方法来查询表中的数据。

以下是一些常用的方法:
1.ABAP查询:可以使用ABAP语言编写查询语句,通过ABAP工作台运行查询。

查询结果将返
回指定的表中的数据。

2.SQL查询:如果熟悉SQL语言,可以使用SAP的数据库系统进行查询。

在SAP系统中,可以
通过事务代码SE17来创建和维护自定义的SQL查询。

3.SAP HANA Studio:如果使用SAP HANA数据库,可以使用SAP HANA Studio来运行SQL查
询或其他查询语言,如SQL*Plus或SPARQL。

4.SAP GUI:通过SAP GUI客户端,可以连接到SAP系统并执行各种查询操作。

可以使用事务代
码SE16N来查看表中的数据,使用SE11事务代码来创建和管理表。

5.报表:SAP系统中提供了许多预定义的报表,这些报表可以显示表中的数据。

可以在报表中选
择所需的表和字段,并对其进行筛选和排序。

6.BADI(Business Add-In):BADI是SAP系统中的一种组件,可以使用ABAP语言编写,以提
供特定的业务逻辑或查询功能。

如果存在适用于您的查询需求的BADI,则可以使用它来获取所需的数据。

请注意,具体的查询方法可能因SAP系统的版本和配置而有所不同。

建议参考SAP系统的官方文档或咨询系统管理员以获取更准确的信息。

sap查询数据库方法

sap查询数据库方法

sap查询数据库方法
在SAP系统中,有多种查询数据库的方法,以下是其中的几种:
1. 事务代码(Transactions Code):这是SAP系统中最常用的查询工具。

通过输入特定的事务代码,用户可以查询和操作数据库。

例如,SE16用于查
询表,SE11用于创建表等。

2. ABAP语言:ABAP是SAP的专用编程语言,用户可以使用ABAP语言
编写程序来查询和操作数据库。

通过使用ABAP的SQL语句或数据库函数,可以实现复杂的数据库查询和操作。

3. SAP SQL:SAP SQL是SAP系统的专用SQL查询工具,用户可以在其
中执行标准的SQL语句来查询数据库。

SAP SQL提供了对SAP数据库的访问和操作功能。

4. 外部工具:除了上述方法外,还可以使用一些外部工具来查询SAP数据库。

例如,可以使用数据库管理工具(如Oracle SQL Developer、Microsoft SQL Server Management Studio等)来查询SAP数据库。

这些工具可以提供更多的灵活性和功能,但需要一定的技能和经验。

无论使用哪种方法,查询数据库时都应该注意遵守系统的安全和数据保护政策,以确保数据的安全性和完整性。

sap查询操作手册

sap查询操作手册

sap查询操作手册摘要:1.SAP 查询操作手册概述2.SAP 查询的基本概念3.SAP 查询的方法和步骤4.SAP 查询的实例分析5.SAP 查询的注意事项正文:【SAP 查询操作手册概述】SAP 是一款全球领先的企业资源规划(ERP)软件,它广泛应用于各个行业的企业中,用于管理企业的财务、生产、销售等各个方面。

SAP 查询操作手册是为了帮助用户更好地掌握和应用SAP 软件的查询功能而编写的。

本手册将从SAP 查询的基本概念、方法和步骤、实例分析以及注意事项等方面进行详细介绍。

【SAP 查询的基本概念】SAP 查询是指在SAP 系统中,用户通过输入特定的指令或语句,从系统中获取所需数据的过程。

SAP 查询主要包括以下几种类型:1.标准查询:通过执行标准报表或表查询,获取系统中预设好的数据。

2.自定义查询:根据用户需求,编写特定的SQL 语句或ABAP 程序,实现对系统中数据的检索。

【SAP 查询的方法和步骤】1.标准查询方法:步骤一:登录SAP 系统,进入相应模块。

步骤二:选择“查询”或“报表”功能,执行标准查询。

步骤三:查看查询结果,根据需要进行数据分析和处理。

2.自定义查询方法:步骤一:登录SAP 系统,进入相应模块。

步骤二:选择“查询”或“报表”功能,创建自定义查询。

步骤三:编写SQL 语句或ABAP 程序,实现对系统中数据的检索。

步骤四:执行自定义查询,查看查询结果。

【SAP 查询的实例分析】假设某企业需要查询上个月的销售额,可以通过以下步骤实现:步骤一:登录SAP 系统,进入销售模块。

步骤二:选择“查询”功能,创建自定义查询。

步骤三:编写SQL 语句,如“SELECT * FROM SALES WHERE MONTH(ORDER_DATE) = MONTH(CURRENT_DATE) - 1”。

步骤四:执行自定义查询,查看上个月的销售额数据。

【SAP 查询的注意事项】1.在执行SAP 查询时,需要注意保护系统安全,避免泄露敏感数据。

2020年(sap实施)SAP查询操作手册

2020年(sap实施)SAP查询操作手册

(sap实施)SAP查询操作手册SAP培训教材(报表查询)目录一、查询分类2二、查询的一般技巧3(一)选择界面的查询技巧3单项选择3多项选择3动态选择6保存、选择变式6(二)显示内容界面的查询技巧8 排序8筛选8小计9选择、保存格式11三、详细方法12凭证查询12已记帐凭证12未记帐凭证16总账查询17应收查询20应付查询23成本中心查询24订单查询28工号查询28合同号查询31主数据查询31FI主数据查询31CO主数据查询31四、报表的导出与打印32五、SAP其他小技巧35显示系统信息35添加到收藏夹36修改字体、快速剪贴36设置个人设置37一、查询分类1、凭证查询2、总帐查询3、应收、应付查询4、成本中心查询(费用查询)5、订单查询(收入、成本查询)6、开发报表查询7、主数据查询二、查询的一般技巧(一)选择界面的查询技巧单项选择双击需选择的字段出现如下图所示:多项选择多项选择是查询中最常用的技巧;图标为。

1、在多项选择时如果不选任何选项则系统默认为全部选择;2、进入到多项选择内部后会有红、绿,单值、范围共四种选项;其中绿色的代表包含;红色代表不包含;A、在绿色单值输入200000则只显示客户200000B、如想查询多个客户则可以在绿色单值处多次输入C、如要查询的是一个范围在绿色范围处输入所要的范围D、在红色单值处输入20000则显示200000以外的所有客户,红色的范围也是这种选择E、高级:单击画红圈的地方会有等于、不等于、大于、小于等选项。

(在绿色单值和红色单值)F、多项选择中相关按钮的使用技巧插入行、删除选择标准、删除全部选择行、从文本文件中导入3、多项选择有两种模式A、本身包含范围:一般用于日期、科目等。

因为本身包含范围所以如要查询一个范围,不必要点选多项选择,直接输入既可。

例如:记帐日期时要想查询某一时间段的业务则直接输入日期既可如:2004-05-01到2004-7-8如只想查询到2004-7-8的余额则只需输入到2004-7-8既可B、本身只是单值:这时如需输入范围则要在多项选择之后才可以输入动态选择动态选择指的是查询主界面所没有的其他的选项,图标是这是一个常用的按键,因为很多信息必须通过它来查询。

在SAP中查询table的18种方法

在SAP中查询table的18种方法

18 T echniques for Locating the Underlying Data of a Screen Field Dennis BarrettDennis Barrett is an applications consultant with SAP America who focuses on Service Management/ Customer Service and the Picture this. An Operations Manager wants a special report of her service orders. She gives you a sketch of what she wants it to look like (columns, rows, headings, grouping, subtotals, totals, and the like), and points to fields on the Service Management transaction screens that have the data she wants you to show in the report.What do you do? Most likely, you would check to find any existing reports delivered with the system (or already written for this client) that provide the information the Operations Manager wants, or that can be copied and revised to fit her needs. If you don’t find any, you might then look into the appropriate reporting system — in this case, the Plant Maintenance Information System (PMIS) — to see if you can adapt it. In this case, however, you can’t find the report, and you can’t cobble one together from existing ones. You must write a report or an ABAP Query to fulfill the requirements.Now, suppose the Operations Manager asks if you can somehow add just one more little function to her Create Measurement Docu-ments transaction: paste the associated sales order number into the MDoc text field. This scenario requires you to create an enhance-ment. In both the first and second scenario, you’ll need access to specific data from the database tables. How do you find that data with just the screen fields as your guide? We all know the information associated with a transaction is stored in several (sometimes many) related tables. So, when you need several fields from a transaction for a report or an enhancement, you may need to find many of the transaction’s tables and establish the links among them. Those links are often not obvious.(complete bio appears on page 18)HomeI’ve come across these very situations on numer-ous occasions while working for several clients with the SD, MM, IM, WM, and Service Management (now called Customer Service) modules. Over time I have gathered suggestions from colleagues and developed some techniques myself to find the data I needed. I will share these techniques — 18 of them in all — with you now.The Starting Gate and Finish Line I will be presenting a wide variety of techniques for reaching the “finish line” of this exercise — namely, locating the table and field that stores the underlying data of a screen field. You’re unlikely to need all of them; you’ll probably be successful within the first four techniques. I include the remaining techniques because some fields can be very hard to chase down, and any one of these other tools just might do the trick.The Starting PointThe starting point for this set of techniques is always the Technical Information screen, because it is here that you learn the screen field’s name, and can dis-cern whether or not the underlying data object is a structure, view, or table.If the underlying data object is a table, your search is over. The field name shown on the Technical Information screen, plus this table name,arm you with the details you need. If the data object is a view, just one more click and you’ve got that table name. If the data object is a structure, you still have to unearth the name of the table. Technique #1:Check the Technical Information ScreenI always start my search for the underlying data object by getting the names of the field and Data Dictionary object from the transaction screen. Call up the Technical Information screen by positioning your cursor in the target screen field and then press-ing F1 or clicking on the ? button. This will bring up the initial Help screen. From within the Help screen, press F9 or click on the Technical info button.Take a look now at Figure 1. It shows the Technical Information screen for the Sold-to party field in the Create Standard (Sales) Order screen for Release 4.0B. You see in the “Field data” block that the Table name is KUAGV and the Field name is KUNNR.1 In Releases 4.0B and below, this screen calls the associated object a “table,” whether it’s a table, view, or structure. Notice in Figure 2 that the 4.5B release (and above) informs you that KUAGV is actually a structure.1The examples herein mention names of tables, structures, and fields that I found in my searches. You may find a different name in the same search — particularly a different structure’s name. For example, the Sold-to party field in the Sales Order initial screen may beKUAGV-KUNNR or RV45S-KUNNR (or maybe something else).I’ll show one name in this article; don’t worry if you find another.It’s a reflection of the continual enhancement of R/3, not (I hope) anerror in the article.In Releases 4.0B and below, to ascertain whether or not an object is a structure you must take one more step. Drill into the Table name field in the Technical Information screen to see the Data Dictionary screen for the object.Figure 3 shows those screens for the table VBAK, the view VIVEDA, and the structure KUAGV. Corresponding screens in Releases 4.5 and 4.6 look very similar. As you can see, the object type is easy to recognize in these screens.If the underlying object is a table, you’re home free. The information is stored in that table in the field with the same name as the one shown on the Technical Information screen. Success! When you write your report or ABAP Query, or when you program your enhancement, you can refer to the data using these table and field names.If the object is a view, then scroll to the View field in the view with the same name as the one shown in the Technical Information screen. See Figure 4; the Table and Field name associated with the View field is your goal. Success again!Figure 3The Release 4.0B Data Dictionary Screens forTable “VBAK,” View “VIVEDA,” and Structure“KUAGV”StructureStructures are Data Dictionary objects that have fields but do not carry data. A structure is Figure 4Locating the “Table” and “Field name” Associated with the “View field”TableTables store data. If your screen field points to a table,or you are able to drill down toTables, Views, and StructuresViewViews used in screens are linked groups of tables. If the field is in a view, you can drill A screen field is associated with a table, view, or structure. While each of these is a Data Dictionary object, only the table actually stores data. This is why the goal of all these techniques is to find the table that actually stores the information that you can see displayed in the screen.Figure 5The Suggested Sequence of TechniquesIf the object is a structure, then you have more digging to do, and you must proceed to one or more of the remaining 17 techniques described here. These techiques follow an order that should get you to the finish line in the fewest number of steps. Remember, as soon as you find the associated table, you’re done with the search. Look at the flowchart in Figure 5 to see my suggested sequence of techniques. Racing Toward the Finish Line: Techniques 2-13Remember, the finish line, or goal, of this exerciseis to locate the table and field names in which the underlying data for a screen field is stored. At this point, we know only that the underlying data object is a structure. Techniques 2-13, which I detailin this section, will most likely hold the answer. If techniques 2-13 do not hold the answer, try tech-niques 14-18 — the measures of last resort! I suggest you hold off trying these last five tactics until you’ve exhausted the other possibilities. If none of these 18 techniques work, you have an unusually difficult problem; I wish you good luck. I hope you find your table quickly and easily.Technique #2: Text FieldsIf the screen label is “Short text”, or the field name is STTXT, or its data element is CO_STTXT, then you are looking for the source of a text field. As Figure 6shows, the Short text field often has a “Maintain long text” icon stuck at the end that may look like a sheet of paper with a pencil. Click on that icon to get to the Long text screen.Texts are stored all over the place in R/3, but frequently in tables STXH and STXL, which are the text header and text line, respectively. Their texts are stored in raw (i.e., non-ASCII) form, so you must use function modules to get them. There are several function modules for processing these texts, including Read_Text, which reads text lines from the database. In the Long text screen, follow GoTo→Header (see Figure 7) to get the Text name, Text ID, and Text object parameters that you’ll need to execute the function module.If the field is not a text field, then you must con-tinue to search.Technique #3: “INCLUDE” TableA structure may contain one or more INCLUDEs. An INCLUDE may actually be a table or another structure. So, if the structure you are working with includes an INCLUDE, and that INCLUDE is a table that contains your field, then you have won again. For example, in a Sales Order Item Overview, the Condition Type is listed as KOMV-KSCHL, but KOMV is a structure. KOMV does contain the INCLUDE KONV, which is a table that contains the field KSCHL. That table and field are your goal, andFigure 7Retrieving the Text Name, Text ID, and Text Object Parameterswe need not go any further. If the structure doesn’t contain an INCLUDE, or if the INCLUDE is not a table, then we must keep searching. The next tech-nique you should apply is described in technique 4 because it’s easy and, quite likely, will get youyour answer.Technique #4: Reports, Queries, Infostructures If you know of any ABAP Queries, already-existing reports, or Infostructures that use the field you need, then you can dig into them to find the source table. Before you started this search, you may have found a report or query that didn’t provide the result that the Operations Manager needs, but that uses the field you are looking for. Now that you have the field name from the Technical Information screen, you can review those reports and queries to see if the search has already been done for you. If you find your field in one of those reports or queries, you can examine the code and find the table that it uses to pull that field; you will have successfully concluded your search.If you don’t find your table and field here, then you must continue searching. Technique 5 is a powerful one for those who know how to use it, and can very often find the result.You may have found a report or querythat uses the field you are looking for.Now that you have the field name, youcan review those reports and queries tosee if the search has already been donefor you. If you find your field in one ofthose reports or queries, you canexamine the code and find the tablethat it uses to pull that field, whichsuccessfully concludes your search.Technique #5: Debug WatchpointIf you are searching in Release 4.0B or above, and want to go to the heavy artillery immediately, then get the Program name (under “Screen data”) from the Technical Information dialog box and debug the program. Go to Tools→ABAP Workbench→ABAP Editor→Program=[the program name]→Debugging. Click on the Watchpoint button on the task bar and enter the program and field names into the Local watchpoint fields, then click on Enter and F8. Any change in the variable triggers the watchpoint, presenting you with the code immedi-ately below the line that changed the variable. Read the code above the watchpoint carefully, and you can probably find the name of the Data Dictionary object that the field is in. Again, it may be a table, view, or structure, but you are getting very close.Ken Greenwood (author of Teach Yourself ABAP/4 in 21 Days) says he always jumps immedi-ately to this technique if the Technical Information screen doesn’t produce the table. Ken further sug-gests that this technique finds the table right away —with the only exception being the IMPORT statement. If the watchpoint doesn’t trigger, then debug again using a breakpoint on IMPORT and you will find it in a maximum of three steps.If you can’t find the table reference you need in the code, then you must continue your search, and the next natural technique for you to use is described in technique 6.Technique #6: Value TableIf debugging didn’t give you what you need or you don’t want to debug a program, then back out to the Technical Information dialog box and double-click on the Data element field under “Field data”. This will show you the value table, if there is one. If you’re just looking for master data like customer name — whose field name is KUNNR — then a value table will probably be defined, and it will give you what you want. You’ll find that transactiondata like Order Quantity — whose field name is KWMENG — has no value table, and you get to keep looking. From here on, techniques 7-13 all have about the same likelihood of revealing your table name. Use them in any order you like. You’llprobably find that you like some more than others, so use those first.If debugging didn’t give you what youneed or you don’t want to debug aprogram, then back out to the TechicalInformation dialog box and double-clickon the Data element field under “Fielddata”. This will show you the value table,if there is one.Technique #7: “Where-Used” Data Element When R/3 moves data from one table (or structure) to another, it often (not always) moves it into a target field having the same data element as the source field. From the Technical Information dialog box, double-click on the Data element field under “Field data” and follow Utilities→Where-used List→ Table fields→Enter (see Figure 8). This will list the tables, views, and structures that use this data element. If your field is a commonly usedFigure 8“Where-used List Data element”Request Screen in Release 4.0Bone, this list may be so large that it’s hard to find your data storage location. For example, KUNNR shows up in 743 objects in Release 4.0B. An infre-quently used field may show up in fewer objects, and you can find your data source in the list.Note also that the list includes structures; some-times, lots of structures. When you drill into a field name in the list, you’ll see the table display that will identify it as a structure or a transparent table. If it’s a structure, you’ll have to keep looking.Technique #8: “Z_DATA_ELEMENT”Since the “Where-used” list for a data element generally contains so many (non-data carrying) structures, the list is not terribly useful for our purpose. Take a look at Figure 9, for example. It has 77 hits.You can create the Data Dictionary viewZ_DATA_ELEMENT, which will show only the data tables that use your data element.Figure 9Data Element “Where-used”ListFigure 10 Components of a View for Searching Data ElementsCreate the view with Tools→ABAP Workbench→ Dictionary→Objectname=Z_DATA_ELEMENT →Views→Create, then enter the values shown in Figure 10.Use this tool with Tools→ABAP Workbench→ Dictionary→Object name=Z_DATA_ELEMENT→Views→Display →Utilities→[Display data or Table contents]→DATA_ELEM=[the name of the data element you are searching for]→[Execute or F8].This view will give you a list of only the tables that use your data element.Technique #9: ViewsTransaction data is normally stored in several hierar-chically connected tables, and R/3 may have one or more views defined for the transaction you’re dealing with. You can search through those views to find other associated tables. Any one of those might store your data. For example, assume you want the Order Quantity data from the Sales order: Single-Line Overview screen. It’s listed as RV45A-KWMENG, but you find that RV45A is a structure. You already know that Order is VBAK-VBELN, so you lookfor views in the Where-used list for VBAK. View VIVEDA connects VBAK, VBUK, and VBAP, and you find KWMENG in the VBAP table. Technique #10: Logical DatabasesTables that are related in a business processare frequently connected in logical databases.The VBAK “Where-used” list for logical databases, for example, includes AAV, which also shows the connection to VBAP.Technique #11: Other Screen FieldsOne or more of the other fields in the same transac-tion may be directly connected to their database tables. If you can discover the Header table of the transaction, it may include the field you want. For example, assume you want the Sold to data from the Sales Order initial screen. It’s listed as RV45S-KUNNR, but you find that RV45S is a structure. Its data element is KUNAG, but Release 4.0B uses that data element in 276 tables, so it would be tough to find it there. On the same screen, the Order or Standard Order is listed as VBAK-VBELN. When you look up the VBAK table, you find that it also includes KUNNR.Technique #12: Application HierarchyIn 4.0B or above, go to Tools→ABAP Workbench →Overview→Data Browser. Press F4 in the empty Table name field, then click on SAP Applica-tions→Application Hierarchy. Drill down through the menu tree to find the tables associated withyour application. Your field may well be in one of those tables.Technique #13: GraphicsIn 4.0B or above, go to Tools→ABAP Workbench → Dictionary, then type in the name of a table you believe is related to your field. Follow the path Display →[Extras or Utilities]→Graphics. You’ll see a graphical representation of the selected table and its links to other tables. You can use this to see the entire family of tables related to a business object, and you may be able to find where your field is located.The Last Resort:Techniques 14-18These are the techniques of last resort, which you should turn to only if you’ve exhausted all other possibilities.Technique #14: Change RecordsR/3 allows for changes that are made to many documents to be recorded in change records, and frequently the change information includes the name of the table and field affected. If change recording is turned on, you can change the field you’re looking for in such a document, and then read the change record to find the table and field name. Depending on theR/3 release, here are some examples of menu paths to change records:•In Plant Maintenance or Service Management Technical Objects: Extras→[Display Changes or Environment]→Display ChangesOrder: Extras→Order documents→[Changes or Extras]→Display ChangesNotification: Extras→Notification documents→ChangesContracts & Planning: Environment→Changes•In Sales and DistributionOrder: Environment→ChangesDelivery: Environment→ChangesIf more than one change is shown, drill into the change you’re interested in (generally the most recent). Tables TCDOB and TCDOBT list allthe available object classes for change document creation. You can get clues there about whether your application supports change documents. Technique #15: Change DocumentsIf you can’t find the change record in your transac-tion, have a look in the change document tables CDHDR and CDPOS (now there’s a mix of English and German naming conventions: “Change Document Header” and “Change Document Position”!) as fol-lows. After you have changed and saved the field you’re searching for, open CDHDR in the ABAP Workbench dictionary, then follow Utilities→Table contents to find the change record. In the selection screen enter today’s date, time range, and your user name. It should pull the one matching record.Ctrl+C (copy) the value of CHANGENR, and use it to pull the appropriate record from CDPOS (Figure 11). This record contains the names of the table and field affected, as well as the new and old values, so you can ensure that you’re looking at the right record.Figure 11Change Table Illustration in Release 4.0BTechnique #16: SQL TraceIf all else fails, it’s time for some serious archeology. In one session, go to your transaction but don’t run it yet. In another session, go into Tools→ABAP Workbench→Test→SQL Trace→Trace On→Ok. Switch to your transaction session and run your transaction. Switch back to the trace session and click Trace off→List trace→[Execute or Ok]. You’ll have a list of all the SQL calls to the tables with their parameters. It may be easier to download it into a word processor document for searching. Use System → List→Save→Local file→unconverted→Enter→Filename=[c:\mypath\filename.doc]→Transfer. Open “filename.doc” in Word, search for your field name, and notice the tables it is associated with. It may involve detective work to determine which table actually stores the data. This approach requires an understanding of SQL commands and principles. Technique #17: Runtime Analysis Alternatively, use runtime analysis withSystem→Utilities→Runtime Analysis→Execute→[Transaction=your_transcode or Program=your_program_name]→F8. Afteryou post the transaction or complete the program, the system will return you to the Runtime Analysis screen. Choose Analyze, then Tables or Table Hit List (F6) to see all the transparent and pool tables that were accessed during the transaction. Hit List (F5) will show you all the program calls and specify the ABAP program that was running. Sometimes the Where-used list from the “Structure” display with Programs checked will list a program in which the field is associated with the database. Compare the programs in that list to those you found in the Runtime Analysis Hit List to narrow your search. Technique #18: Data ContentsFinally, extract some data from the set of tables asso-ciated with your transaction, and copy those records into a text file. Use the “Search” function in your word processor to find data flows by content where the source and destination fields may have different names and data elements. R/3 often uses internal numbers that you’d never think of, such as Object ID and Object Type, to link records. Their values, how-ever, can be quite distinctive, and you may be able to find the path of data flow by searching for the values (ignoring the field names) when you have pulled data from several transactions.For example, to find Measurement documents associated with a service order, we needed to trace the connections shown in Figure 12. There was nothing obvious about which fields linked the data.We created a service order and several Measure-ment documents in R/3. Then we pulled out the records starting with the service order numbers, and chased through the various joins to pull all the associ-ated records. While displaying each table in SE11 we used Utilities→Table contents to extract the data.Figure 12Data Path from Service Order to Measurement DocumentWe exported the records as text documents using System→List→Save→Local file and merged them all into a single Word document. We then used Word’s “Find” function to follow the data through the tables by following the value of the contents. OBJID, OBJNR, and MPOBJ contain internal numbers that “mean” nothing to the transaction, yet they linkedthe records.Helpful Hints✔ Many transactions have header informationand detail or item lines in separate linked tables. Remember that R/3 is a German product. “Kopf” is German for “head,” and “position” can be interpreted in German as “detail” or “item.” You’ll often find header/item table pairs with “K” and “P” in their names, such as VBAK and VBAP. When you are looking for linked tables containing the data for a transaction, this tip may help you identify one ifyou have the other.✔ There are small differences between R/3 Releases 3.1I, 4.0B, 4.5B, and 4.6B for the menu paths and directions used in this article. For example, Release 3.1I menus refer to the ABAP/4 (Workbench, Editor, etc.) whereas higher releases refer to ABAP. The Release 4.0B ABAP Workbench→ABAP Editor menu path shows up in Release 4.6B with the extra step ABAP Workbench→Development→ABAP Editor. The figures in this article were taken from a 4.0B system unless there was an important difference in appearance on another release. Many installations today are still using Release 3.1, and most are running 4.0 or below, so those images are important. The corresponding 4.5 and 4.6 screens are virtually identical to Release 4.0B except for Figure 2, so there’s no need to show the other figures in those releases as well.✔ Release 3.1I and below can’t execute technique 5 because they don’t have the watchpoint functionality in their debuggers, or techniques 12 and 13 because they don’t have the application hierarchy or graphics functions.ConclusionSAP’s three-tiered architecture is the backbone of an R/3 infrastructure. It’s what makes an R/3 system flexible, reliable, and open, all at the same time. It’s also what makes locating underlying data, at times, so inherently difficult. Hopefully the techniques presented here will help. Opt for the ones that you find easiest and most convenient to use. Leave the others as techniques of last resort. Some fields may still resist these techniques; there are no doubt other ways yet to chase them down. If you know of other techniques (or corrections to these techniques), please e-mail me at dennis.barrett@. AcknowledgementsThank you to the many SAP and partner consultants who gave me suggestions and feedback, and to those who reviewed this article.Dennis Barrett is an applications consultantwith SAP America who focuses on Service Management/Customer Service and the Service Provider solution. He has been consulting in computers for over 15 years, always blending applications and programming. He’s a certified ABAP programmer and often facilitates communications between business process owners and programmers. Dennis is the author of “SAP R/3 ABAP/4 Command Reference,” published by Que/MacMillan, and wrote “Customer Service ABAP Tables for Programmers,” published this spring in the PM/CS e-Newsletter, which is sent to all SAP consultants in Plant Maintenance and Customer Service. Dennis maintains a personal Web site at ~dennis.barrett, which includes copies of the PM/CS articles as well as white papers and other items of interest to ABAP programmers and CS consultants. You can reach him at dennis.barrett@.Home。

SAPABAP系统进行数据库表查询的几种常用方法的试读版

SAPABAP系统进行数据库表查询的几种常用方法的试读版

SAPABAP系统进行数据库表查询的几种常用方法的试读版零基础 ABAP 学习教程系列文章的目录•ABAP 标准培训教程BC400 学习笔记之一:ABAP 服务器的架构和一个典型的 ABAP 程序结构介绍•ABAP 标准培训教程BC400 学习笔记之二:Cross-client 和Client-specific 的区别•ABAP 标准培训教程BC400 学习笔记之三:ABAP 编程语言的特性和基本构成要素•ABAP 标准培训教程BC400 学习笔记之四:ABAP 编程语言的数据类型•ABAP 标准培训教程BC400 学习笔记之五:ABAP 编程语言的变量,常量和字面量,以及文本符号ABAP 基础知识•通过实际的例子,介绍SAP ABAP 里的Repository Information System 的使用技巧•ABAP function module 的使用•ABAP subroutine 的定义和使用•ABAP 中的变量和常量•ABAP 编程语言中的系统字段(System Fields)•什么是 ABAP Field Symbol•ABAP 引用类型介绍•最浅显易懂的 SAPGUI 里 ABAP 调试器的使用方法介绍•如何创建最简单的 ABAP 数据库表,以及编码从数据库表中读取数据 (上)•如何创建最简单的 ABAP 数据库表,以及编码从数据库表中读取数据 (下)•用 ABAP 读取本地文本文件内容•用 ABAP 新建本地 Excel 文件并写入数据•26 行 ABAP 代码使用 HTTP_GET 函数下载百度网站的首页数据•ABAP 如何解析 JSON 数据•如何从本地文件里拷贝某个 ABAP 类到 SAP 系统•面向对象的 ABAP 编程初探 - 什么是类,实例,和 Public 方法•SAP ABAP 报表的用户输入功能•使用 ABAP 事物码 SM59 创建 Destination 来读取外网的数据•通过一个具体的例子,讲解 SAP BDC 技术的使用步骤•从解读 BDC 自动生成的代码谈起,讲解 SAPGUI 的程序组成部分•如何查询 SAPGUI 屏幕上某个字段对应的数据库表存储•如何使用事物码 SAT 查找某个 SAPGUI 屏幕字段对应的后台存储数据库表的名称•一步步创建包含自定义 Screen 的 ABAP 程序的详细步骤•SAP ABAP 字符串变量容易疏忽和混淆的一些知识点•SAP ABAP 处理Excel 的标准函数TEXT_CONVERT_XLS_TO_SAP 介绍•授人以渔-在 SAP MM 物料显示界面上看到一个字段,如何查找哪张数据库表的哪个字段进行的存储•SAP ABAP 系统进行数据库表查询的几种常用方法•更多文章正在写作中ALV 开发专题•27 行代码开发一个最简单的 SAP ALV 报表•48 行代码给 ABAP ALV 报表的数据行增添颜色效果•77 行代码实现ABAP ALV 中的双击事件处理本文介绍已知一个数据库表,想查看表里有哪些数据的几种常用方法,即数据库表的查询操作。

SAP系统用户操作手册_SD_V1.5(四)报表查询

SAP系统用户操作手册_SD_V1.5(四)报表查询

ERP项目SAP系统用户操作手册销售与分销(SD)版本:V1.0日期:2022年3月23日说明:1、不改变各部分对应字体、字号;2、系统操作界面截屏中,标注符号从以下标识选取即可:3、版本控制:版本号日期更改者版本备注1.02012-05-31胡瑞媛 景伟 周俊杨靓 张晶 王丽娜 胡云炜 杨瑞娟初始版本: 客户主数据信贷主数据;托盘回收价格主数据;销售开票(参考财务操作手册) 业务员主数据数量合同;按单采购;免费发货;借/贷项;其它 标准销售订单(按单/库);来料加工;退货;换货 销售交货 销售BOM 2.0 2012-06-15 销售报表报表查询1 报表查询详细参考:《开发清单》7 810 1 12 2 45678 91011 313 14151.1运输费用明细表1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)1.2销售状态表1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)123451.3订单执行情况表菜单路径事务代码ZSDR0061)在处录入事务代码“zsdr006”12)点击或者回车,进入查询数量合同/订单执行情况的初始界面23456栏位说明参数2 录入售达方的客户编码3 录入销售部门4 录入创建日期5 录入销售订单类型6 录入数量合同号码/销售订单号码1)在栏位2-6中选择需要的帅选条件,点击,即可查看:1.4销售月度滚动计划表1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)23451.5销售年度预算表菜单路径事务代码ZSDR0081)在处录入事务代码“zsdr008”12)点击或者回车进入查询销售年度预算表的初始界面:234567栏位说明参数2 录入工厂代码11003 录入年份20124 录入计划方案801(只能选801)5 录入版本Y16 录入物料编码7 录入物料类型栏位2-5为必填项,栏位6-7为选填项,录入相关条件后,点击,即可查看销售年度预算表:1.6销售完成情况与预算、计划对比表1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)1.7未开发票明细1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)1.8发票状态表1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏) -北京科莱特信息技术有限公司1.9销售、生产、采购单据对应1)(进入操作界面操作文字说明)(系统初始界面截屏)2)(后续操作步骤文字说明)(后续操作界面截屏)*北京科莱特信息技术有限公司所有,转载请注明出处。

如何在SAP中找表

如何在SAP中找表

如何在SAP中找表在SAP系统中,用户在进行日常业务的过程时,经常会因为操作不方便,或者需要某些归类的数据集合,提出对系统的更改需求,包括程序的更改和报表的开发。

用户在操作业务的时候,看到的只是前台界面,因此只能把自己需要的数据告诉开发人员,指出数据在前台的显示位置,开发人员还需要找到相关的数据在后台的存储位置,这样才能进行开发。

由于系统的复杂性,大部分显示在前台的数据都是经过系统程序的处理,并不能够直接找到与后台数据表之间的映射关系,这也是所有大型ERP系统的共有特点。

那应该如何把前台界面显示的数据,关联到后台的数据表中呢?从简单到复杂,一步步深入,有以下几种方法:1. SAP系统在前台操作界面,提供了一个很好的操作方式,点击自己需要跟踪的数据,按F1键,然后选择“技术信息”,会出现如下图所示界面:可以看到,我要跟踪的数据是存储在表名为MEPO01222的表中,字段的名称是EKORG,我们可以去后台查看这个数据表,是否有我们需要的数据。

有可能,我们已经成功了,找到了前台数据和后台表的关系,那实在是非常的幸运。

而一般情况下,你会发现我们找到的这个名为MEPO01222的所谓的表,并不是一个真正的数据表,他可能是一个视图(View),也可能只是一个结构(Structure),这时候,我们就必须进行下一步操作了。

2. 如果我们在第一步中,发现的是view,这种情况比较简单,我们可以通过T-code(操作代码,对应于系统的操作界面)SE38,进入ABAP Dictionary,查看这个View所关联的表:我们可以看到在左边一栏,显示了这个View涉及到的table,右边显示的是这些table中那些字段进行了相互的连接(Join),这样我们就可以很方便的从这些table找到我们需要的数据。

3. 如果我们在第一步中,发现的是Structure ,相对来讲就比较麻烦。

因为Structure只是用来临时存储程序运行时的实时数据,我们在里面无法得到我们需要的数据。

SAP自学系列-FICO报表查询

SAP自学系列-FICO报表查询

SAP自学系列-FICO报表查询SAP FICO(Financial Accounting and Controlling)是SAP的财务会计和控制模块,它可以帮助企业管理财务和业务流程,同时提供多种报表和数据分析功能。

本文将介绍如何在SAP系统中使用FICO模块查询报表和数据。

FICO报表查询的基本概念在SAP FICO模块中,报表是指用于显示企业财务和业务数据的结构化表格。

每个报表都有特定的用途和数据来源,比如总账报表(General Ledger report)可以显示企业的总账科目余额,利润和损失表(Profit and Loss statement)可以显示企业的收入和支出情况。

根据不同的业务需要,SAP FICO提供了多种预定义的报表,用户也可以自定义报表以满足自己的需求。

FICO报表可以分为两类:操作性报表和分析性报表。

操作性报表是日常工作中必须使用的报表,比如账目凭证、银行对账单等。

分析性报表则是用于管理和分析财务和业务数据,比如总账科目余额表、现金流量表等。

在FICO模块中,报表查询通常是通过SAP的查询工具来完成的,包括QuickViewer、ABAP查询等。

FICO报表查询的步骤FICO报表查询的步骤如下:1.打开SAP系统并登录FICO模块。

2.选择需要查询的报表类型,比如总账报表或利润和损失表。

3.根据报表类型输入相关查询条件,比如查询时间范围、科目组、公司代码等。

4.运行查询,并查看结果。

例如,我们要查询某个公司代码在某个时间范围内的总账科目余额表,可以按照以下步骤进行:1.打开SAP系统并登录FICO模块。

2.在菜单栏中选择“Accounting -> Financial Accounting -> GeneralLedger -> Information System -> General Ledger Reports”。

3.在弹出的报表列表中选择“General Ledger Subsequent AccountAnalysis”报表,这是总账科目余额表的一个预定义报表。

ABAP培训课程-SAP找表方法

ABAP培训课程-SAP找表方法

SAP 找表方法总述:下面依次介绍了六种在R/3和CRM中找表及相应字段的方法。

但每种方法都有一定的局限性,所以要根据情况灵活使用。

1.方法(一):用F1找表要查字段‘FUND’所在的系统表,按F1;在下表中可以先点击‘Field Name’(字段名称),若是结构,可以查看他的‘ENTRY HELP’中的‘CHECK TABLE’是否有相应的表名;若没有‘CHECK TABLE’,就要双击‘Data Element’单击‘Where_user list’:勾选‘TABLE FIELDS’后:橘黄色的都是表名,这些表中都会含有字段‘FUND’。

2.方法(二):用F4找表只适用于主数据字段的查找,在弹出的选择框中再利用F1的方法即可;并且此方法是在F1查到的是结构的情况下才有用处;3.方法(三):Editor单击屏幕上方‘SYSTEM’中的‘STA TUS’;双击下面屏幕中的‘PROGRAME’;最后三个字母‘TOP’代表程序的起始段,双击进入;可以逐个查看TABLE中是否含有‘FUND’字段;如下图可知,在‘RESBN’中可以找到所要字段。

在所要查找的屏幕处键入‘/H’,两次回车进入调试状态;调出‘FIND’对话框,可键入‘SELECT/INSERT/UPDATE’等与数据库交互的命令字段,从而找到对应的TABLE。

但如果此界面没有与数据库进行交互时此方法无效。

5.方法(五):SCREEN单击屏幕上方‘SYSTEM’中的‘STA TUS’;双击下面屏幕中的‘Screen number’;再单击右上角的‘LAYOUT’;双击对应字段,可得到该字段所在TABLE或STRUCTURE。

单击屏幕上方‘SYSTEM’中的‘STA TUS’;双击下面屏幕中的‘TRANSACTION’;得到屏幕左上方第二行的‘PACKAGE’打开另一个界面,键入事物代码‘SE80’,并将上面的‘PACKAGE NAME’填入并显示;如下图所示,子文件夹‘DA TABASE TABLE’下面列出的是该事物有关的所有TABLES。

SAP自学系列-FICO报表查询

SAP自学系列-FICO报表查询

SAP自学系列-FICO报表查询目录一、查询分类 (2)二、查询的一般技巧 (2)(一)选择界面的查询技巧 (2)单项选择 (2)多项选择 (3)动态选择 (6)保存、选择变式 (6)(二)显示内容界面的查询技巧 (8)排序 (8)筛选 (9)小计 (10)选择、保存格式 (12)三、详细方法 (13)凭证查询 (13)已记帐凭证 (13)未记帐凭证 (17)总账查询 (18)应收查询 (21)应付查询 (24)成本中心查询 (25)订单查询 (29)工号查询 (29)合同号查询 (32)主数据查询 (32)FI主数据查询 (32)CO主数据查询 (32)四、报表的导出与打印 (33)五、SAP其他小技巧 (36)显示系统信息 (36)添加到收藏夹 (37)修改字体、快速剪贴 (37)设置个人设置 (38)一、查询分类1、凭证查询2、总帐查询3、应收、应付查询4、成本中心查询(费用查询)5、订单查询(收入、成本查询)6、开发报表查询7、主数据查询二、查询的一般技巧(一)选择界面的查询技巧单项选择双击需选择的字段出现如下图所示:多项选择多项选择是查询中最常用的技巧;图标为。

1、在多项选择时如果不选任何选项则系统默认为全部选择;2、进入到多项选择内部后会有红、绿,单值、范围共四种选项;其中绿色的代表包含;红色代表不包含;A、在绿色单值输入200000则只显示客户200000B、如想查询多个客户则可以在绿色单值处多次输入C、如要查询的是一个范围在绿色范围处输入所要的范围D、在红色单值处输入20000则显示200000以外的所有客户,红色的范围也是这种选择E、高级:单击画红圈的地方会有等于、不等于、大于、小于等选项。

(在绿色单值和红色单值)F、多项选择中相关按钮的使用技巧插入行、删除选择标准、删除全部选择行、从文本文件中导入3、多项选择有两种模式A、本身包含范围:一般用于日期、科目等。

因为本身包含范围所以如要查询一个范围,不必要点选多项选择,直接输入既可。

SAP系统18种查询标的方法

SAP系统18种查询标的方法

18种根据屏幕字段查找数据库表数据的技巧帮助18种根据屏幕字段查找潜在数据的技巧Dennis Barrett / 翻译:强晟********************想象一下这样的情景。

一个业务经理希望得到一个关于她的服务订单的专用报表,她给了你一个报表的草图(包括列、行、标题、分组、小计、合计等等),而“服务管理”事务屏幕中的字段就包含了她希望你在报表中显示的数据。

你该怎么做?通常的,你会检查系统中运行的,能够提供这个业务经理所需信息的现存报表(或者是已经为这个client写过的),或者可以复制和修改后能符合需要的报表。

如果没有找到,你也许会在适当的报表系统——例如,工厂维护信息系统(PMIS)——中看看是否能找到合适的。

即使这样,你仍然无法找到报表,或者无法从现存报表中找到可修改的,那只能写一个报表或者一个ABAP查询来实现这个需求。

现在,设想一下业务经理问你是否以某种方式在《创建计量单位文档事务》中增加一个小小的功能:向MDoc文本字段中粘贴相关销售订单号。

这个要求需要你创建一个增强功能。

在前面两个情形中,你都需要访问数据库表中的特定数据。

你怎么以屏幕字段做指导来找到这些数据?我们都知道与一个事务关联的信息都存储在几个(偶尔还会是很多个)相关的表里。

这样,当你需要在报表或增强功能中使用一个事务中的几个字段时,你需要找出许多事务的表并在它们之间建立关联。

这些关联通常都不会很明显。

我曾经在众多场合遇到这些情况,有时需要同时在SD、MM、IM、WM和服务管理(现在叫客户服务)等模块对多个client进行工作。

随着时间推移,我收集了同事和自己在开发中寻找需要数据的建议。

我现在来跟你分享这些技巧——共18种。

起跑线和终点线我将会介绍达成本练习“终点线”的各种各样的技巧——也就是说,定位那些在屏幕字段中存储潜在数据的表和字段。

你未必需要所有这些方法,一般来说,前四种技巧已经足够了。

我之所以写其他的技巧是因为有些字段非常难以追踪,而这些工具或许可以解决问题。

SAP?几种查表的方法

SAP?几种查表的方法

SAP 几种查表的方法说说我常用的几种方法。

1,F1。

毫无悬念,当我想要知道某一个字段存在哪一张表里的时候,我就会下意识的按F1,然后去看Technical Infomation。

我觉得有一半左右的机会可以得到我想要的答案2,SAP Application。

用SE16进入Data Browser,然后F4,点击进入SAP Application。

然后可以看到,一个表和应用相匹配的树状图,根据当前进行的操作内容,查找对应的表。

3,CDHDR and CDPOS。

这两个表记录了SAP内所有的修改记录:CDHDR是change document header;CDPOS是change document position;一个是header信息,一个是Item信息如果想知道某个字段在哪个表中,可以去修改这个字段,然后用SE16到CDHDR中查找你刚才的更改记录,输入Name,Date,Time可以缩小范围:然后根据显示出的Change doc. object,Object Value和Document number去CDPOS中查找细节,就可以找到更改的表了4,ST05。

SQL Trace。

SQL trace记录了在系统里所做的操作访问了数据库中的那些表。

点击Active Trace后,进行和要查找的字段相关的操作后,再Deactive trace,然后Display Trace查看刚才操作的过程中访问过哪些表。

有的时候,访问的表很多,但是多数不是想要找的,所以需要花时间去分析。

以上四个是我常用的方法,而且我觉得很有效了。

这四个方法在Dennis Barrett的《18 Techniques for Locating the Underlying Data of a Screen Field》里都有提及,他提到的其余的方法没有用过,不做评价了。

不过有一段hint还是不错的:Many transactions have header information and detail or item lines in separate linked tables.Remember that R/3 is a German pro duct. “Kopf” is Germanfor “head,” and。

SAP中根据字段查找对应表

SAP中根据字段查找对应表

SAP中根据字段查找对应表的方法下面的查找主要以事务QS23为例进行。

一、F1直接查找实例:查找QS23界面的工厂字段对应的表格。

1、将光标定位在工厂字段值1000内,按F1键2、点击上图标记的按钮弹出的屏幕中就可以找到需要的表信息,以及字段所对应的元素,要注意下面的表类别是否为透明表格,有些字段对应的表类别是结构等,这时候就需要用其他方法去查找字段对应的透明表。

二、根据元素查找有时候根据第一种方法找出的表名是结构类型的,这时可以用字段对应的元素继续查找。

实例:查找QS23界面的短文本字段对应的表格。

1、首先经过第一种方法之后,发现找出的表类别是结构类型的,不满足要求:2、这时需要双击图中的数据元素QKURZTEXT,进入到元素屏幕:3、根据上图,找到元素所用出清单,只需选择表格字段复选框即可,进入清单界面,如下:只选择表格字段,点击执行之后进入所用处界面。

可以看到所用处清单列出了所有使用该数据元素的数据库表,这样就可以在其中找到所需要的透明表了,这里需要自己去判断,感觉可能性比较大的就去SE11里面找到这个表确认一下,上述短文本所对应的数据库表为QPMT。

不过这种方法也有问题,有时候某个数据元素所对应的表格太多,以至于无法从中准确快速地找到自己需要的表,这时候就需要用其他方法再去查找了。

三、 ST05性能跟踪实例:还是查找QS23界面的短文本字段对应的表格。

1、运行事务ST05,进入性能跟踪界面。

2、运行事务QS23,进入选择屏幕界面,如下:3、这时再回到ST05,点击开始跟踪:4、进入QS235、返回ST05,点击结束跟踪,之后点击跟踪列表,进入跟踪列表界面:跟踪列表界面如下:这个界面显示的就是刚刚对于QS23操作所涉及的所有数据库表信息,即QS23事务运行过程中屏幕上的数据来源,这里可以看到对象名一列所列的都是透明表名称,可以去SE11查看相关表格,对比过后,发现所需要的字段在表QPMT中,则QPMT即所需要的表。

30SAP_QUERY 使用简介(SQ01,SQVI快速查询报表)

30SAP_QUERY 使用简介(SQ01,SQVI快速查询报表)

7.3版本下的QUERY使用简介(入门级)。

SAP 查询: 维护查询: SQ01/SQ02/SQ03.
还有一种创建方法:SQVI(主要是为了个人快速查询用,也可以生成对应的程序,再SE93创建一个事务码,供他人用)
系统一共支持4种不同数据源的查询:
(1).SAP 查询信息集
(2).表(单表)
(3).表连接(多表)
(4).逻辑数据库
以最常用的【表连接】为例,进行说明。

1.使用布局模式进行创建。

2.进入布局模式,并添加需要查询的表
2.连接条件。

添加数据库表的时候,系统会自动匹配表与表之间的主KEY,它会自动的先生成一个连接条件,当然可以根据自己的需要添加连接条件。

生成了如下的连接视图
3.选择需要出力显示的项目
4.确定选择条件
执行画面:
结果画面:。

SAP中的报表查询

SAP中的报表查询

SAP中的报表查询对于任何一个信息系统,从输入、转换、输出过程中,最后决策还是需要从输出的信息中获取有用的信息和数据,然后利用这些数据和信息,作为我们决策的依据。

在SAP系统中也一样,不仅仅知道业务处理的过程,而且更要很好的利用报表查询,获取我们自己所需的信息与数据。

现列举部分常用查询,见下表:模块查询-内容-路径-交易码FI查询会计科目表信息系统/会计/财务会计/总分类帐/会计科目表F.10FI查询资产负债表和损益表信息系统/会计/财务会计/总分类帐/资产负债表F.01FI查询多个总帐科目的余额信息系统/会计/财务会计/总分类帐/科目余额F.08FI查询单个总帐科目的余额会计/财务会计/总分类帐/帐户/显示余额FS10FI查询多个总帐科目的行项目(明细帐)信息系统/会计/财务会计/总分类帐/行项目F.51FI查询单个总帐科目的行项目会计/财务会计/总分类帐/帐户/显示行项目FBL3FI查询单个供应商的明细帐会计/财务会计/应付帐款/帐户/显示行项目FBL1FI查询多个供应商的明细帐信息系统/会计/财务会计/应付帐款/未清项目F.41FI查询单个供应商的余额会计/财务会计/应付帐款/帐户/显示余额FK10FI查询多个供应商的余额信息系统/会计/财务会计/应付帐款/科目余额F.42FI查询供应商清单信息系统/会计/财务会计/应付帐款/帐户清单F.40AM按资产号、资产分类等查询资产的原值、累计折旧和净值信息系统/会计/财务会计/固定资产/资产价值AR01AM显示资产的历史变化信息系统/会计/财务会计/固定资产/资产历史数据表AR02AM模拟多项资产在查询年度的折旧信息系统/会计/财务会计/固定资产/折旧值AR03AM显示资产购置清单无AR05AM显示资产报废清单无AR06AM显示未记帐资产目录无AR12-----------------通过ME2L可以查询物料对应的供应商---------------------MM按供应商查询订单后勤/物料管理/采购/采购定单/清单显示/按供应商ME2L---------------------------------------------------------------------MM按物料查询订单后勤/物料管理/采购/采购定单/清单显示/按物料ME2MMM按物料组查询订单后勤/物料管理/采购/采购定单/清单显示/按物料组ME2CMM按采购订单号查询订单后勤/物料管理/采购/采购定单/清单显示/根据采购定单号ME2NMM按供货工厂查询订单后勤/物料管理/采购/采购定单/清单显示/根据供货工厂ME2WMM物料库存一览查询后勤/物料管理/仓库管理/环境/库存/库存一览MMBEMM仓库库存查询后勤/物料管理/仓库管理/环境/库存/仓库库存MB52MM显示库存盘点凭证后勤/物料管理/库存盘点/库存盘点凭证/显示MI03MM显示库存差异清单后勤/物料管理/库存盘点/差额/差异清单MI20MMGR/IR余额清单后勤/物料管理/仓库管理/环境/余额显示/出入库余额清单MB5SMM显示库存盘点结果后勤/物料管理/库存盘点/环境/物料的库存盘点凭证MI22MM库存价值查询信息系统/后勤/库存管理/工厂/库存MC.1MM显示物料清单后勤/物料管理/物料管理/物料主数据/其他/物料清单MM60MM显示物料采购信息记录后勤/物料管理/采购/主数据/信息系统/显示ME13MM显示采购单后勤/物料管理/采购/采购定单/显示ME23MM显示物料凭证后勤/物料管理/库存管理/物料凭证/显示MB03 MM显示物料凭证清单后勤/物料管理/库存管理/环境/清单显示/物料凭证MB51MM显示物料会计凭证清单后勤/物料管理/库存管理/环境/清单显示/物料会计凭证MR51MM按供应商查询物料采购信息后勤/物料管理/采购/主数据/信息系统/清单显示/按供应商ME1LMM按物料查询物料采购信息后勤/物料管理/采购/主数据/信息系统/清单显示/按物料ME1MCO成本中心计划和实际比较表会计/管理会计/成本中心/信息系统/报告选择/计划与实际比较SARTCO内部定单计划和实际比较表会计/管理会计/内部定单/信息系统/报告选择/计划与实际比较SARTSAP 查询物料对应的供应商。

SAP系统18种查询标的方法

SAP系统18种查询标的方法

18种根据屏幕字段查找数据库表数据的技巧帮助18种根据屏幕字段查找潜在数据的技巧Dennis Barrett / 翻译:强晟********************想象一下这样的情景。

一个业务经理希望得到一个关于她的服务订单的专用报表,她给了你一个报表的草图(包括列、行、标题、分组、小计、合计等等),而“服务管理”事务屏幕中的字段就包含了她希望你在报表中显示的数据。

你该怎么做?通常的,你会检查系统中运行的,能够提供这个业务经理所需信息的现存报表(或者是已经为这个client写过的),或者可以复制和修改后能符合需要的报表。

如果没有找到,你也许会在适当的报表系统——例如,工厂维护信息系统(PMIS)——中看看是否能找到合适的。

即使这样,你仍然无法找到报表,或者无法从现存报表中找到可修改的,那只能写一个报表或者一个ABAP查询来实现这个需求。

现在,设想一下业务经理问你是否以某种方式在《创建计量单位文档事务》中增加一个小小的功能:向MDoc文本字段中粘贴相关销售订单号。

这个要求需要你创建一个增强功能。

在前面两个情形中,你都需要访问数据库表中的特定数据。

你怎么以屏幕字段做指导来找到这些数据?我们都知道与一个事务关联的信息都存储在几个(偶尔还会是很多个)相关的表里。

这样,当你需要在报表或增强功能中使用一个事务中的几个字段时,你需要找出许多事务的表并在它们之间建立关联。

这些关联通常都不会很明显。

我曾经在众多场合遇到这些情况,有时需要同时在SD、MM、IM、WM和服务管理(现在叫客户服务)等模块对多个client进行工作。

随着时间推移,我收集了同事和自己在开发中寻找需要数据的建议。

我现在来跟你分享这些技巧——共18种。

起跑线和终点线我将会介绍达成本练习“终点线”的各种各样的技巧——也就是说,定位那些在屏幕字段中存储潜在数据的表和字段。

你未必需要所有这些方法,一般来说,前四种技巧已经足够了。

我之所以写其他的技巧是因为有些字段非常难以追踪,而这些工具或许可以解决问题。

sap查询语法

sap查询语法

sap查询语法SAP查询语法用于在SAP系统中检索数据。

以下是一些常见的SAP查询语法:1. SELECT 语句:用于从数据库表中检索数据。

```sqlSELECT 列1, 列2, ...FROM 表名WHERE 条件;```2. 条件语句:用于过滤查询结果。

`=`:等于`<>` 或 `!=`:不等于`>`:大于`<`:小于`>=`:大于或等于`<=`:小于或等于```sqlSELECT FROM 表名 WHERE 列名 > 10;```3. 排序数据:使用 `ORDER BY` 对查询结果进行排序。

```sqlSELECT FROM 表名 ORDER BY 列名 ASCDESC;```4. 聚合函数:用于对数据进行计算。

`SUM()`:求和`COUNT()`:计数`AVG()`:平均值`MAX()`:最大值`MIN()`:最小值```sqlSELECT SUM(column_name) FROM 表名 WHERE condition; ```5. 分组数据:使用 `GROUP BY` 对数据进行分组。

```sqlSELECT 列1, COUNT()FROM 表名GROUP BY 列1;```6. HAVING 子句:用于对分组后的数据进行过滤。

```sqlSELECT 列1, COUNT()FROM 表名GROUP BY 列1HAVING COUNT() > 10;```7. JOIN 操作:用于将多个表中的数据连接起来。

```sqlSELECT FROM 表1 INNER JOIN 表2 ON 表1.列名 = 表2.列名; ```8. 子查询:在查询中使用另一个查询。

```sqlSELECT FROM 表名 WHERE 列名 IN (SELECT 列名 FROM 表名 WHERE condition);```。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

SAP 几种查表的方法
(2015-12-13 14:04:09)
转载▼
标签:
分类:ERP、MES与企业信息化
sap
报表查询
说说我常用的几种方法。

1,F1。

毫无悬念,当我想要知道某一个字段存在哪一张表里的时候,我就会下意识的按F1,然后去看Technical Infomation。

我觉得有一半左右的机会可以得到我想要的答案
2,SAP Application。

用SE16进入Data Browser,然后F4,点击进入SAP Application。

然后可以看到,一个表和应用相匹配的树状图,根据当前进行的操作内容,查找对应的表。

3,CDHDR and CDPOS。

这两个表记录了SAP内所有的修改记录:CDHDR是change document header;CDPOS是change document position;一个是header信息,一个是Item信息
如果想知道某个字段在哪个表中,可以去修改这个字段,然后用SE16到CDHDR中查找你刚才的更改记录,输入Name,Date,Time可以缩小范围:
然后根据显示出的Change doc. object,Object Value和Document number去CDPOS中查找细节,就可以找到更改的表了
4,ST05。

SQL Trace。

SQL trace记录了在系统里所做的操作访问了数据库中的那些表。

点击Active Trace后,进行和要查找的字段相关的操作后,再Deactive trace,然后Display Trace 查看刚才操作的过程中访问过哪些表。

有的时候,访问的表很多,但是多数不是想要找的,所以需要花时间去分析。

以上四个是我常用的方法,而且我觉得很有效了。

这四个方法在Dennis Barrett的《18 Techniques for Locating the Underlying Data of a Screen Field》里都有提及,他提到的其余的方法没有用过,不做评价了。

不过有一段hint还是不错的:
Many transactions have header information and detail or item lines in separate linked tables. Remember that R/3 is a German p roduct. “Kopf” is German for “head,” and “position” can be interpreted in German as “detail” or “item.” You’ll often find header/item table pairs with “K” and “P” in their names, such as VBAK and VBAP. When you are looking for linked tables containing the data for a transaction, this tip may help you identify one if you have the other.。

相关文档
最新文档