Application Development 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: 

how to filter the data

Former Member
0 Kudos

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.

2 REPLIES 2

Former Member
0 Kudos

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

Former Member
0 Kudos

When u r putting data use where conditon in s_vkorg. it will filter the data.