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: 

Function module based generic extractor - Problem with the selection

former_member210676
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

MARCWERKS = MARDWERKS

MARC~werks EQ gt_werks-werks

for the corresponding Material need's to be satisfied.

9 REPLIES 9

Former Member
0 Kudos

Hi,

MARCWERKS = MARDWERKS

MARC~werks EQ gt_werks-werks

for the corresponding Material need's to be satisfied.

0 Kudos

Hi

If possible could you provide me the corrected code. Thanks in advance.

kesavadas_thekkillath
Active Contributor
0 Kudos

the 'in' statement - check with that.

LS_MATNR must be declared as ranges

0 Kudos

Yes LS_MATNR is already declared as ranges. Thanks.

kesavadas_thekkillath
Active Contributor
0 Kudos

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.

raymond_giuseppi
Active Contributor
0 Kudos

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

kesavadas_thekkillath
Active Contributor
0 Kudos

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.

0 Kudos

also pass ur material no's in first query

0 Kudos

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.