How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

Hi
How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
          lw_cust_h_com        TYPE crmt_customer_h_com,
          lw_input_field_names TYPE crmt_input_field_names,
          lt_input_field_names TYPE crmt_input_field_names_tab,
          lt_objects_to_save TYPE crmt_object_guid_tab,
          lw_guid TYPE CRMT_OBJECT_GUID.
DATA : lv_process_type TYPE crmt_process_type.
data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
data: wa_customer_h type crmd_customer_h.
*  Function module for retriving the Process type.
  CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
    EXPORTING
      iv_orderadm_h_guid     = iv_header_guid
    IMPORTING
      ev_process_type        = lv_process_type
    EXCEPTIONS
      admin_header_not_found = 1
      OTHERS                 = 2.
if lv_process_type eq 'ZG01'.
CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
EXPORTING
   IV_HEADER_GUID                 = iv_header_guid
IMPORTING
   ET_DOC_FLOW_WRK                = lt_doc_flow.
read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
            if sy-subrc eq 0.                    "set flag for service order
            lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
            lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
             lw_cust_h_com-mode           = 'A'.
            lw_cust_h_com-ref_handle     = '0000000001'.
            lw_guid = wa_doc_flow-objkey_a.
            INSERT lw_guid INTO TABLE lt_objects_to_save.
     endif.
              lw_input_field_names-fieldname = 'REF_GUID'.
            lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
          lw_input_field_names-changeable = ' '.
           INSERT lw_input_field_names INTO TABLE lt_input_field_names.
Maintain Customer H
         CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
              EXPORTING
                is_customer_h_com    = lw_cust_h_com
              CHANGING
                ct_input_field_names = lt_input_field_names
              EXCEPTIONS
                header_change_error  = 1
                header_create_error  = 2
               error_occurred       = 3.
ENDIF.
*endif.
*Clearing local variables
  clear: lv_process_type,
         lw_cust_h_com,
         lw_input_field_names.
*Free internal tables
  free: lt_doc_flow,
        lt_input_field_names.

Hi Faisal
I think your not clear with what i am saying anyhow i will again explain you my requirement
As per my requirement
1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
Why bcoz we are doing above process is do show records in result list based on Flag values
these flag checks are validating in the BADI Which we implemented for search logic.
Please refer below Login for my requirement:-
Proposal to have a custom “flag” field (background at table level,
     crmd_customer_h) linked to service order which gets flagged whenever at
     least one Trial order is created and saved from the Service Order.
The flag value should be cleared when all the trial orders created and
saved as follow up transactions are deleted from the system.
Similarly for Trial Orders will use the same custom “flag” field
     which gets activated when at least one follow up is created and saved from Trial Order.
The flag value should be cleared when all the follow up transactions from
the Trial Order are deleted from the system.
When the above search criteria “Has Trial order with no follow up”
     “is” “Yes” is applied then the logic derives all the service
     orders which satisfy additional search criteria applied in the search and
     for these Service orders checks if the custom flag field is checked to
     derive all Service orders which have Trial order. The custom flag values
     values are derived from crmd_customer_h table in CRM.
4 )Further for all the Trial Orders determined in Step 3
check if the Trial Order has a follow up by checking if the custom flag field
is checked. The custom flag values are derived from crmd_customer_h table in
CRM.
5) If step 4 is not met populate the preceding Service
Orders in the Result list

