Dynamisches Selektionsbild

Beschreibung

In diesem Beispielprogramm wird ein Selektionsbild zur Tabelle VBAK erzeugt und als Popup angezeigt. Der Benutzer kann nach belieben andere Felder ein- oder ausblenden. Aus den Selektionsoptionen zu den Feldern wird eine WHERE-Klausel für den Select-Befehl erzeugt, so dass die Daten einfach gelesen werden können.

Quelle: http://tricktresor.de/content/index.php?navID=25&aID=402


Werte übergeben

Soll mehr als ein Wert übergeben werden, so muss die LT_EXPRESSIONS-Tabelle so aufgebaut werden, dass in der ersten Zeile steht

LOGOP = ‘AND’.

ARITY = Anzahl der zu übergebenden Felder

Danach kommen dann die Feldwerte, die vorgeblendet werden sollen.

LOGOP ARITY FIELDNAME OPTION LOW HIGH

AND 3

VBELN BT 1000 2000

ERDAT EQ 20070401

ERNAM EQ XK0945

Dynamisches Selektionsbild mit Einblendung der Felder

Coding

REPORT ZZ_DYNSEL.

*** Type-Pool für “Freie Abgrenzungen”

TYPE-POOLS rsds.

DATA:

*** Datentabelle

lt_vbak TYPE STANDARD TABLE OF vbak,

*** Datenstruktur

ls_vbak TYPE vbak,

*** Selection-ID zur Unterscheidung mehrerer Sets

lv_selection_id LIKE rsdynsel-selid,

*** Anzahl der Felder

lv_number_of_fields TYPE i,

*** Tabellenname

lv_tablename TYPE tablename,

*** Init: Tabellen

lt_tables TYPE STANDARD TABLE OF rsdstabs,

*** Init: Felder

ls_fields TYPE rsdsfields,

lt_fields TYPE STANDARD TABLE OF rsdsfields,

*** Daten für Where-Tabelle

lt_where_clauses TYPE rsds_twhere,

ls_where_clause TYPE rsds_where,

*** Expressions

lt_expressions TYPE rsds_texpr,

ls_expression TYPE rsds_expr,

lt_expr TYPE rsds_expr_tab,

ls_expr TYPE rsdsexpr,

*** Ranges

lt_field_ranges TYPE rsds_trange,

ls_field_ranges TYPE rsds_range,

ls_field_ranges TYPE rsds_range,

lt_range TYPE rsds_frange_t,

ls_range TYPE rsds_frange,

lt_selopt TYPE rsds_selopt_t,

ls_selopt LIKE rsdsselopt.

PARAMETERS:

*** Anzeige der Feldauswahl im Tree?

p_tree AS CHECKBOX DEFAULT ‘X’,

*** Vorgabe eines Selektionswertes?

p_vorg AS CHECKBOX DEFAULT ‘X’.

START-OF-SELECTION.

*** Tabellenname vorgeben

lv_tablename = ‘VBAK’.

*** Tabelle im Dialog bekannt machen:

APPEND lv_tablename TO lt_tables.

*** einzublendende Felder übergeben

ls_fields-tablename = lv_tablename.

*** …Dazu nehmen wir die ersten Felder der Tabelle

SELECT fieldname FROM dd03l INTO ls_fields-fieldname

WHERE tabname = lv_tablename

AND as4local = ‘A’

AND as4vers = 0

AND position < 15

AND datatype <> ‘CLNT’.

APPEND ls_fields TO lt_fields.

ENDSELECT.

IF p_vorg <> space.

*** Name des Erfassers mit SY-UNAME vorbelegen

ls_expr-fieldname = ‘ERNAM’.

ls_expr-option = ‘EQ’.

ls_expr-low = sy-uname.

APPEND ls_expr TO lt_expr.

ls_expression-tablename = lv_tablename.

ls_expression-expr_tab = lt_expr.

APPEND ls_expression TO lt_expressions.

ENDIF.

*** “Freie Abgrenzungen” initialisieren

CALL FUNCTION ‘FREE_SELECTIONS_INIT’

