cancel
Showing results for 
Search instead for 
Did you mean: 

Having problem in creating bom by LSMW

Former Member
0 Kudos

HI

How can we create BOM through LSMW .please suggest the whole procedure ..how to create the BOM

either through standard batch input/direct input OR Batch input recording ..

Accepted Solutions (1)

Accepted Solutions (1)

former_member207022
Active Contributor
0 Kudos

Dear

Use the Batch input method to create the BOM.You have to create two source structure like BOM header and BOM item. Maintain two file structure; one for BOM header and another for BOM item.

Former Member
0 Kudos

Hi

Thanku for your sugggestion but my problem is that

After Recording with the standard input and also creating the both structure files i am getting problem in uploading the file

1 how to upload the file in both the structure

how i have to edit the execl file and load on both the header file and item file ..

Former Member
0 Kudos

Hi,

Refer to the below thread, your query should be answered.

Revert if you need any additional info.

Regards,

Vivek

Former Member
0 Kudos

Hi

All

How to upload the data in the header file and item file

I have uploaded the file in this way

1 The downloaded file from the 3rd step in that file i have seperated the header file and item file and the header file is been sussesfully uploaded but the item file is not been uploaded ..

please help on this issue.

2 The alternative way i have uploaded is the i have not made any changes in the downloaded file and

uploaded thi whole file as it is on the header and item soursces files .When i save the data the system is throwing an error (ERROR IN INSERT TABLE *SAPDMC/LSOFLD..

REGARDS

RAMANUJAM

former_member199502
Active Contributor
0 Kudos

Hi,

Hope u are following the STD procedure, after defining the structure relations and field mapping u have to specify the file path in which u stored the data for header and item(on the PC frontend)

Then Assign files to Source structure, read data and convert data. After that create the batch session and Run that session.

If u r getting particular error please let us know

former_member199502
Active Contributor
0 Kudos

Hi,

1)Check the path u have mention in the specify file step(7 th step) and also check maintain the structure relations step (4 th step) assign it properly

2)In the third step u have used aall fields from the table or only fields which are required by u.Delete the fields which are not reuired by u

Former Member
0 Kudos

HI

Girish Adavisw...

Actally their is problem in the 3rd step it self the file is not been uploaded properly and i anot able to go to the next step i have menstioned my problem in my above issue /...

Regards

former_member199502
Active Contributor
0 Kudos

Hi Ramanujam,

U have to define one reference field which links header and item file.Go to third step,select header component and click change.then go to table maintenance(next to copy symbol) insert in the first row one dummy field having 3 characters and save it.

Repeat the same thing for Item componet also.then insert the same dummy field in first column in both header and item excel files.

For first entry in both file for dummy field shoud be some 0001 and second entry 0002 and so on......

Then system will map 0001 in header file to 0001 in item file

Hope u understood the concept

Former Member
0 Kudos

HI

Girish Adavisw...

