ABAP 一对多关系
FORMGET_DATA.*DATA:BEGINOFit_ekpoOCCURS0,*LIFNRTYPEekko-LIFNR,"供应商*EKGRPTYPEekko-EKGR...
FORM GET_DATA.
* DATA : BEGIN OF it_ekpo OCCURS 0,
* LIFNR TYPE ekko-LIFNR, "供应商
* EKGRP TYPE ekko-EKGRP, "采购租
* MATNR TYPE ekpo-MATNR, "物料编码
* TXZ01 TYPE EKPO-TXZ01, "物料描述
* MENGES TYPE ekpo-MENGE, "采购数量
* EBELN TYPE EKPO-EBELN, "采购订单
* EBELP TYPE EKPO-EBELP, "行项目
* AEDAT TYPE EKPO-AEDAT, "输入系统日期
* EINDT TYPE EKET-EINDT, "厂商回复交期
* END OF it_ekpo.
select lfdat banfn badat menge werks
INTO CORRESPONDING FIELDS OF TABLE it_header
from eban
WHERE werks IN z_werks.
LOOP AT it_header INTO wa_header.
* SELECT
* EKKO~AEDAT EKKO~LIFNR EKKO~EKGRP
* EKPO~ebeln EKPO~TXZ01 EKPO~MENGE
* INTO CORRESPONDING FIELDS OF iy_header
* from EKKO
* INNER JOIN EKPO
* ON EKKO~EBELN = EKPO~EBELN
* WHERE ekpo~banfn = wa_header-banfn
* AND ekpo~bnfpo = wa_header-bnfpo
* .
* MODIFY it_header FROM WA_HEADER.
ENDLOOP.
ENDFORM. 展开
* DATA : BEGIN OF it_ekpo OCCURS 0,
* LIFNR TYPE ekko-LIFNR, "供应商
* EKGRP TYPE ekko-EKGRP, "采购租
* MATNR TYPE ekpo-MATNR, "物料编码
* TXZ01 TYPE EKPO-TXZ01, "物料描述
* MENGES TYPE ekpo-MENGE, "采购数量
* EBELN TYPE EKPO-EBELN, "采购订单
* EBELP TYPE EKPO-EBELP, "行项目
* AEDAT TYPE EKPO-AEDAT, "输入系统日期
* EINDT TYPE EKET-EINDT, "厂商回复交期
* END OF it_ekpo.
select lfdat banfn badat menge werks
INTO CORRESPONDING FIELDS OF TABLE it_header
from eban
WHERE werks IN z_werks.
LOOP AT it_header INTO wa_header.
* SELECT
* EKKO~AEDAT EKKO~LIFNR EKKO~EKGRP
* EKPO~ebeln EKPO~TXZ01 EKPO~MENGE
* INTO CORRESPONDING FIELDS OF iy_header
* from EKKO
* INNER JOIN EKPO
* ON EKKO~EBELN = EKPO~EBELN
* WHERE ekpo~banfn = wa_header-banfn
* AND ekpo~bnfpo = wa_header-bnfpo
* .
* MODIFY it_header FROM WA_HEADER.
ENDLOOP.
ENDFORM. 展开
3个回答
2010-11-17
展开全部
你用select single 取第一条记录呗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
您可能需要的服务
百度律临官方认证律师咨询
平均3分钟响应
|
问题解决率99%
|
24小时在线
立即免费咨询律师
17631人正在获得一对一解答
杭州雪花飘飘5分钟前提交了问题
深圳蓝天飞翔3分钟前提交了问题
武汉草原风1分钟前提交了问题