EXPORTING

kind = ‘T’

expressions = lt_expressions

IMPORTING

selection_id = lv_selection_id

field_ranges = lt_field_ranges

TABLES

tables_tab = lt_tables

fields_tab = lt_fields

EXCEPTIONS

OTHERS = 20.

IF sy-subrc <> 0.

WRITE: / sy-subrc.

ELSE.

*** Dialog mit “freien Abgrenzungen” aufrufen

CALL FUNCTION ‘FREE_SELECTIONS_DIALOG’

EXPORTING

selection_id = lv_selection_id

title = ‘Tricktresor’

frame_text = ‘Bitte Selektion eingeben’

as_window = ‘X’

start_row = 3

start_col = 3

tree_visible = p_tree

no_frame = ‘X’

IMPORTING

where_clauses = lt_where_clauses

expressions = lt_expressions

field_ranges = lt_field_ranges

number_of_active_fields = lv_number_of_fields

TABLES

fields_tab = lt_fields

EXCEPTIONS

internal_error = 1

no_action = 2

selid_not_found = 3

illegal_status = 4

OTHERS = 5.

IF sy-subrc > 0.

IF sy-subrc = 2.

*** Meldung “Auswahl wurde abgebrochen”

MESSAGE s000(oo) WITH ‘Auswahl wurde abgebrochen’.

ELSE.

*** Meldung “Fehler bei Funktionsbausteinaufruf”

MESSAGE i000(oo) DISPLAY LIKE ‘E’

WITH ‘Fehler bei FREE_SELECTIONS_DIALOG’ sy-subrc.

ENDIF.

ELSE.

*** vom Baustein generierte WHERE-Klausel zur Selektion lesen

READ TABLE lt_where_clauses INTO ls_where_clause

WITH KEY tablename = lv_tablename.

*** Selektion durchführen

SELECT * FROM (lv_tablename) INTO TABLE lt_vbak

WHERE (ls_where_clause-where_tab).

IF sy-subrc > 0.

MESSAGE s000(oo) WITH ‘Keine Daten zur Selektion

vorhanden’.

ELSE.

*** …und ausgeben

LOOP AT lt_vbak INTO ls_vbak.

WRITE: / ls_vbak-vbeln.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

