‎2005 Sep 15 5:39 PM
Hi all,
can anyone please tell what this does......
SELECT AUFNR CHARG FROM AFPO
INTO TABLE I_AFPO
FOR ALL ENTRIES IN I_DATA_TEMP
WHERE AUFNR = I_DATA_TEMP-AUFNR.
AFPO is a table and has a primary key of AUFNR(order number) and POSNR(order item). My question is how is it retrieving unique records from AFPO when I am supplying only Order number in AUFNR = I_DATA_TEMP-AUFNR
I_DATA_TEMP is an internal table and has Order numbers and some other fields.
thanks,
Sabrina.
‎2005 Sep 15 5:44 PM
Hi Sabrina,
The reason why you are seeing only unique values is that the option 'INTO TABLE' works that way. It eliminates any duplicates by default. If you want all the records, including duplicates, then you need to add POSNR to the internal table I_AFPO.
Regards,
Srinivas
‎2005 Sep 15 5:44 PM
Hi Sabrina,
The reason why you are seeing only unique values is that the option 'INTO TABLE' works that way. It eliminates any duplicates by default. If you want all the records, including duplicates, then you need to add POSNR to the internal table I_AFPO.
Regards,
Srinivas
‎2005 Sep 15 5:44 PM
Hi the select will get all entries of AUFNE for rows in I_DATA_TEMP .
It will be similar to ( just for understanding )
SELECT AUFNR CHARG FROM AFPO
INTO TABLE I_AFPO
WHEREAUFNR = I_DATA_TEMP(1)-AUFNR
or AUFNR = I_DATA_TEMP(2)-AUFNR.
or AUFNR = I_DATA_TEMP(3)-AUFNR
....
....
Upto no of rows in I_DATA_TEMP.
Cheers
‎2005 Sep 15 5:45 PM
‎2005 Sep 15 5:50 PM
Rich, thanks for getting back to me.
I did check in AFPO table, the process orders are unique and all the order items have a value of one.
‎2005 Sep 15 5:57 PM
Hi SAbrina
Have you tried to use the statament
SELECT DISTINCT * FROM <TABLE>....?
This is a piece of SAP help:
DISTINCT
Duplicate entries in the result set are automatically deleted.
So:
SELECT DISTINCT AUFNR CHARG FROM AFPO into table I_AFPO.
Max
Message was edited by: max bianchi
‎2005 Sep 16 3:47 AM
For all entries returns only the unique records use in select statement..
eg
SELECT AUFNR CHARG FROM AFPO
INTO TABLE I_AFPO
FOR ALL ENTRIES IN I_DATA_TEMP
WHERE AUFNR = I_DATA_TEMP-AUFNR.
this will give the unique records of AUFNR CHARG ..
since AUFNR and posnr are keys & u hv used only AUFNR in select stmt u will only unique records of AUFNR.
If u want to get unique records from table better u specify all the keys in select stmt whether u use or not.
SELECT AUFNR POSNR CHARG FROM AFPO
INTO CORRESPONDING FIELDS OF TABLE I_AFPO
FOR ALL ENTRIES IN I_DATA_TEMP
WHERE AUFNR = I_DATA_TEMP-AUFNR.
now this will give unique records of AUFNR POSNR .
regards
venkat