Automate BOM creation with script

Hi all
I'like to create an Excel macro that would upload a BOM for a specific equipment using SAP Script.
where i'm struggling right now is on determining the first available position in the ib02 tab
in the example the first line available for insertion of a new item would be the 53 one.
When i ran the script recorder i get the following code
session.findById("wnd[0]/tbar[0]/okcd").text = "/nib02"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 7
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 14
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 21
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 28
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 35
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 42
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 49
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 56
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 63
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 70
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 76
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 69
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 62
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 61
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 60
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 59
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 58
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 57
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 56
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 55
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 54
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").verticalScrollbar.position = 53
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,2]").setFocus
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,2]").caretPosition = 0
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,2]").text = "I"
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,2]").text = "TEST_1117"
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,2]").setFocus
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[2,2]").caretPosition = 9
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/subPOS_PHPT:SAPLCSDI:0830/txtRC29P-MENGE").text = "1"
session.findById("wnd[0]/usr/subPOS_PHPT:SAPLCSDI:0830/txtRC29P-MENGE").caretPosition = 1
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
thanks a lot for your input

Hi Umur
Thanks for the tip.
this is working very well.
another option is to check is one of the field is empty.
If no then increment a counter
if yes then you have reach the first available line and you can use the counter to identify it in the script
here is an example :
k = 0
While session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1," & CStr(k) & "]").Text <> ""
k = k + 1
Wend
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1," & CStr(k) & "]").Text = item_type

