06-05-2009 12:59 PM
Hi all
The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT MARA~MANDT
MARA~MATNR
MARC~WERKS
MARD~LGORT
MARA~MEINS
MARD~LABST
MARD~EINME
MARD~SPEME
MARD~RETME
MARD~INSME
MARD~UMLME
MARD~VMLAB
MARD~VMEIN
MARD~VMSPE
MARD~VMRET
MARD~VMINS
MARD~VMUML
MARC~XCHPF
MARD~KLABS
MARD~KEINM
MARD~KSPEM
MARD~KINSM
from MARA inner join MARC on
MARAMANDT = MARCMANDT AND
MARAMATNR = MARCMATNR
inner join MARD on
MARAMANDT = MARDMANDT AND
MARAMATNR = MARDMATNR
AND MARCWERKS = MARDWERKS
for all entries in gt_werks
where MARC~werks EQ gt_werks-werks
AND MARA~MATNR in LS_MATNR.
ENDIF. "First data package ?
Fetch records into interface table.
named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
06-05-2009 1:02 PM
Hi,
MARCWERKS = MARDWERKS
MARC~werks EQ gt_werks-werks
for the corresponding Material need's to be satisfied.
06-05-2009 1:02 PM
Hi,
MARCWERKS = MARDWERKS
MARC~werks EQ gt_werks-werks
for the corresponding Material need's to be satisfied.
06-05-2009 1:04 PM
Hi
If possible could you provide me the corrected code. Thanks in advance.
06-05-2009 1:04 PM
the 'in' statement - check with that.
LS_MATNR must be declared as ranges
06-05-2009 1:08 PM
06-05-2009 1:11 PM
u can split and write the query using for all entries..
Just a clarification.
a material will be available in different plants.
so joining mara and marc will not be correct.
06-05-2009 1:12 PM
I suppose you get a problem related to conversion exit, Doesn't RSA3 wait for internal format parameters ? (try to use F4 to select material numbers)
Regards,
Raymond
06-05-2009 1:17 PM
try this
select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
where werks EQ gt_werks-werks and lvorm = space.
if t_marc is not initial.
select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
MARD~KEINM MARD~KSPEM MARD~KINSM MARA~MEINS from
mard inner join MARA on mard~matnr = mara~matnr
for all entries in t_marc where mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
and mard~lvorm = space.
06-05-2009 1:18 PM
06-05-2009 1:24 PM
I will try this and let u know , but i am not sure as to how far this will work inside the open cursor. I think there will be some problem with my cursors... any how i will let u know. Thanks.