Skip to Content
author's profile photo Former Member
Former Member

passing parameter in function module

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 04:45 AM

    using split command divide the reference variable

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 04:54 AM

    Hi Ram,

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

    Regards,

    Chandru

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 04:54 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 05:10 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 05:10 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.