‎2009 Jan 13 5:43 AM
Hi,
I have a code piece:
REPORT Z_CONSISTENT.
tables: t001,tkeb,tka01,t242v,t009.
data: it_t001 type table of t001,
it_t009 type table of t009,
it_tkeb type table of tkeb,
it_tka01 type table of tka01,
it_t242v type table of t242v.
Select periv from T001 into corresponding fields of table it_t001.
If sy-subrc eq 0.
select periv from t009 into corresponding fields of table it_t009 for all entries in it_t001
where PERIV = it_t001-PERIV.
ENDIF.
if it_t009 is not initial.
write : 'records are existing in t009'.
else.
write: 'rong'.
endif.
*****************************************
Select periv from Tkeb into corresponding fields of table it_tkeb.
If sy-subrc eq 0.
select periv from t009 into corresponding fields of table it_t009 for all entries in it_tkeb
where PERIV = it_tkeb-PERIV.
ENDIF.
if it_t009 is not initial.
write 😕 'records are existing in t009'.
else.
write: 'rong'.
endif.
*****************************************
Select lmona from Tka01 into corresponding fields of table it_tka01.
If sy-subrc eq 0.
select periv from t009 into corresponding fields of table it_t009 for all entries in it_tka01
where PERIV = it_tka01-lmona.
ENDIF.
if it_t009 is not initial.
write 😕 'records are existing in t009'.
else.
write: 'rong'.
endif.
*****************************************
Select periv from T242v into corresponding fields of table it_t242v.
If sy-subrc eq 0.
select periv from t009 into corresponding fields of table it_t009 for all entries in it_t242v
where PERIV = it_t242v-PERIV.
ENDIF.
if it_t009 is not initial.
write 😕 'records are existing in t009'.
else.
write: 'rong'.
endif.
If I need to convert this code so that i can create a Function Module out of it, how can this be done... I mean what all do i need to put as inport, export parameters etc.?
Thanks,
Ajay.
‎2009 Jan 13 6:05 AM
Hi,
All ur input parameters are in Import or table parameter,
All ur outputs are in Export or table parameter.
‎2009 Jan 13 6:00 AM
Normally you can keep the selection screen parameters as exporting parameters in FM.
You can have the output structure as tables or exporting paramater.
‎2009 Jan 13 6:03 AM
HI,
You can have the selection-screen fields in Import Tab and Return table in Table tab.
Return_tab is of type Bapireturn1 which will hold all the messages what you write on the list.
‎2009 Jan 13 6:13 AM
Hi Avinash,
I think that return tab can be of any type. Which will hold the data that will be returned from the function Module.
Regards
Sandipan
‎2009 Jan 13 6:05 AM
Hi,
All ur input parameters are in Import or table parameter,
All ur outputs are in Export or table parameter.
‎2009 Jan 13 6:18 AM
Hi,
Input values(Parameters/Select options) can be sent as IMPORT in FM and
Output values can be sent as EXPORT in FM.
TABLES can be used both ways.
Now as per ur code you don't need any IMPORT,as there is no WHERE clause in ur query!!!
and the output you want as per ur code is just a message so you can declare an EXPORT parameter in FM as
g_message type stringand from FM you can output message in g_string.
OR
Table parameter as
g_mess_tab type solisti1and within FM you can populate this table with messages.
Regards,
Neha
Edited by: Neha Shukla on Jan 13, 2009 11:53 AM
‎2009 Jan 13 6:18 AM
Hi,
You can give your selection criteria as import parameters and the final table as Export or Tables Parameter.
Regards
Sandipan