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