2013 May 13 9:21 AM
I Had a situation where for a given value in the key field i should add some extra fields to the existing fields.
I should design a custom upload process to update additional fields for a given value in the key field.
the upload document is a excel file .
eg:
existing table has product_no as a key field and product_name as the other field
i want to add the field product_price for every product_no present in the table through uploading a excel sheet containing product_no and product_price
as columns.
the process will not create new product_no ,but updates/ creates value for product_price for already existing product_no
Upload process will log error when a product_no listed in data file is not found in already existing table.
Moderator message:The SCN is not a forum for ordering free technical consulting. It is a collaborative community where people voluntarily help you to understand things better in the SAP world. As you obviously need some more understanding of this,I recommend to read the useful Blog "Asking Good Questions in the SCN Discussion Spaces will helpyou get Good Answers" to avoid the impression of"spec dumping and learnthe principles of this before asking any more questions.
Message was edited by: Kesavadas Thekkillath
2013 May 13 9:31 AM
Vani,
Get all the excel data in the interanl table using FM ALSM_EXCEl_TO_INTERNAL_TABLE. Then using this product_no get the data from SAP Table Eg: Mara, If exists then update the data to the exiting record or else if not found then append it to other internal table which you can display at the end of the upload as errors.
Regards,
Shakeel.
2013 May 13 9:35 AM
Hi shakeel,
Thanks for the reply ...... but intially the field product_price will not be present at the table
2013 May 13 9:44 AM
create another table having all the fields of existing table and the additional two fields.
Loop at current table
move correspoding values.
assign values for the new fields (Price )
append to the new tablae.
endloop.
Upload this new table as excel file using the following FM.
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
i_filename = p_file "Destination path in local PC.
TABLES
i_tab_sap_data = table_name.
2013 May 13 9:42 AM
You should not update the Standard tables of SAP via direct statement. Use the standard transaction and create a recording via SHDB.
Modify the program according to your need.
You need to run the same via session method and you can have the message log for the same.
Regards,
Rahul
2013 May 13 9:47 AM
Hi Rahul,
It is not a Standard table ,its a Ztable.
The main question is i want to add a aditional field and the values are filled by uploading an excel document.
2013 May 13 10:02 AM
You could create table with three fields product_no , product name , product price
First upload the data from excel to a temporary table....
Now loop at your temporary table
READ the internal table((which contains the main product no. and name till now)
if value exist copy the price and modify
else.
Append it to error log file...
Now depending on your requirement if you want to replace the file with the error file then do that...
or if you have a field status , you can modify its status it to error and then download it to the same path & name you have uploaded it from.