‎2007 Nov 06 1:58 PM
TABLES:MARA,MARC.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR, "Material Number
MTART LIKE MARA-MTART,
MEINS LIKE MARA-MEINS, "Base Unit of Measure
MBRSH LIKE MARA-MBRSH, "Industry sector
END OF ITAB.
DATA:BEGIN OF ITAB1 OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
PSTAT LIKE MARC-PSTAT,
EKGRP LIKE MARC-EKGRP,
END OF ITAB1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_MATNR LIKE MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
SELECT MATNR
MTART
MEINS
MBRSH
FROM MARA
INTO TABLE ITAB
WHERE MATNR EQ P_MATNR.
IF NOT ITAB IS INITIAL.
SELECT MATNR
WERKS
PSTAT
EKGRP
FROM MARC
INTO TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE MATNR EQ ITAB-MATNR.
ENDIF.
LOOP AT ITAB1.
WRITE:/ ITAB1-MATNR,ITAB1-WERKS,ITAB1-PSTAT,ITAB1-EKGRP.
ENDLOOP.
REGARDS IN ADVANCE,
PANDU.
‎2007 Nov 06 2:02 PM
‎2007 Nov 06 2:05 PM
if it is correct why i am not having the o/p.
give me the suggestion.
regards in advance,
pandu.
‎2007 Nov 06 2:06 PM
Hi pandu
tel me one thing
ur getting error or getting blank output
‎2007 Nov 06 2:09 PM
Hi,
Replace IF NOT ITAB IS INITIAL by the following : IF NOT ITAB[] IS INITIAL.
Your program is checking the header line of table itab which is obviously empty. You need to check the table content here.
Regards,
Nicolas
‎2007 Nov 06 2:10 PM
HI,
I think there is no corresponding entries found in FOR ALL ENTRIES query..
that is the reason you not able to see the output.
reward points if it is helpful.
Regards,
Satish.
‎2007 Nov 06 2:11 PM
it is not moving from the at selection screen.
with regards,
pandu.
‎2007 Nov 06 2:15 PM
‎2007 Nov 06 2:20 PM
So that means 2 possibilities :
1) There is no record in MARA for the MATNR you gave.
or
2) There is no corresponding record in table MARC.
You should check your data and run your program in debugging mode to find what is wrong.
Regards,
Nicolas.
‎2007 Nov 06 2:06 PM
Hi
write like this
START-OF-SELECTION.
SELECT a~MATNR
b~WERKS
b~PSTAT
b~EKGRP
FROM MARA AS a join MARC as b
on amatnr = bmatnr
INTO TABLE ITAB1
WHERE a~MATNR EQ p_MATNR.
ENDIF.
LOOP AT ITAB1.
WRITE:/ ITAB1-MATNR,ITAB1-WERKS,ITAB1-PSTAT,ITAB1-EKGRP.
ENDLOOP.
Regards
Anji
‎2007 Nov 06 2:09 PM
i dont want change the code,what is the problem in this code.
give me the faults.
pandu.
‎2007 Nov 06 2:09 PM
hi
i think there is no matching data available in ur system
go to that tables and check the availability of data
if there is no data then it won't show any data
check for ur condition in that table
<b>Rewar dif useful</b>
‎2007 Nov 06 2:16 PM
Hi,
just replace IF NOT ITAB[] IS INITIAL.
no need to delcrea MARC in tables because we don't have any selection-screen field from MARC
TABLES:MARA.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR, "Material Number
MTART LIKE MARA-MTART,
MEINS LIKE MARA-MEINS, "Base Unit of Measure
MBRSH LIKE MARA-MBRSH, "Industry sector
END OF ITAB.
DATA:BEGIN OF ITAB1 OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
PSTAT LIKE MARC-PSTAT,
EKGRP LIKE MARC-EKGRP,
END OF ITAB1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_MATNR LIKE MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
SELECT MATNR
MTART
MEINS
MBRSH
FROM MARA
INTO TABLE ITAB
WHERE MATNR EQ P_MATNR.
IF NOT ITAB[] IS INITIAL.
SELECT MATNR
WERKS
PSTAT
EKGRP
FROM MARC
INTO TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE MATNR EQ ITAB-MATNR.
ENDIF.
LOOP AT ITAB1.
WRITE:/ ITAB1-MATNR,ITAB1-WERKS,ITAB1-PSTAT,ITAB1-EKGRP.
ENDLOOP.
‎2007 Nov 06 2:17 PM
Hi,
TABLES:MARA,MARC.
DATA:BEGIN OF ITAB1 OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
PSTAT LIKE MARC-PSTAT,
EKGRP LIKE MARC-EKGRP,
END OF ITAB1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
select-options: s_MATNR for MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
select qmatnr qwerks qpstat qekgrp from marc as q inner join mara as
p on qmatnr = pmatnr into table itab1 where p~matnr in s_matnr.
LOOP AT ITAB1.
WRITE:/ ITAB1-MATNR,ITAB1-WERKS,ITAB1-PSTAT,ITAB1-EKGRP.
ENDLOOP.
Try this,
KC
‎2007 Nov 06 2:23 PM
Hi pandu,
you might get more acceptance by using one or more of this:
- Read the ABAP FAQ , Welcome and Rules of Engagement and Read this before posting: Pay attention to the new categories please mails before posting again
- avoid multiple postings for the same questions
- use a meaningful subject when posting
- use GOOGLE
- ask a colleague (especially useful - don't worry: Mos don't know that much more than you)
- use debugger: At SELECT statement analyze WHERE condition. Transfer the WHERE condition values/conditions to SE16 screen. Check if conditions and results are the same. Find reason if not. Very common error is entering material numbers in non-MATNR fields: No input conversion will take place and the number used in WHERE condition does not have leading zeros. This will never find an existing material number in database which carries leading zeros.
Regards,
Clemens
‎2007 Nov 06 3:24 PM
This will work fine... reward points if usefull...
data :ITAB type table of mara.
DATA:BEGIN OF ITAB1 OCCURS 0,
WERKS type MARC-WERKS,
MATNR type MARC-MATNR,
PSTAT type MARC-PSTAT,
EKGRP type MARC-EKGRP,
END OF ITAB1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_MATNR LIKE MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
SELECT MATNR
MTART
MEINS
MBRSH
FROM MARA
INTO corresponding fields OF table ITAB
WHERE MATNR EQ P_MATNR.
IF NOT ITAB IS INITIAL.
SELECT MATNR
WERKS
PSTAT
EKGRP
FROM MARC
INTO corresponding fields OF table ITAB1
FOR ALL ENTRIES IN ITAB
WHERE MATNR EQ ITAB-MATNR.
endif.
LOOP AT ITAB1.
WRITE:/2(20) ITAB1-MATNR,
21(26) ITAB1-WERKS,
27(29) ITAB1-PSTAT,
30(35) ITAB1-EKGRP.
ENDLOOP.