06-16-2008 7:29 AM
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: WA_ITAB LIKE LINE OF ITAB.
SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.
LOOP AT ITAB INTO WA_ITAB.
WRITE : WA_ITAB-MATKL.
ENDLOOP.
it is syntically correct but o/p is not coming
06-16-2008 7:32 AM
Hi Ansuman,
Please check this
MATNR = '000000000000521196'.
Please check wheather the ITAB is getting populated or not.
Best regards,
raam
06-16-2008 7:30 AM
Write your select stmt this way.
SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = '521196'.
REGARDS,
aZAD.
06-16-2008 7:30 AM
06-16-2008 7:32 AM
Hi Ansuman,
Please check this
MATNR = '000000000000521196'.
Please check wheather the ITAB is getting populated or not.
Best regards,
raam
06-16-2008 7:32 AM
HI,
change the internal table structure to the retriving variables in SELECT conditon.
DATA: BEGIN OF ITAB OCCURS 0,
MATKL LIKE MARA-MATKL,
END OF ITAB.
or change the select condition
SELECT MATNR
MTART
MATKL
UOM
LAEDA
FROM MARA
INTO TABLE ITAB
WHERE MATNR = '521196'.
06-16-2008 7:32 AM
Hi,
The length of the matnr is 18 and the value you are passing is not equal to length of the matnr, add zeros infront of the matnr you passed or conversion exit.
Thanks,
Sriram Ponna.
06-16-2008 7:32 AM
Hi,
your code is ok make but requires some changes
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: WA_ITAB LIKE LINE OF ITAB.
SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.
LOOP AT ITAB.
WRITE : ITAB-MATKL.
ENDLOOP.
Either use the table with header line or with work area.
Regards
Adil
06-16-2008 7:33 AM
either use 'into corresponding fields of ' addition or write the query as follows....
SELECT MATNR MTART MATKL MEINS LAEDA FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.
06-16-2008 7:34 AM
hi,
Do like this.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: WA_ITAB LIKE LINE OF ITAB.
SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS FOF TABLE ITAB WHERE MATNR = '521196'.
IF SY-SUBRC = 0. // see whether subrc is 0 or not if it is 0 then ur select stmt is right , eventhough u r not getting data into internal table may be data is not available in table mara.LOOP AT ITAB INTO WA_ITAB.
WRITE : WA_ITAB-MATKL.
ENDLOOP.
ENDIF.
Rgds.
subash
06-16-2008 7:35 AM
Before passing the value in to select condition,
pass the value to FM: CONVERSION_EXIT_MATN1_INPUT and pass this value to Select.
In select condition INTO CORRESPONDING FIELDS OF TABLE should be used instead of INTO TABLE.
Regards
Kannaiah
06-16-2008 7:38 AM
plz check whether in the database table there exist a value which you have given in the where clause.
that is in the database it is not satisfying the where clause
write this loop at itab into wa.
dont give where clause fr the time being
if value comes then give where clause with where clause and check...
06-16-2008 7:47 AM
hi,
write your code like this.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: v_matnr type mara-matnr..
v_matnr = '521196' .
SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = v_matnr.
LOOP AT ITAB.
WRITE : ITAB-MATKL.
ENDLOOP.
06-16-2008 7:51 AM
hi,
just use "INTO CORRESPONDING FIELDS OF " in the select statement.
Regards,
venkat n
06-16-2008 7:52 AM
See my comments (marked in bold) below:
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL, << Keep only matkl and remove other fields
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: WA_ITAB LIKE LINE OF ITAB.
SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'. << Give material name with 18 char length
<< check sy-subrc value to detemine whether any record is selected or not
LOOP AT ITAB INTO WA_ITAB.
WRITE : WA_ITAB-MATKL. << Check the value of WA_ITAB-MATKL, it can be blank in that case you will get blank output
ENDLOOP.
06-16-2008 8:17 AM
Hi,
Try this it will surely work.
TABLES : MARA.
TYPES: BEGIN OF ITAB ,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL TYPE MARA-MATKL,
UOM LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
END OF ITAB.
DATA: I_ITAB TYPE STANDARD TABLE OF ITAB,
WA_ITAB LIKE LINE OF I_ITAB,
LV_MATNR LIKE MARA-MATNR.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = '59'
IMPORTING
OUTPUT = LV_MATNR
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS OF TABLE I_ITAB WHERE MATNR = LV_MATNR.
IF SY-SUBRC EQ 0.
LOOP AT I_ITAB INTO WA_ITAB.
WRITE : WA_ITAB-MATKL.
ENDLOOP.
ELSE.
MESSAGE E003.
ENDIF.
Plz reward if useful.
Thanks,
Dhanashri.