20 Kommentare zu “Dynamisches Selektionsbild”

  1. men shoe lifts
    Juli 26th, 2013 04:28
    1

    I guess this is a sincere major article berth.Thanks Again. Real Major.

  2. Johng323
    Juni 24th, 2014 20:52
    2

    Hi my friend! I want to say that this post is amazing, great written and include almost all significant infos. I’d like to see more posts like this. fgkbekgedaec

  3. you can look here
    September 19th, 2014 07:47
    3

    I just want to mention I am just newbie to weblog and definitely liked you’re blog site. Almost certainly I’m going to bookmark your blog . You certainly have wonderful posts. Kudos for revealing your web page.

  4. Stormy
    November 1st, 2014 11:29
    4

    Simply aspiration to say your article is as amazing. The clarity in your post is merely abundant and i can affect you’re an skilled by this subject. Warm with your permission allow me to grab your nourish to keep in the lead to date with helpful place of duty. Thankfulness a million and satisfy keep in the lead the heartwarming work.

  5. Herbert Sary
    November 13th, 2014 05:11
    5

    Hi there, I enjoy reading through your article post. I like to write a little comment to support you.|

  6. bell mobility
    November 15th, 2014 00:43
    6

    Its like you read my thoughts! You appear to grasp so much about this, such as you wrote the ebook in it or something. I think that you just could do with some percent to pressure the message house a bit, but other than that, that is wonderful blog. An excellent read. I will certainly be back.|

  7. Ming Mcgowin
    Dezember 17th, 2014 05:07
    7

    Interesting blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog stand out. Please let me know where you got your design. Appreciate it|

  8. new music video
    Dezember 25th, 2014 02:40
    8

    Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is excellent, as well as the content!|

  9. classified advertising service
    Januar 20th, 2015 18:52
    9

    I do like the manner in which you have presented this specific issue plus it does offer me personally a lot of fodder for thought. Nonetheless, through what precisely I have witnessed, I really wish as the actual reviews stack on that people today stay on point and don’t get started upon a soap box regarding some other news of the day. Yet, thank you for this superb piece and even though I can not necessarily concur with this in totality, I respect the standpoint.

  10. pożyczka przez internet
    Januar 20th, 2015 20:04
    10

    It’s hard to find knowledgeable people on this topic, but you sound like you know what you’re talking about! Thanks

  11. Appliance Repair Gilbert
    Januar 29th, 2015 17:47
    11

    This website was… how do you say it? Relevant!! Finally I have found something which helped me. Thank you!

  12. Read More
    Februar 13th, 2015 04:19
    12

    Throughout the great pattern of things you’ll get a B- just for effort. Where you actually misplaced me personally was in the particulars. As as the maxim goes, the devil is in the details… And it couldn’t be much more accurate at this point. Having said that, permit me say to you exactly what did give good results. Your article (parts of it) can be very convincing which is probably the reason why I am taking an effort to comment. I do not make it a regular habit of doing that. Next, despite the fact that I can certainly see the leaps in logic you come up with, I am not necessarily sure of exactly how you appear to connect the details which help to make your final result. For now I will yield to your point but hope in the foreseeable future you connect your dots better.

  13. New Rap Songs
    März 2nd, 2015 23:47
    13

    A lot of what you point out is supprisingly appropriate and that makes me wonder the reason why I hadn’t looked at this with this light before. Your piece really did turn the light on for me personally as far as this particular issue goes. Nonetheless there is actually just one point I am not really too comfy with so whilst I attempt to reconcile that with the central idea of the position, allow me observe exactly what all the rest of your visitors have to point out.Very well done.

  14. important site
    Januar 26th, 2016 01:59
    14

    I just want to tell you that I am just beginner to blogs and seriously savored your blog site. More than likely I’m want to bookmark your website . You actually come with good well written articles. Appreciate it for revealing your website.

  15. 자동차보험료비교견적사이트
    März 16th, 2019 05:40
    15

    Wonderful items from you, man. I have bear in mind your stuff previous to and you are simply extremely magnificent.
    I really like what you’ve obtained here, really like what you are saying and the way in which
    during which you are saying it. You’re making it
    entertaining and you still take care of to stay it smart.

    I can not wait to learn far more from you. This is really a wonderful web site.

    My weblog 자동차보험료비교견적사이트 http://www.javaexpert.co.kr/

  16. Aairbnb management UK
    März 21st, 2019 19:02
    16

    Hey there would you mind letting me know which hosting company you’re working with?
    I’ve loaded your blog in 3 completely different web browsers and I must
    say thks blog loads a lot quicker then most. Can you recommend a good hosting provider at a reasonable price?
    Kudos, I appreciate it!

    My web site … Aairbnb management UK

  17. https://www.linkedin.com/pulse/5-loai-thuoc-chua-xuat-tinh-som-hieu-qua-bac-sy-vu-dinh-cau/
    März 27th, 2019 01:25
    17

    Thank you for sharing your info. I really appreciate your efforts and I
    am waiting for your next post thank you once again.

  18. 실비보험
    April 17th, 2019 01:22
    18

    Hey there! Do you use Twitter? I’d like to follow
    you if that would be okay. I’m undoubtedly enjoying your
    blog and look forward to new updates.

    Here is my website; 실비보험 http://www.xn--o39a72xnoa77f81b7wmdvinwnh2q.kr/

  19. free movies
    Mai 13th, 2019 21:02
    19

    Hello mates, nice article and fastidious urging commented here,
    I am in fact enjoying by these.

  20. Video Game Strategies
    Juni 4th, 2019 22:46
    20

    It’s the best time to make a few plans for the future and it is time to
    be happy. I have learn this post and if I may I want to
    counsel you few interesting things or tips. Maybe you can write subsequent articles regarding this article.
    I want to read even more issues about it! Rocket League

Kommentar abgeben: