2007 Jun 08 10:04 AM
HI All
I need fetch all matnr ,ersda,ernam and mtart from table MARA,Iam using as follows but iam getting only one records.please i need all records from mara as my requirement.
DATA: BEGIN OF wa_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
DATA:it_MARA LIKE TABLE OF wa_MARA WITH HEADER LINE.
select MATNR ERSDA ERNAM MTART from MARA into table it_mara.
please help me.
Thanks.
jay
2007 Jun 08 10:11 AM
Hi Jay
DATA: BEGIN OF wa_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
DATA: IT_MARA LIKE TABLE OF MARA occurs with 0 header line.
select * from MARA into table it_mara.
this is the sample code for ur reference
DATA:
wa_ekko LIKE ekko,
wa_ekbe LIKE ekbe,
wa_ekkn LIKE ekkn,
wa_konp LIKE konp,
wa_ekpo LIKE ekpo,
wa_rbkp LIKE rbkp,
wa_j_1ipart1 LIKE j_1ipart1,
wa_j_1igrxref LIKE j_1igrxref,
wa_rseg LIKE rseg OCCURS 0 WITH HEADER LINE.
**********************************
*internal tables
*********************************
DATA: BEGIN OF int_konh OCCURS 0,
knumh LIKE konh-knumh,
kschl LIKE konh-kschl,
vakey LIKE konh-vakey,
END OF int_konh.
SELECT ebeln ebelp kostl ps_psp_pnr FROM ekkn INTO int_ekkn
FOR ALL ENTRIES IN int_outtab
WHERE ebeln = int_outtab-ebeln AND
ebelp = int_outtab-ebelp.
APPEND int_ekkn.
ENDSELECT.
Reward all helpfull answers
Regards
Pavan
2007 Jun 08 10:05 AM
2007 Jun 08 10:06 AM
Hi Jay,
Can u please try this code:
DATA:it_MARA LIKE wa_MARA OCCURS 0 WITH HEADER LINE.
Best Regards,
Victor.
2007 Jun 08 10:07 AM
you have defined the work area not an internal table
DATA: BEGIN OF wa_MARA ,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
change ther statement has below.
<b>data:It_mara like wa_mara occurs 0 with header line.</b>
thanks and regardss
pavankumar
2007 Jun 08 10:08 AM
Hi,
instead of data
DATA: BEGIN OF wa_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
use
Types: BEGIN OF wa_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
and then
DATA:it_MARA LIKE TABLE OF wa_MARA WITH HEADER LINE.
regards,
sudha
2007 Jun 08 10:08 AM
Hi Jay ,
Did you check in your table MARA how many entries are there , becuase i pasted your code in my system and executed it and it retrieved all the data.
Regards
Arun
2007 Jun 08 10:08 AM
YOUR CODE IS CORRECT ONLY WHAT IS YOUR PROBLEM?
REGARDS
SHIBA DUTTA
2007 Jun 08 10:08 AM
hi use this,
select * from MARA into INTO CORRESPONDING FIELDS OF it_mara.
append it_mara.
endselect.
2007 Jun 08 10:11 AM
Hi Jay
DATA: BEGIN OF wa_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF wa_mara.
DATA: IT_MARA LIKE TABLE OF MARA occurs with 0 header line.
select * from MARA into table it_mara.
this is the sample code for ur reference
DATA:
wa_ekko LIKE ekko,
wa_ekbe LIKE ekbe,
wa_ekkn LIKE ekkn,
wa_konp LIKE konp,
wa_ekpo LIKE ekpo,
wa_rbkp LIKE rbkp,
wa_j_1ipart1 LIKE j_1ipart1,
wa_j_1igrxref LIKE j_1igrxref,
wa_rseg LIKE rseg OCCURS 0 WITH HEADER LINE.
**********************************
*internal tables
*********************************
DATA: BEGIN OF int_konh OCCURS 0,
knumh LIKE konh-knumh,
kschl LIKE konh-kschl,
vakey LIKE konh-vakey,
END OF int_konh.
SELECT ebeln ebelp kostl ps_psp_pnr FROM ekkn INTO int_ekkn
FOR ALL ENTRIES IN int_outtab
WHERE ebeln = int_outtab-ebeln AND
ebelp = int_outtab-ebelp.
APPEND int_ekkn.
ENDSELECT.
Reward all helpfull answers
Regards
Pavan
2007 Jun 08 10:17 AM
Hi,
The code looks correct.I executed the same code and found I am getting all the records.
Check anywhere in the coding whether you are deleting records from it_mara.
Check the table contents whether it is having more than one record.
Kindly reward points by selecting the star on the left of reply,if it helps.
2007 Jun 08 10:40 AM