BOM Interface

Hi
I am looking for BAPI or any other technical solution which can take multiple alternate BOMs creation or updation in SAP.
I have tested BOMMAT01 Idoc type. but it is able to create only one BOM. when I want to create a second alternate BOM, it is failing..
Pl suggest a solution which can take interface record and create/update the multiple alternate BOMs.
Thanks
Ram

Related question:
If I populate the BOM interface tables in one instance, can I copy the entire table again in another instance to run the BOM import OR do I have to populate the tables from scratch in every instance ?

Similar Messages

  • Import multi-level BOM into Oracle

    We have a client requirement to create BOM based on level using Pl/Sql, Data will be coming in the below format:-
    Item Description      BOM LEVEL
    a               *1*     
    aa               *2*     
    aaa               *3*     
    aab               *3*     
    aaba               *4*     
    aabb               *4*     
    ab               *2*     
    aba               *3*     
    abb               *3*     
    we want the above data in table to be inserted in below format:
    Assembly Item     Component Item
    a               Aa
    Aa               Aaa
    Aa               Aab
    Aa               Aac
    A               Ab
    Ab               Aba
    Ab               Abb
    Aab               aaba
    Please suggest.
    Thanks,
    Urvashi Arora
    Edited by: user10992307 on 08-May-2012 23:07

    When you look at one row in your source data, there is no way to tell what is the parent item for the component you are looking at.
    So you will have to write a program that walks thru the data and builds parent=child relationship. It will be a tricky program but once that is done, all you have to do is to insert into bom interface tables and Oracle will take care of the rest.
    Oracle BOM interface will take care of building a multi-level structure.
    Sandeep Gandhi

  • Is there a way to "mix" the nodes and leaves of the tree so if they are at the same level, they will display in a specified order.

    Is there a way to "mix" the nodes and leaves of the tree so that even if they are at the same level (1,2,3...), they will display in a specified order (via sort sequence, alphabetical, etc.).
    History:
    We are using the Tree UI element to display/manage a material bom interface. We seem to be running into an issue with displaying the nodes/leaves of the tree.. regardless of the order that the context is built (which is currently the order of the exploded BOM from from CS_BOM_EXPL_MAT_V2), the bom is displayed with the nested boms at the top of each level and the single materials below them. For example. If  TK1 contains Material1, Material2, Material3, Kit1(containing component1, comp2, comp3), Material4, Kit2(containing comp4, comp5, comp6), and Material5 (in this order), the tree will display with the A level node as TK1, the next node as Kit1 (with its subleaves of comp1,comp2,comp3), Kit2(with subleaves of comp4,comp5,comp6), THEN Material1, material2, material3, material4, material5.  Our users are adamant about the items displaying in the correct order (which should be alphabetical based on the description for one report and by location for purposes of inventory for another). I've searched but not been able to locate a similar question. If I've missed it, please point me in the right direction. The users want the tree,  not a "tree" table.  This is our first attempt at the tree, so maybe we're missing something basic?
    TK1
    -Mat1
    -Mat2
    -Mat3
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Mat4
    -Kit2
    --Comp4
    --comp5
    --comp6
    -Material5
    displays as
    TK1
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Kit2
    --Comp4
    --Comp5
    --Comp6
    -Mat1
    -Mat2
    -Mat3
    -Mat4
    -Mat5

    co-workers said example picture is misleading.. we can make the order work if everything is a "folder" but not a mix of "folders" and "files" (if making a visual reference to the windows browser). i.e - a file is represented as an empty folder.
    TK1    
    . Mat1
    . Mat2
    . mat3
    > kit1   
    .. comp1
    .. comp2
    .. comp3
    . mat4
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat5
    displays at
    TK1
    > kit1
    .. comp1
    .. comp2
    .. comp3
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat1
    . mat2
    . mat3
    . mat4
    . mat5
    we can make it work if everything is a folder. This is our current workaround.
    TK1
    > mat1
    > mat2
    > mat3
    v kit1 (when expanded)
    .. comp1
    .. comp2
    .. comp3
    > mat4
    > kit2 (when not expanded)
    > mat5

  • Problem regarding SAP Project System & Material Management

    Hello Experts,
    please check our process as below:
    Order confirms than sales order and project will create
    material of BOM is assigned to any activity in project so these material (RM) will be procured and consumed
    assign activity for all work done on material to produce FG or SFG.
    confirm activity whenever any work done like fabrication done so confirm and its cost comes to WBS.
    than we have to subcontracting process so dispach SFG from this and receive after activity done by third party.
    than more work is done and confirm these activity. than after all work done we get FG in stock. than delivery from project.
    We are facing issue in above business process of our client as below:
    1. process of subcontracting using project system as we are not using production planning. how we get any SFG for subcontracting process.
    2. if we confirm all activities and consume all Raw Materials than how we will get finished good in our project stock for delivery.
    3. after delivery from project how sales order affects with regards to completeness of this sales document.
    Please help for this.
    Note: Remember we are not using PP cos customer require detailed report of these process and capacity planning etc.
    Thanks
    Sunil

    Hi Sunil,
    Assume this is my project structure & attached components. I will procure this components externally. After GRN, This components will be issued to network with 581 Q movement type.
    Now we need to assemble this raw material to produce our FG, As these SFG are in our project stock. What we need to do for assembly process through PS.
    Also throw some light over benefit of using PS-BOM interface ( CN33 ) for attaching material components.
    Project
    WBS
    Network
    Activity A
    Gears
    Qty - 1
    Activity B
    Blades
    Qty - 2
    Activity C
    Stand
    Qty - 1
    Activity D
    Connectors
    Qty - 1
    Regards
    Gaurav Ahuja    

  • IDOC Process Stops Due To System Warning

    Hello Friends,
    Here is the ALE inbound scenario: We are setting up an order BOM interface using idoc BOMORD01. During the test, we found that the idoc has the error status 51 and this was due to a warning message issued by the system. In dialog mode (CS61 or CS62), we press enter to confirm the warning and thereby continue with the transaction. <b>The ALE process treats this API-warning as an error and stops.</b>
    How can this be handled/resolved? Please help me out!
    Thanks,
    Sam

    This turned out to be data problem. Of course, SAP's error message was not helpful.
    We had to report this to SAP and they found the problem after some debugging.

  • Issues with Reprocess Idoc

    Hi all,
    The developement for BOM interface is done.
    it is working fine.But my client extented requirement like this
    after processing IDOC , if there is any status 51 idocs available.
    he will do reprocess from BD87. that time some part of code in FM needs to be triggered.
    I am not able make Difference b/w first IDOC number and Reprocess IDoc number.
    means for keeping conditon , i need one unique differenet between new IDOC and Reprocess IDOC.
    Is there any point to know that properties.
    thanks in Advance,
    regards,
    JBR

    Hi,
    Reprocessing a idoc would not create a new IDoc, only the status of the IDoc would be changed if the error with which it was already occuring has been modified.
    Thanks
    Krithika

  • Object link to STKO_DOC cannot be changed

    Hi Guys,
    I have created document with application winword 6.0 and attached word document, while in changemode  trying to acesess object links in BOM HEADER  and BOM ITEM are in grey filled and for rest of all links I can able to Give Input
    Document type is KPR and In spro Maintained this application
    Object link to STKO_DOC cannot be changed in this transaction
    Object link to STPO_DOC cannot be changed in this transaction
    Kindly help me in this regard
    tks and regards
    murali

    Hello Murali,
    You should attach BOM header and BOM Items links to DIR from BOM interface, you can use the transaction CS02.
    You can attach a document to the BOM header or bom item and it will be visible as an object link in DMS.
    Regards
    Surjit

  • BOMBOS interface "warning" message after changes saved in the BOM.

    Hello,
    We our client is facing an issue, regarding BOM change / Modification in CS02.
    After any modifications saved in the BOM (transaction CS02), in SLG1 transaction system gives u201Cwarning messageu201D as given below.
    1.     Entry already exists in the work list
    For components, system is giving following message.
    2. Item material PPA_FORM_NU001 (Material number) is not assigned to a specification
    We found one note for this u2013 u201Csapnote_0000893616_BOMBOS_Specification not foundu201D, this note is already applied in the program by SAP at 2005.
    Because of this note, program creates the message in SLG1.
    We also found that, in the IMG customization >>>
    Environment Health & Safety > Product Safety > Bill Of Material Transfer > Specify Environment parameter & condition for the parameter u201CBOMBOS_WL_DIALOGu201D parameter value is u201CXu201D. If we remove this value, then system gives error message in the SLG1.
    We want to know,
    1.     Why we have such entries in SLG1?
    2.     What is the goal of this standard BOMBOS interface?
    3.     What is the impact of this warning message in the process of the transaction?
    4.     To solve this, is there any solution?
    Please confirm us.
    Thanks in advance.
    Edited by: Hemant Baviskar on Apr 27, 2009 11:25 AM
    Hello, Can any body help me on this?
    Thanks

    Hello,
    To rectify this issue, please refer the SAP Note - sapnote_0000683420 and make the changes accordingly.
    Thanks
    Best Regards

  • Bom And Routing Import interface errors Help needed

    Hi All,
    I am using bom and Routing Interface to load the Bom and Routing Header.papulating the BOM_INVENTORY_COMPS_INTERFACE,BOM_OP_SEQUENCES_INTERFACE,and BOM_OP_RESOURCES_INTERFACE tables BOM header and Components are created sucessfully but routing is failed with process flag 3.the errorr i am getting is You cannot update or delete operation sequences when there is no routing for the assembly item &ASSEBLY_ITEM_NAME. (ASSEMBLY_ITEM_NAME=TESTITEMBOM) (ORGANIZATION_CODE) and
    This record received an error status since a severe error occurred in the operation sequence 10 while performing user unique index conversions."
    please let me know any api is avilable to load ROUTING Components
    Thanks in advance

    Hi,
    Try following
    step 1. Insert routing header (bom_op_routings_interface) : Run Interface
    step 2. Insert routing lines (bom_op_sequences_interface) with correct reference to routing_sequence_id: Run Interface
    step 3. Insert all resource lines (bom_op_resources_interface) with correct reference to operation_sequence_id, routing_sequence_id , Run Interface.
    Thanks,
    Hrishi

  • Interface to send the BOM-DMS link to Other Legacy System.

    Dear All,
    I am Looking to MAP the Interface Between 2 SAP Systems to Send the Information Related to Document No, Version, and other Information from BOM.
    I am unable to identify the table where i can get this details.
    Kindly help on this.. this is very urgent requirement.
    Thanks with Regards,
    Baya JO

    Hi Christoph,
    Thanks for guidance. but DOCMAS is working for Material Master Record and it is working on CV01N.
    Below are the Critical point where i am facing the problem:
    1. The IDOC is not generating when any changes happended in existing Document Info
        Record. is their any separate way availble to trigger the IDOC.
    2. Regarding the DMS for Bill Of Material, how to trigger the IDOC for Document info Record?
    I will give Sample BP:
    Client is working on Engineering product, so they have the Desing Documents for Every Part as well Assenbly Desing Document for each Bill of Material (Header and Component). And Same Design Document No is Applicable for the Multiple Material Products and it will get added in to Existing Document Info Records (CV02N).
    Now I needs to Genrate the IDOC to Multiple Systems in below Cases:
    1. CV01N.
    2. CV02N
    3. After Document Info Records get linked to BOM.
    hope you get clear picture.
    Thanks With Records,
    Baya Jo

  • E Business suite -BOM and interfaces

    I have spent 29 yrs in Engg/Mfg industry. I have found that Oracle apps ERP Business suite BOM module is very poorly conceived . It is rich and robust in other areas but in design activity of business function it is not good.It needs lot of change. It is becoming useful only when we customize it. Some of the concern points are :
    1.Too many identifications and dummy nos.
    2. No facility to generate long lead BOM
    3.No facility of automatic discounting of long lead items
    4.No discretization of module
    5.No facility for advance mfg item generation
    many like this................
    With all my due regards to Oracle I do not get a feeling that a hardcore working designer's brain has gone into it.
    If Oracle needs my help I am ready to extend my help in sharing my practical views to make it more rich.

    Hussein,
    Database Version is RDBMS 11.2.0.2; Oracle EBS Version is R-12.1.3; OS is HP-UX Itanium 64-Bit Version 11.31 (for DB and Apps Tier).
    We bounced the application services after doing the above changes and running AutoConfig.
    We checked access_log and the only information that we can find there is
    [29/Nov/2011:15:15:05 -0600] "GET /OA_HTML/portlets/WSRPBaseService?WSDL HTTP/1.1" 403 242 0 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET4.0C; .NET4.0E)"
    [Tue Nov 29 16:08:54 2011] [error] client denied by server configuration: /OA_HTML/portlets
    [Tue Nov 29 16:08:58 2011] [error] client denied by server configuration: /OA_HTML/portlets/WSRPBaseService
    [Tue Nov 29 16:25:11 2011] [error] client denied by server configuration: /OA_HTML/providers/OAFrameworkProviderPlease let us know if we have to look for something specific in apache logs files.
    Edited by: Deepak on Nov 30, 2011 6:56 AM

  • URGENT : TAS Interface - BOM SO create a IDOC Automatically

    Hi,
    We have a situation where I am not able to configure the system to trigger an IDOC automatically.
    1. Unable assign load IDs to the exploded BOM items in SO. I have added the material / sales org / plant to make it TAS relevant. Yet I am getting the message that the item is not TAS relevant. Adding to this the same configuration is working if the item is not a BOM.
    2. When we create a SO in both the above cases I would like the SO to automatically have the output type and medium as ALE and the Logical system to be populated. So when the Order is saved an IDOC will be triggered to an external Logical system. Currently i have to manually enter the output type , and still even the IDOC isnot triggered. I have configured the Output type(OIOR) to the IDOC Include.
    Any help to fill in any missing configuration would be helpful. Please feel free to ask questions, as this is on HIGH PRIORITY.
    Thanks and Regards,
    Arnab

    >
    Abir Banerjee wrote:
    > Check this BADI. See if it helps.
    >  BAdI for Processing Inbound Licenses
    >
    > Path: SPRO->SAP GTS->General Settings->BADI For SAP GTS->BAdI for Processing Inbound Licenses
    Abir,
      Thanks for the response, All my license information is coming from the 3rd party, so I don't need any sort of logic or manipulation on GTS side. All i have to do is blindly create a license, so BADI doesn't help me.
    All I need is a function module/ BAPI  that can accept the licence information as input and create a license.
    Also I'm looking to see if there is any standard Idoc to hold the licence data (Like orders04 for sales order...)
    Thanks for your time
    -Amit.

  • Error while creating BOM

    Hi
    iam facing error while creating, changing and display BOM.
    Error: Status MHCO of the user interface SAPLCSDI missing.
    rgads

    Dear,
    MHCO - BOM item screen GUI status..Are you using any Alternative item?
    Have you applied any new patch in the system?
    Contact ABAPer, can give more details
    In SAP service place serach for this interface program,,,you will get many notes on this.

  • Message type BOMMAT (change BOM)

    Hello Guru,
    I have some question and need help, when i try a standard transaction CS02, try to change a BOM material existing for example, the base quantity of the BOM was 650, i enter new data as 655, but suddenly retain the original Qty as 650 and save the changes as SAP will accept the changes i've done (BOM for material 2456 changed) but eventual i have not change any value to the original BOM. SO it mean this is standard SAP funtionality for CS02.
    But when we use an interface using message type BOMMAT a standard SAP message tpye, we have created an IDOC using this message type and same data as the original was maintain to it, to be more exact we plan to change a BOM thru this IDOC but all the data we have is the same value of the original BOM, so we expect no error could be encounter of this IDOC since in standard CS02, changing of BOM even same value was inidicated did not had error message encountered when saving.
    But thru our process, when we try to process the IDOC with message type BOMMAT in program RBDAPP01 (BD20) the idoc did not pass it when into status 51(Error when saving BOM. Please see the application log.) and when we check the BOM it has duplicate value upon executing the program we able to fix it when we delete the duplicate line segment in the IDOC and reprocess it once again.
    my question is why in standard message type BOMMAT had encountered error when processing when we try to make change of BOM even the same value is carried out by the IDOC, and why in standard CS02 saving a change of BOm with same value as it is SAP accept the process? Please help and clear the process.
    Any inputs R.Brahamankar and Vivek
    Thanks
    Edited by: Ryan on Feb 9, 2009 9:23 AM

    BOMMAT  and process code BOMM

  • Problem in a Interface

    Hi....
    I have an Interface which actually downloads the "MATERIAL MASTER DATA" from SAP to a flat file.
    The current o/p of the interface looks like:
    MAT NO. MAT DESCRIPTION Subst. Mat no......
    Now they askd me to add 3 more fields to that existing program.
    those are:
    1.OUTSERT No.
    2.MEDICATION PART No.
    3.AWP PRICE.
    So I have written 2 FORMS to retrieve these things.
    1st FORM is for getting OUTSERT and MED. PART No.
    2nd FORM for AWP PRICE.
    (1) OUTSERT: This we get from STPO-IDNRK field. similarly
    (2) MED. PART NO.: This also is from STPO-IDNRK field.
    The method I used for getting these two things is:
    Basically the OUTSERT and MED PART NO. is nothing but the BOM COMPONENTS [STPO-IDNRK].
    There is a simple difference between these two things:
    If the BOM Component contains 'O' or 'OP' in that value then it is taken as OUTSERT.
    For Eg: If STPO-IDNRK value is 73543O or 98723OP then it is OUTSERT.
    and If STPO-IDNRK value is 65489M or 68785MP then it is MED. PART NO.
    and we have two conditions to be satisfied to calculate these two things,
    1.The Material Group[MARA-MATKL] should be 'OST' or 'OSP'.
    means MARA-MATKL = 'OST' or 'OSP'.
    2.The Alternative BOM Text[STKO-STKTX] should be 'UNRESTRICTED'.
    means STKO-STKTX = 'UNRESTRICTED'.
    Coming to AWP PRICE, it should be get from field RATE[KONP-KBETR].
    I have used tables STKO, STPO to get Outsert and Med. Part No and A505, KONP for AWP Price...
    I have highlighted the part of the code which I have included in the existing program....
    But there are some problems with that code...so i'm not getting results....
    Plz look at the code and let me know wher I've gone wrong...
    Thanks much,
    The code is:
    REPORT Z02.
    Table definitions ----------------------------------------------------
    TABLES: AUSP, " Characteristic Values
    CABN, " Characteristic
    CAWN, " Characteristic values
    CAWNT, " Value Texts
    LFA1, " Vendor master (general section)
    MAKT, " Material Descriptions
    MARA, " Material Master: General Data
    MARM, " Units of Measure
    MBEW, " Material Valuation
    MVKE, " Material Master: Sales Data
    TVMST, " Materials: SD Status: Texts
    TVM3T, " Material pricing group 3: Description
    TVM5T, " Material pricing group 5: Description
    KOTD001, " Conditions: Substitution - Sample Structure
    KONDD, " Material Substitution - Data Division
    <b>mast,
    stko,
    stpo,
    a505,
    konp.</b>
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TITLE1.
    SELECT-OPTIONS: S_BWKEY FOR MBEW-BWKEY
    MEMORY ID DEFAULT_BWKEY OBLIGATORY
    No-Extension No Intervals.
    SELECTION-SCREEN END OF BLOCK B1.
    PARAMETERS:
    MATLFILE(100) LOWER CASE OBLIGATORY
    DEFAULT '/sapinterface/ebusiness/matlfile'.
    Constants ------------------------------------------------------------
    CONSTANTS:
    ZERO_DEC_3 TYPE P DECIMALS 3 VALUE 0,
    ZEROS(9) TYPE N VALUE 0,
    REC_TYPE(2) VALUE 'MM',
    DELIMETER_QUOTE VALUE '"',
    BEGIN OF DEFAULTS,
    BWTAR LIKE MBEW-BWTAR VALUE SPACE,
    VKORG LIKE MVKE-VKORG VALUE '1000',
    VTWEG LIKE MVKE-VTWEG VALUE '10',
    END OF DEFAULTS.
    constants:
    c_uncpath_material(43)
    value '/sapinterface/unconverted/zvppo102_matlfile',
    c_final_path(44)
    value '/sapinterface/ebusiness/' ,
    c_uncpath(26)
    value '/sapinterface/unconverted/' .
    Data Elements --------------------------------------------------------
    DATA: PROGNAME LIKE SY-REPID,
    PROG_START_DATE LIKE SY-DATUM,
    PROG_START_TIME LIKE SY-UZEIT,
    WRITE_COUNT TYPE I,
    OUTFILE(100),
    WK_STPRS LIKE MBEW-STPRS,
    WK_AUSP LIKE AUSP,
    WK_CABN LIKE CABN,
    WK_MARA LIKE MARA,
    WK_MARM LIKE MARM.
    DATA: BEGIN OF MATERIAL_DATA occurs 0,
    DELIMITER_START,
    REC_TYPE LIKE REC_TYPE,
    MATNR LIKE MARA-MATNR,
    MAKTX LIKE MAKT-MAKTX,
    SMATN LIKE KONDD-SMATN,
    SMATN_START LIKE KOTD001-DATAB,
    SMATN_END LIKE KOTD001-DATBI,
    VMSTA LIKE MVKE-VMSTA,
    VMSTB LIKE TVMST-VMSTB,
    LAEDA LIKE MARA-LAEDA,
    AENAM LIKE MARA-AENAM,
    VENDOR_NUM LIKE MARA-MFRNR,
    VENDOR_NM LIKE LFA1-NAME1,
    PROD_LINE_CD LIKE MVKE-MVGR5,
    PROD_LINE_DSC(20),
    DEA_SCH_ID LIKE MVKE-MVGR3,
    DEA_SCH_DSC(20),
    NORMT LIKE MARA-NORMT,
    STPRS(13),
    LOGO_DESC(30),
    PRESCRIPT_FLAG(1),
    THER_CLASS(5),
    THER_CLASS_DSC(30),
    THER_SUB_CLASS(5),
    THER_SUB_CLASS_DSC(30),
    THER_EQUIV(2),
    ITEM_PACKAGE_SIZE(10),
    ITEM_PACKAGE_TYPE(2),
    DOSAGE_FORM(3),
    DOSAGE_FORM_DSC(30),
    DOSE_ADMIN(3),
    DOSE_ADMIN_DSC(30),
    BOTTLE_SIZE(6),
    BRAND_NAME(25),
    BRAND_DISTR(20),
    BRAND_COLOR(20),
    BRAND_SHAPE(15),
    ANDA_DATE LIKE SY-DATUM,
    ANDA_NUMBER(9),
    BIO_STUDY,
    DESI_INDICATOR,
    DRUG_TERM_DT LIKE SY-DATUM,
    FDA_APPRV_DT LIKE SY-DATUM,
    ITEM_REG_NM(30),
    MARKET_DT LIKE SY-DATUM,
    PRODUCT_COLOR(20),
    PRODUCT_FLAVOR(15),
    PRODUCT_SHAPE(15),
    PRODUCT_STRENGTH(18),
    MEINS LIKE MARA-MEINS,
    BEGIN OF BASE_MEASURES,
    WEIGHT(15), "* like mara-brgew
    WT_UNIT LIKE MARA-GEWEI,
    VOLUM(15), "* like mara-volum,
    VOL_UNIT LIKE MARA-VOLEH,
    PKG_LENGTH(15), "* like mara-laeng
    PKG_WIDTH(15), "* like mara-breit
    PKG_HEIGHT(15), "* like mara-hoehe
    DIM_UNIT LIKE MARA-MEABM,
    END OF BASE_MEASURES,
    INR_CRTN_COUNT(6), "* like marm-umrez
    INR_CRTN_MEASURES LIKE MATERIAL_DATA-BASE_MEASURES,
    CASE_COUNT(6), "* like marm-umrez
    CASE_MEASURES LIKE MATERIAL_DATA-BASE_MEASURES,
    ITEM_NOTE(500),
    DELIMITER_END,
    <b>component like stpo-idnrk,
    mguide    like stpo-idnrk,
    awp       like konp-kbetr,</b>
    END OF MATERIAL_DATA.
    DATA : F_M_uncFILE(100) . " Material file(unconverted)
    DATA: W_BRM(3) Value 'BRM'.
    <b>data: str1(2) type c value 'O',
    str2(2) type c value 'OP',
    str3(2) type c value 'M',
    str4(2) type c value 'MP'.</b>
    <b>data: begin of i_material,
            matnr like mara-matnr,
            rate  like konp-kbetr,
          end of i_material.
    data: begin of i_outsert occurs 0,
            matnr like mara-matnr,
            stktx like stko-stktx,
            component like stpo-idnrk,
          end of i_outsert.</b>
    INITIALIZATION.
    *--- Initialize text fields for selection screen.
    TITLE1 = 'Set Default'.
    SET PARAMETER ID 'DEFAULT_BWKEY' FIELD W_BRM.
    START-OF-SELECTION.
    PERFORM INITIAL_STUFF.
    PERFORM MAIN_SELECT.
    PERFORM WRAPUP.
    Select all material master records for finished products.
    FORM MAIN_SELECT.
    SELECT MATNR
    BISMT
    LAEDA
    AENAM
    MEINS
    BRGEW
    GEWEI
    VOLUM
    VOLEH
    LAENG
    BREIT
    HOEHE
    MEABM
    NORMT
    INTO (MATERIAL_DATA-MATNR,
    MATERIAL_DATA-SMATN,
    MATERIAL_DATA-LAEDA,
    MATERIAL_DATA-AENAM,
    MATERIAL_DATA-MEINS,
    WK_MARA-BRGEW,
    MATERIAL_DATA-BASE_MEASURES-WT_UNIT,
    WK_MARA-VOLUM,
    MATERIAL_DATA-BASE_MEASURES-VOL_UNIT,
    WK_MARA-LAENG,
    WK_MARA-BREIT,
    WK_MARA-HOEHE,
    MATERIAL_DATA-BASE_MEASURES-DIM_UNIT,
    MATERIAL_DATA-NORMT)
    FROM MARA
    WHERE MTART = 'FERT' "* Finished product
    OR MTART = 'HAWA'
    ORDER BY MATNR.
    Assign default values for fields which may not be available.
    PERFORM ASSIGN_DEFAULTS.
    Get related data from other tables.
    PERFORM GET_MATERIAL_DESCRIPTION.
    PERFORM GET_STANDARD_PRICE.
    PERFORM GET_MVKE.
    PERFORM GET_MARM.
    PERFORM GET_AUSP.
    PERFORM GET_SUBSTITUTE_MATNR.
    PERFORM GET_BASIC_DATA_TEXT.
    PERFORM GET_VENDOR_NAME.
    <b>perform get_outsert.
    perform get_awp.</b>
    SEARCH MATERIAL_DATA FOR '"'.
    IF SY-SUBRC = 0.
    REPLACE '"' WITH ' ' INTO MATERIAL_DATA.
    ENDIF.
    MATERIAL_DATA-DELIMITER_START = DELIMETER_QUOTE.
    MATERIAL_DATA-DELIMITER_END = DELIMETER_QUOTE.
    Write output record.
    ADD 1 TO WRITE_COUNT.
    TRANSFER MATERIAL_DATA TO F_M_UNCFILE .
    Reinitialize work variables.
    CLEAR: MATERIAL_DATA,
    WK_STPRS,
    WK_AUSP,
    WK_CABN,
    WK_MARA,
    WK_MARM.
    ENDSELECT.
    ENDFORM. " main_select
    Assign numeric fields to character fields for output.
    FORM ASSIGN_DEFAULTS.
    MATERIAL_DATA-REC_TYPE = REC_TYPE.
    MATERIAL_DATA-BASE_MEASURES-WEIGHT = WK_MARA-BRGEW.
    MATERIAL_DATA-BASE_MEASURES-VOLUM = WK_MARA-VOLUM.
    MATERIAL_DATA-BASE_MEASURES-PKG_LENGTH = WK_MARA-LAENG.
    MATERIAL_DATA-BASE_MEASURES-PKG_WIDTH = WK_MARA-BREIT.
    MATERIAL_DATA-BASE_MEASURES-PKG_HEIGHT = WK_MARA-HOEHE.
    Set character fields to 0 in case not found on DB.
    MATERIAL_DATA-ANDA_NUMBER = ZEROS. "* ???
    MATERIAL_DATA-ITEM_PACKAGE_SIZE = 0.
    MATERIAL_DATA-INR_CRTN_COUNT = 0.
    MATERIAL_DATA-CASE_COUNT = 0.
    MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT = ZERO_DEC_3.
    MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM = ZERO_DEC_3.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH = ZERO_DEC_3.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH = ZERO_DEC_3.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT = ZERO_DEC_3.
    MOVE-CORRESPONDING MATERIAL_DATA-INR_CRTN_MEASURES
    TO MATERIAL_DATA-CASE_MEASURES.
    ENDFORM. " assign_defaults
    FORM GET_VENDOR_NAME.
    SELECT SINGLE NAME1
    INTO MATERIAL_DATA-VENDOR_NM
    FROM LFA1
    WHERE LIFNR = MATERIAL_DATA-VENDOR_NUM.
    ENDFORM. " get_vendor_name
    FORM GET_OUTSERT *
    <b>form get_outsert.
    select matnr from mara into corresponding fields of table material_data
                 where mtart = 'FERT' or mtart = 'HAWA'.
         select didnrk amatnr
             into (i_outsert-component, i_outsert-matnr)
                from stpo as d
               inner join stko as c
                     on dstlnr = cstlnr
               inner join mast as b
                     on cstlnr = bstlnr
               inner join mara as a
                     on bmatnr = amatnr
              for all entries IN material_data
                   where a~matnr = material_data-matnr.
           append i_outsert.
         endselect.
        check i_outsert-stktx = 'UNRESTRICTED'.
      if ( i_outsert-component cs str1 ) or ( i_outsert-component cs str2 ).
               move i_outsert-component to material_data-component.
               append material_data.
      elseif ( i_outsert-component cs str3 ) or
                             ( i_outsert-component cs str4 ).
               move i_outsert-component to material_data-mguide.
               append material_data.
      endif.
          modify material_data transporting component
                          where matnr = i_outsert-matnr.
    endform.                               "get_outsert</b>
    FORM GET_AWP *
    <b>form get_awp.
    select matnr from mara into corresponding fields of table material_data
                  where mtart = 'FERT' or mtart = 'HAWA'.
        select bmatnr ckbetr into (i_material-matnr, i_material-rate)
               from konp as c
              inner join a505 as b
                    on cknumh = bknumh
              inner join mara as a
                    on bmatnr = amatnr
              for all entries IN material_data
                  where a~matnr = material_data-matnr
                    and b~kappl = 'V'
                    and b~kschl = 'ZR10'
                    and b~vkorg = '1000'
                    and b~pltyp = '01'
                    and b~datbi > sy-datum
                    and b~datab < sy-datum.
             append i_material.
        endselect.
            move i_material-rate to material_data-awp.
            append material_data.
            modify material_data transporting awp
                  where matnr = i_material-matnr.
    endform.                               "get_awp</b>
    FORM GET_MATERIAL_DESCRIPTION.
    SELECT SINGLE MAKTX
    INTO MATERIAL_DATA-MAKTX
    FROM MAKT
    WHERE MATNR = MATERIAL_DATA-MATNR
    AND SPRAS = SY-LANGU.
    ENDFORM. " get_material_description
    FORM GET_STANDARD_PRICE.
    data: l_vprsv like mbew-vprsv,
    l_verpr like mbew-verpr.
    clear: l_Vprsv, l_verpr.
    SELECT SINGLE VPRSV VERPR stprs
    into (l_vprsv, l_verpr, WK_stprs)
    FROM MBEW
    WHERE MATNR = MATERIAL_DATA-MATNR
    AND BWKEY IN S_BWKEY
    AND BWTAR = DEFAULTS-BWTAR.
    the need to change the assumption
    that standard price is housed in MBEW-STPRS. This does not apply to
    plant US18, so need to check to see what the price control field is
    (MBEW-VPRSV) and if it is S, use standard price, if it is V, use the
    moving average price.
    IF L_VPRSV = 'V'.
    WK_STPRS = L_VERPR.
    ENDIF.
    MATERIAL_DATA-STPRS = WK_STPRS.
    ENDFORM. " get_standard_price
    FORM GET_MVKE.
    SELECT SINGLE MVGR3
    VMSTA
    MVGR5
    INTO (MATERIAL_DATA-DEA_SCH_ID,
    MATERIAL_DATA-VMSTA,
    MATERIAL_DATA-PROD_LINE_CD)
    FROM MVKE
    WHERE MATNR = MATERIAL_DATA-MATNR
    AND VKORG = DEFAULTS-VKORG
    AND VTWEG = DEFAULTS-VTWEG.
    IF SY-SUBRC = 0.
    PERFORM GET_DEA_ID_DSC.
    PERFORM GET_PROD_LINE_DSC.
    PERFORM GET_VMSTB.
    ENDIF.
    ENDFORM. " get_mvke
    FORM GET_DEA_ID_DSC.
    SELECT SINGLE BEZEI
    INTO MATERIAL_DATA-DEA_SCH_DSC
    FROM TVM3T
    WHERE SPRAS = SY-LANGU
    AND MVGR3 = MATERIAL_DATA-DEA_SCH_ID.
    ENDFORM. " get_dea_id_dsc
    FORM GET_PROD_LINE_DSC.
    SELECT SINGLE BEZEI
    INTO MATERIAL_DATA-PROD_LINE_DSC
    FROM TVM5T
    WHERE SPRAS = SY-LANGU
    AND MVGR5 = MATERIAL_DATA-PROD_LINE_CD.
    ENDFORM. " form get_prod_line_dsc
    FORM GET_VMSTB.
    SELECT SINGLE VMSTB
    INTO MATERIAL_DATA-VMSTB
    FROM TVMST
    WHERE SPRAS = SY-LANGU
    AND VMSTA = MATERIAL_DATA-VMSTA.
    ENDFORM. " form get_vmstb
    Get measurements, etc. for inner carton and case from the MARM table.
    FORM GET_MARM.
    SELECT MEINH " alternative unit of measure for stockkeeping unit
    UMREZ " numerator for conversion to base units of measure
    LAENG " length
    BREIT " width
    HOEHE " height
    MEABM " unit of dimension for length/width/height
    VOLUM " volume
    VOLEH " volume unit
    BRGEW " gross weight
    GEWEI " unit of weight
    INTO (WK_MARM-MEINH,
    WK_MARM-UMREZ,
    WK_MARM-LAENG,
    WK_MARM-BREIT,
    WK_MARM-HOEHE,
    WK_MARM-MEABM,
    WK_MARM-VOLUM,
    WK_MARM-VOLEH,
    WK_MARM-BRGEW,
    WK_MARM-GEWEI)
    FROM MARM
    WHERE MATNR = MATERIAL_DATA-MATNR
    AND MEINH IN ('CS', 'PAK').
    PERFORM EVALUATE_MEINH.
    CLEAR WK_MARM.
    ENDSELECT.
    ENDFORM. " get_marm
    Populate output record fields based on alternative unit of measure.
    FORM EVALUATE_MEINH.
    CASE WK_MARM-MEINH.
    WHEN 'CS'.
    MATERIAL_DATA-CASE_COUNT = WK_MARM-UMREZ.
    MATERIAL_DATA-CASE_MEASURES-WEIGHT = WK_MARM-BRGEW.
    MATERIAL_DATA-CASE_MEASURES-WT_UNIT = WK_MARM-GEWEI.
    MATERIAL_DATA-CASE_MEASURES-VOLUM = WK_MARM-VOLUM.
    MATERIAL_DATA-CASE_MEASURES-VOL_UNIT = WK_MARM-VOLEH.
    MATERIAL_DATA-CASE_MEASURES-PKG_LENGTH = WK_MARM-LAENG.
    MATERIAL_DATA-CASE_MEASURES-PKG_WIDTH = WK_MARM-BREIT.
    MATERIAL_DATA-CASE_MEASURES-PKG_HEIGHT = WK_MARM-HOEHE.
    MATERIAL_DATA-CASE_MEASURES-DIM_UNIT = WK_MARM-MEABM.
    WHEN 'PAK'.
    MATERIAL_DATA-INR_CRTN_COUNT = WK_MARM-UMREZ.
    MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT = WK_MARM-BRGEW.
    MATERIAL_DATA-INR_CRTN_MEASURES-WT_UNIT = WK_MARM-GEWEI.
    MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM = WK_MARM-VOLUM.
    MATERIAL_DATA-INR_CRTN_MEASURES-VOL_UNIT = WK_MARM-VOLEH.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH = WK_MARM-LAENG.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH = WK_MARM-BREIT.
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT = WK_MARM-HOEHE.
    MATERIAL_DATA-INR_CRTN_MEASURES-DIM_UNIT = WK_MARM-MEABM.
    ENDCASE.
    ENDFORM. " evaluate_meinh
    Get characterics from the AUSP & CABN tables.
    FORM GET_AUSP.
    *--- Get object number for classification lookup.
    data: l_objek like ausp-objek.
    clear l_objek.
    select cuobj into l_objek from inob up to 1 rows
    where klart = '001'
    and obtab = 'MARA'
    and objek = material_data-matnr.
    endselect.
    SELECT A~ATINN " internal characteristic
    A~ATWRT " characteristic value
    A~ATAWE " unit of measurement
    A~ATAW1 " unit of measurement
    A~ATFLV " internal floating point from (value if date)
    C~ATNAM " characteristic name
    INTO (WK_AUSP-ATINN,
    WK_AUSP-ATWRT,
    WK_AUSP-ATAWE,
    WK_AUSP-ATAW1,
    WK_AUSP-ATFLV,
    WK_CABN-ATNAM)
    FROM AUSP AS A INNER JOIN
    CABN AS C ON AATINN = CATINN
    where a~objek = l_objek
    AND C~ATNAM LIKE 'MM_%'
    AND A~LKENZ = SPACE.
    PERFORM EVALUATE_CHARACTERISTIC.
    ENDSELECT.
    ENDFORM. " get_ausp
    Populate output record fields based on characteristic type.
    FORM EVALUATE_CHARACTERISTIC.
    DATA: SIZE_TEMP TYPE I.
    CASE WK_CABN-ATNAM.
    when 'MM_BOTTLE_SIZE'.
    MATERIAL_DATA-BOTTLE_SIZE = WK_AUSP-ATWRT.
    when 'MM_BRAND_COLOR'.
    MATERIAL_DATA-BRAND_COLOR = WK_AUSP-ATWRT.
    WHEN 'MM_BRAND_DISTRIBUTOR'.
    MATERIAL_DATA-BRAND_DISTR = WK_AUSP-ATWRT.
    when 'MM_BRAND_NAME'.
    MATERIAL_DATA-BRAND_NAME = WK_AUSP-ATWRT.
    when 'MM_BRAND_SHAPE'.
    MATERIAL_DATA-BRAND_SHAPE = WK_AUSP-ATWRT.
    WHEN 'MM_DOSAGE_FORM'.
    MATERIAL_DATA-DOSAGE_FORM = WK_AUSP-ATWRT.
    PERFORM GET_CHARACTERISTIC_DSC
    USING WK_AUSP-ATINN
    WK_AUSP-ATWRT
    CHANGING MATERIAL_DATA-DOSAGE_FORM_DSC.
    when 'MM_DOSE_ADMINISTRATION'.
    MATERIAL_DATA-DOSE_ADMIN = WK_AUSP-ATWRT.
    PERFORM GET_CHARACTERISTIC_DSC
    USING WK_AUSP-ATINN
    WK_AUSP-ATWRT
    CHANGING MATERIAL_DATA-DOSE_ADMIN_DSC.
    WHEN 'MM_ITEM_PACKAGE_SIZE'.
    SIZE_TEMP = WK_AUSP-ATFLV.
    MATERIAL_DATA-ITEM_PACKAGE_SIZE = SIZE_TEMP.
    WHEN 'MM_ITEM_PACKAGE_TYPE'.
    MATERIAL_DATA-ITEM_PACKAGE_TYPE = WK_AUSP-ATWRT.
    when 'MM_LOGO_DESC'.
    MATERIAL_DATA-LOGO_DESC = WK_AUSP-ATWRT.
    when 'MM_PRESCRIPTION_FLAG'.
    MATERIAL_DATA-PRESCRIPT_FLAG = WK_AUSP-ATWRT.
    when 'MM_THERAPEUTIC_CLASS'.
    MATERIAL_DATA-THER_CLASS = WK_AUSP-ATWRT.
    PERFORM GET_CHARACTERISTIC_DSC
    USING WK_AUSP-ATINN
    WK_AUSP-ATWRT
    CHANGING MATERIAL_DATA-THER_CLASS_DSC.
    when 'MM_THERAPEUTIC_SUB_CLASS'.
    MATERIAL_DATA-THER_SUB_CLASS = WK_AUSP-ATWRT.
    PERFORM GET_CHARACTERISTIC_DSC
    USING WK_AUSP-ATINN
    WK_AUSP-ATWRT
    CHANGING MATERIAL_DATA-THER_SUB_CLASS_DSC.
    WHEN 'MM_THERAPEUTIC_RATING'.
    MATERIAL_DATA-THER_EQUIV = WK_AUSP-ATWRT.
    when 'MM_ANDA_DATE'.
    PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
    CHANGING MATERIAL_DATA-ANDA_DATE.
    when 'MM_ANDA_NUMBER'.
    MATERIAL_DATA-ANDA_NUMBER = WK_AUSP-ATWRT.
    when 'MM_BIO_STUDY'.
    MATERIAL_DATA-BIO_STUDY = WK_AUSP-ATWRT.
    when 'MM_DESI_INDICATOR'.
    MATERIAL_DATA-DESI_INDICATOR = WK_AUSP-ATWRT.
    when 'MM_DRUG_TERMINATION_DATE'.
    PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
    CHANGING MATERIAL_DATA-DRUG_TERM_DT.
    when 'MM_FDA_APPROVAL_DATE'.
    PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
    CHANGING MATERIAL_DATA-FDA_APPRV_DT.
    when 'MM_ITEM_REGULATORY_NAME'.
    MATERIAL_DATA-ITEM_REG_NM = WK_AUSP-ATWRT.
    when 'MM_MARKET_DATE'.
    PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
    CHANGING MATERIAL_DATA-MARKET_DT.
    when 'MM_PRODUCT_COLOR'.
    MATERIAL_DATA-PRODUCT_COLOR = WK_AUSP-ATWRT.
    when 'MM_PRODUCT_FLAVOR'.
    MATERIAL_DATA-PRODUCT_FLAVOR = WK_AUSP-ATWRT.
    when 'MM_PRODUCT_SHAPE'.
    MATERIAL_DATA-PRODUCT_SHAPE = WK_AUSP-ATWRT.
    when 'MM_PRODUCT_STRENGTH'.
    MATERIAL_DATA-PRODUCT_STRENGTH = WK_AUSP-ATWRT.
    WHEN 'MM_VENDOR'.
    MATERIAL_DATA-VENDOR_NUM = WK_AUSP-ATWRT.
    ENDCASE.
    CLEAR SIZE_TEMP.
    ENDFORM. " evaluate_characteristic
    Get descriptive text from CAWN & CAWNT for characteristics.
    FORM GET_CHARACTERISTIC_DSC USING PARM_ATINN
    PARM_ATWRT
    CHANGING PARM_DSC_TEXT.
    CLEAR PARM_DSC_TEXT.
    SELECT SINGLE ATWTB
    INTO PARM_DSC_TEXT
    FROM CAWN AS C1 INNER JOIN
    CAWNT AS C2 ON C1ATINN = C2ATINN
    AND C1ATZHL = C2ATZHL
    WHERE C1~ATINN = PARM_ATINN
    AND C1~ATWRT = PARM_ATWRT
    AND C2~SPRAS = SY-LANGU
    AND C2~ADZHL = 0.
    ENDFORM. " get_characteristic_dsc
    Call function CTCV_CONVERT_FLOAT_TO_DATE to convert floating point
    number to a date in yyyymmdd format.
    form convert_to_date using date
    changing conv_date.
    clear conv_date.
    data: wrk_date(30) type c."Format YYYYMMDD changing it to MMDDYYYY
    call function 'CTCV_CONVERT_FLOAT_TO_DATE'
    EXPORTING
    float = date
    IMPORTING
    date = wrk_date
    EXCEPTIONS
    others = 1.
    CONV_DATE = WRK_DATE.
    ENDFORM. " convert_to_date
    Get substitute material number.
    FORM GET_SUBSTITUTE_MATNR.
    SELECT SINGLE SMATN
    DATAB
    DATBI
    INTO (MATERIAL_DATA-SMATN,
    MATERIAL_DATA-SMATN_START,
    MATERIAL_DATA-SMATN_END)
    FROM KOTD001 INNER JOIN
    KONDD ON KOTD001~KNUMH = KONDD~KNUMH
    WHERE KAPPL = 'V' "* Sales/Distribution
    AND KSCHL = 'A001' "* Material Entered
    AND MATWA = MATERIAL_DATA-MATNR
    AND DATBI >= SY-DATUM
    AND DATAB <= SY-DATUM
    AND SUGRD = SPACE.
    ENDFORM. " get_substitute_matnr.
    Get basic data text for material item note.
    If this is longer than 500 bytes, it will be truncated at 500.
    FORM GET_BASIC_DATA_TEXT.
    DATA: BEGIN OF TEXT_HEADER.
    INCLUDE STRUCTURE THEAD. "* SAPscript: Text Header
    DATA: END OF TEXT_HEADER.
    DATA: BEGIN OF TEXT_LINES OCCURS 100.
    INCLUDE STRUCTURE TLINE. "* SAPscript: text lines
    DATA: END OF TEXT_LINES.
    DATA: ITEM_NOTE_LENGTH TYPE I.
    Set up text header for call to READ_TEXT.
    TEXT_HEADER-TDOBJECT = 'MATERIAL'.
    TEXT_HEADER-TDNAME = MATERIAL_DATA-MATNR.
    TEXT_HEADER-TDID = 'GRUN'. "* Basic data text
    TEXT_HEADER-TDSPRAS = SY-LANGU.
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = TEXT_HEADER-TDID
    LANGUAGE = TEXT_HEADER-TDSPRAS
    NAME = TEXT_HEADER-TDNAME
    OBJECT = TEXT_HEADER-TDOBJECT
    ARCHIVE_HANDLE = 0
    IMPORTING
    HEADER =
    TABLES
    LINES = TEXT_LINES
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    CASE SY-SUBRC.
    WHEN 0.
    LOOP AT TEXT_LINES.
    IF SY-TABIX = 1.
    MATERIAL_DATA-ITEM_NOTE = TEXT_LINES-TDLINE.
    ELSE.
    Pass up to 500 bytes to Siebel.
    ITEM_NOTE_LENGTH = STRLEN( MATERIAL_DATA-ITEM_NOTE ).
    IF ITEM_NOTE_LENGTH > 498.
    EXIT.
    ELSE.
    CONCATENATE MATERIAL_DATA-ITEM_NOTE
    TEXT_LINES-TDLINE
    INTO MATERIAL_DATA-ITEM_NOTE
    SEPARATED BY SPACE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    WHEN 4.
    Not found; this is normal if no text was entered.
    WHEN OTHERS.
    MESSAGE E000(38) WITH 'Bad call to function READ_TEXT'.
    ENDCASE.
    ENDFORM. " get_substitute_matnr
    Open files, set initial conditions, etc.
    FORM INITIAL_STUFF.
    data : w_length type i .
    PROGNAME = SY-REPID.
    WRITE: / 'Program: ', PROGNAME.
    WRITE: / 'Execution start date: ', SY-DATUM.
    WRITE: / 'Execution start time: ', SY-UZEIT.
    WRITE: / .
    CALL FUNCTION 'Z_SET_INTERFACE_FILENAME'
    EXPORTING
    INTERFACE_NAME = MATLFILE
    DATE_TIME_SW = 'X'
    EXTENSION_TYPE = 'txt'
    IMPORTING
    PATHNAME = OUTFILE
    EXCEPTIONS
    OTHERS = 1.
    f_m_uncfile = outfile .
    clear w_length.
    w_length = strlen( matlfile ).
    replace matlfile with c_uncpath_material into F_M_UNCFILE length
    w_length .
    open dataset F_m_UNCFILE for output in text mode .
    if sy-subrc <> 0 .
    MESSAGE E000(38) WITH 'Unable to open file ' F_m_UNCFILE.
    endif.
    ENDFORM. " initial_stuff.
    Close files, etc.
    FORM WRAPUP.
    CLOSE DATASET F_M_UNCFILE.
    PERFORM CONVERT_FILE.
    WRITE: / 'Material interface file name: ', OUTFILE,
    / 'Number of records written to material file: ', WRITE_COUNT.
    endform.
    This form is included for testing and is performed if the test_rec
    checkbox is checked.
    FORM WRITE_FORMATTED_TEST_RECORD.
    WRITE: /,
    / 'Beginning of new record :',
    / 'Start Delimiter :|' NO-GAP,
    MATERIAL_DATA-DELIMITER_START NO-GAP, '|',
    / 'Record Type :|' NO-GAP,
    MATERIAL_DATA-REC_TYPE NO-GAP, '|',
    / 'Material Number :|' NO-GAP,
    MATERIAL_DATA-MATNR NO-GAP USING NO EDIT MASK, '|',
    / 'Material Description :|' NO-GAP,
    MATERIAL_DATA-MAKTX NO-GAP, '|',
    / 'Substitute Material Number :|' NO-GAP,
    MATERIAL_DATA-SMATN NO-GAP, '|',
    / 'Substitute Start Date :|' NO-GAP,
    MATERIAL_DATA-SMATN_START NO-GAP, '|',
    / 'Substitute End Date :|' NO-GAP,
    MATERIAL_DATA-SMATN_END NO-GAP, '|',
    / 'Status Code :|' NO-GAP,
    MATERIAL_DATA-VMSTA NO-GAP, '|',
    / 'Status Description :|' NO-GAP,
    MATERIAL_DATA-VMSTB NO-GAP, '|',
    / 'Date of last change :|' NO-GAP,
    MATERIAL_DATA-LAEDA NO-GAP, '|',
    / 'User who changed record :|' NO-GAP,
    MATERIAL_DATA-AENAM NO-GAP, '|',
    / 'Manufacturer Number :|' NO-GAP,
    MATERIAL_DATA-VENDOR_NUM NO-GAP, '|',
    / 'Vendor Name :|' NO-GAP,
    MATERIAL_DATA-VENDOR_NM NO-GAP, '|',
    / 'Product Line Code :|' NO-GAP,
    MATERIAL_DATA-PROD_LINE_CD NO-GAP, '|',
    / 'Product Line Description :|' NO-GAP,
    MATERIAL_DATA-PROD_LINE_DSC NO-GAP, '|',
    / 'DEA Schedule ID :|' NO-GAP,
    MATERIAL_DATA-DEA_SCH_ID NO-GAP, '|',
    / 'DEA Schedule Description :|' NO-GAP,
    MATERIAL_DATA-DEA_SCH_DSC NO-GAP, '|',
    / 'Labeller Code :|' NO-GAP,
    MATERIAL_DATA-NORMT NO-GAP, '|',
    / 'Standard Price :|' NO-GAP,
    MATERIAL_DATA-STPRS NO-GAP, '|',
    / 'Logo Description :|' NO-GAP,
    MATERIAL_DATA-LOGO_DESC NO-GAP, '|',
    / 'Prescription Flag :|' NO-GAP,
    MATERIAL_DATA-PRESCRIPT_FLAG NO-GAP, '|',
    / 'Therapeutic Class :|' NO-GAP,
    MATERIAL_DATA-THER_CLASS NO-GAP, '|',
    / 'Therapeutic Class Description :|' NO-GAP,
    MATERIAL_DATA-THER_CLASS_DSC NO-GAP, '|',
    / 'Therapeutic Subclass :|' NO-GAP,
    MATERIAL_DATA-THER_SUB_CLASS NO-GAP, '|',
    / 'Therapeutic Subclass Description:|' NO-GAP,
    MATERIAL_DATA-THER_SUB_CLASS_DSC NO-GAP, '|',
    / 'Therapeutic Equivalence :|' NO-GAP,
    MATERIAL_DATA-THER_EQUIV NO-GAP, '|',
    / 'Item Package Size :|' NO-GAP,
    MATERIAL_DATA-ITEM_PACKAGE_SIZE NO-GAP, '|',
    / 'Item Package Type :|' NO-GAP,
    MATERIAL_DATA-ITEM_PACKAGE_TYPE NO-GAP, '|',
    / 'Dosage Form :|' NO-GAP,
    MATERIAL_DATA-DOSAGE_FORM NO-GAP, '|',
    / 'Dosage Form Description :|' NO-GAP,
    MATERIAL_DATA-DOSAGE_FORM_DSC NO-GAP, '|',
    / 'Dose Administration :|' NO-GAP,
    MATERIAL_DATA-DOSE_ADMIN NO-GAP, '|',
    / 'Dose Administration Description :|' NO-GAP,
    MATERIAL_DATA-DOSE_ADMIN_DSC NO-GAP, '|',
    / 'Bottle Size :|' NO-GAP,
    MATERIAL_DATA-BOTTLE_SIZE NO-GAP, '|',
    / 'Brand Name :|' NO-GAP,
    MATERIAL_DATA-BRAND_NAME NO-GAP, '|',
    / 'Brand Distributor :|' NO-GAP,
    MATERIAL_DATA-BRAND_DISTR NO-GAP, '|',
    / 'Brand Color :|' NO-GAP,
    MATERIAL_DATA-BRAND_COLOR NO-GAP, '|',
    / 'Brand Shape :|' NO-GAP,
    MATERIAL_DATA-BRAND_SHAPE NO-GAP, '|',
    / 'ANDA Date :|' NO-GAP,
    MATERIAL_DATA-ANDA_DATE NO-GAP, '|',
    / 'ANDA Number :|' NO-GAP,
    MATERIAL_DATA-ANDA_NUMBER NO-GAP, '|',
    / 'Bio Study :|' NO-GAP,
    MATERIAL_DATA-BIO_STUDY NO-GAP, '|',
    / 'DESI Indicator :|' NO-GAP,
    MATERIAL_DATA-DESI_INDICATOR NO-GAP, '|',
    / 'Drug Term Date :|' NO-GAP,
    MATERIAL_DATA-DRUG_TERM_DT NO-GAP, '|',
    / 'FDA Approval Date :|' NO-GAP,
    MATERIAL_DATA-FDA_APPRV_DT NO-GAP, '|',
    / 'Item Regulatory Name :|' NO-GAP,
    MATERIAL_DATA-ITEM_REG_NM NO-GAP, '|',
    / 'Market Date :|' NO-GAP,
    MATERIAL_DATA-MARKET_DT NO-GAP, '|',
    / 'Product Color :|' NO-GAP,
    MATERIAL_DATA-PRODUCT_COLOR NO-GAP, '|',
    / 'Product Flavor :|' NO-GAP,
    MATERIAL_DATA-PRODUCT_FLAVOR NO-GAP, '|',
    / 'Product Shape :|' NO-GAP,
    MATERIAL_DATA-PRODUCT_SHAPE NO-GAP, '|',
    / 'Product Strength :|' NO-GAP,
    MATERIAL_DATA-PRODUCT_STRENGTH NO-GAP, '|',
    / 'Base Unit of Measure :|' NO-GAP,
    MATERIAL_DATA-MEINS NO-GAP, '|',
    / 'Base Weight :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-WEIGHT NO-GAP, '|',
    / 'Base Weight Unit :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-WT_UNIT NO-GAP, '|',
    / 'Base Volume :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-VOLUM NO-GAP, '|',
    / 'Base Volume Unit :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-VOL_UNIT NO-GAP, '|',
    / 'Base Package Length :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-PKG_LENGTH NO-GAP, '|',
    / 'Base Package Width :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-PKG_WIDTH NO-GAP, '|',
    / 'Base Package Height :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-PKG_HEIGHT NO-GAP, '|',
    / 'Base Dimension Unit :|' NO-GAP,
    MATERIAL_DATA-BASE_MEASURES-DIM_UNIT NO-GAP, '|',
    / 'Inner Carton Count :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_COUNT NO-GAP, '|',
    / 'Inner Carton Weight :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT NO-GAP, '|',
    / 'Inner Carton Weight Unit :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-WT_UNIT NO-GAP, '|',
    / 'Inner Carton Volume :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM NO-GAP, '|',
    / 'Inner Carton Volume Unit :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-VOL_UNIT NO-GAP, '|',
    / 'Inner Carton Package Length :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH NO-GAP, '|',
    / 'Inner Carton Package Width :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH NO-GAP, '|',
    / 'Inner Carton Package Height :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT NO-GAP, '|',
    / 'Inner Carton Dimension Unit :|' NO-GAP,
    MATERIAL_DATA-INR_CRTN_MEASURES-DIM_UNIT NO-GAP, '|',
    / 'Case Count :|' NO-GAP,
    MATERIAL_DATA-CASE_COUNT NO-GAP, '|',
    / 'Case Weight :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-WEIGHT NO-GAP, '|',
    / 'Case Weight Unit :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-WT_UNIT NO-GAP, '|',
    / 'Case Volume :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-VOLUM NO-GAP, '|',
    / 'Case Volume Unit :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-VOL_UNIT NO-GAP, '|',
    / 'Case Length :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-PKG_LENGTH NO-GAP, '|',
    / 'Case Width :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-PKG_WIDTH NO-GAP, '|',
    / 'Case Height :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-PKG_HEIGHT NO-GAP, '|',
    / 'Case Dimension Unit :|' NO-GAP,
    MATERIAL_DATA-CASE_MEASURES-DIM_UNIT NO-GAP, '|',
    / 'Item Note :|' NO-GAP,
    MATERIAL_DATA-ITEM_NOTE NO-GAP, '|',
    / 'End Delimiter :|' NO-GAP,
    MATERIAL_DATA-DELIMITER_END NO-GAP, '|',
    ENDFORM. " write_formatted_test_record
    Copy the output files to the appropriate archive folder.
    FORM COPY_TO_ARCHIVE USING C_FILE.
    DATA:
    ARCHFILE(100),
    COPYFILES(255),
    ITAB LIKE BTCXPM OCCURS 0 WITH HEADER LINE,
    W_LENGTH TYPE I ,
    W_INFILE(100),
    W_OUTFILE(100).
    PERFORM BUILD_ARCHIVE_NAME USING C_FILE
    CHANGING ARCHFILE.
    CONCATENATE C_FILE C_UNCPATH INTO COPYFILES SEPARATED BY SPACE .
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
    EXPORTING
    COMMANDNAME = 'ZUNIXCOPY'
    ADDITIONAL_PARAMETERS = COPYFILES
    OPERATINGSYSTEM = SY-OPSYS
    STDOUT = 'X'
    STDERR = 'X'
    TERMINATIONWAIT = 'X'
    TABLES
    EXEC_PROTOCOL = ITAB
    EXCEPTIONS
    NO_PERMISSION = 1
    COMMAND_NOT_FOUND = 2
    PARAMETERS_TOO_LONG = 3
    SECURITY_RISK = 4
    WRONG_CHECK_CALL_INTERFACE = 5
    PROGRAM_START_ERROR = 6
    PROGRAM_TERMINATION_ERROR = 7
    X_ERROR = 8
    PARAMETER_EXPECTED = 9
    TOO_MANY_PARAMETERS = 10
    ILLEGAL_COMMAND = 11
    WRONG_ASYNCHRONOUS_PARAMETERS = 12
    CANT_ENQ_TBTCO_ENTRY = 13
    JOBCOUNT_GENERATION_ERROR = 14
    OTHERS = 15.
    w_length = strlen( c_final_path ).
    replace c_final_path with ' ' into c_file length w_length.
    shift c_file left deleting leading space .
    concatenate c_uncpath c_file into w_infile .
    concatenate archfile c_file into w_outfile .
    CALL FUNCTION 'Z_CONVERT_UNIX2DOS'
    EXPORTING
    INFILE = w_infile
    OUTFILE = w_outfile
    EXCEPTIONS
    ERROR = 1
    IDENTICAL_FILENAMES = 2
    NO_INPUT_FILE = 3
    OTHERS = 4.
    IF SY-SUBRC = 0.
    SKIP.
    WRITE: / C_FILE, 'copied to', ARCHFILE.
    ELSE.
    MESSAGE E000(38) WITH 'Archive file copy failed.'.
    ENDIF.
    ENDFORM. " copy_to_archive.
    Build Archive file pathnames.
    FORM BUILD_ARCHIVE_NAME USING P_PATH
    CHANGING P_ARCH.
    DATA:
    NODECOUNT TYPE I,
    LASTNODE TYPE I,
    BEGIN OF NODES OCCURS 25,
    NODENAME(100),
    END OF NODES.
    SPLIT P_PATH AT '/' INTO TABLE NODES.
    DESCRIBE TABLE NODES LINES NODECOUNT.
    CLEAR P_ARCH.
    LASTNODE = NODECOUNT - 1.
    LOOP AT NODES.
    CASE SY-TABIX.
    WHEN LASTNODE.
    CONCATENATE P_ARCH NODES-NODENAME '/archive/' INTO P_ARCH.
    WHEN NODECOUNT.
    WHEN OTHERS.
    CONCATENATE P_ARCH NODES-NODENAME '/' INTO P_ARCH.
    ENDCASE.
    ENDLOOP.
    ENDFORM. " build_archive_name
    *& Form CONVERT_FILE
    Move output files from unconverted directory to final destination
    directory and convert from UNIX to DOS format in the process.
    FORM CONVERT_FILE.
    CONCATENATE MATLFILE '.txt' INTO OUTFILE.
    Convert customer file from Unix to DOS
    CALL FUNCTION 'Z_CONVERT_UNIX2DOS'
    EXPORTING
    INFILE = F_M_UNCFILE
    OUTFILE = outFILE
    EXCEPTIONS
    ERROR = 1
    IDENTICAL_FILENAMES = 2
    NO_INPUT_FILE = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    write: /'Error converting file. Input file: ', F_M_UNCFILE.
    write: /' Output file: ', outFILE.
    ENDIF.
    ENDFORM. " CONVERT_FILE

    Hi Vijay,
    thanks very much for the reply with valuable suggestion.
    I have made couple of changes in the program like this:
    i have created another Internal table like this...for selecting the data of MARA...
    <b>data: begin of it_temp occurs 0,
             matnr like mara-matnr,
          end of it_temp.</b>
    then I have changed the FORM like this ....
    Plz have a look on that and let me know if any thing is wrong in that...
    thnx much..
    <b>form get_outsert.
    select matnr from mara into corresponding fields of table
        it_temp where mtart = 'FERT' or mtart = 'HAWA'.
         select didnrk amatnr
             into (i_outsert-component, i_outsert-matnr)
                from stpo as d
               inner join stko as c
                     on dstlnr = cstlnr
               inner join mast as b
                     on cstlnr = bstlnr
               inner join mara as a
                     on bmatnr = amatnr
               for all entries IN it_temp
                   where a~matnr = it_temp-matnr.
           append i_outsert.
         endselect.
         loop at i_outsert where matnr = it_temp-matnr.
      if ( i_outsert-component cs str1 ) or ( i_outsert-component cs str2 ).
               write i_outsert-component to material_data-component.
               append material_data.
      elseif ( i_outsert-component cs str3 ) or
                             ( i_outsert-component cs str4 ).
               write i_outsert-component to material_data-mguide.
               append material_data.
      endif.
          modify material_data transporting component
                          where matnr = i_outsert-matnr.
         endloop.
    endform.                               "get_outsert</b>

