on 10-17-2011 9:47 AM
Hi,gurus here
I want to copy SOURCE_PACKAGE in start routine to another inner table and increase the inner table's fields.
But when I write the code like this "DATA ITAB4 TYPE tyt_SC_1." (Also Source_package is TYPE tyt_SC_1.)
The system reports an error as: E:Type "_TY_T_SC_1" is unknown
Another thing is how to fill Source_package via an inner table?
So how to make it up?
Or anybody can provide some sample codes like to copy Source_package to an inner table,increase some customized-fields in this inner table and then copy the inner table back to Source_package?
Thanks,for a lot.
Hi,
Kindly define the DATA ITAB4 TYPE tyt_SC_1 after below statement.
DATA:
MONITOR_REC TYPE rstmonitor.
OR
TYPE tyt_SC_1 in the global section of the routine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you have all the data available in internal table itab and you want to change some values of source package which has got different structure than itab then you can simply manually loop on the source package and inside loop read the value of itab and then do the manual assignment of fields.
loop at source_package assigning <wa_package>.
read table itab into wa_itab with key key1= <wa_package>-key1.........
<wa_package>-field1 = wa_itab-field1 and so on.....
endloop.
you can do the manual assignment of fields inside the loop.
Regards,
Durgesh.
Hi,thanks.
Actually I want to enlarge the SOURCE_PACKAGE which means I want to append some additional records into SOURCE_PACKAGE.
eg:
SOURCE_PACKGE content
Material Sold_to quantity type Sales order ReceiptNO
mm01 100016 5 Market 100103 9004313
mm02 100017 6 Market 100103 9004314
mm03 100018 7 Market 100104 9004315
Now I have an inner table which content is
Material Sold_to quantity type
mm04 100016 4 Supply
mm05 100019 3 Supply
I want to insert the content of inner table to SOURCE_PACKAGE in spite of Sales order and ReceiptNO.
That means I want to realize the following content:
SOURCE_PACKAGE content
Material Sold_to quantity type Sales order ReceiptNo
mm01 100016 5 Market 100103 9004313
mm02 100017 6 Market 100103 9004314
mm03 100018 7 Market 100104 9004315
mm04 100016 4
mm05 100019 3
How to realize the intention in START ROUTINE by codes? Is that possible to "APPEND WA_ITAB TO SOURCE_PACKAGE" directly?
Hi Pradeep,
I tried implementing the code that you suggested to pull data from source package to an internal table.
However, although I have defined the Itab with the same structure as source package, still while checking, it says that the internal table has not been defined.
Could you help on this.
Regards,
Uday
HIi,
In the start routine, therer will be space immediately after the declaration tyt_SC_1 .
eg:
$*$ begin of global - insert your declaration only below this line -
... "insert your code here
*Declare Your internal table here like below***
DATA: it_data type STANDARD TABLE OF tys_SC_1,
wa_data type tys_SC_1,
wa_source_package type tys_SC_1.
*end OfDeclare Your internal table here like below***
$$ end of global - insert your declaration only before this line -
Later in the space whichs is listed below.
$*$ begin of routine - insert your code only below this line -
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
****Write your logic here like**
it_data[ ] = source_package[ ].
End OF logic***
If your internal tbale it_tab is different from Source package.
then you have loop at Source_package and populate your internal table...
Eg:
Loop at source_package into wa_source_package.
wa_data-field1 = wa_source_package-field1.
wa_data-field2 = wa_source_package-field2.
.....
......
wa_data-fieldn = wa_source_package-fieldn.
append wa_data to it_data.
clear: wa_data, wa-source_package.
endloop.
$$ end of routine - insert your code only before this line -
Regards,
Nanda.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My one comment to Nanda's post is that I would put the table declaration in the "normal" section.
DATA: it_data type STANDARD TABLE OF tys_SC_1,
wa_data type tys_SC_1,
wa_source_package type tys_SC_1.
Because if you were to write a Transformation Rule or End Routine, you may get a warning that type_ty_s_SC_1 doesn't exist. Because it technically only exists in the start routine. It'll probably work but every time you'd modify the rule, it would tell you that that type doesn't exist.
-
And yes you can append lines to your internal table and then at the end I usually just say
SOURCE_PACKAGE = internal_table.
Which overwrites the original source package with the one I was play around with.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.