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

passing parameter in function module

Former Member
0 Likes
816

hi friends,

I have created one function module in which i need to pass PO/SO number from standard EKKO/VBAK tables through the select option parameter S_POSONO. Inside the function module I have a select query which fetches the records from a Z-table which has a field called 'REFERENCE' which is 16-char long. Hence the length mismatches with PO/SO no which is 10-char long. the first 10-char from 'REFERENCE' is PO/SO number, next 3-char is line-item num, and the last three char is schedule item num. It is required to match only first 10-char with the parameter passed i.e, S_POSONO and display only those datas.

The function module is as follows.....

Function :

CALL FUNCTION 'YFIIN_RETRIEVE_SOURCE_DATA'

EXPORTING

LT_RANGE_BUKRS = S_BUKRS[]

LT_RANGE_DOCNO = S_POSONO[]

LT_RANGE_DOCDATE = S_DATUM[]

LT_RANGE_CURRENCY = S_FCURR[]

TABLES

IT_TEMEXPOSU = LT_TEMEXPOSU

EXCEPTIONS

INVALID_SELECTION = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Source code inside function module:

SELECT * FROM ZFIGL_TEMEXPOSU INTO TABLE IT_TEMEXPOSU

WHERE COMPANY_CODE IN LT_RANGE_BUKRS

AND currency in LT_RANGE_CURRENCY

and REFERENCE in LT_RANGE_DOCNO

and doc_date in LT_RANGE_docdate.

IF SY-SUBRC = 0.

SELECT COMPANY_CODE ATTRIBUTE_01 REFERENCE CREATION_DATE FOREIGN_CURR

FROM TEMT_RAWEXPOS APPENDING CORRESPONDING FIELDS OF

TABLE IT_TEMEXPOSU WHERE COMPANY_CODE IN LT_RANGE_BUKRS

AND REFERENCE in LT_RANGE_DOCNO

AND CREATION_DATE IN LT_RANGE_DOCDATE

AND FOREIGN_CURR IN LT_RANGE_CURRENCY.

ENDIF.

Import Parameter of Function Modules :

LT_RANGE_BUKRS - type - BUKRS

LT_RANGE_DOCNO - type - EBELN

LT_RANGE_DOCDATE - type - DOKDATS

LT_RANGE_CURRENCY - type - WAERS

please help me to solve this problem..

6 REPLIES 6
Read only

Former Member
0 Likes
748

using split command divide the reference variable

Read only

Former Member
0 Likes
748

Hi Ram,

Yes the reply from p498863 solves ur prob if u use split condition.

Regards,

Chandru

Read only

Former Member
0 Likes
748

Hi,

In the source code of the function module, you just need to prepare one range for PO/SO number which is coming from first 10 characters of S_POSONO. Then after you need to fetch the data and display it.

Cheers,

Bujji

Read only

0 Likes
748

hi Bujji,

S_POSONO is 10 char only. But 'REFERENCE' which is from the z.table is 16 char .In the select statement how can I take first 10 char of 'REFERENCE' .

Read only

Former Member
0 Likes
748

Hi Ram Tej,

Try this.

First Read all the records without Checking REFERENCE field with LT_RANGE_DOCNO into an internal Tbale.

Then looping at that internal table delete records from the same internal table where REFERENCE(10) <> LT_RANGE_DOCNO.

Hope this may help ur requirement.

Award points if useful.

Read only

Former Member
0 Likes
748

HI Ram,

You can fill your range table like below.....

SIGN = 'I'.

OPTION = 'EQ'.

LOW = PO/SO followed with a character ('XXXXXXXXXX*')

I am not sure but you can try with this. I hope this will works fine.

Cheers,

Bujji