Similar Messages

  • How to update multiple tables using results from query

    I'm a bit rusty on this stuff and am hoping for some help.
    Table 1 is:
    location_id, location_name
    Table 2 is
    location_id, employee_id and misc. other columns
    Then there are multiple tables with associated data, keys being location_id and employee_id.
    There are no established relationships.
    Trying to come up with a process to change location_id for all employees assigned to a particular location.
    It seems to me that the basics are
    select employee_id from Table2 where location_id='xxxxxx'
    Then take each employee_id returned and change their location_id in each of the other tables
    I'm not clear on how to load the returned employee id's as variables and then loop through them.
    Thanks

    Thanks for the welcome. I'll read up on the rules now.
    Below is the DDL for a couple of the tables.
    Version = 11g
    I would query the users table for all users with a certain site_id and then use them to update the site_id in the users table (and other tables)
    -- DDL for Table USERS
    CREATE TABLE "USERS"
    (     "USERID" VARCHAR2(8 BYTE),
         "PASSWORD" VARCHAR2(50 BYTE),
         "FIRST_NAME" VARCHAR2(50 BYTE),
         "LAST_NAME" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "ROLE_ID" VARCHAR2(1 BYTE)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;
    -- DDL for Table EMPLOYEE_PROFILE
    CREATE TABLE "EMPLOYEE_PROFILE"
    (     "EMPLOYEEID" VARCHAR2(9 BYTE),
         "PROGRAM" NUMBER,
         "REQUIREMENT" NUMBER,
         "JOBNUM" VARCHAR2(50 BYTE),
         "STATUS" VARCHAR2(50 BYTE),
         "PROGRAM_TYPE" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "NUM_QUAL_TEST_ATTEMPTS" NUMBER(7,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;

  • Update oracle table using data through ODBC

    Hi,
    I want to update tables inside an Oracle 8i database.
    The updates depend on data in a mySql database that I want to approach using an ODBC connection.
    I cannot figure out what I need to do to select data from an ODBC source from an oracle session.
    What do I have to call this external table ...
    Edward

    The following link may be relevant. Check it out.
    http://download-east.oracle.com/docs/cd/A87860_01/doc/server.817/a76960/hs_admin.htm

  • How to update existing table using Data Load from spreadsheet option?

    Hi there,
    I need to update an existing table, but in Data Load application when you select csv file to upload it inserts all data by replacing existing one. How can i change this?
    Let me know,
    Thank you.
    A.B.A.

    And how do you expect your database server to access a local file in your machine ?
    Is the file accessible from outside your machine say inside a webserver folder so that some DB process can poll on the file ?
    Or, is your DB server in the same machine where you have the text file ?
    You will have to figure out the file acess part before automating user interaction or even auto-refreshing.

  • How to update many tables using the same code

    <%@ page language = "java" import = "java.sql.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.text.*" %>
    <%
    String custname1=request.getParameter("custname");
    session.setAttribute("custname",custname1);
    String custtin1=request.getParameter("custtin");
    session.setAttribute("custtin",custtin1);
    %>
    <%
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn;
    conn=DriverManager.getConnection("jdbc:odbc:loginval");
    Statement stat=conn.createStatement();
    String stmt="insert into custdetails values('"+custname1+"','"+custtin1+"')";
    stat.executeUpdate(stmt);
    stat.close();
    conn.close();
    %>
    <jsp:forward page = "success.html"/>
    <%
    catch(Exception e)
    %>
    <jsp:forward page = "tinerror.jsp"/>
    <%
    %>---------------------------------------------------------------
    this is my code, now this code will be used by many users to update their corresponding tables. so my problem is based on the username i need to change the table name in the insert query, for example if the username is sai, then the table name has to be saicustdetails and if the user name is ram then the table name in the query has to be ramcustdetails. and so on.
    please help

    *<%@ page language = "java" import = "java.sql.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.text.*" %>
    <%
    String tin1=request.getParameter("tin");
    session.setAttribute("tin",tin1);
    tin1=tin1+"custdetails";
    String custname1=request.getParameter("custname");
    session.setAttribute("custname",custname1);
    String custtin1=request.getParameter("custtin");
    session.setAttribute("custtin",custtin1);
    //String tin2;
    %>
    <%
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn;
    conn=DriverManager.getConnection("jdbc:odbc:loginval");
    Statement stat=conn.createStatement();
    String tin2;
    tin2=tin1;
    String stmt="insert into "+tin2+"values('"+custname1+"','"+custtin1+"')";
    stat.executeUpdate(stmt);
    stat.close();
    conn.close();
    %>
    <jsp:forward page = "success.html"/>
    <%
    catch(Exception e)
    %>
    <jsp:forward page = "tinerror.jsp"/>
    <%
    %>i tried what u have said but still it does not work, anyother way?????

  • How to get tables used by a Function Module

    Hi,
    How to know the tables used by a function module dynamically.
    Cuurently im using BAPI_MATERIAL_SAVEDATA in my report program.
    I tried FM GET_TABLES to know the tables, but could see only tables used in the report.
    Main issue in my case is when im running this update program, could observe different tables being displayed as updated in SM50(Process Overview).Want to clarify as why these tables which are not being used in my report are being displayed in SM50.
    So was doubtin weather this FM is using these displayed tables.
    Thanks in advance for u r replys.
    Regards,
    Dedeepya

    Hi Dedeepya,
    you could use a SQL Trace (tx. ST05) to list all tables affected and operations that realize. Just active the trace, execute FM, and Deactive trace. Then click in "Display trace" and check it.
    Best regards,
    Pablo

  • How to update two tables in a single call using JDBC Sender adapter

    Hello All,
    The scenario is, database entries have to be selected from two tables and at the same time those tables have to be udpated with the flag.
    We are using JDBC sender adapter and in Select Query, we are fetching the data by joinin the two tables.
    Update Statemtent: We can only update one table using this statement.
    Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Let me know.
    Regards,
    Sreenivas.

    Hi Sreenivas,
    > Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Yes its possible through join statement
    Check this links
    Update in JDBC Sender adapter for more than one table
    data from 2 tables for jdbc sender adapter
    Regards
    Ramesh

  • How to update Spry-table and present the updated table in a div element?

    Hello!
    I am using a very interesting AJAX-framework called Spry when designing a web page. Here the web page is: Link.
    I need some help.
    Every time a new project or shift is added, the changes are written to an xml-file. When the page is reloaded, Spry reads data from xml-files.
    This is caused by this code:
    dsProjects = new Spry.Data.XMLDataSet("timetable/projects.xml", "projects/project");
    dsShifts = new Spry.Data.XMLDataSet("timetable/{dsProjects::url}", "project/shift"); //look inside projects.xml and //extrac xml-file. url
    dsName = new Spry.Data.XMLDataSet("timetable/{dsProjects::url}", "project");
    I call this function that I have written: loadProjectsIntoDivElement ().
    This function does the following: [See attached code.]
    It iterates through the Spry-datastructure and puts the data in a table inside of the div-element called 'projectsList'.
    Now, when I add a new project, I want it to be inserted into the Spry-datastructure and then cause the new data to be written into the div element called 'Specials_DIV'.
    I have found out how to update a Spry-datastructure (e.g. dsProjects above), but I don't know how to update the table containing the data without refreshing the page. This should be done using Spry.
    Some code:
    1:
    2:
    3:
    function loadProjectsIntoDivElement () {
    $('#projectsList').html('');
    $('#projectsList').append('<table id="Specials_Table"><tr><th spry:sort="id">ID</th><th spry:sort="NAME">Name </th><th spry:sort="hoursestimated">Nr. of hours estimated</th><th spry:sort="hoursworked">Nr. of hours worked</th><th spry:sort="costperhour">Cost per hour.</th></tr>{function::init_hours}<tr spry:repeat="dsProjects" onclick="chooseProject({ds_RowID})"><td>{id}</td><td>{NAME}</td><td>{hoursestimated}</td><td>{hoursworked}</td><td>{costperhour}</td></tr></table><br/>{function::get_hours}<br/>');
    I have tried to accomplish this in various ways but I don't succeed.
    I want to do it without refreshing the page.
    Update: I found some code here that I will try: Link
    Thanks in advance!
    Anders Branderud
    My blog

    Hello!
    Thanks!
    I don't succeed with the implementation in any browser.
    I have found a way to it, but I would like a way that updates the data quicker and without reloading all of the page. After all, I am only adding one row on the end of the data structure, so there should be no need to read in all data again.
    Now I do it like this:
    When a project is added, do this:
    1. Store a new row in the project file through a php script.
    2. When the post-call to the php-file returns, do refresh of the whole page.
    Then the newest version of the xml file will be read in.
    However, I don't want to read the data from a xml file each time that a new project is created.
    I know how to add the new data to a Spry-datastructure [in my code 'dsProjects'], but I don't know how to display the updated data without reloading the whole page.
    I have tried some various ways to do it, but haven't succeded.
    Thanks!
    Anders Branderud

  • Updating SAP  Table using JCO

    Dear All
                      How to update SAP Table (Any single or multiple tables) through Java code using JCO. Can any body provide sample code regarding this...
    Thanks&Regards
    mgreddy

    Hi,
    I think for that anyway you will have to use JCO as the middleware to connect to SAP R/3.
    So what you can to do is to write three RFCs and call them through JCO from your JAVA application.
    1. First BAPI for reading the dictionary information about an SAP table.
    2. Second to read data from the table.
    3. And, third to write data to that table.
    But if you want to edit any table (and not a specific table) then your program will become even more complex since then you will have to pass the table name and information dynamically to the BAPIs.
    Best regards,
    Guru.

  • How to Update a Row using ADF

    Hi every one
    Can any one help me out, How to Update a Row using ADF.
    Thanks in advance

    In addition to Clear to my question
    By Using ADF BC How can I update a record in a database.
    I have VO and EO associated with a table.
    How can I update a record using ADF BC
    Message was edited by:
    user616296

  • How to update database table !!!

    hi all,
    Please advice how to update database table with certain cndition needs to be checked.
    Please consider below scenario.
    have used enqueu and dequeue function to lock entries  and also i have used BAPI so considering that return parameter . i want to update table
    /tdk/st0027.
    1. I want to update database table
    2. there are certain condition needs to be checked like ,
       loop at it_final into wa_final.
    th_return-type = 'S'.
               if th_final-vbeln = /tdk/st0027-vbeln and
                  th_final-posnr = /tdk/st0027-posnr and
                  th_final-etenr = /tdk/st0027-sdslno.
    above condition which i need to check .and need to append below system fields need to be appended in table.
              th_final-prstsind = '20'.
              th_final-chgdate  = g_date.
              th_final-chgtime  = g_uzeit.
              th_final-chgprog  = g_cprog.
              th_final-chguser  = g_uname.
              append th_final to td_final.
              update /tdk/st0027 FROM th_final.
              endif.
    endloop.
    but i am getting error saying that  "The type od database table and work area (TH_FINAL)  are not unicode convertible"?
    I am not able to understandwhat would be the solution for this ?
    Thanks and regards,
    Prasad K. NAralkar

    The error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
    try to create a structure w.r.t the DDIC table.
    Eg: DATA: wa_temp TYPE /tdk/st0027.
    MOVE-CORRESPONDING th_final TO wa_temp.
    Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table.

  • Updating EKKO table using E1BPPAREX

    Hi all,
    My requirement is to update ekko table using E1BPPAREX segement. I have gone through so many posts regarding this.
    In my case, PO number is not yet created. I am using BAPI_PO_CREATE1 for creating this . From PI side, if they pass the custom field value in the appropriate postion of VALUEPART field of E1BPPAREX, will it get updated to the ekko table automatically.
    Regards,
    Sajith

    Hi Sajith,
      you have to do is populate structure extensionin. You'll have to implement the fm DDIF_NAMETAB_GET to look for the right place (offset) in order to add the field on the structure extension in.
    Example:
      CALL FUNCTION 'DDIF_NAMETAB_GET'
        EXPORTING
          tabname   = c_ext_table   --> ''BAPI_TE_MEPOHEADER
        TABLES
          dfies_tab = lt_tab
        EXCEPTIONS
          not_found = 1
          OTHERS    = 2.
      CLEAR l_offset.
      LOOP AT lt_tab.
        CASE lt_tab-fieldname.
          WHEN c_yourfield.
            w_extin-valuepart1+l_offset = p_yourfield.
        ENDCASE.
        ADD lt_tab-leng TO l_offset.
      ENDLOOP.
      MOVE c_ext_table TO w_extin-structure.
      APPEND w_extin TO p_i_extin.
    Regards,
    Carlos.

  • How to update the ztable using screen.

    hi experts,
    i have one ztable with 8 fields
    and i created one screen with 8 fields
    how to update the ztable using this screen menas when i press the some push button in my screen the table should update.
    Devi

    hi
    check the link shown below
    Coding & screen shots of how to update a database table from screen(Module poool)
    http://www.scribd.com/doc/15628693/moduleprog090311165111phpapp011
    in the attachment u will find
    data  : begin of i_ysrtmm occurs 0,
            sno type ysrtmm-sno,
            sname type ysrtmm-sname,
            scity type ysrtmm-scity,
            sedu type ysrtmm-sedu,
            spercent type ysrtmm-spercent,
            select(1),
            end of i_ysrtmm.
    in the SE51 click on layout & in that menu goto - secwindow- enter the internal table i_ysrtmm
    and click on get from program.u will get all the fields of the internal table select all of them except
    SELECT  field  and then drag and drop on table control . double click on the table control u see the attributes screen there in the w/colselect enter i_ysrtmm-select for tab selection of table control.
    Regards

  • How to update the Ztable using modulepool Tablecontrol...

    Hi All,
    could anyone help me how to update the Ztable using modulepool Tablecontrol...
    if it is possible give me a example with code..
    Many thanks in advance...!!
    Rajesh

    Hi,
    For that pls refer to the link:
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbac3735c111d1829f0000e829fbfe/frameset.htm
    Also refer the sample program:
    RSDEMO02
    Then for updating:
    modify the internal table(which u used to populate the tabcntrl) from the table control.
    Then update database table like:
    update dbtab from table itab.
    Regards,
    Renjith Michael.

  • How to update the table available in BADI method

    Hi Friends,
    I have to implement one badi ME_REQ_POSTED for purchase requistion, in this badi  I have to read first line item and do
    some check...if that check is true i need to update subsequent line item (line 20, 30, 40 or so) with purchase group and MRP controller.
    In this BADI i have method POSTED, in this method parameter IM_EBAN is a table which i need to modify with my different
    values for purchase group and MRP controller.
    Kindly let me know how to update this table, so the changes can be reflected in purchase requistion.
    Since when I tried to directly modify the table in a loop, system throw one error stating IM_EBAN can not be modified.
    kindly help.
    pradeep

    hi
    I have implemented this exit but it does not stop at it while saving Purchase requistion. But my previous BADI stops at it when saving.
    Kindly guide.

Maybe you are looking for

  • Video playback in preview monitors appears as a jagged mess

    Video playback in the preview monitors appears as a jagged mess. The audio plays perfectly. I am using Premiere Pro CS4 4.2.1, only DV NTSC. I have checked all my settings, have found nothing that will fix this. What could be causing this problem?

  • Email counter and connection not working correctly after updates

    How do I fix the email counter on my dock bar it shows that I have 214 unread and they have all been read? Also, my email is constantly asking me to enter my password to establish connection this is after I have been working in email and sending and

  • Manual posting to reconciliation account under asset account group

    We need to maintain Asset Group (G007) to allow manual input in order to post a period end-closing adjustment as required by our external auditors. ( i.e in the reconciliation account under the asset account group, we need to check the 'allow manual

  • Scan a positive transparency with an Epson Perfection 1200 scanner?

    I cannot get Image Capture to scan a positive transparency.  The overview scan keeps cancelling. I'm using an Epson Perfection 1200 scanner.   It works in the flatbed mode, e.g. scanning a photo. What can I do to scan a transparency?

  • Animate a cube to rotate around x axis!!!

    Hi! I'm trying to animate a cube to rotate around x axis using RotationInterpolator object. Can anyone kindly tell me how I can do that? I've seen the example at Sun's 3d tutorial but they use the default behavior which is rotating around y axis. Tha