What is Bill of Material (BOM)?

Bill of Materials (BOM) means that the list items require to produce the semifinished product or Final Product and the list of material can be raw materials, purchase materials and transfer materials.

The Bill of material consists two part. One is Header item and another one is Sub items which have the consumable quantity and its unit of measurement.

How Bill of Material can be created?

The Bill of material can be created manually using the T codes called CS01 – BOM Creation, using the BAPI, ABAP upload program can be created for BOM upload.

LSMW can be used for BOM creation and another method is we can create SAP GUI Scripting through excel sheet that automated with in a single click.

What is SAP GUI Scripting?

SAP GUI Scripting is the method of creating, changing master data and transaction data in SAP

To use SAP GUI Scripting method, the recording needs to be done with single entry where these entries will be used in Script recording.

Here, to create Bill of material one header material and its subitems are used and same is recorded and downloaded as notepad file.

This recorded GUI scripting can be copied in to the excel source code view in the sheet. The macro setting needs to be enabled in excel sheet.


The excel field mapping is done and the looping method of programming used to create multiple headers with multiple subitems.

Following code is modified to get the automation for creating multiple Bill of Materials in the plant.

Public SapGuiAuto, WScript, msgcol

Public objGui As GuiApplication

Public objConn As GuiConnection

Public objSess As GuiSession

Public objSBar As GuiStatusbar

Public objSheet As Worksheet

Dim W_System

Function Attach_Session() As Boolean

Dim il, it

Dim W_conn, W_Sess

If W_System = “” Then

Attach_Session = False

Exit Function

End If

If Not objSess Is Nothing Then

If objSess.Info.SystemName & objSess.Info.Client = W_System Then

Attach_Session = True

Exit Function

End If

End If

If objGui Is Nothing Then

Set SapGuiAuto = GetObject(“SAPGUISERVER”)

Set objGui = SapGuiAuto.GetScriptingEngine

End If

For il = 0 To objGui.Children.Count – 1

Set W_conn = objGui.Children(il + 0)

For it = 0 To W_conn.Children.Count – 1

Set W_Sess = W_conn.Children(it + 0)

If W_Sess.Info.SystemName & W_Sess.Info.Client = W_System Then

Set objConn = objGui.Children(il + 0)

Set objSess = objConn.Children(it + 0)

Exit For

End If

Next

Next

If objSess Is Nothing Then

MsgBox “No active session to system ” + W_System + “, or scripting is not enabled.”, vbCritical + vbOKOnly

Attach_Session = False

Exit Function

End If

If IsObject(WScript) Then

WScript.ConnectObject objSess, “on”

WScript.ConnectObject objGui, “on”

End If

Set objSBar = objSess.FindById(“wnd[0]/sbar”)

objSess.FindById(“wnd[0]”).maximize

Attach_Session = True

End Function

Public Sub RunGUIScript()

Dim W_Ret As Boolean

Dim material, plant, bomusage, Date01 As String

Dim i As Integer

W_Ret = Attach_Session

If Not W_Ret Then

Exit Sub

End If

material = Cells(9, 2).Value

plant = Cells(9, 5).Value

bomusage = Cells(10, 2).Value

Date01 = Cells(10, 5).Value

i = 0

On Error GoTo myerr

objSess.FindById(“wnd[0]”).maximize

While Cells(12 + i, 1).Value <> “”

If Cells(12 + i, 1) <> Cells(11 + i, 1) Then

objSess.FindById(“wnd[0]/tbar[0]/btn[11]”).press

objSess.FindById(“wnd[0]/tbar[0]/okcd”).Text = “cs01”

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]/usr/ctxtRC29N-MATNR”).Text = Cells(12 + i, 1).Value

objSess.FindById(“wnd[0]/usr/ctxtRC29N-WERKS”).Text = Cells(12 + i, 2).Value

objSess.FindById(“wnd[0]/usr/ctxtRC29N-STLAN”).Text = Cells(12 + i, 3).Value

objSess.FindById(“wnd[0]/usr/ctxtRC29N-DATUV”).Text = Cells(12 + i, 4).Value

objSess.FindById(“wnd[0]/usr/ctxtRC29N-DATUV”).SetFocus

objSess.FindById(“wnd[0]/usr/ctxtRC29N-DATUV”).caretPosition = 10

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-POSNR[0,0]”).Text = Cells(12 + i, 5).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,0]”).Text = Cells(12 + i, 6).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,0]”).Text = Cells(12 + i, 7).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).Text = Cells(12 + i, 8).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).SetFocus

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).caretPosition = 1

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT”).VerticalScrollbar.Position = i + 1

Else

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-POSNR[0,0]”).Text = Cells(12 + i, 5).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,0]”).Text = Cells(12 + i, 6).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,0]”).Text = Cells(12 + i, 7).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).Text = Cells(12 + i, 8).Value

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).SetFocus

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]”).caretPosition = 1

objSess.FindById(“wnd[0]”).sendVKey 0

objSess.FindById(“wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT”).VerticalScrollbar.Position = i + 1

End If

i = i + 1

Wend

objSess.FindById(“wnd[0]/tbar[0]/btn[11]”).press

objSess.FindById(“wnd[1]/tbar[0]/btn[0]”).press

Exit Sub

myerr:

MsgBox “BOM creation Successful!!!”

End Sub

Sub StartExtract()

Dim currentline As Integer

‘ This is the system to connect to

W_System = “CEF340”

‘ Run the actual GUI script

RunGUIScript

objSess.EndTransaction

End Sub

Conclusion – The BOM can be created with the help of excel sheet and the provision is given by SAP as SAP GUI Scripting. Only thing is we need record with minimum data and while uploading we can upload huge data. This feature will create n number of BOM in front of our eyes. Thanks for reading or referring.Cheers!

