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 problem....

aris_hidalgo
Contributor
0 Kudos

Hello experts,

I am having a problem with my function module below. What I want to do is to convert the werks found in my itab to their respective bukrs and put it in a range so I may later use them in my select statement. My code below does not run I dont know why. Help would be greatly appreciated. Thanks a lot and have a nice day!

LOOP AT it_equz.

CALL FUNCTION 'CF_TA_T001W_READ'

EXPORTING

t001w_exp = gv_bukrs

IMPORTING

werks_imp = it_equz-iwerk

EXCEPTIONS

not_found_werks = 1.

r_iwerk-sign = 'I'.

r_iwerk-option = 'EQ'.

r_iwerk-low = gv_bukrs.

APPEND r_iwerk.

CLEAR r_iwerk.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi viraylab,

r u trying to export gv_bukrs and get the plant value? looks like what you need and what you are trying is totally different.

Why dont you use normal select statements to achieve the same. I think there is a table which holds the relation between werks and bukrs.

I think in your code you are passing bukrs value to get plant value?

Regards

VJ

3 REPLIES 3

Former Member
0 Kudos

hi viraylab,

r u trying to export gv_bukrs and get the plant value? looks like what you need and what you are trying is totally different.

Why dont you use normal select statements to achieve the same. I think there is a table which holds the relation between werks and bukrs.

I think in your code you are passing bukrs value to get plant value?

Regards

VJ

0 Kudos

Hi Vijayendra,

I solved my prblem. I instead used FM HRCA_PLANT_GET_COMPANYCODE and it worked fine. However, is there a way to just select all the distinct records in a particular field in an itab since I do not need duplicates.

0 Kudos

Hi Viraylab,

You can select distinct fields from the database directly. I would prefer using delete adjacent duplicates after sorting the table. This makes it even faster.

Again it depends on which table you are using to select data from.

Cheers

VJ