I have done the same way u have said but while save the data the system is giving an error (ERROR IN INSERT TABLE *SAPDMC/LSOFLD..

I have seperated both the header data and item data in different execl files and have done as u said the data was been uploaded but when i am saving the data i am getting an the above mentioned error..

regards

former_member199502
Active Contributor
0 Kudos

Hi Ramanjam,

Please tell me in which step you are getting the error

Former Member
0 Kudos

Hi

In third step when we upload the execl file to the sourse file and saving it on saving i am getting an error ...(ERROR IN INSERT TABLE *SAPDMC/LSOFLD..) i am getting this error ..

regards

former_member199502
Active Contributor
0 Kudos

Hi Ramanujam,

In third step,instead of uploading u can go for copy from datarepository by taking MAST and STPO table.

Go to Maintain source field(3 rd step)-change mode-click on header component

In menubar go to source fields-copy fields-copty from data repository-table(mast) get all the fields,keep the necessary fields and rest all u can delete.

iiily for STPO table.

then copy this to excel sheets separately.Save.

then follow the std steps .maintain the data in excel sheets according to the third step.copy the data to 2 notepad files

In specify files -in legacy(frontend)-give the path of this notepad files as header and item

Assign the files and procced

hope it will solve ur problem

Former Member
0 Kudos

HI

Thanku for your solutions but it is not working

and if we use this process then the object overview table and display sourse feilds do not match .

and we if we do this i think if we copy from the tables then wht is the need of the second step ...

regards

former_member199502
Active Contributor
0 Kudos

Hi Ramanujam,

In Second Step you will create Source structures and object overview table is for your reference.You can manually enter the fields you want to upload in step three.

the procedure what you are following is one of the method to map the fields to upload and by using tables also u can do this.

Former Member
0 Kudos

Hi

Ok i do agree that we can use the tables .

but in the first step when i do the recording and enter wht ever feilds that i need

and after recording it is automatically will be assigned and carry forward to the third step then now in the third step when i copy the feids from the table instead of the recorded exexl file . the system is not taking like this

I have done like the above i have mentioned

I want u telll me how to do create the Bom in your processes step by step from the step 1 to step 3

it will be more helpful for me .

Regards

ramanujam

former_member199502
Active Contributor
0 Kudos

Hi Ramanujam,

You are manually recording and doing,its very difficult for BOM.Batch input recording will used for simple transactions.

In My method,

Step1:Maintain Object Attributes- click display/change-Tick standard batch /direct input

object :0030

method:0001

and save it

Step 2:Maintain Source structures-go to change mode and create source structure header and item in lower level.save

Step 3:Maintain Source fields-click on heade-change mode -then go in the menu source fields-copy fields -copy from data repository-table MAST

Reapeat same thing for Item for Table STPO

Include Dummy field in the first row as i told yesterday for both header and item by going to table maintenace next to copy fields symbol.

In table maintenance keep the fields u want and rest delete it.

Then copy the final sorce fields in to excel sheet and maintain the data according to that.

Step 4:maintain structure relations-in this assign the source structure header to created in step2 to BICSK and Item sorce to BICSP

Step 5:Field mapping-Change mode -go to extras-Auto field mapping-no confirmation

Then in the fields TCODE assign CS01 tr code by going to constant symbol-save it

Rest of the step hope u know

Former Member
0 Kudos

HI

Girish Adavisw...

It is a very kind of u that u have sahred your knowledge with me

thanku for your replys

Now the problem is comming tht in the 6 th step when i am downloading the text file from the front end while saving i am getting an error that the no logical path is specified .

2 I have also on more dought that

I am downloading the file from the table but in the table it is defined for only one header and only one component i can add in the BOM but u abb more components how can i map this ...

Regards

ramanujam

Former Member
0 Kudos

Use this program to create BDC for BOM copy

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

TABLES: T001W, "Plants/branches.

MARA. "Material Master: General Data.

*parameters : t_infile like rlgrap-filename

  • default 'c:\gnpl project\abap\copybom.txt'.

DATA: T_BDC_TAB LIKE STANDARD TABLE OF BDCDATA

INITIAL SIZE 0 WITH HEADER LINE, " For storing BDC data

SESSION LIKE APQI-GROUPID

VALUE 'copybom', " Defining batch input Session

T_INFILE LIKE RLGRAP-FILENAME, " Storing legacy data

  • value 'c:\copybom.txt',

flag(1) value ' ',

ctr type i value 0.

DATA:BEGIN OF T_INREC OCCURS 0, " Internal table to upload

MATNR LIKE RC29N-MATNR, " Material number

WERKS LIKE RC29N-WERKS, " Plant

STLAL LIKE RC29N-STLAL, " Alternative BOM

MATNR1 LIKE RC29N-MATNR, " Material number

WERKS1 LIKE RC29N-WERKS, " Plant

STLAL1 LIKE RC29N-STLAL, " Alternative BOM

FLAG(1),

END OF T_INREC.

DATA : W_MAT(18) TYPE N,

W_MAT1(18) TYPE N,

POSNR LIKE RC29P-POSNR.

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

            • We are using WS_UPLOAD funtion in order to upload legacy data

            • into internal table. Here legacy data is in t_infile i.e.

            • 'c:\copybom.txt' & internal table is t_inrec

            • The legacy filetype is DAT since it is txt file delimited by TAB.

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

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_FILENAME = 'copybom.txt'

DEF_PATH = 'c:\'

MASK = ',.txt,.txt.'

MODE = 'O'

TITLE = 'Please specify the locaton of copybom.txt'

IMPORTING

FILENAME = T_INFILE

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

IF SY-SUBRC = 0.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = T_INFILE

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = T_INREC

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

GUI_REFUSE_FILETRANSFER = 8

OTHERS = 9.

*break-point.

DELETE T_INREC INDEX 1. " Since 1st row contains column headings.

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

            • Opening Batch input session for adding transactions.

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

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = SESSION

  • HOLDDATE = FILLER8

KEEP = 'X' " To maintain log after

" execution of session

USER = SY-UNAME " User Name for authorization

  • RECORD = FILLER1

  • IMPORTING

  • QID =

EXCEPTIONS

CLIENT_INVALID = 1

DESTINATION_INVALID = 2

GROUP_INVALID = 3

GROUP_IS_LOCKED = 4

HOLDDATE_INVALID = 5

INTERNAL_ERROR = 6

QUEUE_ERROR = 7

RUNNING = 8

SYSTEM_LOCK_ERROR = 9

USER_INVALID = 10

OTHERS = 11.

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

LOOP AT T_INREC. " Checking internal table

perform check_data.

endloop.

WRITE : 'Total No. of errorneous records : ', CTR.

IF CTR < 51.

loop at t_inrec where flag = ' '. " Reading internal table

PERFORM FILL_BDC_TAB. " Filling t_bdc_tab table

CALL FUNCTION 'BDC_INSERT' " Inserting batch input transactions

" in batch input session

EXPORTING

TCODE = 'CS01' " Transaction Code

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

TABLES

DYNPROTAB = T_BDC_TAB " bdc table name

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 6

OTHERS = 7.

ENDLOOP.

ELSE.

WRITE : / 'No BDC created due to errorneous records '.

ENDIF.

CALL FUNCTION 'BDC_CLOSE_GROUP' " To Close batch input session

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

ENDIF. "sy-subrc before ws_upload.

&----


*& Form FILL_BDC_TAB

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILL_BDC_TAB.

REFRESH T_BDC_TAB.

  • posnr = 'RC29P-POSNR(01)'.

  • concatenate 'RC29P-POSNR(01)' into posnr.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPLCSDI' '0100',

' ' 'RC29N-MATNR' T_INREC-MATNR,

' ' 'RC29N-WERKS' T_INREC-WERKS,

' ' 'RC29N-STLAN' '1',

' ' 'RC29N-STLAL' T_INREC-STLAL,

' ' 'BDC_OKCODE' 'VOKO',

'1' 'SAPLCSDI' '0105',

' ' 'RC29N-MATNR' T_INREC-MATNR1,

' ' 'RC29N-WERKS' T_INREC-WERKS1,

' ' 'RC29N-STLAN' '1',

' ' 'RC29N-STLAL' T_INREC-STLAL1,

' ' 'BDC_OKCODE' 'CLWI',

'1' 'SAPLCSDI' '0156',

' ' 'BDC_OKCODE' 'MALL'.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPLCSDI' '0156',

' ' 'BDC_OKCODE' 'FCUE',

'1' 'SAPLCSDI' '0150',

  • ' ' 'BDC_CURSOR' posnr,

' ' 'BDC_OKCODE' 'FCBU'.

  • '1' 'SAPLKACB' '0002',

  • ' ' 'COBL-PRCTR' t_inrec-prctr.

  • ' ' 'BDC_OKCODE' 'ENTE'.

  • ' ' 'BDC_OKCODE' '/00'.

ENDFORM. " FILL_BDC_TAB

&----


*& Form POPULATE_BDC_TAB

&----


  • text

----


  • -->P_0272 text *

  • -->P_0273 text *

  • -->P_0274 text *

----


FORM POPULATE_BDC_TAB USING VALUE(FLAG)

VALUE(VAR1)

VALUE(VAR2).

CLEAR T_BDC_TAB.

IF FLAG = '1'.

T_BDC_TAB-PROGRAM = VAR1. " Program Name

T_BDC_TAB-DYNPRO = VAR2. " Screen Number

T_BDC_TAB-DYNBEGIN = 'X'. " Starting of new screen

ELSE.

T_BDC_TAB-FNAM = VAR1. " Field Name

T_BDC_TAB-FVAL = VAR2. " Field Value

ENDIF.

APPEND T_BDC_TAB.

ENDFORM. " POPULATE_BDC_TAB

----


  • FORM check_data *

----


  • ........ *

----


form check_data.

FLAG = ''.

*break-point.

*check Material code.

  • if t_inrec-matnr <> space.

W_MAT = T_INREC-MATNR.

SELECT SINGLE * FROM MARA WHERE MATNR = W_MAT.

if sy-subrc ne 0.

WRITE : / 'Invalid material code ', T_INREC-MATNR.

FLAG = 'X'.

ENDIF.

  • endif.

*check Material code.

  • if t_inrec-matnr <> space.

W_MAT1 = T_INREC-MATNR1.

SELECT SINGLE * FROM MARA WHERE MATNR = W_MAT1.

if sy-subrc ne 0.

WRITE : / 'Invalid material code ', T_INREC-MATNR.

FLAG = 'X'.

ENDIF.

  • endif.

*check Plant code.

IF T_INREC-WERKS <> SPACE.

SELECT SINGLE * FROM T001W WHERE WERKS = T_INREC-WERKS.

if sy-subrc ne 0.

WRITE : / 'Invalid plant code ', T_INREC-WERKS.

FLAG = 'X'.

ENDIF.

endif.

if flag = 'X'. "the record is erroneous

t_inrec-flag = 'X'.

ctr = ctr + 1.

ELSE.

T_INREC-FLAG = ' '.

ENDIF.

MODIFY T_INREC INDEX SY-TABIX.

CLEAR FLAG.

ENDFORM.

former_member199502
Active Contributor
0 Kudos

Hi,

1)Check the file path u have given

