How to used BAPI_SALESORDER_CHANGE to add items

Hi, I am trying to use the above bapi to add items to a sales order, but I can't get the qty to map across.  I had the same problem using the create bapi whcih I resolved by populating the schedule tables, but in change this just causes an "unhandled exception" to occur, so i can;t even step into the FM to see the problem.  Has anyone got any ideas.
s_header_inx-updateflag  = 'U'.
*   set item data
    s_items-itm_number     = s_stock-item_no.
    s_items-material       = s_stock-material_no.
    s_items-target_qty     = s_stock-quantity.
    s_items-target_qu      = s_stock-uom.
    s_items-ref_doc        = s_stock-agreement.
    s_items-ref_doc_it     = s_stock-agreement_item.
    s_items-batch          = s_stock-batch.
    s_items-plant          = s_stock-plant.
    s_items-store_loc      = s_stock-storage_location_no.
    append s_items to it_items.
*   set flag to add items (I)
    s_itemsx-updateflag    = insert.
    s_itemsx-itm_number    = s_items-itm_number.
    s_itemsx-material      = abap_true.
    s_itemsx-target_qty    = abap_true.
    s_itemsx-ref_doc       = abap_true.
    s_itemsx-ref_doc_it    = abap_true.
    s_itemsx-batch         = abap_true.
    s_itemsx-plant         = abap_true.
    s_itemsx-store_loc     = abap_true.
    append s_itemsx to it_itemsx.
    s_sched-itm_number    = s_items-itm_number.
    s_sched-sched_line    = '0001'.
    s_sched-REQ_DATE      = sy-datum + 30.
    s_sched-req_qty       = s_items-target_qty.
    append s_sched to it_sched.
*   set flag to add items (I)
*    s_schedx-updateflag    = 'I'
    s_schedx-itm_number    =  s_items-itm_number.
    s_schedx-sched_line    = '0001'.
    s_schedx-REQ_DATE      = 'X'.
    s_schedx-req_qty       = abap_true.
    append s_schedx to it_schedx.
* Now call the BAPI to add the items
  call function 'BAPI_SALESORDER_CHANGE'
    exporting
      salesdocument             = me->number
*   ORDER_HEADER_IN             =
    order_header_inx            = s_header_inx
    SIMULATION                  = ' '
*    BEHAVE_WHEN_ERROR           = 'P'
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
*   NO_STATUS_BUF_INIT          = ' '
   tables
    return                      = it_return
    order_item_in               = it_items
    order_item_inx              = it_itemsx
*   PARTNERS                    =
*   PARTNERCHANGES              =
*   PARTNERADDRESSES            =
*   ORDER_CFGS_REF              =
*   ORDER_CFGS_INST             =
*   ORDER_CFGS_PART_OF          =
*   ORDER_CFGS_VALUE            =
*   ORDER_CFGS_BLOB             =
*   ORDER_CFGS_VK               =
*   ORDER_CFGS_REFINST          =
    order_schedules_in          = it_sched
    order_schedules_inx         = it_schedx
*   ORDER_TEXT                  =
*   ORDER_KEYS                  =
*   CONDITIONS_IN               =
*   CONDITIONS_INX              =
*   EXTENSIONIN                 =

hi,
BAPI_SALESORDER_CHANGE didn't work for me either though i'm 100% sure the bapi works
See SAP note 366265 which tells you how to fill the structures but
you can use your program which you used to create the sales order to change the order and all you need to
do is change a few parameters
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
  EXPORTING
   SALESDOCUMENTIN               =  P_VBELN
    ORDER_HEADER_IN               = ORDER_HEADER_IN
    ORDER_HEADER_INX              = 'U'
