2013 May 14 6:38 AM
Hi Gurus,
I have a requirement like this.
In function module am getting one importing parameter as structure
in that structure one field (account) having Table type(data type string),because this account field containg 1..N records.
My requirement is i need to pass all the values(1..N) of the field(account) into table field,like this i have totally 5 fields in structure.
So,in table what can i give for table type? and how can i insert multiple
values for each field in table?
I already try with loop statement but its not yet good,because in some cases the fields having lot of records .
Please help me on this ASAP
Thanks in advance.
Moderator Message:Formulations like "ASAP" , “Urgent “ and "Please send step by step" are easily interpreted as orders to people who offer help for nothing more but the satisfaction to being helpful.
Compose your question precisely that everybody understands it well.
Thank you for taking more time to understand community help.
Message was edited by: Kesavadas Thekkillath
2013 May 14 6:52 AM
"My requirement is i need to pass all the values(1..N) of the field(account) into table field,like this i have totally 5 fields in structure."
It's not clear what you mean by the above statement. Can you provide more clarity?
2013 May 14 6:52 AM
"My requirement is i need to pass all the values(1..N) of the field(account) into table field,like this i have totally 5 fields in structure."
It's not clear what you mean by the above statement. Can you provide more clarity?
2013 May 14 7:06 AM
structure:
1) account type zfxx_acc_tt (Table type) ( zfxx_acc_tt is predefined type 'string')
2) Recipts type zfxx_rec_tt (Table type) ( zfxx_rec_tt is predefined type 'string')
3) ledgers type zfxx_led_tt (Table type) ( zfxx_led_tt is predefined type 'string')
like this i hav totally five fields
example:
account field having (1..N) values i.e, (121345,12346,12347...N)
recipts field having (1..N) values i.e, (121345,12346,12347...N)..
Table:
mandt type mandt
date type sydatum
account type ???????
recipts type ???????
ledgers type ???????
Now, I want to pass those values in table fields.
2013 May 14 7:49 AM
Ok, so you can define your internal table (which you mention would contain the fields MANDT, DATE, ACCOUNT_TYPE, RECEIPT_TYPE, LEDGER_TYPE) to refer to a structure that is composed of table types for account type, receipt type and ledger type. If you can ensure that the table types in your internal table have the same structure as the table types in the structure used in the function module's interface, then you can simply assign ( = ) the source and target tables.
For e.g, let's say the structure used in your function module interface is S_SOURCE and it has a table called ACCOUNT_TYPES containing account types. And, let's say that your internal table is called T_TARGET and has a table type called ACCOUNT_TYPES. Now, you need to declare a structure, say S_TARGET in your code having the same structure as T_TARGET. Then, you can simply do
S_TARGET-ACCOUNT_TYPES = S_SOURCE-ACCOUNT_TYPES
APPEND S_TARGET TO T_TARGET.
2013 May 14 8:41 AM
Hi Kumar,
thats not an internal table.that is data base table,there i need to insert data for each field.
like this;
FM:
Importing
i_struc type zstrcuture
Move: i_struc-account to wa_zxx_t22-account
i_struc-recipts to wa_zxx_t22-recipts
i_struc-ledgers to wa_zxx_t22-ledgers
insert zxx_t22 from wa_zxx_t22.
like that i want to insert data into data base table.
2013 May 14 8:52 AM
It's not possible to insert a table in a database table. If in your case, you have multiple records related to another one, you would need to create a separate database table having some common key with the parent table.
2013 May 14 10:04 AM
i think you need to found a relation for account recipts and ledgers
say you have 3 account values , 3 recipts, 3 ledgers..
now do the 1st account value 1st receipt value 1st ledger will go into table as one record ?..
or it would be decided on other conditions...
once you know this then just create an internal table
mandt keyof DB(whatever) account recipt ledger
and based on the above conditions that you should know , fill this table and save it to DB...
2013 Jun 10 7:42 AM
Hi Kumar,
Yes, u r correct i did like that only, i created 3 tables for each field with key fields of main table.