hii expert,
I wrote one FM for selecting entry from table into internal table.
here is my code
FUNCTION Z_TERRITORY.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(SORG) TYPE VKORG
*" REFERENCE(DCHANNEL) TYPE VTWEG
*" REFERENCE(DIVISION) TYPE SPART
*" REFERENCE(ACCGRP) TYPE KTOKD
*" REFERENCE(VALIDON) TYPE SY-DATUM
*" TABLES
*" CUSTOMER STRUCTURE ZSTRUC
*" RESULT STRUCTURE ZRESULT
TABLES : KNVH.
TYPES : BEGINOF TY_CUST,
VKORG TYPE VKORG,
VTWEG TYPE VTWEG,
SPART TYPE SPART,
KTOKD TYPE KTOKD,
KUNNR TYPE KUNNR,
ENDOF TY_CUST,
BEGINOF TY_RESULT,
VKORG TYPE VKORG,
VTWEG TYPE VTWEG,
SPART TYPE SPART,
KUNNR TYPE KUNNR,
HKUNNR TYPE HKUNNR_KH,
DATAB TYPE DATAB,
DATBI TYPE DATBI,
ENDOF TY_RESULT.
DATA : IT_JOIN TYPETABLEOF TY_CUST,
IT_RESULT TYPETABLEOF TY_RESULT.
DATA : WA_CUST TYPE TY_CUST,
WA_RESULT TYPE TY_RESULT.
SELECT A~VKORG A~VTWEG A~SPART A~KUNNR B~KTOKD
INTO CORRESPONDING FIELDSOFTABLE IT_JOIN
FROM KNVV AS A INNER JOIN KNA1 AS B
ON A~KUNNR = B~KUNNR
WHERE A~VKORG = SORG AND
A~VTWEG = DCHANNEL AND
A~SPART = DIVISION AND
B~KTOKD = ACCGRP AND
A~KUNNR = CUSTOMER-CUSTNO.
SELECT KUNNR HKUNNR VKORG VTWEG SPART DATAB DATBI
FROM KNVH
INTO CORRESPONDING FIELDSOFTABLE RESULt[]
FORALL ENTRIES IN IT_JOIN
WHERE KUNNR = IT_JOIN-KUNNR AND
DATAB < VALIDON AND
DATBI > VALIDON.
in out put table i get number of entry but not data.
i mean out put of 2nd query is 4 row then i get 4 empty row in out put table.