(make sure your partners are blank, otherwise you'll get a duprec on VBPA)
-( PS , yes, i;m saying , see if BAPI_SALESORDER_CREATEFROMDAT2 works for you)
I hope this helps
Paul Q
Edited by: Paul Quinn on Jun 2, 2011 11:10 PM

Similar Messages

  • How to use *MonitorManager* to add custom messages in channel monitoring?

    Hi experts,
    How to use MonitorManager to add custom messages in channel monitoring for custom adapter development(Not in audit log).
    like
    Type   Time Stamp   Message ID   Explanation 
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing completed successfully
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message with ID 00199942-6e43-02df-96ca-8b538c63dd98 processed
      6/25/11 6:39:46 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing started
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing completed successfully
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message with ID 00199942-6e43-02ef-96b1-7650f3495e03 processed
      6/24/11 6:43:24 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing started
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing completed successfully
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message with ID 00199942-6e43-02df-9698-5be345a9ddf5 processed
      6/23/11 6:45:50 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing started
      6/22/11 6:43:30 AM 00199942-6e43-02ef-95ff-2c03493dc078 Message processing completed successfully
    Edited by: SAP_PI_D on Jun 28, 2011 12:10 PM

    Solve by myself

  • How to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?

    Can any body give me an idea on how to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?
    Regards,
    Dantham Conpolwedson

    Hi,
    try the link
    Link:[https://forums.sdn.sap.com/click.jspa?searchID=24060901&messageID=7265357]

  • How to use BAPI to add a new version for a claim number in WTY transaction.

    How to use BAPI to add a new version for a claim number in WTY transaction.
    I am using  function module " BAPI_WARRANTYCLAIM_ADD_VERSION ".
    It needs to copy all contents of previous version to a new version.
    While doing so i am unable to copy fields like valic valoc etc. Any ways by which  i can copy this values.
    WTY will update PNWTYH , PNWTYV and PVWTY tables.
    Thanking you,
    Lokesh.

    Hi Vishnu,
    You can do that through EEWB. Please go through SAP Note 484597. You would get the details of using Easy Enhancement Work bench.
    Rewards point if you think this info is useful
    Regards,
    Dipender Singh

  • How to use "Context Menu" web item in WAD 7.0 ?

    Hi Experts,
    Kindly tell me How to use "Context Menu" Web item in SAP WAD 7.0 ?
    How to attach this Web item to my Graph/Chart ?
    Plz provide some documents on this.
    Full points will be given.
    Thanks.
    -Jay Jay
    Edited by: jayaprakash j on Oct 10, 2008 1:47 PM

    Hi Jay
    Web items and HTML elements (for example, tables, texts, and images) that you insert into a Web template, as well as the Web template itself, have a context menu. This context menu has context-sensitive menu entries that you can use to call various Web Application Designer functions. You can, for example, use the context menu to save a Web item (for which you have specified properties by using the parameters) as a reusable Web item, call the properties dialog box for this Web item, copy the Web item and paste it into another Web template, or delete the Web item from the Web template.
    for more info go to following link:
    http://help.sap.com/saphelp_nw70/helpdata/EN/2f/776b3d32390968e10000000a114084/frameset.htm
    Regards
    Vivek

  • Using Bapi_salesorder_change adding a item, deleting a  item,Quanty change

    I need help on Bapi_salesorder_change.
    I have a table control in which there will be data of a particular sales document no, items, quantity, sales unit. When user changes the quantity, or adds a line item or deletes a line item and the press the save button bapi_salesorder_change should trigger and should change the order as the user changes.
    Can u help how to write code for this three conditions
    1> adding line item.
    2> deleting a line item.
    3> changing the quantity.
    using bapi_salesorder_change
    Can i use the same bapi for three conditions?
    Please help me in this as soon as possible.
    I thank them in advance

    Hello Geeks,
              i am using this bapi  for updating my item quantity no....
              but the bapi return msg say tat its not changing....
              i think i may did some mistake pls anyone can rectify it....
              i hv attached my code below......
    *For line item
    TYPES :BEGIN OF y_t_vbap,
            vbeln TYPE vbeln_va,  "sales Document
            posnr TYPE posnr_va,  "Item no of SD document
            matnr TYPE matnr,     "Material No
            zmeng TYPE dzmeng ,   "Target qty in Sales unit
            spart TYPE spart,     "division
            message TYPE BAPI_MSG,
           kwmeng type kwmeng,   "cummulative order qty
           END OF y_t_vbap.
    TYPES : y_t_itemin TYPE bapisditm,
            y_t_return TYPE bapiret2,
            y_t_headerx TYPE bapisdh1x.
    TYPES: BEGIN OF y_t_logdata,
           lno             TYPE         lineno,         "Lineno
           field           TYPE         fieldname,      "Field Name
           value           TYPE         lmon_fvalue,    "Field Value
           message         TYPE         bapi_msg,       "Messages
           END OF y_t_logdata.
                     Internal table declaration
    DATA: "y_i_vbak      TYPE   STANDARD TABLE OF y_t_vbak,
          y_i_vbap      TYPE   STANDARD TABLE OF y_t_vbap,
          y_i_headerx   TYPE   STANDARD TABLE OF bapisdh1x,
          y_i_itemin    TYPE   STANDARD TABLE OF bapisditm ,
          y_i_iteminx   TYPE   STANDARD TABLE OF bapisditmx,
          y_i_return    TYPE   STANDARD TABLE OF y_t_return,
          y_i_logdata   TYPE   STANDARD TABLE OF y_t_logdata,
          y_i_bapiret   TYPE   STANDARD TABLE OF bapiret2.
                     Table type declaration
    TYPES: y_tt_vbap    TYPE   STANDARD TABLE OF y_t_vbap ,
           y_tt_logdata TYPE   STANDARD TABLE OF y_t_logdata.
                     Work Area declaration.
    DATA:   y_wa_vbap     TYPE   y_t_vbap,
          y_wa_itemin   TYPE   bapisditm ,
          y_wa_iteminx  TYPE   bapisditmx,
          y_wa_headerx  TYPE   bapisdh1x,
          y_wa_return   TYPE   y_t_return,
          y_wa_logdata  TYPE   y_t_logdata,
          y_wa_event    TYPE   slis_alv_event,
          y_wa_event1   TYPE   slis_t_event,
          y_wa_bapiret  TYPE   bapiret2.
                     Variables declaration.
    DATA: y_i_event     TYPE   slis_t_event,
          y_v_success   TYPE   i           , "For Success
          y_v_error     TYPE   i           , "For Error
          y_v_sno       TYPE   char30      ,
          y_v_eno       TYPE   char30      ,
          y_v_msg       TYPE   char100     . "error msg
                     Constants declaration.
    constants : y_k_x type char1 value 'X',
                    y_k_u type char1 value 'U',
                   y_k_e type char1 value 'E'.
                  SELECTION SCREEN LAYOUT
    SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 3(18) text-003.
    PARAMETERS   :    y_p_vbln TYPE vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN : END OF BLOCK b1.
                      START-OF-SELECTION.
    START-OF-SELECTION.
    WRITE: text-002.
                      END-OF-SELECTION.
    END-OF-SELECTION.
      SELECT  vbeln
              posnr
              matnr
              zmeng
              spart
              FROM vbap
                   INTO TABLE    y_i_vbap
                   WHERE vbeln = y_p_vbln.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        y_wa_vbap-zmeng = 2 + y_wa_vbap-zmeng.
        MODIFY y_i_vbap FROM y_wa_vbap INDEX sy-tabix.
      ENDLOOP.
      PERFORM y_f_update USING y_i_vbap.
    *&      Form  y_f_update
           POPULATE BAPI DATA AND RUN BAPI
    FORM y_f_update USING  y_p_vbap TYPE y_tt_vbap.
      CLEAR: y_i_headerx, y_i_itemin, y_i_iteminx,
             y_i_return, y_i_bapiret.
      REFRESH: y_i_itemin, y_i_iteminx, y_i_return, y_i_bapiret.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        MOVE y_wa_vbap-zmeng TO y_wa_itemin-target_qty.
        MOVE y_wa_vbap-posnr TO y_wa_itemin-itm_number.
        APPEND y_wa_itemin TO y_i_itemin.
      ENDLOOP.
    *Update the Bapi Itnernal tables
      y_wa_headerx-updateflag = y_k_u .
      APPEND y_wa_headerx TO y_i_headerx.
      LOOP AT y_i_vbap INTO y_wa_vbap.
        y_wa_iteminx-itm_number = y_wa_vbap-posnr.
        y_wa_iteminx-target_qty = y_k_x .
        y_wa_iteminx-updateflag = y_k_u .
        APPEND y_wa_iteminx TO y_i_iteminx .
      ENDLOOP .
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = y_wa_vbap-vbeln
          order_header_inx = y_wa_headerx
        TABLES
          return           = y_i_return
          order_item_in    = y_i_itemin
          order_item_inx   = y_i_iteminx.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      CLEAR y_i_vbap.
    IF y_i_return is not initial.
      LOOP AT y_i_return INTO y_wa_return where TYPE = y_k_e .
        MOVE y_wa_return-message TO y_wa_vbap-message .
        Append  y_wa_vbap to y_i_vbap.
        y_v_success = y_v_success + 1.
      ENDLOOP.
    ENDIF.
      y_wa_event-name = 'TOP_OF_PAGE'.
      y_wa_event-form = 'Y_FD_TOP_OF_LIST'.
      APPEND y_wa_event TO y_i_event.
      CLEAR y_wa_event.
      CALL FUNCTION 'ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program         = sy-repid
          i_tabtypename1             = 'Y_T_VBAP'
          it_events1                 = y_i_event[]
        TABLES
          t_outtab1                  = y_i_vbap[]
        EXCEPTIONS
          program_error              = 1
          maximum_of_appends_reached = 2
          OTHERS                     = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " y_f_vbap
    *&      Form  Y_FD_TOP_OF_LIST
    FORM y_fd_top_of_list.
      MOVE: y_v_success TO y_v_sno,
            y_v_error   TO y_v_eno.
      CONCATENATE text-002 y_v_sno '/' y_v_eno INTO y_v_msg SEPARATED BY
      space.
      CONDENSE y_v_msg.
      WRITE / y_v_msg .
      SKIP 1.
    ENDFORM.                    "Y_FD_TOP_OF_LIST

  • How to customize the default add item in a content area

    Hi!! I want to know what can I do to introduce a file in a content area, but I don't want to use the default page that portal use. I want to customize the add item option, the same that I have done with the folders. The problem that I have is that I need the user to have the file on his/her pc, and the api add_item needs the file on unix, where de DB is installed.
    If anyone has any idea, please help me.

    Hi All,
    Thanks for all your reply, but maybe i didn't describe my problem clear. My problem for the combobox is that once the combobox has a selected value, then there is no way to clear it in the UI even I remove all the items in its ValidValues. From the user interface, the selected value still stays there but actually this combobox is empty and does not have any items. My question is how can I remove the current selected item in the combobox.
    Thanks,
    Lan

  • How to use FNDLOAD to add program to request group?

    Is there a way to use FNDLOAD to add a program to System administrators > security > responsilibity > request.
    I have try to use the following command to downlod this information to load it to other place but no record saved in ldt file:
    FNDLOAD apps/apps1234 O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct PO_RESQUEST_GROUP_2.ldt REQUEST_GROUP REQUEST_GROUP_NAME="All Reports" APPLICATION_SHORT_NAME="XXPO"
    OR
    FNDLOAD apps/apps1234 O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct PO_RESQUEST_GROUP_3.ldt REQUEST_GROUP APPLICATION_SHORT_NAME="Purchasing" REQUEST_GROUP_NAME="All Reports" UNIT_NAME="XXPO_PUR_REQ"
    if i delete APPLICATION_SHORT_NAME="Purchasing" , it downloaded many seemingly not relevant data as follow:
    Downloading REQUEST_GROUP to the data file PO_RESQUEST_GROUP_3.ldt
    Downloaded REQUEST_GROUP All Reports CUN
    Downloaded REQUEST_GROUP All Reports IGS
    Downloaded REQUEST_GROUP All Reports PSB
    Downloaded REQUEST_GROUP All Reports CSE
    Downloaded REQUEST_GROUP All Reports AHL
    Downloaded REQUEST_GROUP All Reports ENI
    Downloaded REQUEST_GROUP All Reports OFA
    Downloaded REQUEST_GROUP All Reports XTR
    Downloaded REQUEST_GROUP All Reports SQLAP
    Downloaded REQUEST_GROUP All Reports PO
    Downloaded REQUEST_GROUP All Reports CHV
    Downloaded REQUEST_GROUP All Reports QA
    Downloaded REQUEST_GROUP All Reports CE
    Downloaded REQUEST_GROUP All Reports POA
    Downloaded REQUEST_GROUP All Reports MFG
    Downloaded REQUEST_GROUP All Reports CRP
    Downloaded REQUEST_GROUP All Reports WIP
    How can I confine "Application"? which is under the field "Group" and how can I download all application named "custom puchasing" next to "Name"?

    When migrating to another instance and want to add a concurrent program to a request group, I do it in two steps. Within a shell script, I call
    1 - FNDLOAD to load ldt file (concurrent program definition)
    2 - SQLPLUS to run an sql file that call FND API that install concurrent program into proper request group.
    ex # 1 :
    FNDLOAD $apps_user/$apps_pswd@$dbsid 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct $XX_TOP/XX_PGM.ldt - WARNING=YES CUSTOM_MODE=FORCE >> $LOG_FILE 2>&1
    ex # 2 :
    sqlplus -s $apps_user/$apps_pswd@$dbsid @$XX_TOP/XX_PGM_REQ_GROUP.sql >> $LOG_FILE 2>&1
    XX_PGM_REQ_GROUP.sql content.
    IF NOT fnd_program.program_in_group('XX_PGM','Business Online','GL Concurrent Program Group','General Ledger' ) THEN
    fnd_program.add_to_group(program_short_name => 'XX_PGM',
    program_application => 'Business Online',
    request_group => 'GL Concurrent Program Group',
    group_application => 'General Ledger');
    COMMIT;
    END IF;
    Hope this might help.

  • How to use ATO Model & ATO Item as bill for ATO Model

    Can anybody have an Idea of using ATO Item inside an ATO Model, ATO Model as a bill for another ATO model. In the below mentioned scenario, is it possible for the ATO Item(item_compE) to be manufactured based on the sales order.. I don't want to keep it manufactured.. But in Vision Instance, the parent Job is completed normaly & able to ship the SO. But when i checked the onhand for the ATO Item components, its not reduced.. ie it is not manufactured & shipped, but didn't throw any error....
         1     Order_itemABCDE (ATO Model)
         1.1     item_compA          (Purchased)
         1.2     item_compB     (Purchased)
         1.3     item_compC          (Purchased)
         1.4     item_compD          (ATO Option Class)
         1.4.1     item_compD1          (Purchased)
         1.4.2     item_compD2          (Purchased)
         1.4.3     item_compD3          (Finished)
         1.5     item_compE          (ATO ITEM)
         1.5.1     item_compE1          (Finished)
         1.5.2     item_compE2          (Purchased)
         1.5.3     item_compE3          (Purchased)
    Now I am creating a separate discreet job order for the ATO Item & keep the onhand available, & its working fine...Is there a way to automatically create a Job order for ATO Item along with the parent item from the Sales order?.
    Also How can I extend it to a requirement like, an ATO Model item, inside another ATO model item???For example ItemA(ATO Model) as a bill for ItemB(ATO Model). How it can be accomplished, as ItemA is not directly ordered thru SO, its jus a component for ItemB & want to manufacture based on requirement..
    Hope the Scenario is clear.. Please suggest if this can be achieved...
    Thanks
    Ranjith

    rrenji83 wrote:
    Can anybody have an Idea of using ATO Item inside an ATO Model, ATO Model as a bill for another ATO model. In the below mentioned scenario, is it possible for the ATO Item(item_compE) to be manufactured based on the sales order.. I don't want to keep it manufactured.. But in Vision Instance, the parent Job is completed normaly & able to ship the SO. But when i checked the onhand for the ATO Item components, its not reduced.. ie it is not manufactured & shipped, but didn't throw any error....
         1     Order_itemABCDE (ATO Model)
         1.1     item_compA          (Purchased)
         1.2     item_compB     (Purchased)
         1.3     item_compC          (Purchased)
         1.4     item_compD          (ATO Option Class)
         1.4.1     item_compD1          (Purchased)
         1.4.2     item_compD2          (Purchased)
         1.4.3     item_compD3          (Finished)
         1.5     item_compE          (ATO ITEM)
         1.5.1     item_compE1          (Finished)
         1.5.2     item_compE2          (Purchased)
         1.5.3     item_compE3          (Purchased)
    Now I am creating a separate discreet job order for the ATO Item & keep the onhand available, & its working fine...Is there a way to automatically create a Job order for ATO Item along with the parent item from the Sales order?.
    Also How can I extend it to a requirement like, an ATO Model item, inside another ATO model item???For example ItemA(ATO Model) as a bill for ItemB(ATO Model). How it can be accomplished, as ItemA is not directly ordered thru SO, its jus a component for ItemB & want to manufacture based on requirement..
    Hope the Scenario is clear.. Please suggest if this can be achieved...
    Thanks
    RanjithI don't know..if i got your requirement correctly or not
    Make ATO Item supply type as phantom for the ATO model Bill..this way when the job is created for the top model...ATO item will be exploded..
    HTH
    Mahendra

  • How to change style of add item screen

    I have created a pagegroup with a specific style, however whenever a user attemps to add an item or a portlet it defaults the standard portal colour scheme, how can I get portal to display the add item, add portlet screen in my default colour.

    Orlando -
    You may want to contact support to try to get some documentation. There should be a script called <OracleInfrastructureHome>/portal/admin/plsql/wwc/uiwizset.sql
    If you open this file in a text editor it should be fairly straight forward to change the styles to the colors and fonts you wish, then execute this sql file in sqlplus.
    Hope this helps,
    Candace

  • How to Use Methods AFTER Work Item Execution (Modal Call)

    Hi,
    Need to execute a piece of code after a decision based on the result.
    Hope this can be done using Methods After WorkItem Execution
    Can anyone give some idea about how to use this.
    Regards
    Imman

    Hi Mike,
    I have a common piece of code that has to get executed irrespective of the decision made,but after the decision.
    Imman

  • How can i get also the files in the root directory and how can i for testing add items of IEnumerable FTPListDetail to List string ?

    What i get is only the directories and files that in other nodes. But i have also files on the root directory and i never
    get them. This is a screenshot of my program after i got the content of my ftp. I'm using treeView to display my ftp content:
    You can see two directories from the root but no files on the root it self. And in my ftp server host i have files in the root direcory.
    This is the method i'm using to get the directory listing:
    public IEnumerable<FTPListDetail> GetDirectoryListing(string rootUri)
    var CurrentRemoteDirectory = rootUri;
    var result = new StringBuilder();
    var request = GetWebRequest(WebRequestMethods.Ftp.ListDirectoryDetails, CurrentRemoteDirectory);
    using (var response = request.GetResponse())
    using (var reader = new StreamReader(response.GetResponseStream()))
    string line = reader.ReadLine();
    while (line != null)
    result.Append(line);
    result.Append("\n");
    line = reader.ReadLine();
    if (string.IsNullOrEmpty(result.ToString()))
    return new List<FTPListDetail>();
    result.Remove(result.ToString().LastIndexOf("\n"), 1);
    var results = result.ToString().Split('\n');
    string regex =
    @"^" + //# Start of line
    @"(?<dir>[\-ld])" + //# File size
    @"(?<permission>[\-rwx]{9})" + //# Whitespace \n
    @"\s+" + //# Whitespace \n
    @"(?<filecode>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<owner>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<group>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<size>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<month>\w{3})" + //# Month (3 letters) \n
    @"\s+" + //# Whitespace \n
    @"(?<day>\d{1,2})" + //# Day (1 or 2 digits) \n
    @"\s+" + //# Whitespace \n
    @"(?<timeyear>[\d:]{4,5})" + //# Time or year \n
    @"\s+" + //# Whitespace \n
    @"(?<filename>(.*))" + //# Filename \n
    @"$"; //# End of line
    var myresult = new List<FTPListDetail>();
    foreach (var parsed in results)
    var split = new Regex(regex)
    .Match(parsed);
    var dir = split.Groups["dir"].ToString();
    var permission = split.Groups["permission"].ToString();
    var filecode = split.Groups["filecode"].ToString();
    var owner = split.Groups["owner"].ToString();
    var group = split.Groups["group"].ToString();
    var filename = split.Groups["filename"].ToString();
    var size = split.Groups["size"].Length;
    myresult.Add(new FTPListDetail()
    Dir = dir,
    Filecode = filecode,
    Group = group,
    FullPath = CurrentRemoteDirectory + "/" + filename,
    Name = filename,
    Owner = owner,
    Permission = permission,
    return myresult;
    And then this method to loop over and listing :
    private int total_dirs;
    private int searched_until_now_dirs;
    private int max_percentage;
    private TreeNode directories_real_time;
    private string SummaryText;
    private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
    var directoryNode = new TreeNode(name);
    var directoryListing = GetDirectoryListing(path);
    var directories = directoryListing.Where(d => d.IsDirectory);
    var files = directoryListing.Where(d => !d.IsDirectory);
    total_dirs += directories.Count<FTPListDetail>();
    searched_until_now_dirs++;
    int percentage = 0;
    foreach (var dir in directories)
    directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
    if (recursive_levl == 1)
    TreeNode temp_tn = (TreeNode)directoryNode.Clone();
    this.BeginInvoke(new MethodInvoker( delegate
    UpdateList(temp_tn);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    foreach (var file in files)
    TreeNode file_tree_node = new TreeNode(file.Name);
    file_tree_node.Tag = "file" ;
    directoryNode.Nodes.Add(file_tree_node);
    numberOfFiles.Add(file.FullPath);
    return directoryNode;
    Then updating the treeView:
    DateTime last_update;
    private void UpdateList(TreeNode tn_rt)
    TimeSpan ts = DateTime.Now - last_update;
    if (ts.TotalMilliseconds > 200)
    last_update = DateTime.Now;
    treeViewMS1.BeginUpdate();
    treeViewMS1.Nodes.Clear();
    treeViewMS1.Nodes.Add(tn_rt);
    ExpandToLevel(treeViewMS1.Nodes, 1);
    treeViewMS1.EndUpdate();
    And inside a backgroundworker do work how i'm using it:
    var root = Convert.ToString(e.Argument);
    var dirNode = CreateDirectoryNode(root, "root", 1);
    e.Result = dirNode;
    And last the FTPListDetail class:
    public class FTPListDetail
    public bool IsDirectory
    get
    return !string.IsNullOrWhiteSpace(Dir) && Dir.ToLower().Equals("d");
    internal string Dir { get; set; }
    public string Permission { get; set; }
    public string Filecode { get; set; }
    public string Owner { get; set; }
    public string Group { get; set; }
    public string Name { get; set; }
    public string FullPath { get; set; }
    Now the main problem is that when i list the files and directories and display them in the treeView it dosen't get/display
    the files in the root directory. Only in the sub nodes.
    I will see the files inside hello and stats but i need also to see the files in the root directory.
    1. How can i get and list/display the files of the root directory ?
    2. For the test i tried to add to a List<string> the items in var files to see if i get the root files at all.
       This is what i tried in the CreateDirectoryNode before it i added:
    private List<string> testfiles = new List<string>();
    Then after var files i did:
    testfiles.Add(files.ToList()
    But this is wrong. I just wanted to see in testfiles what items i'm getting in var files in the end of the process.
    Both var files and directoryListing are IEnumerable<FTPListDetail> type.
    The most important is to make the number 1 i mentioned and then to do number 2.

    Risa no.
    What i mean is this. This is a screenshot of my ftp server at my host(ipage.com).
    Now this is a screenshot of my program and you can see that in my program i have only the directories hello stats test but i don't have the files in the root: htaccess.config swp txt 1.txt 2.png....all this files i don't have it on my treeView.
    What i want it to be is that on my program on the treeView i will also display the files like in my ftp server.
    I see in my program only the directories and the files in the directories but i don't see the files on the root directory/node.
    I need it to be like in my ftp server i need to see in my program the htaccess 1.txt 2.png and so on.
    So what i wrote in my main question is that in the var files i see this files of the root directory i just don't know to add and display them in my treeView(my treeView is treeViewMS1).
    I know i checked in my program in the method CreateDirectoryNode i see in the first iteration of the recursive that var files contain this root files i just dont know how to add and display them in my treeView.
    On the next iterations when it does the recursive it's adding the directories hello stats test and the files in this directories but i need it to first add the root files.

  • How To Use a Hidden Page Item within an SQL Report Query without Submitting

    Hi,
    Using: Oracle ApEx 3.0.1
    I have an sql report region that contains a hidden page item as part of the "where clause". My problem is, based on a value entered by the user, I need to assign this value enetered to my hidden item, so that it can be used within the where condition of my sql but this would need to be done without actually submitting the form.
    At the moment, I can set the value via an on-demand process but my SQL is still not returing any values as the hidden page item within the query is not set (as page has not been submitted).
    Can anybody please assist as I am not sure how to do this and whether in actual fact, this is possible to do, without having submitted the page.
    Thanks.
    Tony.
    Edited by: Tony F. on Nov 12, 2011 1:39 AM

    You can set a session value using a dummy ajax call e.g:
    Add the following to the 'Function and Global Variable Declaration' region
    function f_set_item(pThis){
      var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',1);
      get.add('P1_ID',pThis.value)
      gReturn = get.get();
      get = null;
    }Where P1_ID is the session value to be set. Then call the function in the usual way e.g.
    javascript:f_set_item(this);
    I hope that helps
    Shunt

  • How to use two different report items in SSRS page header

    Hi All,
    Can we use more than one report item in SSRS 2008 R2 page header...
    Like this in expression..
    =IIF(Globals!PageNumber=1,ReportItems!Col1.Value,ReportItems!Col2.Value)
    Whenever Globals!PageNumber=1 I want to show values present in Col1 and when Globals!PageNumber<>1 then show values present in col2
    Also let know if any other work around is there to meet above criteria...
    Thanks,
    RH
    sql

    Hi RH,
    Based on my research, a text box in the page header can only refer to the ReportItems built-in collection once in an expression. So if we directly use the expression in the page header, we can receive the error message that “The Value expression for textrun’’
    refer to more than one report item. An expression in a page header or footer can refer to only one report item”.
    To work around the issue, we can add two text boxes to the page header: one for the textbox col1 value (=ReportItems!Col1.Value), another for the textbox col2 value (=ReportItems!Col2.Value). Then use the expressions as below to control the visibility of
    those textboxes:
    =iif(Globals!PageNumber=1,false,true)
    =iif(Globals!PageNumber<>1,false,true)
    Please note that only text boxes on the current page are available as a member of the ReportItems collection in a page header or page footer section. For example, if ReportItems!textbox_name.Value refers to a text box that only appears on the first page
    for a multipage data region, we cannot see a value on other pages except the first page.
    Reference:
    Using the ReportItems Collection References (Report Builder 3.0 and SSRS)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to use ADD_METADEF to add a custom metadata field

    Hi All,
    I am trying to add a custom metadata field to check in profile, and this I want to do using RIDC library through my java program. I have tried the following code, but some how I could not see its getting added to Information Fields and also to Standard check in profile.
    Can you let me know what am I missing?
                myIdcClient = myIdcClientManager.createClient("idc://XXXX:4444"); // just commented out
                IdcContext myIdcContext = new IdcContext("weblogic", "weblogic1");
                ServiceResponse myServiceResponse = null;
                  DataBinder myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "UPDATE_OPTION_LIST");
                    myRequestDataBinder.putLocal("dKey", "xLocationList123");
                  myRequestDataBinder.putLocal("OptionListString", "Madrid\nTokyo\nLondon\nWashington");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "ADD_METADEF");
                    myRequestDataBinder.putLocal("dName", "xLocations123123");
                    myRequestDataBinder.putLocal("dIsRequired", "0");
                    myRequestDataBinder.putLocal("dOptionListKey", "xLocationList123");
                    myRequestDataBinder.putLocal("dOptionListType", "choice");
                    myRequestDataBinder.putLocal("dIsOptionList", "1");                    
                    myRequestDataBinder.putLocal("dIsSearchable", "1");
                    myRequestDataBinder.putLocal("dIsEnabled", "1");
                    myRequestDataBinder.putLocal("dType", "Text");
                    myRequestDataBinder.putLocal("FieldName", "xLocations123123");
                    myRequestDataBinder.putLocal("dCaption", "Locations");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    //IdcService=UPDATE_META_TABLE
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "UPDATE_META_TABLE");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "START_SEARCH_INDEX");
                    myRequestDataBinder.putLocal("IsRebuild", "1");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "PUBLISH_SCHEMA");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
    Thanks in advance.

    Try calling the following code:
    import static intradoc.shared.MetaFieldUtils.hasDocMetaDef;
    import static intradoc.shared.MetaFieldUtils.updateMetaDataFromProps;
    import intradoc.common.ServiceException;
    import intradoc.data.DataBinder;
    import intradoc.data.DataException;
    import intradoc.data.Workspace;
        protected static void addMetadataFields(final Workspace workspace, final DataBinder binder) {
            traceVerbose("Start addMetadataFields");
            // Parameters for metadata field
            final String[] parameters = new String[] { "dsdComponentName", "dComponentName", "dsdVersion", "dType", "dIsRequired", "dIsEnabled", "dIsSearchable", "dIsOptionList", "dOptionListKey", "dOptionListType", "dDefaultValue", "dOrder", "dIsPlaceholderField", "dsdCheckFlag",
                    "dsdDisableOnUninstall" };
            // Common values for primary and alternate field values
            final String[] values = new String[] { "ComponentName", ComponentName, "build_1_20131206", "BigText", "0", "1", "1", "0", "", "", "", "2500", "0", "", "" };
            // Primary file checksum field parameters and values
            final Properties field = new Properties();
            for (int i = 0; i < parameters.length; i++) {
                field.put(parameters[i], values[i]);
            // Setup primary file specific parameters
            field.put("dName", "Metadata field name");
            field.put("dCaption", "Metadata field caption");
            try {
                // Name of metadata field
                final String fieldName = field.getProperty("dName");
                trace("dName: " + fieldName);
                if (fieldName != null && fieldName.length() > 0 && !hasDocMetaDef(fieldName)) {
                    try {
                        updateMetaDataFromProps(workspace, null, field, fieldName, true);
                        trace("Successfully added metadata field " + fieldName);
                    } catch (final ServiceException e) {
                        warn("Metadata field " + fieldName + " was not installed.", e);
                    } catch (final DataException e) {
                        warn("Metadata field " + fieldName + " was not installed.", e);
                } else {
                    trace("Metadata field already exists; will not modify");
            } finally {
                traceVerbose("End addMetadataFields");
    Jonathan
    http://jonathanhult.com

Maybe you are looking for

  • IPOD Formatted !! Wouldnt start up now

    hi all, i formatted my ipod 5G 30GB using the restore instructions from apple's website. all went well except after completion an icon showed up showing a power adapter going into wall and everything went blank. i checked the iconography website and

  • New to Mac's

    Hi all, im new to macs and just wondering about Anti-Virus. I just bought a MacBook, the 1299 one. i had a dell XPS. jusdt wondering how macs work dealing with anti-virus, does it come with one, do i need to get one? thanks in advance.

  • How to make an explicit closing tag in XML(e4x).

    I'm working with some XML data and I'm having trouble forcing the way my closing tags are generated. I want the long hand form, such as: var xmlData:XML = <code>    <codeSnippet>    </codeSnppet> </code>; But when I try to insert nodes within the cod

  • Dll in lv7

    Use the CALL LIBRARY FUNCTION to access a function in a DLL Attachments: DLLQuestion.txt ‏1 KB

  • Destructor method in Forte...

    Hi all, Does anyone know of a "destructor" method in Forte that will be called when an object is destroyed? Thanks, -Deva