Application Development and Automation 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: 
Read only

Urgent- Need help

Former Member
0 Likes
800

Hi all SAP Gurus,

I have a code in my function module as below:

Like:

ranges: r_alt for mast-stlal,

r_date for stko-datuv,

r_plant for mast-werks,

r_product_code for mara-matnr.

  • Alt , Product_code , date and plant are the import parameters

if not alt is initial.

r_alt-sign = 'I'.

r_alt-option = 'EQ'.

r_alt-low = alt.

append r_alt.

endif.

if not date is initial.

r_date-sign = 'I'.

r_date-option = 'EQ'.

r_date-low = date.

append r_date.

endif.

if not plant is initial.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

r_plant-low = plant.

append r_plant.

endif.

IF NOT product_code IS INITIAL.

r_product_code-sign = 'I'.

r_product_code-option = 'EQ'.

r_product_code-low = product_code.

APPEND r_product_code .

ENDIF.

SELECT a~matnr

INTO TABLE t_mast

FROM mast AS a

INNER JOIN stko AS k

ON astlnr EQ kstlnr

AND astlal EQ kstlal

WHERE a~werks in r_plant

AND a~stlal in r_alt

AND k~datuv in r_date

AND a~matnr in r_product_code .

If I give the product code input as a wild search, I am not getting the data..For example if I want all the data for which the product code starts with C ( Say C*) ,

the program is not working.Please tell me how to get the data for wild searches .

Vishnu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
777

If the value is 'C*', then you also have to change r_product_code-option to 'CP'.

Rob

Hi all SAP Gurus,

I have a code in my function module as below:

Like:

ranges: r_alt for mast-stlal,

r_date for stko-datuv,

r_plant for mast-werks,

r_product_code for mara-matnr.

  • Alt , Product_code , date and plant are the import parameters

if not alt is initial.

r_alt-sign = 'I'.

r_alt-option = 'EQ'.

r_alt-low = alt.

append r_alt.

endif.

if not date is initial.

r_date-sign = 'I'.

r_date-option = 'EQ'.

r_date-low = date.

append r_date.

endif.

if not plant is initial.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

r_plant-low = plant.

append r_plant.

endif.

IF NOT product_code IS INITIAL.

r_product_code-sign = 'I'.

r_product_code-option = 'EQ'.

r_product_code-low = product_code.

APPEND r_product_code .

ENDIF.

SELECT a~matnr

INTO TABLE t_mast

FROM mast AS a

INNER JOIN stko AS k

ON astlnr EQ kstlnr

AND astlal EQ kstlal

WHERE a~werks in r_plant

AND a~stlal in r_alt

AND k~datuv in r_date

AND a~matnr in r_product_code .

If I give the product code input as a wild search, I am not getting the data..For example if I want all the data for which the product code starts with C ( Say C*) ,

the program is not working.Please tell me how to get the data for wild searches .

Vishnu.

5 REPLIES 5
Read only

Former Member
0 Likes
778

If the value is 'C*', then you also have to change r_product_code-option to 'CP'.

Rob

Read only

0 Likes
777

Thanks a lot Rob.It's working.

Read only

0 Likes
777

Glad to help - will you have to deal with ranges and complex patterns as well?

Rob

Read only

0 Likes
777

Yes Rob.I have a requirement where in I have to use a wild search for material.

Read only

Former Member
0 Likes
777

Hi Vishwa,

Use Select-Options for Alt , Product_code and plant and try.

Regards,

Satish