Selection Screens Übung

Getting started ... Alles für einen gelungenen Start.

Selection Screens Übung

Postby Andre81 » Sat Mar 15, 2014 1:23 pm

Hallo zusammen,

ich bin neu in Forum und versuche mich gerade an einem Programm, das auf dem FLugdaten-Beispiel der SAP aufbaut. Ich möchte alle alle Kunden nach Gesamtumsatz absteigend sortiert ausgeben, wobei die Anzeige durch Select Options eingeschränkt werden kann. Zusätzlich soll es möglich sein, sich zu jedem Kunden, per Doppelklick, die dazugehörigen Einzelbuchungen anzeigen zu lassen. Mein Problem ist, dass mir keine Einzelbuchungen zu den jeweiligen Kunden angezeigt werden, ich weiss aber nicht wo der Fehler im 2ten Select liegt.


Ich verwende folgende View ZZ_1030_KVIEW:
Viewfeld | Tabelle | Feld | Beschreibung
Umsatz | SBOOK | FORCURAM | Preis der Buchung
Name | SCUSTOM | NAME
City | SCUSTOM| CITY
COUNTRY | SCUSTOM | COUNTRY
CUSTOMID| SBOOK | CUSTOMID
CUSTTYPE | SCUSTOM | CUSTTYPE| Privat/Business
CURRENCY | SBOOK | FORKURKEY | Zahlungswährung
class | SBOOK | class| Flugklasse


Mein Code schaut bis jetzt folgendermaßen aus:

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. REPORT  ZZ_1030_KUNDENANALYSE MESSAGE-ID ZZ_1030_MsgAnalyse.
  2. TABLES: ZZ_1030_KVIEW,sscrfields.
  3. Data: wa_analyse type ZZ_1030_KVIEW,
  4.       itab_analyse type TABLE OF ZZ_1030_KVIEW,
  5.       typeKunde type c LENGTH 1,
  6.       wa_sbook type sbook.
  7.  
  8.  
  9. SELECTION-SCREEN COMMENT /1(60) heading.
  10. SELECT-OPTIONS so_land FOR wa_analyse-country.
  11. SELECTION-SCREEN COMMENT /1(30) headerCb.
  12.  
  13.  
  14.  
  15.   PARAMETERS  p_bKunde as CHECKBOX DEFAULT 'X' USER-COMMAND business.
  16.   PARAMETERS p_pKunde AS CHECKBOX USER-COMMAND private.
  17.  
  18.  
  19.  
  20. SELECT-OPTIONS so_class FOR wa_analyse-class OBLIGATORY.
  21. SELECT-OPTIONS so_cur FOR wa_analyse-currency OBLIGATORY.
  22. SELECTION-SCREEN PUSHBUTTON 1(30) delete USER-COMMAND delete.
  23.  
  24.  
  25.  
  26.  
  27. heading = 'Kundenauswertung nach Umsätzen'.
  28. delete = 'Eingaben löschen'.
  29. headerCb = 'Business-/Privatkunde'.
  30.  
  31. AT SELECTION-SCREEN.
  32.   if sscrfields-ucomm = 'DELETE'.
  33.     p_bKunde = 'X'.
  34.     p_pKunde = ' '.
  35.     refresh so_cur.
  36.     refresh so_class.
  37.     refresh so_land.
  38.     ELSEIF sscrfields-ucomm = 'PRIVATE'.
  39.       p_bKunde = ' '.
  40.     ELSEIF sscrfields-ucomm = 'BUSINESS'.
  41.       p_pKunde = ' '.
  42.   ENDIF.
  43.  
  44.   if p_bKunde = 'X'.
  45.     typeKunde = 'B'.
  46.     else.
  47.       typeKunde = 'P'.
  48.   ENDIF.
  49.  
  50.   Select sum( umsatz ) as totalSum name city country customid
  51.     from ZZ_1030_KVIEW
  52.     INTO TABLE itab_analyse
  53.     WHERE country in so_land and
  54.           class in so_class and
  55.           currency in so_cur and
  56.           custtype = typeKunde
  57.     GROUP BY name country city customid
  58.     ORDER BY totalSum DESCENDING.
  59.  
  60.     if sy-subrc = 0.
  61.  
  62.      write: / 'Kunden nach Umsatz absteigend sortiert.'.
  63.      ULINE /1(145).
  64.      FORMAT COLOR 1.
  65.      write: /'|Umsatz',25 '|Name', 55 '|Ort', 85 '|Land', 115 '|Kundennr.', 145 '|'.
  66.      FORMAT RESET.
  67.      Loop at itab_analyse into wa_analyse.
  68.        write: /'|',wa_analyse-umsatz, 25 '|',wa_analyse-name, 55 '|',wa_analyse-city, 85 '|', wa_analyse-country,115'|', wa_analyse-customid, 145'|'.
  69.        hide wa_analyse.
  70.        ULINE /1(145).
  71.        ENDLOOP.
  72.        ULINE /1(145).
  73.      else.
  74.        MESSAGE i000.
  75. At LINE-SELECTION.
  76.  IF sy-lsind = 1 AND sy-lilli > 5.
  77.    FORMAT COLOR 1.
  78.     WRITE: / 'Einzelbuchungen zu Kunde ',wa_analyse-name.
  79.     ULINE /1(110).
  80.     WRITE: / '|Buchungsdatum',25 '|Fluggesellschaft',50 '|Flugnummer',75 '|Preis',100 '|Währung',110'|'.
  81.     FORMAT RESET.
  82.     Select * from sbook into wa_sbook
  83.       where sbook~customid = wa_analyse-customid and
  84.       sbook~class = wa_analyse-class and
  85.       sbook~forcurkey = wa_analyse-currency and
  86.       sbook~custtype = wa_analyse-custtype
  87.  
  88.       ORDER BY sbook~order_date DESCENDING.
  89.  
  90.       ULINE /1(110).
  91.       write: /'|', wa_sbook-order_date, 25 '|',wa_sbook-carrid, 50 '|', wa_sbook-connid, 75 '|',wa_sbook-forcuram, 100'|',wa_sbook-forcurkey,110'|'.
  92.       ENDSELECT.
  93.       ULINE /1(110).
  94.  
  95.    ENDIF.
  96.  
GeSHi ©
Andre81
.
.
 
Posts: 1
Joined: Sat Mar 15, 2014 1:23 pm

Return to ABAP® für Anfänger

Who is online

Users browsing this forum: No registered users and 2 guests