on 10-30-2007 3:01 PM
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....
" Read table with key" will return only first record.
You may have to "loop at ... where" .
And, even if you find two values, how are you going to set it? You have only one field RESULT, so the second will overwrite the first one.
To make one row into two in this case, this logic will have to be applied in the start routine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.