Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

lsmw

Former Member
0 Likes
678

HI all,

I am ABAP fresher anybody plz help me how to export excel format data into database by using lsmw workbench.

thank you

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
654

Dear Kumar,

Check out the following steps for LSMW. Below are the links that would be helpful to you.

1. Maintain Attributes:

Here you have to choose the second option and you can do the recording how this should work. Then assign the same to the Batch Input Recording name.

2. Maintain Source structure:

Create a structure name

3. Maintain Source field:

In this you have to create a structure same as that of the input file

eg: name

age

sex

4. Maintain structure relations:

This will link the structure to the input file.

5. Maintain field mapping and conversion rules:

Here is the place where you can do coding, depending upon the code you have written or assignment you have done the values will get picked up from the file and get processed.

6. Maintain field mapping and conversion rules:

If you have any fixed values you can define here.

7. Specify files:

Specify the input file path and type.

8. Assign files:

This will assign ur file to the Input file

9. Read Data:

This will read ur data from teh file.

10. Dispaly Read Data:

You can see the uploaded data

11. Convert Data

This will convert the data to the corresponding format for processing

12. Display Converted data:

13. Create batch input session

Here this will create a batch input session for processing

14. Run Batch Input session:

By clicking on the session and process the same you can do teh needfu.

Best Regards,

Rajesh.

Please reward points if found helpful.

HI all,

I am ABAP fresher anybody plz help me how to export excel format data into database by using lsmw workbench.

thank you

4 REPLIES 4
Read only

Kanagaraja_L
Active Contributor
0 Likes
654

Check the Link you can get more step by step procedure

http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc

Kanagaraja L

Read only

Former Member
0 Likes
654

Hi,

1) save the Excel as *.csv with a delimiter e.g. semi-colon (',')

2) read the CSV-file as plain text file

3) split the line at the delimer (',')

LSMW :

Enter Project Name => Module Name (Material Management)

Enter Subproject => Transaction Group (Master Data)

Enter Object Name => Transaction (Vendor Master)

Press Create / Change

Enter Projects Descriptions

Continue (F8)

Maintain Object Attributes

Execute (Ctrl+F8)

Press Display Changes button

Select Batch Input Recording (Radio Button)

Press Recordings – Overview button – (SHDB for Transaction Recording)

Press Create Recording

Enter Recording Name & Description

Enter Currently Using Transaction Code

Enter Needed Fields (Ex. Account Group for Vender Master)

Enter Values for All Uploading Field

Save

Press Default All Button

Maintain Source Structures

Press Display Changes button

Enter Source Structure Name & Description

Save

Maintain Source Fields

Press Display Changes button

Save

Enter Field Names & Length

Maintain Structure Relations

Press Display Changes button

Save

Maintain Field Mapping and Conversion Rules

Select or Auto set Fields to Real Fields

Save

Maintain Fixed Values, Translations, User-Defined Routines

Optional

Specify Files

Select Uploading File

Save

Assign Files

Press Display Changes button

Save

Read Data

Enter No of Transactions to View Data Summary

Display Read Data

Enter No of Transactions to View Data List

Convert Data

Optional

Display Converted Data

Optional

Create Batch Input Session

Run Batch Input Session

Regards,

Omkar.

Read only

Former Member
0 Likes
655

Dear Kumar,

Check out the following steps for LSMW. Below are the links that would be helpful to you.

1. Maintain Attributes:

Here you have to choose the second option and you can do the recording how this should work. Then assign the same to the Batch Input Recording name.

2. Maintain Source structure:

Create a structure name

3. Maintain Source field:

In this you have to create a structure same as that of the input file

eg: name

age

sex

4. Maintain structure relations:

This will link the structure to the input file.

5. Maintain field mapping and conversion rules:

Here is the place where you can do coding, depending upon the code you have written or assignment you have done the values will get picked up from the file and get processed.

6. Maintain field mapping and conversion rules:

If you have any fixed values you can define here.

7. Specify files:

Specify the input file path and type.

8. Assign files:

This will assign ur file to the Input file

9. Read Data:

This will read ur data from teh file.

10. Dispaly Read Data:

You can see the uploaded data

11. Convert Data

This will convert the data to the corresponding format for processing

12. Display Converted data:

13. Create batch input session

Here this will create a batch input session for processing

14. Run Batch Input session:

By clicking on the session and process the same you can do teh needfu.

Best Regards,

Rajesh.

Please reward points if found helpful.

Read only

Former Member
0 Likes
654

Dear Kumar,

Below is a sample code that you can use to upload excel document into an internal table.

ABAP code for uploading an Excel document into an internal table. See code below for structures. The code is based on uploading a simple Excel spreadsheet or for an actual Excel file click here.

There are also a couple of alternatives which use fucntion modules ‘KCD_EXCEL_OLE_TO_INT_CONVERT’

and ‘ALSM_EXCEL_TO_INTERNAL_TABLE’ but the method below is by far the simplest method to use.

*……………………………………………………..

*: Description :

*: ———– :

*: This is a simple example program to get data from an excel :

*: file and store it in an internal table. :

*: :

*: Author : www.sapdev.co.uk, based on code from Jayanta :

*: :

*: SAP Version : 4.7 :

*:……………………………………………………:

REPORT zupload_excel_to_itab.

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE rlgrap-filename.

TYPES: BEGIN OF t_datatab,

col1(30) TYPE c,

col2(30) TYPE c,

col3(30) TYPE c,

END OF t_datatab.

DATA: it_datatab type standard table of t_datatab,

wa_datatab type t_datatab.

DATA: it_raw TYPE truxs_t_text_data.

  • At selection screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION ‘F4_FILENAME’

EXPORTING

field_name = ‘P_FILE’

IMPORTING

file_name = p_file.

***********************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = ‘X’

i_tab_raw_data = it_raw ” WORK TABLE

i_filename = p_file

TABLES

i_tab_converted_data = it_datatab[] “ACTUAL DATA

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

***********************************************************************

  • END-OF-SELECTION.

END-OF-SELECTION.

LOOP AT it_datatab INTO wa_datatab.

WRITE:/ wa_datatab-col1,

wa_datatab-col2,

wa_datatab-col3.

ENDLOOP.

Hope this is helpful.

Best Regards,

Rajesh.

Please reward points if found helpful.