Creating a sales document using BAPI in web dynpro by uploading a file

Hi ALL,
Can some one help me how to create a sales document using  BAPI by uploading a file as input...Can someone  provide me a sample program....
Thanks n Regards,
Praveenn.
Edited by: praveenn on Aug 23, 2011 12:42 PM

Hi Sri,
Thx for the response...
Here is the code that i followed for creating a BAPI_SALESORDER_CREATE1 by uploading a text file as input.
Just create a Attribute  in the VIEW CONTEXT of type String.
method ONACTIONCREATE_SO .
types : Begin of ty_data,
         sales_org  type vkorg,
         doc_type   type AUART,
         DISTR_CHAN type VTWEG,
         DIVISION   type spart,
         material   type matnr,
         partn_role type PARVW,
         PARTN_NUMB type kunnr,
       end of ty_data.
  DATA  :it_table TYPE  TABLE OF ty_data,
         i_data   TYPE  TABLE OF string,
         l_string TYPE string,
         wa_table TYPE ty_Data,
         l_xstring TYPE xstring,
         fields TYPE string_table,
         lv_field TYPE string.
DATA: wa_order_header_in TYPE BAPISDHD1,
      it_order_items_in  TYPE TABLE OF BAPISDITM,
      wa_order_items_in  TYPE BAPISDITM,
      it_order_partners  TYPE TABLE OF BAPIPARNR,
      wa_order_partners  TYPE BAPIPARNR,
      it_return TYPE TABLE OF BAPIRET2,
      wa_return TYPE BAPIRET2.
DATA : sales_doc type bapivbeln-vbeln.
DATA:
   node_zfinal_node  TYPE REF TO if_wd_context_node,
   elem_zfinal_node  TYPE REF TO if_wd_context_element,
   stru_zfinal_node  TYPE if_main_view=>element_zfinal_node .
get single attribute
  wd_context->get_attribute(
  EXPORTING
  name =  'DATASOURCE'
  IMPORTING
  value = l_xstring ).
  CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
      in_xstring = l_xstring
    IMPORTING
      out_string = l_string.
SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
  LOOP AT i_data INTO l_string.
   SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
    READ TABLE fields INTO lv_field INDEX 1.
    wa_table-sales_org = lv_field.
    READ TABLE fields INTO lv_field INDEX 2.
    wa_table-doc_type = lv_field.
    READ TABLE fields INTO lv_field INDEX 3.
    wa_table-DISTR_CHAN = lv_field.
    READ TABLE fields INTO lv_field INDEX 4.
    wa_table-DIVISION = lv_field.
    READ TABLE fields INTO lv_field INDEX 5.
    wa_table-material  = lv_field.
    READ TABLE fields INTO lv_field INDEX 6.
    wa_table-partn_role  = lv_field.
    READ TABLE fields INTO lv_field INDEX 7.
    wa_table-partn_numb  = lv_field.
APPEND wa_table TO it_table.
  ENDLOOP.
loop at it_table into wa_table.
clear : wa_order_header_in.
wa_order_header_in-sales_org   = wa_table-sales_org.
wa_order_header_in-doc_type    = wa_table-doc_type.
wa_order_header_in-distr_chan  = wa_table-distr_chan.
wa_order_header_in-division    = wa_table-division.
clear : wa_order_items_in.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = wa_table-material
IMPORTING
   OUTPUT        = wa_order_items_in-material.
*wa_order_items_in-req_qty  = wa_table-req_qty.
append wa_order_items_in to it_order_items_in.
clear : wa_order_partners.
wa_order_partners-partn_role = wa_table-partn_role.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = wa_table-partn_numb
IMPORTING
   OUTPUT        = wa_order_partners-partn_numb
*wa_order_partners-partn_numb = wa_table-partn_numb.
append wa_order_partners to it_order_partners.
endloop.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
  EXPORTING
  SALESDOCUMENTIN               =
    order_header_in               = wa_order_header_in
  ORDER_HEADER_INX              =
  SENDER                        =
  BINARY_RELATIONSHIPTYPE       =
  INT_NUMBER_ASSIGNMENT         =
  BEHAVE_WHEN_ERROR             =
  LOGIC_SWITCH                  =
  TESTRUN                       =
  CONVERT                       = ' '
IMPORTING
   SALESDOCUMENT                 = sales_doc
  tables
   RETURN                        = it_return
   ORDER_ITEMS_IN                = it_order_items_in
  ORDER_ITEMS_INX               =
    order_partners                = it_order_partners.
  ORDER_SCHEDULES_IN            =
get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
       l_message_manager    TYPE REF TO if_wd_message_manager.
       l_current_controller ?= wd_this->wd_get_api( ).
DATA:  v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
   EXPORTING wait = 'X'.
  CONCATENATE 'Sales Document' sales_doc 'has been created.' INTO v_message_text SEPARATED BY space.
Report Success message
  CALL METHOD l_message_manager->report_success
  EXPORTING
  message_text = v_message_text.
  ELSE.
  v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING
message_text = v_message_text.
ENDIF.
endmethod.
Edited by: praveenn on Aug 30, 2011 2:41 PM