2)It logical,For 1 header and 1 commponet u will define dummy field right

Dummy header material Dummy Item

0001 Material 0001 Component

0001 Component

0001 Component

0002 materail 0002 Component

0002 Component

Former Member
0 Kudos

HI

In the 6 th step i have up loaded the file and now when i save it it is asking the * no logical path is specified *

That this path we have to assign in the converted data path but i an not able to add the path as it is saying tht this partyicaular file is no assigned on it ,...

regards

Former Member
0 Kudos

Hi

1. Go to object attributes and assign Object: 0030, Method: 0001; Program Name: RCSBI010 in Standard batch/Direct input

2. In maintain source structures BOMHEADER and BOMITEM ( at lower level not at same level)

3. Maintain the source fields

BOMHEADER Header

KEY C(005) Common key

MATNR C(016) Material

WERKS C(004) Plant

STLAN C(001) BOM Usage

BOMITEM ITEM

KEY C(005) Common key

MATNR C(016) Material

MENGE C(004) Qty

PSOTP C(002) Item Category

There should common field(KEY) with same field type and field length in Header and Item source fields.

4. Map the header structure to BICSK to BOMHEADER and BICSP to BOMITEM

For BICSU no need to map any structure.(assuming your not uploading BOM sub item data)

5. Maintain the field mapping with Tcode value constant CS01 and Itemcategoy(POSTP) as u2018Lu2019.