Maybe you are looking for

  • How can I remove all Time Machine data from an external HD, while retaining the other folders/files on the disk?

    I recently replaced my old Macbook Pro with a new Macbook Pro Retina. The original MBP had Time Machine set up on an external HD, and I also had some manually saved/backed up files (stuff that didn't need incremental backups; very old stuff) on the d

  • How to create a Complex Organization Index  Materialized View Example

    Hi I have a 11g database that I'm trying to create a complex Materialized View that I would like to make Organization Index? How do I specify what I want for a primary Key? CREATE MATERIALIZED VIEW RCS_STG.MV_NEXT_HOP_iot ORGANIZATION INDEX AS SELECT

  • Cannot save changes to an Indesign document

    I have documents from a client that were created in an earlier version of Indesign (I'm not sure if it was CS3 or CS4). I use Indesign CS5.5. I can open the documents OK and work in them without problem. (I have all the fonts being used, but some of

  • Getting "No Object type found error" in BPM sceanrio.

    Hi Friends, I am doing File to RFC with response sceanrio using BPM. For this i configured one receiver step, one send synchronous step to send input message to RFC and one asynchronous send step to send the response to a file. I have configured 3 re

  • Dynamic Expression Evaluation in AS 3

    Hi all, AS 2 had the eval() function, but it was removed in AS 3. Does anyone know of a way to dynamically evaluate an expression in AS 3+? I'm trying to impliment a feature that allows a user to define the behavior of a component based on the evalua