How to change the header of Material BOM in a program for alternative BOM ?

Requirement: An Inbound IDOC creates /change/delete Alternative Material BOM. The Alternative Material BOM can have alternative values from 1 to 99.
ISSUE: I am good with CREATE and DELETE BOM. The issue is with CHANGE of header Material BOM. The fields which we need to change in the header is the base quantity, BOM status, Lot Size from and Lot Size to. Please note that I am able to change the item details of the BOM with FM CSAI_BOM_MAINTAIN. I find no FM /BAPI which would change the header of a material BOM.
Please NOTE that I am using BAPI_MATERIAL_BOM_GROUP_CREATE to create alternative Material BOM. This has a parameter in TABLES called "VARIANTS" which has a field CS_FUNCTION which can have value from NEW/CHG/DEL .Also ,there is another parameter in TABLES called "ITEMASSIGNMENTS" which has a field CS_FUNCTION which can have value from NEW/CHG/DEL which implies this FM will allow us to change the BOM. But this does not work when I use it for CHANGE scenario with CHG value. I debugged this BAPI and observed it requires a STNLR(Bill of Material) value . This field is not there in any of the structure. I am not sure if I am passing the right parameters to it.
Let me know if the parameters are passed correctly for CHANGE scenario.
Also let me know if there is any other way(FM/BAPI)  to update the Header of the Material BOM ?
Here is the code I am using:
*& Report  ZTEST_S_E
REPORT  ZTEST_S_E.
* This code will create a material BoM for the material
* MAINMATERIAL with the components COMPON1 and COMPON2.
* Data Declaration
DATA:
it_bomgroup LIKE bapi1080_bgr_c OCCURS 0 WITH HEADER LINE,
it_variants LIKE bapi1080_bom_c OCCURS 0 WITH HEADER LINE,
it_items LIKE bapi1080_itm_c OCCURS 0 WITH HEADER LINE,
it_matrel LIKE bapi1080_mbm_c OCCURS 0 WITH HEADER LINE,
it_itemas LIKE bapi1080_rel_itm_bom_c OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
* Fill the data
* Material BoM Group Header Data
CLEAR it_bomgroup.
it_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
it_bomgroup-object_type = 'BOM'.
it_bomgroup-object_id = 'SIMPLE1'.
it_bomgroup-bom_usage = '1'. " YOU COULD CHANGE THE BOM USAGE TO YOUR
*NEEDS
it_bomgroup-ltxt_lang = sy-langu.
it_bomgroup-technical_type = ' '.
it_bomgroup-bom_text = 'Simple BoM - FM'.
APPEND it_bomgroup.
* Header Details of the different variants
CLEAR it_variants.
it_variants-CHANGE_NO  = '500000000349'.
it_variants-bom_group_identification = 'BAPI_SMP_COL1'.
it_variants-object_type = 'BOM'.
it_variants-object_id = 'SIMPLE1'.
it_variants-alternative_bom = '01'.
it_variants-bom_status = '01'.
it_variants-base_qty = '2.000'.
it_variants-valid_from_date = sy-datum.
it_variants-function = 'CHG'.
APPEND it_variants.
* Details of the items of the variants
CLEAR it_items.
it_items-bom_group_identification = 'BAPI_SMP_COL1'.
it_items-object_type = 'ITM'.
it_items-object_id = 'SIMPLE1'.
it_items-item_no = '0010'.
it_items-item_cat = 'L'.
it_items-component = '030790490'.
it_items-comp_qty = '2'.
it_items-valid_from_date = sy-datum.
APPEND it_items.
CLEAR it_items.
it_items-bom_group_identification = 'BAPI_SMP_COL1'.
it_items-object_type = 'ITM'.
it_items-object_id = 'SIMPLE1'.
it_itemas-change_no = '500000000138'.
it_items-item_no = '0020'.
it_items-item_cat = 'L'.
it_items-component = '030790490'.
it_items-comp_qty = '3'.
it_items-valid_from_date = sy-datum.
APPEND it_items.
* Details of the materials of the different variants
CLEAR it_matrel.
it_matrel-bom_group_identification = 'BAPI_SMP_COL1'.
it_matrel-material = '030790490'.
it_matrel-bom_usage = '1'.
it_matrel-alternative_bom = '01'.
APPEND it_matrel.
* Linking items to the corresponding variants
CLEAR it_itemas.
it_itemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_itemas-sub_object_type = 'ITM'.
it_itemas-sub_object_id = 'SIMPLE1'.
it_itemas-super_object_type = 'BOM'.
it_itemas-super_object_id = 'SIMPLE1'.
it_itemas-valid_from_date = sy-datum.
it_itemas-function = 'CHG'.
APPEND it_itemas.
* Create variants
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT it_return.
WRITE:/ it_return-type, it_return-id, it_return-number,
it_return-message.
ENDLOOP.
Let me know if the parameters are passed correctly for CHANGE scenario.
Also let me know if there is any other way(FM/BAPI)  to update the Header of the Material BOM ?

