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

Function module problem....

aris_hidalgo
Contributor
0 Likes
571

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
Read only

Former Member
0 Likes
539

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
Read only

Former Member
0 Likes
540

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

Read only

0 Likes
539

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.

Read only

0 Likes
539

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