Similar Messages

  • Automatic Po creation With MB01 i am getting Error

    Hi ,
    While doing goods receipt for  Automatic Po creation i am getting error
    MM activated Automatic Po
    VM activated Automatic Po
    101 Mov Type is also activated
    Item 00010 of purchasing document 9999999999 does not exist
    Message no. ME706
    Diagnosis
    Purchase order 00010 with item 9999999999 was not found.
    Procedure
    Enter a different purchase order.
    i given  the Vendor and quantity  after entering error is coming
    Please help
    Manjunath

    HI,
    Pls ceck the points mentioned below.
    Define one of the purchase organizations as Standard Purchase Organization
    Assign your plant to Standard Purchase Organization
    Maintain purchasing information record with price
    Maintain the indicator for movement types 101 & 161
    Define Default Values (MB01) for Document Type
    Now you can enter a goods receipt without entering the purchase order number, a purchase order will be created automatically when you post the goods receipt. All such goods receipt will be valuated at the price maintained in the purchasing information record.
    First you can try this with T. Code MB01 if it is working then try with T. Code MIGO, if you face any error or functionality is not working check with your basis consultant some authorization or some patches may be missing. Ask him to apply all relevant patches.
    Thanks
    Chandru

  • Automise CS61 BOM creation with reference to Sales order

    Hi Experts.
    Need your help in fixing one scenario:
    We have scenarion data coming from third party containing BOM data with respect to Sales order.
    We are using XI/PI,
    1: Do we have any idoc for CS61 master creation. (Not likely to move in bdc ....etc)
    2: How to Create multilevel in that....
    Please guide .. Help is appreciable.
    Regards
    Deepak Sodhi

    Hi,
    You will need to make assignment from So item to Delivery item please check if copy control is maintained at item level. Also make sure that Copy controls are maintianed for the billing document from the SO & Delivery both as this would be the next step.

  • BOM creation with usage 4

    Hi Team,
    I have created the BOM with usage 4 (Plant Maintenance) for the finished goods material in CS01. For the same finished goods material, i am creating the routing in CA01 with routing usage as 4. I have assigned some work center in the routing operation overview. Now i am selecting the button "Component Allocation" in the routing, the system is fetching the BOM details of the finished goods material with BOM usgae 1 (production). It is not fetching the BOM details with BOM usage 4 in the routing component allocation view .
    I would like to see the BOM components with BOM usage 4 in the routing component allocation view. How to get it?
    Please guide me.
    psk

    Dear PSK,
    You cannot assign the BOM components created for BOM usage 4 in the routing -component assignment.
    If my understanding is correct,then this is the standard SAP behaviour,wherein to add the items relevant to plant maintenance
    does not gets copied into the production order.
    Regards
    Mangalraj.S

  • Automatic TO creation with WMTA during delivery

    Hello,
    We are creating TO for ZLF delivery with WMTA output type during the creation of delivery. But after WMTA output type is competed, we are trying to display the Transfer Order information with smartform using the ZMTA output type by triggering it automatically. The problem here is, for the corresponding delivery, the TO number is getting in database table LTAK when the ZMTA gets triggered. Could you please let me know when the TO number will be updated in database table, or how to get the TO number, When does the above values commits to the database table.

    Hello,
    LTAK and LTAP are the two TO header and item table respectively. This two table gets updated once your TO is created.
    Regards,
    Kishore

  • BOM creation with variable size item

    Dear Experts,
    I want to create BOM with 'R'-Variable size item, Can U tell me exact procedure step by step to How to create BOM with R- Variable size item?
    Regards,
    Shivkumar Dachawar

    Hi,
      T-Code-CS01
    1. Enter the material for which you want to create BOM, Plan and BOM usage.
    2. Select the item category "R", enter the component. Now you will be taken to the "Variable item data" screen.
    3. Enter the datas of Size 1, 2 & 3 (as required) and the unit of the size & number. System will calculate the "Qty of var- size item" in the unit assigned to the basic data of the material master of the component.
    4. Save
    Note: You can change the unit of the variable size item as per your requirement in OS28
    Hope this helps.
    -Thaila Shree

  • Automatic tag creation with WMP

    A friend of mine told me that WMP 0 can automatically tag your files but I can't get it to work here. Okay he said that I could structure my folders like so:
    artist
    album
    album
    album
    and when i sync the parent folder to my player it would assign that folder name to the artist tag
    then it would assign the 3 album tags to the files contained within each.
    is this how it behaves. if so how do i get it to work this way?

    HI,
    Pls ceck the points mentioned below.
    Define one of the purchase organizations as Standard Purchase Organization
    Assign your plant to Standard Purchase Organization
    Maintain purchasing information record with price
    Maintain the indicator for movement types 101 & 161
    Define Default Values (MB01) for Document Type
    Now you can enter a goods receipt without entering the purchase order number, a purchase order will be created automatically when you post the goods receipt. All such goods receipt will be valuated at the price maintained in the purchasing information record.
    First you can try this with T. Code MB01 if it is working then try with T. Code MIGO, if you face any error or functionality is not working check with your basis consultant some authorization or some patches may be missing. Ask him to apply all relevant patches.
    Thanks
    Chandru

  • BOM Creation with SubItem

    Does anyone has readymade code for creating Material BOM with SubItems.
    I have this sample code (I got this from web and changed to add subitem logic) which is creating subitems.
    but I have 2 problems.
    1. The Subitems get created for all the components.
    2. The code is written to create multiple subitems but only create 1 subitem.
    I am new to ABAP, just stared a month back. Any help is appreciated.
    My Sample Code:
    REPORT  y_bapi3.
    This code will create a material BoM for the material
    LSMWTEST12 with the components LSMWTEST14 and LSMWTEST50.
    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_subitems  LIKE bapi1080_sui_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_subitemas LIKE BAPI1080_REL_SUI_ITM_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 = 'BGR'.
    it_bomgroup-object_id = 'SIMPLE1'.
    it_bomgroup-CREATED_IN_PLANT = '1000'.
    it_bomgroup-bom_usage = '1'.  "YOU COULD CHANGE THE BOM USAGE TO YOUR
    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-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 = '1.000'.
    it_variants-valid_from_date = sy-datum.
    it_variants-function = 'NEW'.
    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 = 'LSMWTEST14'.
    it_items-comp_qty = '2.00'.
    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_items-item_no = '0020'.
    it_items-item_cat = 'L'.
    it_items-component = 'LSMWTEST50'.
    it_items-comp_qty = '3.00'.
    it_items-valid_from_date = sy-datum.
    APPEND it_items.
    *Details of the subitems of the variants
    CLEAR it_subitems.
    it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
    it_subitems-object_type = 'SUI'.
    it_subitems-object_id = 'SIM1'.
    it_subitems-subitem_no = '0001'.
    it_subitems-INSTALLATION_POINT = 'ab1'.
    it_subitems-subitem_qty = '1'.
    APPEND it_subitems.
    CLEAR it_subitems.
    it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
    it_subitems-object_type = 'SUI'.
    it_subitems-object_id = 'SIM1'.
    it_subitems-subitem_no = '0002'.
    it_subitems-INSTALLATION_POINT = 'ab2'.
    it_subitems-subitem_qty = '1'.
    APPEND it_subitems.
    Details of the materials of the different variants
    CLEAR it_matrel.
    it_matrel-bom_group_identification = 'BAPI_SMP_COL1'.
    it_matrel-material = 'LSMWTEST12'.
    it_matrel-plant    = '1000'.
    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 = 'NEW'.
    APPEND it_itemas.
    Linking subitems to the corresponding variants
    CLEAR it_subitemas.
    it_subitemas-bom_group_identification = 'BAPI_SMP_COL1'.
    it_subitemas-sub_object_type = 'SUI'.
    it_subitemas-sub_object_id = 'SIM1'.
    it_subitemas-super_object_type = 'ITM'.
    it_subitemas-super_object_id = 'SIMPLE1'.
    APPEND it_subitemas.
    Create variants
    CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
      EXPORTING
        all_error          = 'X'
      TABLES
        bomgroup           = it_bomgroup
        variants           = it_variants
        items              = it_items
        subitems           = it_subitems
        materialrelations  = it_matrel
        itemassignments    = it_itemas
        subitemassignments = it_subitemas
        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.
    -Uday Malgundkar

    Hi uday,
    i am facing the same problem while creating multiple sub-items per item.can u plz suggest me for this issue?
    only one subitem is creating for each item .This bapi is not taking multiple sub-items.i tried , by passing this bapi for each subitem & clearing the subitem field for each time. but only one sub-item is creating.
    can u plz give any sample code where sub-item details will be there?
    ur help will be highly appreaciated.it is urgent yar.
    Thanks & Regards
    pabitra

  • BOM changes(Not creation) with EC Number

    Hi
    I want to make the ECN as mandatory while changing the BOM,not for creation.
    I tried by setting OS27,OS25 settings for BOM. I tried BOM creation with status 3(With history requirement). System gives only warning message,not the error message.(Message no. 29045)
    I tried to make the Change number field as mandatory,but it applies it to CS01 & CS02. I want only in CS02.
    Plse help me out if any knows the soultion.

    Dear Sudhar,
    1.Please check in OS27 - Tick mark is included for EC Management Active &
    BOM validity manitained and History Requirement.
    2.In OS25 - For History Requirement.
    3.Get the help from ABAP consultant,to make use of field exit for the particular
    screen CS02 ,which has got a screen number.The system will not allow the user
    to enter into the next screen unless that field is not filled.
    4.Check for the Auth.Object C_STUE_NOH
    With this Logic only we are using in my present project.
    Check & reply.
    Regards
    Mangal

  • BAPI for automatic Pr creation witth multiple files from excel sheet

    I have written a programm  for automatic PR creation  with the help of bapi , where its picks data from excel sheet and makes PR .It is picking excel files from one folder(Files) for PR creation and moving to another folder(Files sucess).
    now the problem is if Folder (Files) contains one excel sheet ,PR is created fine , but if the Folder(Files) have multiple excel sheet ,its is creating 1st PR right, but next PR's contains all the line item of 1st PR , 2nd PR and so on .can anyone suggest me where is the problem in codes.
    types : begin of x_file ,
            key1(10),
            pur_grp(4),
            maktx(40),
            plant(4) ,
            req(10),
            s_qty(13),
            wbs(24),
            gl(10),
            trackno(10),
            supl(4),
            deladd(255).
    types : end of x_file .
      data : str5 type char10.
      data : mm type char2.
      data : yyyy type char4.
      data : dd type char2.
      data : str9 type char10.
      data : str6 type char10.
      data : month type char2.
      data : year type char4.
      year = sy-datum+0(4).
      month = sy-datum+4(2).
      dd = sy-datum+6(2).
      yyyy = sy-datum+0(4).
      mm = sy-datum+4(2).
      dd = sy-datum+6(2).
      clear str6 .
      clear str5.
      concatenate  dd'.' month '.' year into str5 .
      concatenate  yyyy mm dd into str6 .
    DATA : file type rlgrap-filename .
    data : it_file type table of x_file .
    data : wa_file type x_file .
    data : it_header type table of x_file .
    data : wa_header type x_file .
    *&  Internal Table For Define Row and Coloum Postion
    data: col_start type i value 1 ,
          row_start type i value 2,
          col_end type i value 256 ,
          row_end type i value 65000 .
    *&  Internal Table For Retrieve  Data From Excel
    *data: excel_bdcdata like kcde_cells occurs 0 with header line.
    *data: excel_bdcdata1 like kcde_cells occurs 0 with header line.
    data: excel_bdcdata like ALSMEX_TABLINE occurs 0 with header line.
    data: excel_bdcdata1 like ALSMEX_TABLINE occurs 0 with header line.
    data: it_index type i.
    DATA : IT_INDEX1 TYPE I.
    *&  Define Field Symbol
    field-symbols: <fs> .
    data :   bdcdata like bdcdata    occurs 0 with header line.
    data :   messtab like bdcmsgcoll occurs 0 with header line.
    data : req_items type table of bapiebanc .
    data : wa_req_items type bapiebanc .
    data : req_acc_asg type table of bapiebkn.
    data : wa_req_acc_asg type bapiebkn.
    DATA : RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .
    *data : return type table of     bapireturn.
    *data : wa_return type bapireturn .
    data : number type ebeln .
    *****************************MOVE FILES******************************
    data : xsource type string .
    data : xdestin type string .
    data : destin1 type string .
    data : destin2 type string .
    DATA : DEST1 TYPE STRING.
    DATA : DEST11 TYPE STRING.
    DATA : DEST2 TYPE STRING.
    DATA : DEST22 TYPE STRING.
    data : sou_dir_name like SALFILE-LONGNAME.
    data : tar_dir_name like SALFILE-LONGNAME.
    data : tar_dir_name1 like SALFILE-LONGNAME.
    data : sou_filename like EDI_PATH-PTHNAM .
    data : tar_filename like EDI_PATH-PTHNAM .
    data : filename1  type string .
    data : tar_filename1 like EDI_PATH-PTHNAM .
    data : file_itab like SALFLDIR occurs 0 with header line.
    data : wa_file_itab like SALFLDIR.
    data : file_count type i .
    data : dir_count type i.
    data : dir_table like sdokpath occurs 0 with header line.
    data : file_table like SDOKPATH occurs 0 with header line.
    data : wa_file_table like sdokpath.
    data : strr type string ,
           str1 type string ,
           str2 type string ,
           str3 type string .
    DATA : PA_VAL TYPE CHAR1.
    sou_dir_name = 'D:\barcodes\files\'.
    tar_dir_name = 'D:\barcodes\files-success\'.
        "success folder.
    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
      EXPORTING
        DIRECTORY  = sou_dir_name
        FILTER     = '.'
      IMPORTING
        FILE_COUNT = file_count
        DIR_COUNT  = dir_count
      TABLES
        FILE_TABLE = file_table
        DIR_TABLE  = dir_table
      EXCEPTIONS
        CNTL_ERROR = 1
        OTHERS     = 2.
    IF SY-SUBRC <> 0.
    ENDIF.
    loop at file_table into wa_file_table.
    clear  :  strr , str1 , str2 , str3 .
      strr = wa_file_table-PATHNAME .
      concatenate sou_dir_name strr into str1 .
      concatenate tar_dir_name strr into str2 . " success
      concatenate tar_dir_name1 strr into str3 .         " failed
    FILE = STR1 .
    *start-of-selection.
    *&  Function For Retrieve Data From Excel
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = FILE
        i_begin_col                   = col_start
        i_begin_row                   = row_start
        i_end_col                     = col_end
        i_end_row                     = row_end
      tables
        intern                        = excel_bdcdata
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3.
      IF sy-subrc NE 0.
    WRITE : / 'File Error'.
    EXIT.
    ENDIF.
      loop at excel_bdcdata.
        translate excel_bdcdata to upper case .
        move excel_bdcdata-col to it_index.
        assign component it_index of  structure  wa_file to <fs> .
        move excel_bdcdata-value to <fs>.
        at end of row.
          append wa_file to it_file .
            clear wa_file.
        endat.
      endloop.
    sort it_file by key1. "pur_grp maktx plant  .
    it_header[] = it_file[].
    delete adjacent duplicates from it_header comparing key1 pur_grp maktx
    plant .
    data : h_item(5) type n .
    data : h_pack(10) type n .
    data : line_no(5) type n .
    data : ln_no(5) type n .
    loop at it_header into wa_header .
    ln_no = 1.
    h_item = h_item + 10.
    h_pack = h_pack + 1.
    wa_req_items-preq_item = h_item .
    wa_req_items-doc_type = 'BOM'.
    wa_req_items-pur_group = wa_header-pur_grp .
    wa_req_items-MATERIAL = wa_header-maktx .
    wa_req_items-plant = wa_header-plant .
    wa_req_items-pckg_no =  h_pack .
    wa_req_items-deliv_date = str6 .
    wa_req_items-item_cat = '0'.
    wa_req_items-acctasscat = 'P'.
    *wa_req_items-distrib = '2' .
    **wa_req_items-gr_ind = 'X'.
    wa_req_items-ir_ind = '2'.
    wa_req_items-purch_org = 'TISL' .
    wa_req_items-QUANTITY =  wa_header-s_qty.
    wa_req_items-PREQ_NAME =  wa_header-req.
    wa_req_items-SUPPL_PLNT = wa_header-supl.
    wa_req_items-trackingno = wa_header-trackno.
    append wa_req_items to req_items .
    clear wa_req_items.
    wa_req_acc_asg-preq_item = h_item .
    wa_req_acc_asg-g_l_acct = wa_file-gl .
    WA_req_acc_asg-wbs_elem  = wa_header-wbs .
    append wa_req_acc_asg to req_acc_asg .
    clear wa_req_acc_asg.
    h_pack = h_pack + 1  .
    endloop.
    clear ln_no .
    ***BREAK-POINT.
    *& BAPI FUNCTION
    call function 'BAPI_REQUISITION_CREATE'
    importing
       number                               = number
      tables
        requisition_items                   = req_items
       requisition_account_assignment       = req_acc_asg
       return                               = return .

    Can someone please give me sol........

  • Create ecatt script for one sales order creation with multiple line items

    Hi ,
    I want to create a ecatt script for one sales order creation with multiple line items. Preferably SAP GUI.
    This selection of data will be from an external file/ variants which will have only one row of data in it.
    Firstly: I have to sort the external file having same PO Numbers in an order.Group them together.
    Second: I have to create sales order for those many line items having same PO Number.
    Best Regard
    Taranum

    Hi Micky
    Firstl you should upload the Line items for a particular sales Order in an Internal table
    and then pass that internal table to your BAPI during your coding corresponding to a particu;lar sales order
    In case of any issues pls revert back
    Reward points if helpful
    Regards
    Hitesh

  • If firefox automatically updates my computer past 3.6 I'm inundated with Script Freezes..how do I stop new automatic updates?

    Everytime I'm automatically updated past 3.6 my computer is inundated with Script Freezes..especially on the email page of gmail.
    This has happened many many times. As far as I can determine these Script Freezes (Says: A script is attempting to write on this page.."Continue"..Stop Script etc) are coming from Internet Explorer (I'm not sure of this) and it's tricky to delete any elements of Internet Explorer. But at any rate my computer freezes up until the Script problem is settled..I check the don't ask me again block..but it does no good.
    My real question is: Since things work fine in 3.6...how can I avoid any automatic updates?
    Also, why isn't there a Timer Window (or a timer bar)for Firefox?...sometimes I have to wait 5 minutes for it to load! If there was a timer at least I'd know that something is happening and I'd be willing to wait. When it does take forever to load..it seems to help if I delete all Prefetch and temporary files.
    Is there a safe way of turning off Internet Explorer temporarily?
    Thanks for your help
    Matthew
    [email protected]

    I tried this today, and it is working now:
    Click Firefox > Options > Options > Advanced ... then Uncheck the option "Use hardware acceleration when available"

  • How to skip password demands during DB creation with shel scripts from DBCA

    When Generating a Database automatically with scripts from DBCA passwords are asked 2 times 1 at begining and 1 at ora.ini DB initialization.
    Should I replace lines like
    connect "SYS"/"&&sysPassword" as SYSDBA
    with the real password since its a public password for testing databases.
    P.S.
    If such small questions are not apropriate and a burden to the cmmunity you may inform me.
    Till now if I can't find something on common search keywords, I add it, believing its a contribution to the Oracle communities knowledge base

    I found the solution. As MarkDPowell pointed out, the input prompt happens cause of ACCEPT so have to comment it out.
    And I can pass my own public password as a variable with DEFINE - http://docs.oracle.com/cd/B10501_01/server.920/a90842/ch13.htm#1008884
    P.S.
    I try not leaving non-Answered threads.

  • Disabling policy rules with a post-db-creation sql script

    I want to disable some policy rules with a post-db-creation sql script.
    Is this possible?
    Can You provide me a how to?
    Or a link?

    The only way to do this, is to remove the policy rules from the target within OEM, or by disabling them.
    Rob

  • Automatic Remittances Creation Program (SRS) fails with ARZCAR: Error from main.

    Gurus:
    We have this request that fails - but only at 4am (other scheduled runs it completes fine)
    The error is
    ARZCAR: Error from main.
    Any ideas much apperciated!!
    11.2.0.3
    11.5.10.2
    RHEL 5

    +---------------------------------------------------------------------------+
    Receivables: Version : 11.5.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    ARZCAR_REMIT_SRS module: Automatic Remittances Creation Program (SRS)
    +---------------------------------------------------------------------------+
    Current system time is 11-NOV-2013 04:00:24
    +---------------------------------------------------------------------------+
      BATCH Date : 2013/11/10 00:00:00
    Convert date parm
    prepay_flag: <N>
    Exception Code <1>
    Batch ID: <>
    main: Error from Batch Id Generation.
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    04:00:24 :Auto Remittance Batch Generation
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Successfully resubmitted concurrent program ARZCAR_REMIT_SRS with request ID 19366567 to start at 12-NOV-2013 04:00:00 (ROUTINE=AFPSRS)
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Finished executing request completion options.
    ARZCAR: Error from main.
    +---------------------------------------------------------------------------+
    Concurrent request completed
    Current system time is 11-NOV-2013 04:00:24
    +---------------------------------------------------------------------------+

Maybe you are looking for