Try doing something like this:
class MyJTextArea extends JTextArea {
    public boolean keyDown(Event evt,int key) {
        if(key == 13 || key == 10) { // or whatever ascii codes enter may have
            // move carret to next line
        } else {
            super.keyDown(evt, key);
}which means you have got to catch the enter-key before the actutal JTextArea does this.
p.s. look at my post, maybe you can help me, too.
http://forum.java.sun.com/thread.jsp?forum=5&thread=465803&tstart=0&trange=100

Similar Messages

  • How to change the header and footer in the Section Breaks Next Page using OpenXML?

    I have a word document file in which I added a Section Break of Next Page, now I want to change the header and footer of that page.
    Scenario of example, I have a doc file which has four pages with headers and footers and added fifth page in the section break next page, I want to change the header and footer of the fifth page only. This is achievable manually by deselecting the Link to Previous
    button in the Word Application but I don't know how to change it using XML?
    My code that adds the new page in the section breaks is:
    class Program
    static void Main(string[] args)
    string path = @"C:\Riyaz\sample.docx";
    string strtxt = "Hello This is done by programmatically";
    OpenAndAddTextToWordDocument(path,strtxt);
    public static void OpenAndAddTextToWordDocument(string filepath, string txt)
    using (DocX document = DocX.Load(@"C:\Riyaz\sample.docx"))
    document.InsertSectionPageBreak();
    Paragraph p1 = document.InsertParagraph();
    p1.Append("This is new section");
    document.Save();
    Please help.

    Here is the sample for your reference:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    namespace WordAddNewFooterHeader
    class Program
    static void Main(string[] args)
    string path = @"E:\Document\TestHeaderandfooter-Copy.docx";
    string strtxt = "OpenXML SDK";
    OpenAndAddTextToWordDocument(path, strtxt);
    public static void OpenAndAddTextToWordDocument(string filepath, string txt)
    // Open a WordprocessingDocument for editing using the filepath.
    WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filepath, true);
    MainDocumentPart part = wordprocessingDocument.MainDocumentPart;
    Body body = part.Document.Body;
    //create a new footer Id=rIdf2
    FooterPart footerPart2 = part.AddNewPart<FooterPart>("rIdf2");
    GenerateFooterPartContent(footerPart2);
    //create a new header Id=rIdh2
    HeaderPart headerPart2 = part.AddNewPart<HeaderPart>("rIdh2");
    GenerateHeaderPartContent(headerPart2);
    //replace the attribute of SectionProperties to add new footer and header
    SectionProperties lxml = body.GetFirstChild<SectionProperties>();
    lxml.GetFirstChild<HeaderReference>().Remove();
    lxml.GetFirstChild<FooterReference>().Remove();
    HeaderReference headerReference1 = new HeaderReference() { Type = HeaderFooterValues.Default, Id = "rIdh2" };
    FooterReference footerReference1 = new FooterReference() { Type = HeaderFooterValues.Default, Id = "rIdf2" };
    lxml.Append(headerReference1);
    lxml.Append(footerReference1);
    //add the correlation of last Paragraph
    OpenXmlElement oxl = body.ChildElements.GetItem(body.ChildElements.Count - 2);
    ParagraphProperties paragraphProperties1 = new ParagraphProperties();
    SectionProperties sectionProperties1 = new SectionProperties() { RsidR = oxl.GetAttribute("rsidR", oxl.NamespaceUri).Value };
    HeaderReference headerReference2 = new HeaderReference() { Type = HeaderFooterValues.Default, Id = part.GetIdOfPart(part.HeaderParts.FirstOrDefault()) };
    FooterReference footerReference2 = new FooterReference() { Type = HeaderFooterValues.Default, Id = part.GetIdOfPart(part.FooterParts.FirstOrDefault()) };
    PageSize pageSize1 = new PageSize() { Width = (UInt32Value)12240U, Height = (UInt32Value)15840U };
    PageMargin pageMargin1 = new PageMargin() { Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)720U, Footer = (UInt32Value)720U, Gutter = (UInt32Value)0U };
    Columns columns1 = new Columns() { Space = "720" };
    DocGrid docGrid1 = new DocGrid() { LinePitch = 360 };
    sectionProperties1.Append(headerReference2);
    sectionProperties1.Append(footerReference2);
    sectionProperties1.Append(pageSize1);
    sectionProperties1.Append(pageMargin1);
    sectionProperties1.Append(columns1);
    sectionProperties1.Append(docGrid1);
    paragraphProperties1.Append(sectionProperties1);
    oxl.InsertAt<ParagraphProperties>(paragraphProperties1, 0);
    body.InsertBefore<Paragraph>(GenerateParagraph(txt, oxl.GetAttribute("rsidRDefault", oxl.NamespaceUri).Value), body.GetFirstChild<SectionProperties>());
    part.Document.Save();
    wordprocessingDocument.Close();
    //Generate new Paragraph
    public static Paragraph GenerateParagraph(string text, string rsidR)
    Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = rsidR };
    ParagraphProperties paragraphProperties1 = new ParagraphProperties();
    Tabs tabs1 = new Tabs();
    TabStop tabStop1 = new TabStop() { Val = TabStopValues.Left, Position = 5583 };
    tabs1.Append(tabStop1);
    paragraphProperties1.Append(tabs1);
    Run run1 = new Run();
    Text text1 = new Text();
    text1.Text = text;
    run1.Append(text1);
    Run run2 = new Run();
    TabChar tabChar1 = new TabChar();
    run2.Append(tabChar1);
    paragraph1.Append(paragraphProperties1);
    paragraph1.Append(run1);
    paragraph1.Append(run2);
    return paragraph1;
    static void GenerateHeaderPartContent(HeaderPart hpart)
    Header header1 = new Header();
    Paragraph paragraph1 = new Paragraph();
    ParagraphProperties paragraphProperties1 = new ParagraphProperties();
    ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "Header" };
    paragraphProperties1.Append(paragraphStyleId1);
    Run run1 = new Run();
    Text text1 = new Text();
    text1.Text = "";
    run1.Append(text1);
    paragraph1.Append(paragraphProperties1);
    paragraph1.Append(run1);
    header1.Append(paragraph1);
    hpart.Header = header1;
    static void GenerateFooterPartContent(FooterPart fpart)
    Footer footer1 = new Footer();
    Paragraph paragraph1 = new Paragraph();
    ParagraphProperties paragraphProperties1 = new ParagraphProperties();
    ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "Footer" };
    paragraphProperties1.Append(paragraphStyleId1);
    Run run1 = new Run();
    Text text1 = new Text();
    text1.Text = "";
    run1.Append(text1);
    paragraph1.Append(paragraphProperties1);
    paragraph1.Append(run1);
    footer1.Append(paragraph1);
    fpart.Footer = footer1;
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to change the header text on output type in sapscript

    Dear All,
    In the sapscript, I would like to changes the header text from invoice number to sales number on the output type z001.
    Could someone can guide me?
    Thanks.

    Hi,
    Please go through following link :
    http://forums.adobe.com/thread/870081#870081
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • How to change the header in all pages at once?

    I'm new to iWeb and can't figure out how to change the headers of all pages without having to go through and do it to every page. There should be a way, but is this a feature iWeb doesn't have?

    Hi,
    Refer following link which states how to change the Page Setup setting (just an addition to above poster's explanation):-
    http://docs.oracle.com/cd/E12825_01/epm.111/fr_user/frameset.htm?1900.html
    Regards,
    Edited by: 918547 on Dec 14, 2012 6:17 PM

  • How to change the default servcie port number to be checked for the IPS sig

    Dear
    i have an AIP-SSM (IPS) installed in a an ASA firewall.
    i have configured an access-list in the firewall to forward the traffic coming from the internet toward the internal server to be checked by the IPS module.
    but the case is that the services have to be checked is not the default services port numbers.
    http port is 8081
    oracle port is 2006
    and many other services.
    the question now, is how to change the default service number in the IPS in order to be checked by the corresponding service signatures?
    Thanks

    You would set those as part of the signature variables.
    http://www.cisco.com/en/US/docs/security/ips/6.1/configuration/guide/cli/cli_signature_definitions.html#wp1040009

  • How to change the stock of material?

    Hi everybody,
    Can somebody kindly tell me how can i change the stock (increase or decrease) the stock  of a material?
    Thanks,
    Padma

    Hello,
    If u want to make the changes to the stock of the material then use the BAPI_AMTERAIL SAVEDATA.
    Check this sample.
    REPORT ZV_MAT_CREATE .
    DATA: HEADDATA TYPE BAPIMATHEAD.
    DATA: CLIENTDATA TYPE BAPI_MARA.
    DATA: CLIENTDATAX TYPE BAPI_MARAX.
    DATA: RETURN TYPE  BAPIRET2 .
    DATA: RETURNM TYPE TABLE OF BAPI_MATRETURN2 WITH HEADER LINE.
    DATA: XMARA TYPE MARA.
    DATA: RETURNMESSAGES LIKE BAPIRET2        OCCURS 0 WITH HEADER LINE.
    DATA: MATERIALDESCRIPTION LIKE BAPI_MAKT  OCCURS 0 WITH HEADER LINE.
    PARAMETERS: P_MATNR TYPE MARA-MATNR,
                P_MAKTX LIKE MAKT-MAKTX.
    SELECT SINGLE * FROM MARA INTO XMARA
              WHERE MATNR = P_MATNR.
    HEADDATA-MATERIAL   = P_MATNR.
    HEADDATA-MATL_TYPE  = 'FERT'.
    HEADDATA-IND_SECTOR = 'M'.
    HEADDATA-BASIC_VIEW = 'X'.
    *clientdata-del_flag =  'X'.
    *clientdatax-del_flag = 'X'.
    * Daten für die Sicht GRUNDDATEN 1
    MATERIALDESCRIPTION-LANGU = SY-LANGU.
    MATERIALDESCRIPTION-MATL_DESC = P_MAKTX.
    APPEND MATERIALDESCRIPTION.
    * Mandantenspezifische Materialdaten
    CLIENTDATA-BASE_UOM  = 'ST'.
    CLIENTDATAX-BASE_UOM = 'X'.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
         EXPORTING
              HEADDATA            = HEADDATA
              CLIENTDATA          = CLIENTDATA
              CLIENTDATAX         = CLIENTDATAX
    STORAGELOCATIONDATA = STOLOC  " Here give the plant , Sto. loc and quantity.
    STORAGELOCATIONDATAX = STOLOCX " Here set the X to the quantity field.
         IMPORTING
              RETURN              = RETURN
         TABLES
              RETURNMESSAGES      = RETURNM
              MATERIALDESCRIPTION = MATERIALDESCRIPTION.
    CHECK SY-SUBRC  = 0.
    COMMIT WORK AND WAIT.
    Hope this helps you.
    Vasanth

  • Powershell: How to change the header name in a imported CSV file

    HI All,
    I have a csv file in which I want to change the headers names in powershell.
    oldnames are name,id
    newnames I want to give are: company and transit respectively.
    Following is what I wrote in script:
               $a = import-csv .\finalexam\employees.csv -header name,id'
                       foreach ($a in $as[1-$as.count-1])  // I used 1 here because I want it to ignore the  exiting headers.
                      { $_.name -eq company, $_.id -eq transit}
    I think this not entirely correct way to do this. Can someone show me how to fix this.
    Regards
    SQL 75

    If you're not an experienced PowerShell programmer, I recommend editing the file in a text editor and changing the name that way.
    -- Bill Stewart [Bill_Stewart]

  • How to change the header text fontFamily of spark DataGrid?

    I use an embed font (Nunito-Light.ttf),  and i can set the font of GridColumn to Nunito-Light in DataGrid , but it seems that it has no effect to the header of DataGrid.
    and then I create a  headerRenderer for spark DataGrid, and try to set the fontFamily of "labelDisplay" to Nunito-Light  , but It seems still no effect .
    If I set the fontFamily of "labelDisplay" to "Verdana" or "Arial" , it has effect , so strange! Is that a bug?
    Anybody  has the same problem? Please tell me how to solve it ,thank you very much!

    Hi,
    Please go through following link :
    http://forums.adobe.com/thread/870081#870081
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • How to change the Time Zone of a selected user programically ?

    Hi all,
    I have a specific requirement to develope using Webdynpro. I want to programically change the Time ZOne of a selected  user. Could some one help me . I promise to award points for the solution.
    Thank you in advance
    Regards
    Maruti

    Hi,
    Kindly have a look at the following threads,
    Re: Timezone of current User
    Re: Changing the Time Zone attribute
    Regards,
    Saravanan K

  • How to change the status of material while creating sales order via BDC

    Hai.
    In BDC while creating sales order( va01 posting ) it is stucking up in middle saying material is new. I.e Sales order (va01) is not  getting created because  of material status is new . I want to create sales order  (va01) even  material status is new.
    pls give me out the solution. Points will be rewarded.
    thanks & regards,
    sami.

    Hi,
    If you drag the line item a little towards the right side, you will find a filed material entered. The one you see in the material filed on sales order over view screen is the one determined. You can as well double click and see the fields material entered and material determined.
    Is there anything else you are expecting to see as part of analysis ?
    Regards
    Sadhu Kishore

  • How to change the header text of documents posted to FI from accrual engine

    Dear experts,
    could anybody explain us step by step how we can get a different header or position text into transaction ACACTREE01, which can can be shown in FI or CO-Reporting.
    Kind Regards
    Sladinky

    Hi Sladinky,
    Can you please suggest this in case you have already implemented it ?
    Thanks,
    Sourav

  • How to change the status of clinical order header

    Hi all,
    I need to change the status (N1CORDER-WLSTA) of the clinical order header. I have found the way to change the status of the items and it works, but i dont know how to change the header status.
    Now, for the items i do:
    1- Create an object type cl_ishmed_prereg
    2- Load the item (n1vkg-vkgid)
    3- Use set_status method
    4- Save the object
    5- Commit work
    So, do you know how i can change the status of the header? Im looking for other methods but...
    Thanks,
    Manel

    In order to change the clinic order header status u have to:
    1- Obtain the instance from item instance:
        CALL METHOD lv_prereg->get_corder
          IMPORTING
            er_corder = lv_corder
            e_rc      = rc.
    2- Create a var type rn1_corder_x
    3- Modify:
    is_n1corder_x-wlsta = 'RE'. " new status
    is_n1corder_x-wlsta_x = 'X'.
    4- Use change mehod:
        CALL METHOD lv_corder->change
          EXPORTING
            is_corder_x     = is_n1corder_x
          IMPORTING
            e_rc            = rc
          CHANGING
            cr_errorhandler = cl_error.
    5- Save:
    CALL METHOD lv_corder->if_ish_objectbase~save
    6- Commit work
    Regards,
    Manel

  • How to change the width for af:selectManyShuttle by skins

    i need to change the width for selectManyShuttle by skin i can do that by change the width for .AFFieldText but this method change the all select* and textfiled width,so i just want to change the width for selectManyShuttle component.
    and i hope to know how to change the header color for selectManyShuttle ,the default color for it is green.

    Thanks ,It is working
    Could you please tell me how to change the header text color for af:selectManyShuttle
    Regards
    Wish79

  • How to skip the header rows of the file using UTL_FILE?

    Hi,
    I created a procedure to read the file from shared location using UTl_FILE package. But, I stucked why because I don't know how to skip the header rows as those rows are headings for one of the report.Since, please help me.
    Regards,
    Vissu.....

    vissu wrote:
    Hi,
    I created a procedure to read the file from shared location using UTl_FILE package. But, I stucked why because I don't know how to skip the header rows as those rows are headings for one of the report.Since, please help me.
    Regards,
    Vissu.....UTL_FILE just reads data from the file. It has no concept of what could be a "header" or "body" or "records" or "footer" or any other data based concept. If you want to skip lines of a file, you will just need to read them using UTL_FILE and ignore them.

  • How do I  change the header on subsequent pages

    I need to change the header on pages after the first page. How do I do this?

    Ok, found the answer in the forun already!
    > inspector
    > T
    > more
    > languages
    and I can manage to change the spellcheck to the language I`m working on!!!

Maybe you are looking for

  • CS3 - Viewing HTML in code window, when selecting  a image in design window on split mode wont work .

    Does any 1 know how i can enable my split to be able to select a image from the design mode window with mouse, and have it highlight in the code veiw. I have just upgraded to CS3 and in DW MX2004 i could select HTML from the code view , and attribute

  • Hooking up a wacom cintiq 21 ux to a imac

    Hi I'm trying to find out what adapters I will need to hook up a 2nd gen Cintiq 21 UX to my Imac...any difficulties?

  • Conflicts with Mouse

    I am running Windows XP Home verison. I have SP 2 and should be up to date with all updates. When I install Itunes, from the CD that came with my IPOD, I lose my mouse. I have to do a system restore just to get it back. Anyone have any idea what the

  • Request type of service to a vendor master

    Hi Gurus, Can anyone help me how to request a way to add the industry or type of service to a vendor master and to produce a payment report that includes this information. Thanks, Sathish

  • Message no. AA730 Last posting run terminated

    Hello, I loaded incorrectly assets (asset class land) with depreciation key but for a land there is no account determination. I´ve deleted the incorrect assets and when I run the depreciaton I´m receiving the error message Message no. AA730 Last post