Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Defaulting a value of a column while using CORRESPONDING#

$
0
0

Hi Experts,

 

    I am new to the new ABAP syntax and need to perform the following operation.

 

    Requirement  : it_item and et_item are tables which a slightly different.

                            a) it_item has ( key ....other fields )

                            b) et_item has ( mandt, db_key ... other fields)

 

                            I need to move contents from it_item to et_item while mapping the key from it_item into db_key of et_item.

                            At the same time, I need to fill the mandt field with a fixed value.

 

    Old syntax :

 

      In terms of performance this is slower than the new syntax.

 

      LOOP AT it_item ASSIGNING <ls_item>.


         APPEND INITIAL LINE TO et_item ASSIGNING <ls_item_db>.

         MOVE-CORRESPONDING <ls_item> TO <ls_item_db>.

         <ls_item_db>-db_key = <ls_item>-key.

         <ls_item_db>-mandt is_client-mandt.


       ENDLOOP.


  I replaced the old syntax with the new ABAP constructs.

 

    New syntax:


            et_item = CORRESPONDING #( it_chrg_item MAPPING db_key = key ).

            This works fine to map all fields except it cannot fill the mandt field.


            Is it possible to fill et_item with the mandt field simultaneously while using the new syntax ? 

         

            OR


           Is it possible to fill all contents of et_item with mandt with the new ABAP constructs , I do not want to loop over all et_item contents ?

  





  


Viewing all articles
Browse latest Browse all 3523

Trending Articles



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