2010 Mar 01 10:29 AM
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
2010 Mar 01 10:44 AM
here you can use:
move-corresponding wa_attr1 to wa_NonActiveUSers.
A.
here you can use:
move-corresponding wa_attr1 to wa_NonActiveUSers.
A.
2010 Mar 01 10:44 AM
here you can use:
move-corresponding wa_attr1 to wa_NonActiveUSers.
A.
2010 Mar 01 10:45 AM
Hi,
how about if you better use
move-corresponding wa_attr1 to wa_NonActiveUSers.this is faster.
2010 Mar 01 10:51 AM
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
2010 Mar 01 11:26 AM
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
2010 Mar 02 6:46 AM
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
2010 Mar 02 6:55 AM
Yes you have to use APPEND after the MOVE-CORRESPONDING statement to make the data reflect in the internal table.
2010 Mar 01 12:50 PM
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.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |