Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Lookup from table, which has 1:N relation with Data package

Hi,

I have to look up for Sales Office, Sales district from 0Cust_Sales Masterdata, while loading data to 0FIAR_C03 (from 0FI_AR_4).

0FI_AR_4 has fields -

0Customer

10000

While 0CUST_SALES has

Customer Division DistrCh. SalesOff SalesDistr

10000 10 20 1000 120

10000 20 20 1500 121

Whenever I am looking up for Sales Office, Sales Distr, Division,Distr chn. It is loading ONLY FIRST RECORD.

I want to load both the records. I have written following code-

************************************************************************

SELECT DIVISION

DISTR_CHAN

SALESORG

CUST_SALES

OBJVERS

SALES_DIST

SALES_OFF

INTO TABLE GT_REC_SET

FROM /BI0/MCUST_SALES

FOR ALL ENTRIES IN DATA_PACKAGE

WHERE CUST_SALES = DATA_PACKAGE-DEBITOR AND

OBJVERS = 'A'.

IF SY-SUBRC = 0.

SORT GT_REC_SET BY CUST_SALES.

ENDIF.

************************************************************************************

READ TABLE GT_REC_SET

WITH KEY CUST_SALES = COMM_STRUCTURE-DEBITOR

INTO GW_REC_SET

BINARY SEARCH.

IF SY-SUBRC = 0.

  • result value of the routine

RESULT = GW_REC_SET-DISTR_CHAN.

ENDIF.

Any solution will be a great help....

Former Member
Not what you were looking for? View more on this topic or Ask a question