Show unique values/records from a single table

pts.
Tags:
SAP ABAP
LS, In the most simple case: I've got a transparent table (ZCUST) containing Handling Unit-barcodenumbers (field: BCODEL) with related deliverynumber (field: VBELN). Since a delivery can contain multiple HU's, the deliverynumber appears the number of times it has HU's. I now would like to see only the number of times a unique deliverynumber is listed. This is realy simple using MS Access or MS Excel but can someone please help me with the correct ABAP statement to do this? Thanks in advance, Eric

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not sure I totally understand your question, but to get the number of unique deliveries you would use something like:

SELECT COUNT ( DISTINCT vbeln )
FROM ZCUST
INTO v_counter

to get the number of records with a specified delivery number you could use something like:

SELECT COUNT ( DISTINCT BCODEL )
FROM ZCUST
INTO v_counter
WHERE vbeln EQ p_vbeln

Hopefully one of these is what you are looking for. If not they should at least get you pointed in the right direction.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Raveric
    ABAP101, Thank you for your help! You were spot-on with your code. Kind regards, Eric
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following