Skip to Content
0
Former Member
Jan 24, 2013 at 12:14 PM

Empty value in output

29 Views

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 : BEGIN OF TY_CUST,

VKORG TYPE VKORG,

VTWEG TYPE VTWEG,

SPART TYPE SPART,

KTOKD TYPE KTOKD,

KUNNR TYPE KUNNR,

END OF TY_CUST,



BEGIN OF TY_RESULT,

VKORG TYPE VKORG,

VTWEG TYPE VTWEG,

SPART TYPE SPART,

KUNNR TYPE KUNNR,

HKUNNR TYPE HKUNNR_KH,

DATAB TYPE DATAB,

DATBI TYPE DATBI,

END OF TY_RESULT.





DATA : IT_JOIN TYPE TABLE OF TY_CUST,

IT_RESULT TYPE TABLE OF 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 FIELDS OF TABLE 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 FIELDS OF TABLE RESULt[]

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