Similar Messages

  • How to create the sales order using BAPI's ....?

    Hi Guru's,
    could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically  i don't have basic knowledge on this....please provide required inputs ....:)
    thanks in advance
    Srinivas......

    Hi Guru's thanks for your inouts and your valuble time...
    please find the program logic below...
    *& Report  ZAREPAS30
    REPORT  zarepas30.
    DATA : gs_vbeln                   TYPE  vbak-vbeln,
           gs_order_header_in         TYPE  bapisdhd1,
           gs_order_header_inx        TYPE  bapisdhd1x,
           gt_order_items_in          TYPE  STANDARD TABLE OF bapisditm,
           gwa_itab1                  TYPE  bapisditm,
           gt_order_items_inx         TYPE  STANDARD TABLE OF bapisditmx,
           gwa_itab2                  TYPE  bapisditmx,
           gt_order_partners          TYPE  STANDARD TABLE OF bapiparnr,
           gwa_itab3                  TYPE  bapiparnr,
           gt_return                  TYPE  STANDARD TABLE OF bapiret2,
           gwa_itab4                  TYPE  bapiret2.
    Sales document type
      PARAMETERS: p_auart TYPE auart OBLIGATORY.
    Sales organization
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    Distribution channel
      PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    Division.
      PARAMETERS: p_spart TYPE spart OBLIGATORY.
    Requested Delivery Date
      PARAMETERS: p_edatu  TYPE edatu OBLIGATORY.
    Sold-to
      PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    Ship-to
      PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    Material
      PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    Quantity.
      PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    Plant
      PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    Start-of-selection.
      START-OF-SELECTION.
    Header data
    Sales document type
      gs_order_header_in-doc_type = p_auart.
      gs_order_header_inx-doc_type = 'X'.
    Sales organization
      gs_order_header_in-sales_org = p_vkorg.
      gs_order_header_inx-sales_org = 'X'.
    Distribution channel
      gs_order_header_in-distr_chan  = p_vtweg.
      gs_order_header_inx-distr_chan = 'X'.
    Division
      gs_order_header_in-division = p_spart.
      gs_order_header_inx-division = 'X'.
    Reguested Delivery Date
      gs_order_header_in-req_date_h = p_edatu.
      gs_order_header_inx-req_date_h = 'X'.
      gs_order_header_inx-updateflag = 'I'.
    Partner data
    Sold to
      gwa_itab3-partn_role = 'AG'.
      gwa_itab3-partn_numb = p_sold.
      APPEND gwa_itab3 TO  gt_order_partners .
    ship to
      gwa_itab3-partn_role = 'WE'.
      gwa_itab3-partn_numb = p_ship.
      APPEND gwa_itab3 TO  gt_order_partners .
    ITEM DATA
      gwa_itab2-updateflag = 'I'.
    Line item number.
      gwa_itab1-itm_number = '000010'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    Line item number.
      gwa_itab1-itm_number = '000020'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = gs_order_header_in
        ORDER_HEADER_INX              = gs_order_header_inx
      IMPORTING
        SALESDOCUMENT                 = gs_vbeln
      tables
        RETURN                        = gt_return
        ORDER_ITEMS_IN                = gt_order_items_in
        ORDER_ITEMS_INX               = gt_order_items_inx
        order_partners                = gt_order_partners.
    Check the return table.
      LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error occured while creating sales order '.
      ELSE.
    Commit the work.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', gs_vbeln, ' created'.
      ENDIF.

  • Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI

    I am having a problem when creating a sale order using BAPI
    BAPI_SALESORDER_CREATEFROMDAT2
    Problem is that sale order item quantity field is not populating
    code is as follows
    ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
    ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
    ORDER_ITEMS_IN-TARGET_QU = 'LB'.
    ORDER_ITEMS_IN-TARGET_QTY = 1.

    Hi,
    Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
    Regds,
    Rudra

  • How to create a sales order using bapi

    hi
        i need to create a sales order using bapi.
    can any one help me

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create a sales document using  BAPI_SALESORDER_CREATEFROMDAT2

    Hai i was un able to create a sales order using the BAPI can you help me out

    Sample Code:
              clear:   l_order_header,
                       l_salesdocument,
                       l_order_partners,
                       l_order_items,
                       l_order_schdl.
              refresh: it_order_items,
                       it_order_partners,
                       it_order_schdl,
                       it_return.
    ???????? get from material ...
            Order header
              l_order_header-doc_type          = 'ZQBV'.
              l_order_header-distr_chan        = '10'.
              l_order_header-division          = '00'.
              if g_qals-werk eq '1100'.
                l_order_header-sales_org         = '1000'.
              else.
                if g_qals-werk eq '3100'.
                  l_order_header-sales_org         = '3000'.
                else.
                  message i001(00) with text-005.
                endif.
              endif.
              l_order_header-purch_no_c        = g_qals-prueflos.  " <= lot
            Partner data
              l_order_partners-partn_role      = 'AG'.
              l_order_partners-partn_numb      = g_qals-kunnr.
              append l_order_partners to it_order_partners.
            Order items => only one
              l_order_items-itm_number         = 10.
              l_order_items-material           = g_qals-matnr.
              l_order_items-target_qty         = 1.
              append l_order_items to it_order_items.
            Schedules for quantity
              l_order_schdl-itm_number         = 10.
              l_order_schdl-req_qty            = 1.        " <=  only 1 !
              append l_order_schdl to it_order_schdl.
            Conditions for value
              l_order_conditions-itm_number    = 10.
              l_order_conditions-cond_type     = 'PR00'.
              l_order_conditions-cond_value    = g_effort_sum.
              l_order_conditions-currency      = g_effort_unit.
              append l_order_conditions to it_order_conditions.
            BAPI to create sales order
              CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
                EXPORTING
               SALESDOCUMENTIN               =
                  ORDER_HEADER_IN               = l_order_header
               ORDER_HEADER_INX              =
               SENDER                        =
               BINARY_RELATIONSHIPTYPE       =
               INT_NUMBER_ASSIGNMENT         =
               BEHAVE_WHEN_ERROR             =
               LOGIC_SWITCH                  =
               TESTRUN                       =
               CONVERT                       = ' '
                IMPORTING
                  SALESDOCUMENT                 = l_salesdocument
                TABLES
                  RETURN                        = it_return
                  ORDER_ITEMS_IN                = it_order_items
               ORDER_ITEMS_INX               =
                  ORDER_PARTNERS                = it_order_partners
                  ORDER_SCHEDULES_IN            = it_order_schdl
               ORDER_SCHEDULES_INX           =
                  ORDER_CONDITIONS_IN           = it_order_conditions
               ORDER_CONDITIONS_INX          =
               ORDER_CFGS_REF                =
               ORDER_CFGS_INST               =
               ORDER_CFGS_PART_OF            =
               ORDER_CFGS_VALUE              =
               ORDER_CFGS_BLOB               =
               ORDER_CFGS_VK                 =
               ORDER_CFGS_REFINST            =
               ORDER_CCARD                   =
               ORDER_TEXT                    =
               ORDER_KEYS                    =
               EXTENSIONIN                   =
               PARTNERADDRESSES              =
              if not l_salesdocument is initial.
              order successfully created
                message i001(00) with text-001 l_salesdocument.
    call function 'BAPI_TRANSACTION_COMMIT'.
              endif.
    Regards,
    Ravi

  • Need to Create a Sales Order Using BAPI....

    Hello Gurus,
    I have called 'BAPI_SALESORDER_CREATEFROMDAT2' n a FM and trying to create a Sales Order. I have passed the header (auart, vkorg, vtweg, spart) and partner (nmbr and role). I passed the parameters to BAPI but in the return messages it says 'Sales Document was not changed V4 E'.
    I hope I am clear, if not please ask...
    Suggestions would be rewarded....
    Regards
    Leo

    Hi Leo,
    Check out the following codes:
    Even I have worked in ECC 5.0.These are the mandatory parametersthat u need to pass to create a Sales Order successfully...
    REPORT  Z6SKS_HERSHEYS2.
    data : order_header_in1 type BAPISDHD1.
    data: order_partners1 type BAPIPARNR occurs 0 with header line.
    data: ORDER_ITEMS_IN1 type BAPISDITM occurs 0 with header line.
    DATA : SALESDOCUMENT1 TYPE BAPIVBELN-VBELN.
    DATA : RETURN1 TYPE BAPIRET2 OCCURS 0.
    DATA : RETURN2 TYPE BAPIRET2.
       order_header_in1-doc_type = 'TA'.
       order_header_in1-sales_org = '0001'.
       order_header_in1-distr_chan = '01'.
       order_header_in1-division = '01'.
       ORDER_ITEMS_IN1-material = '000000000000000013'.
       append ORDER_ITEMS_IN1.
       order_partners1-PARTN_ROLE = 'WE'.
       order_partners1-PARTN_NUMB = '0000000017'.
       APPEND order_partners1.
    Perform call_function.
    *&      Form  call_function
          text
    -->  p1        text
    <--  p2        text
    form call_function .
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        order_header_in               = order_header_in1
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                 = SALESDOCUMENT1
      tables
       RETURN                        = RETURN1
       ORDER_ITEMS_IN                = ORDER_ITEMS_IN1
      ORDER_ITEMS_INX               =
        order_partners                = order_partners1
      ORDER_SCHEDULES_IN            =
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN           =
      ORDER_CONDITIONS_INX          =
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
      IF NOT SALESDOCUMENT1 IS INITIAL.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT          =
               IMPORTING
                 RETURN        = RETURN2
       ELSE.
              CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
              IMPORTING
                RETURN        =
       ENDIF.
    endform.                    " call_function
    This should help u...
    Please reward points if found useful...

  • How to create open sales order using BAPI....?

    Hi Guru's,
    please help me how to create open sales order and which BAPI i have to use for open sales order.
    please provide any program logic related to this or step by step process.....
    that would be helpful to me.
    thanks in advance...
    Srinivas....

    Hi sreenu,
    Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
    You can use VA05 to find open sales orders.
    Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
    U cannot directly find the open PO and open SO from any table.
    That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
    U have table VBUP for SO status.Check out the fields in that table
    pls see the below link.
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    http://msdn.microsoft.com/en-us/library/cc185190.aspx
    thjanks
    karthik

  • Create / Change Sales Order using BAPI - Populating Enhanced Fields

    Hi,
    I am using BAPI: BAPI_SALESORDER_CHANGE to change the Sales Order and want to update the Enhanced Screen Field (Screen Exit Fields) in the Sales Order. Where to populate these enhanced screen fields in the BAPI Structure?
    Appreciate Your Help!.
    Thanks,
    Kannan

    Hi,
    MV45AFZZ   BAPI_SALESORDER_CHANGE
    Regards,
    Padmam.

  • Problem acessing KM in Web dynpro for upload a file

    Hello all.
    I have a problem to put a file inside a KM repository. I create a context element like a binary - fileData - and like a String - fileName. and the both code then i will show, I give the same error!!
    please try to help me, in where is my error...
    Code 1:
      public void onActionsavePolitic(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionsavePolitic(ServerEvent)
          IPrivatePoliticCreationView.IFilenodeElement fileelement= wdContext.createFilenodeElement();
          wdContext.nodeFilenode().bind(fileelement);
          IWDAttributeInfo attInfo = wdContext.nodeFilenode().getNodeInfo().getAttribute("fileData");
        ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
          IWDModifiableBinaryType binaryType =(IWDModifiableBinaryType) wdContext.nodeFilenode().getNodeInfo().getAttribute("fileData").getModifiableSimpleType();
          IWDNodeElement element = wdContext.getParentElement();
          String filename = element.getAttributeAsText("fileName");
          if (filename.trim().equals(""))
                return;
          try {
                /*Get an object of current Portal user */
                IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
                com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
                com.sapportals.portal.security.usermanagement.IUser ep5User =
                      WPUMFactory.getUserFactory().getEP5User(sapUser);
                       ResourceContext context = new ResourceContext(ep5User);
                /*Give the path to KM in the variable path */
                 String path="/documents/News/";
                 RID rid = RID.getRID(path);
                 IResourceFactory factory =
                 ResourceFactory.getInstance();
                 ICollection folder = (ICollection) factory.getResource(rid,context);
                 //Using the upload element we can upload the files to a location in the server drive
                /*temperory location for writing */
                 String location =      "d:\";
                 String fileName = location+ fileelement.getFileName();
                 File file = new File(fileName);
                /*Create an output stream for writing to the temperory location*/
                 FileOutputStream out = new FileOutputStream(file);
                 out.write(fileelement.getFileData());
                 out.close();
                /*From the temporary location read the file using an input stream*/
                 FileInputStream fin = new FileInputStream(fileName);
                 fin.read();
                /*Using this input stream we can write to the repository
                 Content content = new Content(fileelement.getFiledata(),fileelement.get) */
                 Content content = new Content(fin,"byte", -1);
                 IResource newResource = folder.createResource(fileelement.getFileName(),null, content);
                 fin.close();
                 file.delete();
          } catch (NotSupportedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (AccessDeniedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (WDUMException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (ResourceException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (UserManagementException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
          } catch (WDRuntimeException e) {
          wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(""+e.getMessage());
          }catch (IllegalArgumentException e) {
                wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(""+e.getMessage());
        //@@end
    Code 2:
      public void onActionsavePolitic(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionsavePolitic(ServerEvent)
          IPrivatePoliticCreationView.IFilenodeElement fileelement= wdContext.createFilenodeElement();
          wdContext.nodeFilenode().bind(fileelement);
          IWDAttributeInfo attInfo = wdContext.nodeFilenode().getNodeInfo().getAttribute("fileData");
          ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
    IWDModifiableBinaryType binaryType =(IWDModifiableBinaryType) wdContext.nodeFilenode().getNodeInfo().getAttribute("fileData").getModifiableSimpleType();
          IWDNodeElement element = wdContext.getParentElement();
          String filename = element.getAttributeAsText("fileName");
          if (filename.trim().equals(""))
                return;
          try {
                //      Get an object of current Portal user
                IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
                com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
                com.sapportals.portal.security.usermanagement.IUser ep5User =
                                 WPUMFactory.getUserFactory().getEP5User(sapUser);
                //       create an ep5 user from the retrieved user
                ResourceContext context = new ResourceContext(ep5User);
                //      Give the path to KM in the variable path
                String repository = "//documents//News//";
                RID rid = RID.getRID(repository);
                IResourceFactory factory = ResourceFactory.getInstance();
                ICollection folder = (ICollection) factory.getResource(rid, context);
                byte[] byteArray =
                      (byte[]) wdContext.currentFilenodeElement().getFileData();
                //      From the temporary location read the file using an input stream
                ByteArrayInputStream fin = new ByteArrayInputStream(byteArray);
                //      Using this input stream we can write to the repository
                Content content =
                      new Content(fin, binaryType.getMimeType().getHtmlMime(), -1L);
                try {
                      IMutablePropertyMap propertyMap = new MutablePropertyMap();
                      IResource newResource =
                            folder.createResource(
                                 wdContext.currentFilenodeElement().getAttributeAsText(
                                 "fileData"),
                                 propertyMap,
                                 content);
                } catch (NameAlreadyExistsException re2) {
                      try {
                            fin = new ByteArrayInputStream(byteArray);
                            content =
                                 new Content(
                                       fin,
                                       binaryType.getMimeType().getHtmlMime(),
                                       -1L);
                            RID fileRid = RID.getRID(repository + filename);
                            IResource fileResource = factory.getResource(fileRid, context);
                            fileResource.updateContent(content);
                      } catch (Exception e) {
                            wdComponentAPI.getMessageManager().reportSuccess(
                                 "File doesn't exist:" + e.getMessage());
                fin.close();
          } catch (Exception e) {
                wdComponentAPI.getMessageManager().reportException(
                      "File not found." + e.getMessage(),
                      true);
          } finally {
                element.setAttributeValue(wdContext.currentFilenodeElement().getFileName(), null);
        //@@end
    and the error then I have in same codes is:
      java.lang.IllegalArgumentException:
        at com.sap.tc.webdynpro.clientserver.data.DataContainer.createLocalPath(DataContainer.java:1347)
        at com.sap.tc.webdynpro.clientserver.data.DataContainer.updateAttribute(DataContainer.java:451)
        at com.sap.tc.webdynpro.clientserver.uielements.adaptbase.AbstractAdapter.updateAttribute(AbstractAdapter.java:644)
        at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.FileUploadAdapter.onFILEUPLOADCHANGE(FileUploadAdapter.java:298)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException
            at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.handleUIElementEvent(HtmlClient.java:957)
            at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.updateEventQueue(HtmlClient.java:372)
            at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:93)
            at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:294)
            at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:707)
            at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:661)
            at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:229)
            at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:152)
            at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
            at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
            at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
            at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sap.tc.webdynpro.clientimpl.html.client.HtmlClient.handleUIElementEvent(HtmlClient.java:949)
            ... 25 more
    Caused by: java.lang.IllegalArgumentException:
            at com.sap.tc.webdynpro.clientserver.data.DataContainer.createLocalPath(DataContainer.java:1347)
            at com.sap.tc.webdynpro.clientserver.data.DataContainer.updateAttribute(DataContainer.java:451)
            at com.sap.tc.webdynpro.clientserver.uielements.adaptbase.AbstractAdapter.updateAttribute(AbstractAdapter.java:644)
            at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.FileUploadAdapter.onFILEUPLOADCHANGE(FileUploadAdapter.java:298)
            ... 30 more

    Hello
    It looks that I have a similar problem - how could you solve your problem.
    Thanks in advance
    Sascha Fuchs

  • How to Use BAPI in Web dynpro?

    Hi SDN,
    I am trying to use BAPI_FLIGHT_GETLIST in my web dypro application but my result table doesn't showing any data.
    can you please tell me the reason behind this?
    Regards,
    Rahul

    hi rahul.........
             steps to be followed:
                Right click on your component and click create->service call.
                give the bapi name you want to access.
                give the rfc destination name..
                if you have all the rights, then whatever name you give, an rfc destination will be created automatically.
                 otherwise you have to specify an already existing rfc destination name.
                 in your view you create input fields for binding the importing parameters.
                 bind the changing parameters to your table.
                 <b>make sure you call the method which will calls the bapi</b> either when you initialize your window or have a button and call the method, inside its action.
                 <b>embed your view to the window</b>.
    note:
             the method and the respective codings would be automatically generated when you created your service call.
    ---regards,
       alex b justin.

  • ISSUE ON CREATE SALES ORDER USING BAPI

    Hi,
       I am creating a sales order using bapi BAPI_SALESORDER_CREATEFROMDAT2.But it it fails to create a sales order abd below is my code pls check and correct me to create a sales order.
    LOOP AT DATA_TAB.
    clear: l_order_header_in,
           l_salesdocument,
           l_order_partners,
           l_order_items_IN,
           l_order_schedules_IN.
    refresh: l_order_items_in,
             l_order_partners,
             l_order_schedules_IN,
             l_return.
    Order header
    l_order_header_in-DOC_TYPE    = DATA_TAB-AUART.
    l_order_header_IN-SALES_ORG   = DATA_TAB-VKORG.
    l_order_header_IN-DISTR_CHAN  = data_tab-vtweg.
    l_order_header_in-division    = DATA_TAB-SPART.
    l_order_header_in-REF_1_S     = DATA_TAB-IHREZ_E.
    l_order_header_in-PURCH_NO_S  = DATA_TAB-BSTKD_E.
    l_order_header_in-PO_DAT_S    = data_tab-bstdk_e.
    l_order_header_in-PO_METH_S   = DATA_TAB-BSARK_E.
    l_order_header_in-DOC_DATE    = DATA_TAB-AUDAT.
    l_order_header_in-REC_POINT   = DATA_TAB-EMPST.
    l_order_header_inX-DOC_TYPE    = 'X'.
    l_order_header_INX-SALES_ORG   = 'X'.
    l_order_header_INX-DISTR_CHAN  = 'X'.
    l_order_header_inX-division    = 'X'.
    l_order_header_inX-REF_1_S     = 'X'.
    l_order_header_inX-PURCH_NO_S  = 'X'.
    l_order_header_inX-PO_DAT_S    = 'X'.
    l_order_header_inX-PO_METH_S   = 'X'.
    l_order_header_inX-DOC_DATE    = 'X'.
    l_order_header_inX-REC_POINT   = 'X'.
    Partner data SOLD TO PARTY
    l_order_partners-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_partners-partn_role = 'SP'.
    l_order_partners-partn_numb = DATA_TAB-kunnr1.
    append l_ordeR_partners.
    Partner data SHOP TO PARTY
    l_order_partners-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_partners-partn_role = 'SH'.
    l_order_partners-partn_numb = DATA_TAB-kunnr2.
    append l_ordeR_partners.
    Order items
    l_order_items_IN-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_items_IN-material   = DATA_TAB-MABNR.
    l_order_items_IN-BATCH      = DATA_TAB-CHARG.
    l_order_items_IN-REASON_REJ = DATA_TAB-ABGRU.
    append l_order_items_IN.
    l_order_items_INX-ITM_NUMBER = DATA_TAB-POSNR.
    l_order_items_INX-material   = 'X'.
    l_order_items_INX-BATCH      = 'X'.
    l_order_items_INX-REASON_REJ = 'X'.
    append l_order_items_INX.
    Schedules for quantity
    l_order_schedules_IN-itm_number = DATA_TAB-POSNR.
    l_order_schedules_IN-req_qty    = DATA_TAB-KWMENG.
    append l_order_schedules_IN.
    Schedules for quantity
    l_order_schedules_INX-itm_number = data_tab-posnr.
    l_order_schedules_INX-req_qty    =  'X'.
    append l_order_schedules_INX.
    Conditions for value
    l_order_conditions_IN-itm_number = DATA_TAB-POSNR.
    l_order_conditions_IN-cond_type  = DATA_TAB-KSCHL.
    l_order_conditions_IN-cond_value = DATA_TAB-KBETR.
    l_order_conditions_IN-currency   = DATA_TAB-KOEIN.
    append l_order_conditions_IN.
    Conditions for value
    l_order_conditions_INX-itm_number = DATA_TAB-POSNR.
    l_order_conditions_INX-cond_type  = 'X'.
    l_order_conditions_INX-cond_value = 'X'.
    l_order_conditions_INX-currency   = 'X'.
    append l_order_conditions_INX .
    endloop.
    BAPI to create sales order
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
    SALESDOCUMENTIN =
      ORDER_HEADER_IN =      l_order_header_IN
      ORDER_HEADER_INX =     l_order_header_INX
    IMPORTING
      SALESDOCUMENT =        l_salesdocument
    TABLES
      RETURN =               l_return
      ORDER_ITEMS_IN =       l_order_items_IN
      ORDER_ITEMS_INX =      l_order_items_INX
      ORDER_PARTNERS =       l_order_partners
      ORDER_SCHEDULES_IN =   l_order_schedules_in
      ORDER_SCHEDULES_INX =  l_order_schedules_inX
      ORDER_CONDITIONS_IN =  l_order_conditions_in
      ORDER_CONDITIONS_INX = l_order_conditions_inX
    IF SY-SUBRC = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT           = C_X
    IMPORTING
      RETURN        =
    ENDIF.
      Pls help me to solve the issue.
    Thanks,
    Rajendra.

    Hi Raj
    This is the sameple code which works fine for me,
    REPORT  zkb_sales_order.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
         i_order_items_in TYPE TABLE OF bapisditm,
         w_order_items_in TYPE  bapisditm,
         i_order_items_inx TYPE TABLE OF  bapisditmx,
         w_order_items_inx TYPE  bapisditmx,
        i_order_conditions_in TYPE TABLE OF bapicond,
        w_order_conditions_in TYPE bapicond,
        i_order_conditions_inx TYPE TABLE OF bapicondx,
        w_order_conditions_inx TYPE TABLE OF bapicondx.
    CLEAR w_order_header_in.
    w_order_header_in-doc_type  = 'ZSO'.
    w_order_header_in-sales_org =  '1000'.
    w_order_header_in-distr_chan = '01'.
    w_order_header_in-division =  '01'.
    w_order_header_in-req_date_h  = sy-datum.
    w_order_header_in-sales_dist =   '000001'.
    CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-material = 77.
    w_order_items_in-salqtynum = 1.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = w_order_items_in-material
      IMPORTING
        output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    * SP
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = 'AG'.
    w_order_partners-partn_numb = '2000016'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = w_order_partners-partn_numb
      IMPORTING
        output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    CLEAR: i_order_conditions_in,w_order_conditions_in.
    w_order_conditions_in-itm_number =  '000010'.
    w_order_conditions_in-cond_type  =   'PR00'.
    w_order_conditions_in-cond_value =  100.
    APPEND w_order_conditions_in TO i_order_conditions_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
    *   SALESDOCUMENTIN               =
        order_header_in               = w_order_header_in
    *   ORDER_HEADER_INX              =
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   TESTRUN                       =
    *   CONVERT                       = ' '
    * IMPORTING
    *   SALESDOCUMENT                 =
      TABLES
       return                        = i_return
       order_items_in                = i_order_items_in
    *   ORDER_ITEMS_INX               =
        order_partners                = i_order_partners
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
       order_conditions_in           = i_order_conditions_in
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =
    READ TABLE i_return INTO w_return WITH KEY type = 'E'.
    IF sy-subrc NE 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    LOOP AT i_return INTO w_return .
      WRITE: / w_return-type,
      w_return-id,
      w_return-number,
      w_return-message.
    ENDLOOP.
    Regards
    Kathirvel

  • How to Create Sales Order using BAPI with Variant configurations

    Hi All,
    I need to create a sales order using BAPI BAPI_SALESORDER_CREATEFROMDAT2 with Varaint confiugartions. I will get Header ITEM and variant configuration items in the flat file. Kindly help me in this regard.
    One more thing, is there any way to findout all the Varaint classifications for a particular Material?
    I have done the below coding. Sales order is getting created but variant configurations are not populating.
    *...Configuration: Reference Data
    DATA: gt_order_cfgs_ref TYPE TABLE OF bapicucfg,
          wa_order_cfgs_ref TYPE bapicucfg.
    *...Configuration: Instances
    DATA: gt_order_cfgs_inst TYPE TABLE OF bapicuins,
          wa_order_cfgs_inst TYPE bapicuins.
    *...Configuration: Part-of Specifications
    DATA: gt_order_cfgs_part_of TYPE TABLE OF bapicuprt,
          wa_order_cfgs_part_of TYPE bapicuprt     .
    *...Configuration: Characteristic Values
    DATA: gt_order_cfgs_value TYPE TABLE OF bapicuval,
          wa_order_cfgs_value TYPE bapicuval.
    *...Configuration: BLOB Internal Data (SCE)
    DATA: gt_order_cfgs_blob TYPE TABLE OF bapicublb  ,
          wa_order_cfgs_blob TYPE bapicublb.
    *...Configuration: Variant Condition Key
    DATA: gt_order_cfgs_vk TYPE TABLE OF bapicuvk,
          wa_order_cfgs_vk TYPE bapicuvk.
    *...Configuration: Reference Item / Instance
    DATA: gt_order_cfgs_refinst TYPE TABLE OF bapicuref,
          wa_order_cfgs_refinst TYPE bapicuref.
    *...Configuration: Reference Data
      wa_order_cfgs_ref-posex = '10'.
      wa_order_cfgs_ref-config_id = '1'.
      wa_order_cfgs_ref-root_id = '1'.
      wa_order_cfgs_ref-SCE = '1'.
      wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.
      wa_order_cfgs_ref-CONSISTENT = 'T'.
      wa_order_cfgs_ref-COMPLETE = 'T'.
      APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.
    *..2nd item
      wa_order_cfgs_ref-posex = '20'.
      wa_order_cfgs_ref-config_id = '2'.
      wa_order_cfgs_ref-root_id = '1'.
      wa_order_cfgs_ref-SCE = '1'.
      wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.
      wa_order_cfgs_ref-CONSISTENT = 'T'.
      wa_order_cfgs_ref-COMPLETE = 'T'.
      APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.
    *...Configuration: Instances
      wa_order_cfgs_inst-config_id = '1'.
      wa_order_cfgs_inst-inst_id = '1'.
      wa_order_cfgs_inst-obj_type = 'MARA'.
      wa_order_cfgs_inst-class_type = '300'.
      wa_order_cfgs_inst-obj_key = '2021B'.
      wa_order_cfgs_inst-quantity = 1.
      wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.
      wa_order_cfgs_inst-CONSISTENT = 'T'.
      wa_order_cfgs_inst-COMPLETE = 'T'.
      APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.
    *..2nd item
      wa_order_cfgs_inst-config_id = '2'.
      wa_order_cfgs_inst-inst_id = '1'.
      wa_order_cfgs_inst-obj_type = 'MARA'.
      wa_order_cfgs_inst-class_type = '300'.
      wa_order_cfgs_inst-obj_key = '2021B'.
      wa_order_cfgs_inst-quantity = 1.
      wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.
      wa_order_cfgs_inst-CONSISTENT = 'T'.
      wa_order_cfgs_inst-COMPLETE = 'T'.
      APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.
    *...Configuration: Characteristic Values
      wa_order_cfgs_value-config_id = '1'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BASIC_MACHINE'.
      wa_order_cfgs_value-value = 'L28'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
      wa_order_cfgs_value-config_id = '1'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET'.
      wa_order_cfgs_value-value = 'PL1001'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    *..2nd item
      wa_order_cfgs_value-config_id = '2'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET_FOC'.
      wa_order_cfgs_value-value = '023OP0049'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
      wa_order_cfgs_value-config_id = '2'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET_HOE'.
      wa_order_cfgs_value-value = '028MS0004'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    wa_order_cfgs_value-config_id = '2'.
    wa_order_cfgs_value-inst_id = '1'.
    wa_order_cfgs_value-charc = 'TYRE_PRESSURE_GAUGE'.
    wa_order_cfgs_value-value = '81004402'.
    APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    *...Configuration: Reference Item / Instance
      wa_order_cfgs_refinst-posex = '10'.
      wa_order_cfgs_refinst-config_id = '1'.
      wa_order_cfgs_refinst-inst_id = '1'.
      APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.
    *..2nd item
      wa_order_cfgs_refinst-posex = '20'.
      wa_order_cfgs_refinst-config_id = '2'.
      wa_order_cfgs_refinst-inst_id = '1'.
      APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.
    Regards,
    Rajesh

    Hi all,
    Please help me in solving the issue.
    Rajesh

  • How to Change a Sales Order using BAPI

    Hi All
    How can we change the sales document using BAPI as the requirement is
    --> First we create a Sales order using a BAPI.
    --> If the sales order is changed then we get the changed order information alonge with the old order data in a CSV file.
    here i have the problem that we are uncertain which fields will be changed some times we may get the item changes or some times we may get the quantity changed information and some times the condition type may be changed . So how to handle this ?
    Thanks,
    Chindam

    Hi,
    try this
    DATA: IT_MESSAGE TYPE STANDARD TABLE OF BAPIRET2,
          WA_VBELN TYPE BAPIVBELN-VBELN.
    DATA: WA_BAPIHEAD TYPE BAPISDH1,
          WA_BAPIHEADX TYPE BAPISDH1X,
          WA_HEADDATA TYPE BAPISDH1.
    DATA: I_BAPIITEM TYPE STANDARD TABLE OF BAPISDITM,
          WA_BAPIITEM TYPE BAPISDITM,
            WA_DATA TYPE BAPISDITM,
          I_BAPIITEMX TYPE STANDARD TABLE OF BAPISDITMX,
          WA_BAPIITEMX TYPE BAPISDITMX.
    CHANGE ITEM DATA
    WA_BAPIITEM-ITM_NUMBER =WA_DATA-ITM_NUMBER.
    WA_BAPIITEM-REASON_REJ = WA_DATA-REASON_REJ. "(REASON FOR REJECTION)
    WA_BAPIITEMX-ITM_NUMBER = WA_DATA-ITM_NUMBER. "(ITEM NUMBER)
    WA_BAPIITEMX-UPDATEFLAG = 'X'.
    WA_BAPIITEMX-REASON_REJ = 'X'.
    APPEND WA_BAPIITEM TO I_BAPIITEM.
    APPEND WA_BAPIITEMX TO I_BAPIITEMX.
    TO CHANGE HEADER DATA
    WA_BAPIHEADX-UPDATEFLAG = 'U'.
    WA_BAPIHEADX-DLV_BLOCK = 'X'.
    WA_BAPIHEAD-SALES_ORG = WA_HEADDATA-SALES_ORG. "(COMPANY CODE)
    WA_BAPIHEAD-DLV_BLOCK = WA_HEADDATA-DLV_BLOCK. "(DELIVERY BLOCK)
    WA_VBELN = '0000000168'.
    CALL BAPI AND PASS THE VALUE
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
       EXPORTING
         SALESDOCUMENT               = WA_VBELN " (SALES AND DOCUMENT NO)
        ORDER_HEADER_IN             = WA_BAPIHEAD
         ORDER_HEADER_INX           = WA_BAPIHEADX
       TABLES
         RETURN                     = IT_MESSAGE
        ORDER_ITEM_IN               = I_BAPIITEM
        ORDER_ITEM_INX              = I_BAPIITEMX
    CLEAR IT_MESSAGE.

  • Price is not being updated when creating a sales order using DTW oOrders

    Hello experts,
    When I create a sales Order using DTW (oOrders), the information in the input files document.csv and document_lines.csv is updated with no problem, except the price. The price is being ignored from the input files.
    Is there something that I must considered when trying to update the price of a sales order using the DTW?
    The field "price" was mapped in the source and target fields in DTW.
    Here is the document_lines.csv
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    1,1,_SYS00000000059, ,30PA08-0360-25,1,11.2,3,20110702,V08,A5
    1,2,_SYS00000000059, ,30PA08-0707-25,1,15.2,3,20110702,V08,A5
    1,3,_SYS00000000059, ,30PA08-0707-22,1,18.3,3,20110702,V08,A5
    And the document.csv:
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    1, ,c-6167,20110702,20110702,2
    Thank you for your help
    Jorge Manzo

    Hi,
    Try to re-create your dtw using my template,and use text tab when saving your template.
    SO-Header
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    1     24-25 MANUFACTU     24-25 MANUFACTURING          4/5/2010     4/15/2010     11142
    SO-LINE
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    1     0     SHAFT HEX 7/8"     1     pc     4536     4050     CRIS
    Note : Line -(LINE NUM and QTY is important upon computation of Price if SO is ITEM TYPE Document.
    hope this will help you!
    Regards,
    Darius

  • Create Excise invoice(J1IIN) document while creating billing document using bapi BAPI_BILLINGDOC_CREATEMULTIPLE

    Dear Experts,
    My scenario is:
    We have batch split scenario, where the parent line item of billing document has 0 quantity and its subsequent item (item with batch number) holds actual quantity data.
    When we create billing document using VF01 against delivery document, system creates billing document along with excise invoice document (J1IIN Document). And in excise document contain same number of line items that of billing document. Please see the below attachment: 
    Biiling document screen shot:
    While creating billing document, the J1IIN Document created automatically. Below is the screen-shot for the same.
    Now the issue is:
    When we create billing document using BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE system creating only billing document and not creating excise invoice document.
    When we create excise document manually using J1IIN the zero quantity line items are excluded in excise invoice document.
    Please see the below screen-shot for the same; The z quantity line items are missing.
    We want excise document to be created while creating billing document using BAPI BAPI_BILLINGDOC_CREATEMULTIPLE. Or is there any other BAPI for the same purpose.
    Customization is also maintained for creating excise invoice document automatically.
    Regards,
    Rajesh Sadula.

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

Maybe you are looking for

  • PDFs will not open in Browser with Adobe Reader 9

    I am using Vista Ultimate x64 (SP1) using IE7. I am using the 32-bit version of the browser. I have selected "Display PDF in browser" on the Internet settings tab of the Adobe Reader 9. Every time I select a PDF document, it forces me to save the doc

  • Import settings for books on CD

    Hi all, What are the best import settings to import books on CDs into iTunes?  Regular MP3 and "high quality" seems to use up a huge amount of disk space.  Is there a rule of thumb for this? Thank you.

  • "Object Type" in Libraries

    Does it much matter what you select for "Object Type" when you add and name something to an InDesign library? Sometimes the name ID Picks for a new library item relates to one of the file types of an element being added to a library.. I don't know wh

  • XMLAGG performance problems

    Hello, I've been having performance problems with one query using XMLAGG. Explain plan shows that all tables are joined using correct indexes - there is nothing wrong with it. After series of experiments with the query I found out that the problem is

  • How do send attachments from email

    I am new at this can anyone help me step by step easier to follow that way