2007 Jun 19 8:14 PM
HI ALL
in this code of mine i use name_tab nametab_3001 but i have a lot of tables that i
have to do the same code what is have to be change is the just the table <b>nametab_3001 & wa_nametab_3001</b>
i do it in perform maybe some can help me with that?
Regards
SELECT SINGLE perid pernr nachn vorna
FROM pa0002
INTO (taz9,emp_pernr,famliy_name,first_name)
WHERE pernr = wa_et_infty_modif-pernr
AND begda LE wa_et_infty_modif-bdate
AND endda GE wa_et_infty_modif-bdate.
lv_str1 = famliy_name(12). "Employee last name
SHIFT lv_str1 LEFT DELETING LEADING space. "Miror
TRANSLATE lv_str1 USING c_translate. "Chinese
wa_nametab_3001-mishpacha = lv_str1.
wa_nametab_3001-emp_pernr = emp_pernr.
APPEND wa_nametab_3001 TO nametab_3001.
CLEAR wa_nametab_3001.
lv_str2 = first_name(7). "Employee first name
SHIFT lv_str2 LEFT DELETING LEADING space. "Miror
TRANSLATE lv_str2 USING c_translate. "Chinese
wa_nametab_3001-praty = lv_str2.
LOOP AT nametab_3001 INTO wa_nametab_3001.
IF wa_nametab_3001-emp_pernr = wa_et_infty_modif-pernr.
MOVE: lv_str2 TO wa_nametab_3001-praty.
MODIFY nametab_3001 FROM wa_nametab_3001 TRANSPORTING praty.
CLEAR wa_nametab_3001.
ENDIF.
ENDLOOP.
2007 Jun 19 8:53 PM
Hello,
If all of your internal tables have the same type, you could create a subroutine named form xxxxx tables itab structure wa_nametab_3001.
Then, in your main program, when calling this perform you could do the following:
perform xxxxx tables: nametab_3001, nametab_3002... (here you would put the tablenames which you are using)
i hope this helps.
regards,
Mar Novalbos
Hello,
If all of your internal tables have the same type, you could create a subroutine named form xxxxx tables itab structure wa_nametab_3001.
Then, in your main program, when calling this perform you could do the following:
perform xxxxx tables: nametab_3001, nametab_3002... (here you would put the tablenames which you are using)
i hope this helps.
regards,
Mar Novalbos
2007 Jun 19 8:53 PM
Hello,
If all of your internal tables have the same type, you could create a subroutine named form xxxxx tables itab structure wa_nametab_3001.
Then, in your main program, when calling this perform you could do the following:
perform xxxxx tables: nametab_3001, nametab_3002... (here you would put the tablenames which you are using)
i hope this helps.
regards,
Mar Novalbos
2007 Jun 19 9:20 PM
hi Mar Novalbos
u can give me example becouse i dont now how the perform now which table i send ?
Regards
2007 Jun 20 7:50 AM
Hi,
Assuming that all the internal tables would be the same type:
within the perform it would not be necessary to know exactly which table name is being used. Instead, internal tables will be passed to the form and will be handled as "formal" parameters inside this form. Then, when returning to the main program, you will be able to distinguish which internal table has been passed to the form.
An example would be:
report ....
data: begin of itab1 occurs 0
f1 type n,
f2 type n
f3 type n,
end of itab1.
data: begin of itab2 occurs 0,
f1 type n,
f2 type n
f3 type n,
end of itab2.
...
as you can see, itab1 and itab2 have really the same structure, so you can also declare them in the following way:
data: begin of wa_itab,
f1 type n,
f2 type n,
f3 type n,
end of wa_itab.
data: itab1 like wa_itab occurs 0 with header line,
itab2 like wa_itab occurs 0 with header line.
......
Then, you could create a form routine in your report similar as:
form fill_tables tables aux_itab structure wa_itab. --> (wa_itab was declared at the beggining of your report)
select * from xxxx into corresponding fields of table aux_itab. (here, aux_itab is the "alias" for the internal table which has been passed to the form)
...
(like this you could fill your internal table as needed),
endform.
....
Then, in your main program you would call the form like this:
perform fill_tables tables itab1.
perform fill_tables tables itab2.
or, you can also call the form like this:
perform fill_tables tables: itab1, itab2. (this means that you will call the form twice)
You can also find more help by pressing 'F1' on the statement "perform" in your ABAP editor. This will show a lot of suggestions about syntax for statement perform/form.
I hope this is useful for you.
kind regards,
Mar
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |