2007 Sep 05 11:11 AM
Hi
this is my code in which vkorg is compulsory.
DATA: ITAB_VBAK TYPE TABLE OF VBAK,
WA_VBAK TYPE VBAK.
DATA: ITAB_VBAP TYPE TABLE OF VBAP,
WA_VBAP TYPE VBAP.
DATA: P_VKORG TYPE VBAK-VKORG,
P_KUNNR TYPE VBAK-KUNNR,
P_VBELN TYPE VBAK-VBELN,
P_MATNR TYPE VBAP-MATNR,
P_AUDAT TYPE VBAK-AUDAT,
P_VDATU TYPE VBAK-VDATU,
P_ERNAM TYPE VBAK-ERNAM,
P_VKAUS TYPE VBAP-VKAUS.
SELECT-OPTIONS: s_VKORG FOR P_VKORG OBLIGATORY, " Sales Organization
s_KUNNR FOR P_KUNNR, " Sold-to party.
s_VBELN FOR P_VBELN, " Sales Document.
s_MATNR FOR P_MATNR, " Material number.
s_AUDAT FOR P_AUDAT, " Document Date (Date Received/Sent).
s_VDATU FOR P_VDATU, " Requested delivery date.
s_ERNAM FOR P_ERNAM, " Name of Person who Created the Object.
s_VKAUS FOR P_VKAUS. " Usage indicator.
wa_vbak_key-vbeln = s_vbeln-low.
append wa_vbak_key to it_vbak_key.
CALL FUNCTION 'SD_VBAK_ARRAY_READ'
EXPORTING
I_BYPASSING_BUFFER = ' '
I_REFRESH_BUFFER =
TABLES
IT_VBAK_KEY = IT_VBAK_KEY
ET_VBAK = ITAB_VBAK
EXCEPTIONS
RECORDS_NOT_FOUND = 1
RECORDS_NOT_REQUESTED = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
The records are coming in the internal table itab_vbak.
But i want to filter the values coming in the internal table by the value whatever the user enters in select option.
The first field ie. VKORG is manadatory and rest is optional.
Please help me out to filter the table.
2007 Sep 05 11:24 AM
hi Darshana,
You can not directly vaidated records for all those fields which are not mendetory.
So after getting values in internal table check each record for given selection screen value if not match for any of selection screen value then delete that record fron internal table.
Reward if useful..
2007 Sep 05 12:08 PM
When u r putting data use where conditon in s_vkorg. it will filter the data.