6. Go to Specify files and mention your file path.

In import data and convert data application server path should get assigned automatically if u have created structure relations correctly.

Otherwise try giving your

Projectname_Subprojectname_Objectname.lsmw.read for import data and

Projectname_Subprojectname_Objectname.lsmw.conv for convert data.

Kindly try this. Kindly revert back if you still face any issue.

Edited by: Senthilkumar Sivaramakrishnan on Mar 20, 2009 1:08 PM

Former Member
0 Kudos

HI

Senthilkumar Si...

The system has created the import and convert data automatically as u said but when i save it after uploading the text file in the legacy data i am getting an error that * No logical path has been specified *

Regards

Ramanujam

former_member199502
Active Contributor
0 Kudos

Hi Ramanjum,

Please give ur Email ID ,i will send u one text file.u copy that to ur sytem and go to LSMW -Extras-Import project.Import the file and check what wrong u have did.You can use that for data uploading.

Former Member
0 Kudos

Hi

Mr Girish Adaviswamy

I have uploaded my ID in MY Profile so please can me Send tht File .. Of LSMW

Regards

Ramanujam

Answers (2)

Answers (2)

Former Member
0 Kudos

Issue Closed

Former Member
0 Kudos

Hi

You can use Std LSMW to create BOM.

Use standard batch/direct input

Object 0030

Method 0001.

Create BOM header and Item structure and files to upload BOM