![]() ITAB members are the following department officials: But that would mean adding unnecessary complexity to the class.The Under Secretary of Defense (AT&L) or designee chairs the ITAB. Note: You could argue that, if the implementation is changed, I could still find a way to keep that public read-only internal table in sync with the actual list of vendors. That’s why I was curious to know if ABAP is planning to support these in the future. To cope with these scenarios most programming languages today directly support iteration of custom classes. Still, having to use a GET_LIST() is not the most elegant approach. So I guess we can argue that using a PRIVATE internal table together with a GET_LIST() preserves encapsulation. With this approach at least, unlike the public read-only, I still have the chance to adapt the GET_LIST() method If I ever change the internal implementation of the list. In order to avoid this I am declaring the internal table as private and implementing a public method called GET_LIST() which returns a list of references to CL_VENDOR. So, as I see it, exposing my data as a public read-only internal table is not a solution because it exposes and locks down the way the list is implemented. Or I may need to change the Internal table’s structure by replacing the simple list of references to CL_VENDOR with a more elaborate line including an indexed ID together with the reference, for performance reasons. But tomorrow I may need to implement it in a completely different way (a collection, Object Services, lazy instancing, etc.). Today I’m using an internal table to implement the list of vendors. ( CORRESPONDING sflight( ls_sflight MAPPING price = price * 2 paymentsum = paymentsum + 30 ) ) ). L_str_sflight2-seatsocc = -seatsocc + 30 INĭATA(gt_sflight_new) = VALUE gty_sflight( LET lt_sflight = gt_sflight IN "Syntax error when adding "* 2" or "+ 30"ĭATA(gt_sflight_for2) = VALUE gty_sflight( I had two other ideas, but they result in syntax errors as soon I try to change the two fields: "Here I laboriously must enumerate the remaining 12 unchanged fields Is there any chance to default them?ĭATA(gt_sflight_for) = VALUE gty_sflight( LET lt_sflight = gt_sflight IN ENDLOOP, but then I tediously have to enumerate all the unchanged fields in the expression. ![]() I tried to have this with table comprehensions instead of LOOP. LOOP AT gt_sflight ASSIGNING FIELD-SYMBOL(). SELECT * FROM sflight INTO TABLE gt_sflight WHERE carrid = 'LH' AND connid = '400'. TYPES: gty_sflight TYPE SORTED TABLE OF sflight WITH UNIQUE KEY carrid connid fldate. Is there any chance to include the unchanged fields in an easy way in table comprehensions? I often have to update just a few fields in a broad internal table with many columns, the most of them remain unchanged. I reduced the values of an iteration into the output list of a display object, oh my … REDUCE outref( INIT out = cl_demo_output=>new( ) To conclude I show a cunning little thing that I use in some of my documentation examples: I only say nested REDUCE and VALUE operators … Now imagine, what you can do by mixing REDUCE with all the other expression enabled capabilities. These simple examples show the principle. with UNTIL or WHILE for conditional iterations.ĭATA itab TYPE STANDARD TABLE OF i WITH EMPTY KEY. ![]() You can use all kinds of FOR expressions in REDUCE: While VALUE and NEW expressions can include FOR expressions, REDUCE must include at least one FOR expression. ![]() And that’s where the new constructor operator REDUCE comes in. Now that we have all kinds of iterations available with FOR, we want to construct arbitrary types. ( col1 = j col2 = j + 1 col3 = j + 2 ) ).īut we don’t want to construct internal tables only. You can use it in constructor expressions with VALUE and NEW for so called table comprehensions, as e.g.ĭATA(itab2) = VALUE t_itab2( FOR wa IN itab1 WHERE ( col1 40 With 7.40, SP05 the first version of the iteration operator FOR was introduced.
0 Comments
Leave a Reply. |