By AskMahe.com

Hi, AskMahe.com is the Brainchild of Mahendran Paramasivan who is interested in bringing the latest technology to the common people and corporates. We are a team and we are providing supports on Technology and innovation as per industrial standard. We are supporting with the help of analysis we made on Technology and innovation to help corporate companies and individuals. We bring the latest updates of technology and innovation in front of the eyes of our readers, clients, and people. We have resources in Cloud computing, IoT, Edge Computing, Dew Computing, 5G, SAP, Web Designing, UI/ UX Design. Regards AskMahe Team askmahe.com

43 thoughts on “SAP GUI SCRIPTING – BOM CREATION”
  1. Продажи с помощью Pinterest. Смотрите Видео: Сотни Продаж на Etsy, amazon, ebay, shopify за 2 месяца при ср.цене чека 300 usd https://youtu.be/GNOZtXGGM-I

  2. 2020 PC Install v4.16 Win serial key or numberBy admin 2020 PC Install v4.16 Win serial key or number 0 Comments2020 PC Install v4.16 Win serial key or number
    2020 PC Install v4.16 Win serial key or number

    Where can I find the Activation Key and File Installation Key (FIK) for my license?
    IMPORTANT: If you are looking for the File Installation Key for the purposes of installing MATLAB on an offline machine, see “How can I install MATLAB or other MathWorks products on an offline machine?” for complete instructions. Entering a File Installation Key into a MATLAB installer downloaded directly from the MathWorks website will not enable you to install MATLAB on an offline machine.

    Administrators

    License administrators can obtain the Activation Key and File Installation Keys through through the “Advanced Options” button in the license center. To retrieve your Activation Key and File Installation Key, follow the steps below:

  3. САмое эффективное для продаж – Pinterest. Сотни Продаж на Etsy, amazon, ebay, shopify за 2 месяца при ср.цене чека 300 usd https://youtu.be/GNOZtXGGM-I

  4. Привет всем! Класный у вас сайт!
    Что думаете по этим новостям?:
    Asus готовит презентацию флагманской модели планшетного компьютера http://mybioplanet.ru/information-technology-it/19469-asus-gotovit-prezentaciyu-flagmanskoy-modeli-planshetnogo-kompyutera.html
    http://mybioplanet.ru/news/33670-vo-lvove-pytalis-vzorvat-ofis-advokatov-obschestvennikov.html
    Ещё много интересного нашел тут: новости возобновляемой энергетики в России http://mybioplanet.ru/
    свежие новости политики мира http://mybioplanet.ru/politika/

  5. Incredible update of captchas solving software “XRumer 19.0 + XEvil 5.0”:

    Captchas recognition of Google (ReCaptcha-2 and ReCaptcha-3), Facebook, BitFinex, Microsoft, Mail.Ru, SolveMedia, Steam,
    and more than 12000 another size-types of captchas,
    with highest precision (80..100%) and highest speed (100 img per second).
    You can use XEvil 5.0 with any most popular SEO/SMM software: iMacros, XRumer, SERP Parser, GSA SER, RankerX, ZennoPoster, Scrapebox, Senuke, FaucetCollector and more than 100 of other programms.

    Interested? You can find a lot of impessive videos about XEvil in YouTube.

    Free XEvil Demo available.

    Good luck 😉

    XEvil Net

  6. Hey there, You have performed an incredible job. I will definitely digg it and in my opinion recommend to my friends. I am confident they will be benefited from this site.|

  7. Hello, i believe that i noticed you visited my web site so i got here to go back the favor?.I’m attempting to to find things to enhance my site!I guess its adequate to make use of some of your ideas!!|

  8. Hi there, yes this paragraph is truly fastidious and I have learned lot of things from it about blogging. thanks.|

  9. you’re truly a good webmaster. The web site loading pace is incredible. It seems that you are doing any distinctive trick. Furthermore, The contents are masterpiece. you have done a magnificent job in this subject!|

  10. Awesome! Its truly awesome paragraph, I have got much clear idea about from this piece of writing.|

  11. Hello, every time i used to check weblog posts here in the early hours in the break of day, since i like to learn more and more.|

  12. hi!,I really like your writing so so much! proportion we communicate more approximately your post on AOL? I require a specialist in this area to resolve my problem. Maybe that’s you! Taking a look forward to look you. |

  13. Hi there friends, pleasant post and nice arguments commented at this place, I am truly enjoying by these.|

  14. A fascinating discussion is definitely worth comment. I think that you need to publish more about this topic, it might not be a taboo subject but generally folks don’t speak about these subjects. To the next! Cheers!!|

  15. Hi, i think that i noticed you visited my blog so i came to return the desire?.I am trying to find things to enhance my site!I guess its good enough to make use of some of your ideas!!|

  16. Hi there everyone, it’s my first visit at this web page, and piece of writing is in fact fruitful in favor of me, keep up posting such posts.|

  17. Hello friends, how is the whole thing, and what you want to say on the topic of this piece of writing, in my view its genuinely awesome in favor of me.|

  18. For hottest news you have to visit the web and on web I found this web page as a best website for most recent updates.|

  19. Hi there, You’ve performed an excellent job. I’ll definitely digg it and individually recommend to my friends. I am sure they’ll be benefited from this website.|

  20. Truly when someone doesn’t know then its up to other users that they will assist, so here it occurs.|

  21. I am in fact pleased to read this webpage posts which consists of tons of useful facts, thanks for providing such data.|

  22. 5 Tips On How To Improve Deep Sleep Time. Resurge is a powerful potent fat burning formula by John Barban, which does not only work for melting off fat, but also regulates the sleep cycle too. In fact, this product only works when a person is in his deep sleep.
    https://tinyurl.com/yxays6j4

Comments are closed.