‎2006 Jul 26 7:41 AM
hi
please help me to find the solution.
this is the logic :
DATA: BEGIN OF it_item_master OCCURS 10,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
spart LIKE mara-spart,
pstyv LIKE vbap-pstyv,
prdha LIKE mara-prdha,
yyverpa LIKE marc-yyverpa,
yyfuellmg LIKE marc-yyfuellmg,
matkl LIKE mara-matkl,
END OF it_item_master.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_matnr2 FOR mara-matnr,
s_vbeln2 FOR vbap-vbeln,
s_werks2 FOR marc-werks,
s_vkorg2 FOR knvp-vkorg.
SELECTION-SCREEN END OF BLOCK b2.
SELECT matnr spart prdha matkl
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE matnr IN s_matnr2.
SELECT yyverpa yyfuellmg
FROM marc
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE matnr IN s_matnr2
AND werks IN s_werks2.
SELECT pstyv
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE vbeln IN s_vbeln2.
LOOP AT it_item_master.
APPEND it_item_master.
ENDLOOP.
WRITE:it_item_master-matnr,
it_item_master-spart,
it_item_master-prdha,
it_item_master-matkl,
it_item_master-maktx,
it_item_master-yyverpa,
it_item_master-yyfuellmg.
ENDLOOP.
i am not getting the data in to the internal table and moreever it is taking long time to come out of the loop.
plse guide me is this right way to retrive the data,is there any mistake? plse ...
with regards
narasimha rao
‎2006 Jul 26 7:46 AM
SELECT pstyv
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE vbeln IN s_vbeln2.
LOOP AT it_item_master.
APPEND it_item_master. <<<<< WHY
ENDLOOP.
.
.
.
if you use "APPEND it_item_master" there, your loop never end.
you must delete this code.
ibrahim
‎2006 Jul 26 7:51 AM
LOOP AT it_item_master.
<b>APPEND it_item_master</b>.---->not needed..
ENDLOOP.
WRITE:it_item_master-matnr,
it_item_master-spart,
it_item_master-prdha,
it_item_master-matkl,
it_item_master-maktx,
it_item_master-yyverpa,
it_item_master-yyfuellmg.
ENDLOOP.
not needed becoz ur recored is already in itab because u used into table itab in select query.
‎2006 Jul 26 7:49 AM
Hi,
Problems in the code:
a) Why don't you try to create a Join of MARA and MARC to pick data into table it_item_master1 (temp table) and then for all entries of that pick data from VBAP into it_item_master2. Combine the datas of both the table into the final table it_item_master.
b)Theres a APPEND it_item_master in your loop before the write statemnet ??
c) Write a separate loop for your write and append statement.
Hope This Helps
Anirban
‎2006 Jul 26 7:50 AM
all selects are strange.
you are deleting it_item_master table in next selects.(what you are getting in select with mara is deleteted by select by marc and.so on)
To get expectet results use Joins between tables MARA, MARC and VBAP.
BR< JAcek
‎2006 Jul 26 7:57 AM
Hi,
Assuming you want the data in <b>it_item_master</b> into another internal table .
This is how you can do it.
Decalare another Internal Table <b>it_item_master_temp</b>
Consider this code.
DATA: BEGIN OF it_item_master OCCURS 10,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
spart LIKE mara-spart,
pstyv LIKE vbap-pstyv,
prdha LIKE mara-prdha,
yyverpa LIKE marc-yyverpa,
yyfuellmg LIKE marc-yyfuellmg,
matkl LIKE mara-matkl,
END OF it_item_master.
<b>DATA : it_item_master_temp LIKE it_item_master OCCURS 0.</b>
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_matnr2 FOR mara-matnr,
s_vbeln2 FOR vbap-vbeln,
s_werks2 FOR marc-werks,
s_vkorg2 FOR knvp-vkorg.
SELECTION-SCREEN END OF BLOCK b2.
SELECT matnr spart prdha matkl
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE matnr IN s_matnr2.
SELECT yyverpa yyfuellmg
FROM marc
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE matnr IN s_matnr2
AND werks IN s_werks2.
SELECT pstyv
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_item_master
WHERE vbeln IN s_vbeln2.
LOOP AT it_item_master.
<b>*For Dispalying the data.</b>
WRITE:it_item_master-matnr,
it_item_master-spart,
it_item_master-prdha,
it_item_master-matkl,
it_item_master-maktx,
it_item_master-yyverpa,
it_item_master-yyfuellmg.
<b>*For putting the data into another Internal Table</b>
it_item_master_temp-matnr = it_item_maste-matnr .
it_item_master_temp-spart = it_item_master-spart.
it_item_master_temp-prdha = it_item_master-prdha.
APPEND it_item_master_temp.
CLEAR it_item_master_temp.
ENDLOOP.
Regards,
AS
‎2006 Jul 26 8:20 AM