Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to write using "PERFROM USING" statement

Former Member
0 Likes
1,009

Hi friends,

How to write the below code using "PERFORM" Statment ,

I hope by using Perfrom we can reduce the code, No need to write move statment each time

Kindly let me know how to write using PERFROM

IF wa_attr1-Status <> 'Active'.

move wa_attr1-empid to wa_NonActiveUSers-empid.

MOVE wa_attr1-EmailId to wa_NonActiveUSers-EmailId.

MOVE wa_attr1-Fname to wa_NonActiveUSers-Fname.

MOVE wa_attr1-Lname to wa_NonActiveUSers-Lname.

MOVE wa_attr1-Status to wa_NonActiveUSers-Status.

MOVE wa_attr1-Manager to wa_NonActiveUSers-Manager.

MOVE wa_attr1-Country to wa_NonActiveUSers-Country.

APPEND wa_NonActiveUSers to itab_NonActiveUSers.

ENDIF.

LOOP AT itab_EmpInfo INTO wa_attr1.

write: 'att- ', wa_attr1-EmpId, 'HPBiz - ', wa_attr1-HPBusinessUnit.

uline.

endloop.

Thank you

Regards,

sandy

Edited by: mrSandy1981 on Mar 1, 2010 11:30 AM

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
980

here you can use:

move-corresponding wa_attr1 to wa_NonActiveUSers.

A.

here you can use:

move-corresponding wa_attr1 to wa_NonActiveUSers.

A.

7 REPLIES 7
Read only

andreas_mann3
Active Contributor
0 Likes
981

here you can use:

move-corresponding wa_attr1 to wa_NonActiveUSers.

A.

Read only

Former Member
0 Likes
980

Hi,

how about if you better use

move-corresponding wa_attr1 to wa_NonActiveUSers.

this is faster.

Read only

0 Likes
980

I can't use move-corrosponding since the structure is not same and data type are not same

some people told me use PERFROM using...so pls tel me how to write using PERFORM statment

Read only

0 Likes
980

Try this. If you do not have wa_attr2 - 7 then ignore the PERFORMS for the structures you do not have. There is not much point in using PERFORM if you just wish to use it for wa_attr1 - but it will work.


PERFORM build_nonactiveusers USING wa_attr1.
PERFORM build_nonactiveusers USING wa_attr2.
PERFORM build_nonactiveusers USING wa_attr3.
PERFORM build_nonactiveusers USING wa_attr4.
PERFORM build_nonactiveusers USING wa_attr5.
PERFORM build_nonactiveusers USING wa_attr6.
PERFORM build_nonactiveusers USING wa_attr7.

*&---------------------------------------------------------------------*
*&      Form  build_NonActiveUSers
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_WA_ATTR1  text
*----------------------------------------------------------------------*
FORM build_nonactiveusers USING    p_attr.

  MOVE p_attr-empid TO wa_nonactiveusers-empid.
  MOVE p_attr-emailid TO wa_nonactiveusers-emailid.
  MOVE p_attr-fname TO wa_nonactiveusers-fname.
  MOVE p_attr-lname TO wa_nonactiveusers-lname.
  MOVE p_attr-status TO wa_nonactiveusers-status.
  MOVE p_attr-manager TO wa_nonactiveusers-manager.
  MOVE p_attr-country TO wa_nonactiveusers-country.
  APPEND wa_nonactiveusers TO itab_nonactiveusers.

ENDFORM.                    " build_NonActiveUSers

Read only

0 Likes
980

HI Jorge Alonso and Friends,

Thanks Move-corrosponding works, But shall we need to use APPEND statement after using append,Can anyone let mem know

thanks

sndy

Read only

0 Likes
980

Yes you have to use APPEND after the MOVE-CORRESPONDING statement to make the data reflect in the internal table.

Read only

Former Member
0 Likes
980

Hi Sandy,

why do you say "I can't use move-corrosponding since the structure is not same and data type are not same".

MOVE-CORRESPONDING is well working with different structures and different data types. You need only to have some fields with the same names in both structures.

You can check it with this small program:


DATA: begin of struct1,
      c1(5),
      c2(10),
      c3 type i,
      end of struct1.

      DATA: begin of struct2,
      c2 type i,
      c3(6) type c,
      c4(10),
      end of struct2.

      struct1-c1 = 'TEST'.
      struct1-c2 = '33'.
      struct1-c3 = 5.

    MOVE-CORRESPONDING struct1 to struct2.

    WRITE: / struct2-c2, struct2-c3.