Skip to Content
0
Former Member
Nov 30, 2006 at 05:28 AM

subroutine

41 Views

Hi experts,

Can somebody explain me how to write a subroutine pool for follwoing code?

I am using same code in different places with different parameters.

ie. I have code like this.

select field1 field2 from /bic/AZODS1 into

table Itab where field1 = datapackage-field1.

if sy-subrc = 0

sort itab by field1.

endif.

Here I have total 6 ODS for 6 different regions.

I have to get same fields (field1 field2) from 6 ODS (ZODS1,ZODS2,ZODS3,ZODS4,ZODS5 and ZODS6) into target ods ( look up).

Could somebody explain me how to write a common subroutine for above code instead of hardcoding each ODS name in the code( for example

Form Get_field tables ypacket type datapackage

ymonitor type rsmonitor.

select field1 field2 from ( /bic/AZODS1 or /bic/AZODS2 so on ) into itab

where field1 = datapackage-field1.

if sy-subrc = 0

sort itab by field1.

endif.

Endform.

Thanks in advance and points will be assigned.

Regards,

Mark