2013 May 08 6:38 AM
Hi All,
I want to create a custom program , which takes the test data from an excel sheet (one by one) and executes the program that many times
and finally the output gets stored in another file.
Please drop in your suggestions as to whether we achieve this in ABAP ?? and if yes then how should I go about writing the code for the same??
Thanks & Regards,
Faiz
2013 May 08 6:47 AM
Hi Faiz,
Here the code is :
SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS: G_FILE1 LIKE RLGRAP-FILENAME OBLIGATORY.
PARAMETERS: P_FROM1 TYPE I DEFAULT 2 OBLIGATORY,
P_TO1 TYPE I OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR G_FILE.
PERFORM FILE_F4.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = G_FILE
I_BEGIN_COL = '1'
I_BEGIN_ROW = P_FROM
I_END_COL = '8'
I_END_ROW = P_TO
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
it will go to internal table IT_EXCEL
2013 May 08 6:51 AM
Yes possible in ABAP...
Does the excel contains the selection input values ?
create a program read from excel into an internal table..
Loop in the internal table.
and inside this loop for every record that you fetch
do your necessary operations
store the result in another file
end the loop
you can also make use of submit command, but then you have to make two programs , one to read from excel and then pass this to the second program using SUBMIT...
hope it helps
2013 May 08 6:53 AM
We have so many function modules as well as classes to upload and download data.
So you can upload data from excel based on your requirement and can download the final output as another file.
I feel there is no point still waiting and you can start with your custom program development.
2013 May 08 6:56 AM
Hi,
You can use any of the standard FMs like Gui_upload to load data from excel to internal table.
Once you have data in internal table use it the way you want.
You can use GUI download to download data to application server.
There are several threads on SCN to explain how these standard FMs work.
2013 May 08 7:04 AM
Hi All,
Thanks for your quick responses. I do know how to upload the data from excel to internal table. The problem that I'm facing is how to make this program as an entry point to several other program as well i.e. A) This program should be able to pass data to different program having different input fields, execute it multiple times in the background and then finally save the output result in a file.
2013 May 08 7:17 AM
use a dynamic submit statement inside your excel upload program
lets say lv_program_name is the variable where you store the program name after uploading from excel ...
so then use SUBMIT (lv_program_name)
also if it has to be run multiple times , (if there is a column say no. of times )
then use Do lv_n times. and then the above submit...
experiment a little its achievable ...
hope it helps...
2013 May 08 7:04 AM
hi Faiz,
surely this can be acieved.
Please explaore the Foloowing Fm for further help.
For Uploading data from Excel: Eg: ALSM_EXCEL_TO_INTERNAL_TABLE , etc....
For Writing the Output on Excel: Use OLE FM's for this.
Regards,
Amit
2013 May 13 1:52 PM
Hi Faiz,
Maybe it would be worth to try it with ECATT instead of writing new Report.
Best Regards
Marcin Cholewczuk