Skip to Content
author's profile photo Former Member
Former Member

4.6: Move-Corresponding vs Untyped Fuba Param

In release 4.6 Move-Corresponding is not able to work with untype argument. If e.g. a structure was passed as argument to a Fuba and the formal parameter is typed with any move-corresponding cant be used.

For such a case one may use the form in the sample below.

Regards

Klaus

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 10, 2004 at 06:34 PM
    REPORT ZMOVESMP .
    
    
     start-of-Selection.
       perform sub_Main.
    
    type-pools:
      Abap.
    
    
    
    *============
    form sub_Main.
    *============
    
    * data decl
      data:
        wa_Source   type Tadir,
        begin of wa_Target,
          Pgmid     type Tadir-Pgmid,
          Obj_Name  type syChar10,
          Author    type syUname,
          GibsNet   type syTitle,
        end of wa_Target.
    
    * fill sample data
      select single * from Tadir into wa_Source
        where
          Pgmid =       'R3TR'  and
          Object =      'PROG'  and
          Obj_Name =     sy-Repid.
    
    
    * do the move
      perform sub_Move_Corresponding
        using    wa_Source
        changing wa_Target.
    
    * sample output
      write: / wa_Target.
    
    endform.
    
    
    *==========================
    form sub_Move_Corresponding
    *==========================
      using
        p_Src      type any
      changing
        p_Dst      type any.
    
    
    * data decl
      data:
        wa_Comp        type abap_compdescr,
        cref_Rtti_Dst  type ref to cl_Abap_StructDescr.
    
      field-symbols:
        <src_Comp>  type any,
        <dst_Comp>  type any.
    
    
    * get rtti handle of target
      cref_Rtti_Dst ?= Cl_Abap_TypeDescr=>Describe_By_Data( p_Dst ).
    
      loop at cref_Rtti_Dst->Components into wa_Comp.
    
        assign component wa_Comp-Name of structure p_Src to <src_Comp>.
        if ( 0 ne sy-SubRc ).
          continue.
        endif.
        assign component wa_Comp-Name of structure p_Dst to <dst_Comp>.
        <dst_Comp> = <src_Comp>.
      endloop.
    
    endform.
    
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.