简体   繁体   English

SAP 查询。 根据选择屏幕上的输入检索值

[英]SAP query. Retrieve values basing on input on selection screen

I am stuck with coding a SAP query..I am new to ABAP.我坚持编写 SAP 查询。我是 ABAP 的新手。

What I would like to achieve is a join between tables ESLL, EKPO, EKKO.我想实现的是表 ESLL、EKPO、EKKO 之间的连接。 Specifically these are the steps I would like to achieve:具体来说,这些是我想要实现的步骤:

  1. in the selection parameter every time I will enter the query I will give a different value for ESLL-EXTSRVNO;在每次我输入查询时的选择参数中,我都会为 ESLL-EXTSRVNO 提供不同的值;
  2. basing on that value the query automatically should select ESLL-PACKNO basing on ESLL-EXTSRVNO given;根据该值,查询应根据给定的 ESLL-EXTSRVNO 自动选择 ESLL-PACKNO;
  3. then the query should put ESLL-SUB_PACKNO equal to the ESLL-PACKNO values of the steps before;那么查询应该把 ESLL-SUB_PACKNO 等于之前步骤的 ESLL-PACKNO 值;
  4. then the query should put the new ESLL-PACKNO values equal to EKPO-PACKNO and retrieve the following fields: EKPO-EBELN, EKPO-EBELP, EKPO-MATKL.那么查询应该把新的 ESLL-PACKNO 值等于 EKPO-PACKNO 并检索以下字段:EKPO-EBELN、EKPO-EBELP、EKPO-MATKL。

I have already written some code inside the infoset, but I do not know how to fix it.我已经在信息集中写了一些代码,但我不知道如何修复它。

In the "data" section I have written:在“数据”部分,我写道:

DATA: it_esll TYPE TABLE OF esll.
DATA: it_esll2 TYPE TABLE OF esll.
DATA: it_ekpo TYPE TABLE OF ekpo.

In the "start-of-selection" section I have written:在“开始选择”部分,我写道:

 SELECT packno
  FROM esll
  INTO TABLE it_esll.
IF sy-subrc EQ 0.
SELECT packno  FROM esll
  into TABLE it_esll2
  for ALL ENTRIES IN it_esll
  where sub_packno EQ it_esll-packno.
IF sy-subrc EQ 0.
  SELECT ebeln ebelp bukrs werks matkl menge netpr peinh
       FROM ekpo
       into TABLE it_ekpo
        for ALL ENTRIES IN it_esll2
       WHERE packno   EQ it_esll2-packno.
endif.
endif.

And, in order to display all the information I want, I have put the following joins: ESLL-PACKNO --> EKPO-PACKNO --> EKPO-EBELN --> EKKO-EBELN而且,为了显示我想要的所有信息,我添加了以下连接:ESLL-PACKNO --> EKPO-PACKNO --> EKPO-EBELN --> EKKO-EBELN

At then end I would like to display these information:最后我想显示这些信息:

  1. EKPO-EBELN EKPO-EBELN
  2. EKPO-EBELP EKPO-EBELP
  3. EKPO-MATKL EKPO-MATKL
  4. EKKO-BSART EKKO-BSART
  5. EKPO-PACKNO EKPO-PACKNO

Could you please help me?你能帮帮我吗?

One option could be to use Alias table in your infoset, something like this:一种选择是在您的信息集中使用别名表,如下所示:

  • First table: ESLL;第一张表:ESLL;
  • Second table ZESLL (Alias on ESLL) with join ZESLL-PACKNO = ESLL-SUB_PACKNO;第二个表 ZESLL(ESLL 上的别名)与连接 ZESLL-PACKNO = ESLL-SUB_PACKNO;
  • Third table: EKPO with join on EKPO-PACKNO = ZESLL-PACKNO;第三个表:EKPO 与 EKPO-PACKNO = ZESLL-PACKNO 的连接;
  • Fourth table: EKKO with join on EBELN;第四个表:EKKO 与 EBELN 的连接;

So you can avoid ABAP所以你可以避免 ABAP

Infoset Join信息集加入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM