2013 Jun 18 5:04 PM
Hello everybody.
I need a suggestion for development.
I have an excel file with many columns and filters.
In this file there are 4 columns, the first has the old data and the new data in the next.
I need to select all tables in sap with the old company code and select in excel this code and replace with the new code that is in the excel file modifying tables.
What would you suggest for good performance?
Thanks.
2013 Jun 18 6:30 PM
Hi Ronaldo,
This is what i understand of your requirement.
You have an excel file whose first two columns have company code data, Specifically
Column 1 has Old Company Codes and Column 2 has new ones.
Now you need to replace the old company codes with new ones in your Z tables.
Solution -
1) Read the Excel using FM ALSM_EXCEL_TO_INTERNAL_TABLE
2) Create an internal table with all the old company codes and new company codes.
3) Say you have 5 Z tables to be modified, Select the data of these 5 tables into internal table of corresponding types doing a For All Entries on the internal table of step 2 with company code field.
4) Loop at the individual Internal tables of the Z tables using a field symbol/work area.
5) Inside Loop , read the internal table of step 2 to know what value of new company code should replace the old company code value.
6) If read is successful , then modify the values in the work area/field symbol.
7) Append the changed values to new internal table if using a work area. If using a field symbol skip this step.
😎 Update Your Z table from the Internal table of Step 7.
Ask further if not clear.
BR.
Hi Ronaldo,
This is what i understand of your requirement.
You have an excel file whose first two columns have company code data, Specifically
Column 1 has Old Company Codes and Column 2 has new ones.
Now you need to replace the old company codes with new ones in your Z tables.
Solution -
1) Read the Excel using FM ALSM_EXCEL_TO_INTERNAL_TABLE
2) Create an internal table with all the old company codes and new company codes.
3) Say you have 5 Z tables to be modified, Select the data of these 5 tables into internal table of corresponding types doing a For All Entries on the internal table of step 2 with company code field.
4) Loop at the individual Internal tables of the Z tables using a field symbol/work area.
5) Inside Loop , read the internal table of step 2 to know what value of new company code should replace the old company code value.
6) If read is successful , then modify the values in the work area/field symbol.
7) Append the changed values to new internal table if using a work area. If using a field symbol skip this step.
😎 Update Your Z table from the Internal table of Step 7.
Ask further if not clear.
BR.
2013 Jun 18 6:30 PM
Hi Ronaldo,
This is what i understand of your requirement.
You have an excel file whose first two columns have company code data, Specifically
Column 1 has Old Company Codes and Column 2 has new ones.
Now you need to replace the old company codes with new ones in your Z tables.
Solution -
1) Read the Excel using FM ALSM_EXCEL_TO_INTERNAL_TABLE
2) Create an internal table with all the old company codes and new company codes.
3) Say you have 5 Z tables to be modified, Select the data of these 5 tables into internal table of corresponding types doing a For All Entries on the internal table of step 2 with company code field.
4) Loop at the individual Internal tables of the Z tables using a field symbol/work area.
5) Inside Loop , read the internal table of step 2 to know what value of new company code should replace the old company code value.
6) If read is successful , then modify the values in the work area/field symbol.
7) Append the changed values to new internal table if using a work area. If using a field symbol skip this step.
😎 Update Your Z table from the Internal table of Step 7.
Ask further if not clear.
BR.
2013 Jun 18 7:32 PM
2013 Jun 18 7:03 PM
Hi Ronaldo,
the "All tables in SAP" afraid me, really.
First of all, I hope the new company code never have been used, if "yes", forgot that, find another job
if I never have been used, you could start with the DD03L table (I'm not sure) to find all the field of the table that used the data element BUKRS (but, for me, that's not enough)
If it's only 5 specific tables you could make like explain Ankit : http://scn.sap.com/message/14135570#14135570
good luck
Fred
2013 Jun 18 11:25 PM
OK i copy from other environment the function and worked but how make the function return blank fields?Is any parameter?
2013 Jun 19 1:00 AM
OK isee in other post and worked now .all is worked thanks guys.
Thanks.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |