Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

PLEASE SOLVE THIS ONE.

Former Member
0 Kudos

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.

15 REPLIES 15

rainer_hbenthal
Active Contributor
0 Kudos

Solved.

0 Kudos

if it is correct why i am not having the o/p.

give me the suggestion.

regards in advance,

pandu.

0 Kudos

Hi pandu

tel me one thing

ur getting error or getting blank output

0 Kudos

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

0 Kudos

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.

0 Kudos

it is not moving from the at selection screen.

with regards,

pandu.

0 Kudos

no change with your code.

regards in advance.

pandu.

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

i dont want change the code,what is the problem in this code.

give me the faults.

pandu.

Former Member
0 Kudos

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>

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.