Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2067

Re: Defaulting a value of a column while using CORRESPONDING#

$
0
0

Hi Sheldon.

 

The REDUCE statement would be as follows:


TYPES: BEGIN OF new_mara_y.         INCLUDE TYPE mara.
 TYPES:  other_field TYPE c.
 TYPES: END OF new_mara_y.
 TYPES new_mara_t TYPE STANDARD TABLE OF new_mara_y WITH DEFAULT KEY.
 SELECT * FROM mara INTO TABLE @DATA(mara_t) UP TO 10 ROWS.
 DATA(new_mara) = REDUCE new_mara_t( INIT out = VALUE new_mara_t( )                                       FOR i IN mara_t                                     NEXT out = VALUE #( BASE out ( VALUE new_mara_y( BASE CORRESPONDING new_mara_y( i )                                                                                      mandt = sy-mandt                                                                                      other_field = abap_true ) ) ) ).
 cl_demo_output=>display( new_mara ).

Where "new_mara" is the structure that receives the mounting data from the new_mara_t type and the result of mara_t (Using CORRESPONDING). As my query already had the MANDT, I did not put it there, I put to you see how is the CORRESPONDING + mapping fields.


Warm regards,


Raphael Pacheco.


Viewing all articles
Browse latest Browse all 2067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>