Get FI Documet number from BKPF table using CO document number in COVP tabl

Hi,
In  datasource 0CO_OM_CCA_9 , we have written a code in CMOD to get the FI Document Number from CO document Number.
The flow of code is:
1) From the CO document number, get reference document number  (REFBNfield) from, COVP table
2) Pass this REFBN in AWKEY(10) field of BKPF table.
3) We have created new field in datasource named 'ZBELRE' which gets populated with BELNR field obtained from BKPF table.
This ZBELNR is the FI Document number.
But somehow wrong FI Document number is getting populated.
After analyzing code, we found that the AWKEY which we passed in BKPF table is incomplete and the full AWKEY is
COVP-REFBN+COVP-AWORG
Is this condition always remains true in all the cases? Also, is the selection criterion which we have used to find the FI document number from BKPF table is sufficient?
Our CO Consultant says that we should also pass AWTYP along with AWKEY in BKPF table.
Please suggest a solution.
Following is the code :
***********Datasource Modification for0CO_OM_CCA_9*******************
  WHEN '0CO_OM_CCA_9'." Data Source
    TYPES:BEGIN OF ty_bkpf,
    belnr TYPE bkpf-belnr,
    xblnr TYPE bkpf-xblnr,
    bktxt TYPE bkpf-bktxt,
    awkey TYPE bkpf-awkey,
    bukrs TYPE bkpf-bukrs,
    gjahr TYPE bkpf-gjahr,
    END OF ty_bkpf.
    TYPES : BEGIN OF ty_bseg1,
    lifnr TYPE bseg-lifnr,
    belnr TYPE bseg-belnr,
    bukrs TYPE bseg-bukrs,
    gjahr TYPE bseg-gjahr,
    END OF ty_bseg1.
    DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
    wa_bkpf TYPE ty_bkpf,
    it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
    wa_bseg1 TYPE ty_bseg1,
    l_s_icctrcsta1 TYPE icctrcsta1.
    "Extract structure for Datasoure 0co_om_cca_9.
    DATA: l_awkey TYPE bkpf-awkey.
    DATA: l_gjahr1 TYPE gjahr.
    DATA: len TYPE i,
    l_cnt TYPE i.
    l_cnt = 10.
    SELECT lifnr
    belnr
    bukrs
    gjahr
    FROM bseg
    INTO TABLE it_bseg1.
    DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
    SELECT belnr
    xblnr
    bktxt
    awkey
    bukrs
    gjahr
    FROM bkpf
    INTO TABLE it_bkpf.
    IF sy-subrc EQ 0.
      CLEAR: l_s_icctrcsta1,
      wa_bkpf,
      l_awkey,
      wa_bseg1.
      LOOP AT c_t_data INTO l_s_icctrcsta1.
        MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
        READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
        l_s_icctrcsta1-refbn
        gjahr = l_gjahr1.
        IF sy-subrc EQ 0.
          MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
          MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
          MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
          MODIFY c_t_data FROM l_s_icctrcsta1.
          READ TABLE it_bseg1 INTO wa_bseg1
          WITH KEY
          belnr = wa_bkpf-belnr
          bukrs = wa_bkpf-bukrs
          gjahr = wa_bkpf-gjahr.
          IF sy-subrc EQ 0.
            MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
            MODIFY c_t_data FROM l_s_icctrcsta1.
            CLEAR: l_s_icctrcsta1,
            wa_bseg1,
            l_gjahr1.
          ENDIF.
        ENDIF.
        CLEAR: l_s_icctrcsta1.
      ENDLOOP.
    ENDIF.
***End of Datasource Modification for 0CO_OM_CCA_9*******************

Hi,
this forum is for the SAP BusinessObjects BI Solution Architecture. Please post your question into the corresponding product forum for SPA BW
regards
Ingo Hilgefort

Similar Messages

  • How to get edited row values from ADF table?

    JDev 11.
    I have a table which is populated with data from Bean.
    I need to save changes after user make changes in any table cell. InputText is defined for table column component.
    I have defined ValueChangeListener for inputText field and AutoSubmit=true. So when user change value in inputText field, method is called:
    public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
    getSelectedRow();
    SaveMaterial(material);
    This method should call getSelectedRow which take values from selected table row and save them into object:
    private Row getSelectedRow(){
    RichTable table = this.getMaterialTable();
    Iterator selection = table.getSelectedRowKeys().iterator();
    while (selection.hasNext())
    Object key = selection.next();
    table.setRowKey(key);
    Object o = table.getRowData();
    material = (MATERIAL) o;
    System.out.println("Selected Material Desc = "+material.getEnumb());
    return null;
    Problem is that getSelectedRow method doesnt get new (edited) values, old values are still used.
    I have tried to use ActiveButton with same method and it works fine in that case. New values are selected from active row and inserted into object.
    JSF:
    <af:table var="row" rowSelection="single" columnSelection="single"
    value="#{ManageWO.material}" binding="#{ManageWO.materialTable}">
    <af:column sortable="false" headerText="E-number">
    <af:inputText value="#{row.enumb}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
    </af:column>
    <af:column sortable="false" headerText="Description">
    <af:inputText value="#{row.desc}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
    </af:column>
    </af:table>
    <af:activeCommandToolbarButton text="Save" action="#{ManageWO.EditData}"/>
    What is a correct place from where save method should be called to get new (edited) values from ADF table?
    Thanks.

    Did you look into the valueChangeEvent?
    It has oldValue and newValue attributes.
    public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
    Object oldVal = valueChangeEvent.getOldValue();
    Object newVal = valueChangeEvent.getNewValue();
    // check if you see what you are looking for.....
    getSelectedRow();
    SaveMaterial(material);
    }Timo

  • Getting description of product from another table

    Hi,
    I am getting the level from the user, and based on that creating an internal table.  I am getting product code (PRODH) and level (STUFE) from one table (T179), and getting product description (VTEXT) from another table (T179T).  I need to create a single internal table (PVS) with all three fields.
    How do I do that?  This may seem like a very simple question, but I have only been teaching myslef ABAP for about one week.
    Once I can prepare this table, I will use a function to display it.
    Regards,
    Al Lal
    Code:
    REPORT  YABHINAV16.
    program to display products at chosen level *
    Tables: T179, T179t.
    types:  begin of hierarchy,
            prodh type t179-prodh,
            vtext type t179t-vtext,
            stufe type t179-stufe,
            end of hierarchy.
    data: pvs type standard table of hierarchy initial size 0.
    select-options level for t179-stufe no intervals.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select vtext from t179t into corresponding fields of table pvs where prodh = pvs-prodh.
    sort pvs by prodh.

    Hi Just change the code accordingly...
    Tables: T179, T179t.
    types: begin of hierarchy,
    prodh type t179-prodh,
    vtext type t179t-vtext,
    stufe type t179-stufe,
    end of hierarchy.
    types: begin of text,
             prodh type t179t-prodh,
             vtext type  t179t-vtext,
             end fo text.
    data: pvs type standard table of hierarchy initial size 0.
    data: it_text type standard table of text,
            wa_text type text.
    select-options level for t179-stufe no intervals.
    start-of-selection.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select prodh vtext from t179t into corresponding fields of table text for all entries in pvs where prodh = pvs-prodh.
    end-of-selection.
    sort pvs by prodh.
    sort it_text by prodh.
    loop at pvs.
    read table it_text into wa_text with key prodh = pvs-prodh.
    if sy-subrc eq 0.
    pvs-vtext = wa_text-text.
    endif.
    modify pvs.
    endloop.
    Award Points If useful

  • How can i get all the records from three tables(not common records)

    Hi
    I have four base tables at R/3-Side. And i need to extract them from R/3-Side.
    And i dont have any standard extractor for these tables .
    If i create a 'View' on top of these tables. Then it will give only commom records among the three tables.
    But i want all the records from three base tables (not only common).
    So how can i get the all records from three tables. please let me know
    kumar

    You can create separate 3 datasources for three tables and extract data to BW. There you can implement business login to build relation between this data.

  • How to get second maximum salary from employee table(sql query)

    how to get second maximum salary from employee table(sql query)

    dude there is no matter of structure .........that user already said its from employee table ...............its basic table in sql and there is no need to specify the table structure
    .........i think u got my point I think you are the one who didn't understand Sarma's point.
    Give a man a fish and you feed him once. Teach a man how to fish and you feed him a life long.
    >
    and the query is
    select max(sal) from emp where sal<(select max(sal)
    from emp);
    this will give the 2nd max salary from the emp tableBtw: You solution is bad, because it needs to scan and sort the table emp twice. And a better solution has been given already.
    Message was edited by:
    Sven W. - reordered statements

  • Help me please going crazy, I have my Iphone 4S getting my e-mails from my computer using outlook but when I delete yhem on my computer they stay on my phone, I am syncing via the cloud, Is there a setting that stopps this e-mail from growing on my phone?

    Help me please going crazy, I have my Iphone 4S getting my e-mails from my computer using outlook but when I delete yhem on my computer they stay on my phone, I am syncing via the cloud, Is there a setting that stopps this e-mail from growing on my phone?

    For outlook or hotmail emails they use a pop server technology that you can't sync your computer and your iPhone with. You have to unfortunately delete the emails from both devices. It is super frustrating but that is the only way.
    Hope this helps.

  • Getting the attribute value from a table from page def using el expression.

    Hi,
    Am using Jdeveloper 11.1.2.0.0 and have a requirement as follows for which a sample is been created. Requirement is as follows..
    1. Have a Taskflow that has a readonly table Employee.
    2. On clicking of a button called "route" checks if the selected row , Manager id attribute value = 200 then navigate to first page else if manager id attribute value is 200 then navigate to second page.
    Through the page def , if it has form , then we can access the attributes like #{data.view_FirstPageDef.ManagerId} . In case of acquiring the same attribute value from table using page def ? is what am unable to get..
    Have achieved the routing concept using the Router activity on Taskflow. But am unable to get the selected row attribute value of a table from the employee page def.. Can someone suggest on the same...
    Thanks and Regards,
    Vinitha G

    On the router, right click its icon in the task flow and create a page definition. Then in the page def file, add an iterator based on the same View Object from the table in the first page, then add a value attribute mapped to managerId in the View Object iterator. Finally in the router you can write EL expressions along the lines of #{bindings.ManagerId.inputValue = 200} or #{bindings.ManagerId.inputValue != 200}.
    CM.

  • How to get the insert scripts from a table data

    hi all,
    i want insert scripts for 100 records from a table.
    suppose i have a table xyz
    xyz:
    id name
    1 abc
    2 def
    i should get insert script for 100 rows like
    insert into xyz(id,name) values (1,'abc');
    insert into xyz(id,name) values (2,'def');
    i want 100 records data from all the tables from my database.
    thanks in advance to all.

    SQL> create table xyz (id number, name varchar2(10));
    Table created.
    SQL> insert into xyz values(1,'abc');
    1 row created.
    SQL> insert into xyz values(2,'def');
    1 row created.
    SQL> select 'insert into xyz values(id,name) values('||id||','''||name||''');' from xyz;
    'INSERTINTOXYZVALUES(ID,NAM
    insert into xyz values(id,name) values(1,'abc');
    insert into xyz values(id,name) values(2,'def');
    SQL>- - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • To get recent timestamp records from internal table

    hi all,
      i have one requirment
      i'm storing error messages in one table  while creating a sales order basing on timestamp
      which is of this format yyyy-mm-dd hh:mm:ss (random Number) 
      if i want to see the error messages left i'm getting all the error messages displayed
      for example i have created a sales order
    i got 10 errors displayed
    i have rectified 5 errors ... if i again display error messages the 10 errors + the 5 errors is getting displayed
    i want to display the 5 error messages only not the previous messages from internal table
    basing on timestamp current one has to displayed remaining has to deleted from internal table.

    I thought we used Sales Order Incompletion process for this....  but, if you're recreating the errors list every time you save with a create or change transaction then, at save, delete all rows in your error table for this document.   Then get your errors and update your db table from your current errors table.   From this viewpoint, the timestamp is not relevant.

  • How to get only column names from different tables as single table columns

    Hi All,
       I have one requirement in which we want only column names from different tables.
    for example :
     I have three tables T1 ,T2, T3 having
      col1 clo2 clo3 -->  T1 , 
      col3 col5 ,clo6 --> T2 ,
      Clo6 col8 col9 --> T3
    columns i want to get only all  Column names from all table as single Resultset not any data from that how can i get that empty resultset 
    because this empty result i want to bind in datagridview(front end) as Empty resultset 
    Please tell me anyways to do this
    Niraj Sevalkar

    If I understand you want an empty result set, just with metadata. SET FMTONLY do the trick:
    SET FMTONLY ON
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    SET FMTONLY OFF
    Another alternative is to include an imposible contition
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    WHERE 1 = 0
    If you are using a SqlDataAdapter in your client application. You can use the FillSchema method. the select command may be any select statement that returns the columns you want. Under the covers FillSchema will call SET FMTONLY ON.
    If you are using SqlCommand.ExecuteReader you can pass SchemaOnly to CommandBehavior argument. SET FMTONLY ON is called under the covers. Again the select command may be any select statement that returns the columns you want.
    "No darás tropezón ni desatino que no te haga adelantar camino" Bernardo Balbuena

  • ¿How can I to get the selected index from a table in sapui5?

    I have a multiselect table for each item I need to open a Dialog and bind then the table.
    How Can I to obtain the index position from my table?
    var myTable = sap.ui.getCore().byId(this.sId);
    var myItem = sap.ui.getCore().byId(myTable.getSelectedItem());
    Thanks in advance.

    Hi,
    You can also use getSelectedContexts of table instance to get the selected indices of sap.m.Table
    var aContexts = myTable.getSelectedContexts(true);
    for(var i = 0 ; i < aContexts.length ; i++)
    var selectedIndex = parseInt(aContexts[i].sPath .split("/")[2]);
    Thanks,
    Rumeshbabu S

  • Very Urgent : Reterival of AWKEY field from BKPF table

    Hi,
    I am making a report in which i have to make relation of 2 fields BKPF-AWKEY and MKPF-MBLNR . but the problem is i am not to reterive data from it as i have to make inner join among these fields so data can be reterived fmo these tables.
    plz provide me some guidelines as it is really urgent to me and help will be deinfately rewarded.

    First and foremost, i would advice you not to use words like VERY URGENT in your subject. You might want to go through the following link to understand the basic rules of the forum:
    [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    For your requirement, below code might help you understand the logic in determining the link between BKPF and MKPF.
    TYPES: BEGIN OF t_bkpf,
             bukrs type bukrs,
             belnr type belnr_d,
             gjahr TYPE gjahr,
             awtyp type awtyp,
             awkey type awkey,
            end of t_bkpf.
    types: begin of t_mkpf,
             mblnr type mblnr,
             mjahr type mjahr,
           end of t_mkpf.
    data: i_bkpf type STANDARD TABLE OF t_bkpf,
          i_mkpf type STANDARD TABLE OF t_mkpf.
    data: wa_bkpf type t_bkpf,
          wa_mkpf type t_mkpf.
    PARAMETERS: p_bukrs type bukrs OBLIGATORY,
                p_gjahr TYPE gjahr OBLIGATORY.
    START-OF-SELECTION.
      SELECT bukrs belnr gjahr awtyp awkey
        into table i_bkpf
        from bkpf
        UP TO 20 ROWS
        where bukrs = p_bukrs
        and   gjahr = p_gjahr
        and   awtyp = 'MKPF'.
    IF NOT i_bkpf[] is INITIAL.
       select mblnr mjahr from mkpf into table i_mkpf
          for ALL ENTRIES IN i_bkpf
         where mblnr = i_bkpf-awkey(10).
    *     and   mjahr = i_bkpf-awkey+10(4).
    ENDIF.
    LOOP AT i_bkpf into wa_bkpf.
      READ TABLE i_mkpf into wa_mkpf
        with key mblnr = wa_bkpf-awkey(10)
                 mjahr = wa_bkpf-awkey+10(4).
      IF sy-subrc eq 0.
         write:/ 'Accounting Document:', 23 wa_bkpf-belnr,
              35 'Material Document:', 55 wa_mkpf-mblnr.
      ENDIF.
    ENDLOOP.

  • Getting filter condition values from a table within the mapping

    I have a table say mytable with columns as name, age and maritalstatus. I have another table paramtable with the following structure parametername, parametervalue. The data in this would be like say
    Age >= 24
    Maritalstatus F
    Now from the table mytable I want to apply a filter which uses the values from the paramtable. Basically the filter condition should be something like
    mytable.age >= 24 and maritalstatus = F
    Any help on how this can be done within OWB?
    Appreciate all the help i can get

    rveluthattil wrote:
    I have a table say mytable with columns as name, age and maritalstatus. I have another table paramtable with the following structure parametername, parametervalue. The data in this would be like say
    Age >= 24
    Maritalstatus F
    Now from the table mytable I want to apply a filter which uses the values from the paramtable. Basically the filter condition should be something like
    mytable.age >= 24 and maritalstatus = F
    Any help on how this can be done within OWB?
    Appreciate all the help i can getoption 1. take table 1 and tabl2 into a joiner and apply this filter on the joiner.
    2. If table 1 has age and marital status then you can straightaway apply a filter with the condition without using table 2.
    if you are always going to link tabl1 and tab2 then perhaps using a joiner is the best way.
    Edited by: Darthvader-647181 on Nov 6, 2008 5:49 AM

  • How to get the job logs from sm35 by using the queue id and session name?

    hi all,
    can any one please let me know how to read the job log from sm35 by using the session name and queue id. i have the job name and job count but is it possible to download the job log by using the queue id and session name.
    FYI..
    i want to read this job log and i want to send it to an email id.
    -> i am using the job_open and submitting the zreport via job name and job count and then i am using the function module  job_close.
    but this is not working in my scenario i have the queue id and session name by using this two i want to get the job log is there any function module available or code please provide me some inputs.
    thanks in advance,
    koushik

    Hi Bharath,
    If you want to download it to the local file then you can follow the instructions in the below link.
    How to download Batch Input Session Log?
    Regards,
    Sachin

  • Getting Paid OT Hours from RT table for Daily

    Hi All,
    I am required to do an overtime report. I have an issue with getting the OT hours. This report outlines the OT hours taken by employee each day.
    I am taking the OT Hours from ZL table. Now I have to get the Paid OT Hours from RT table. This is to compare how many OT hours are taken and which are not paid in payroll.
    I am able to get the Hours from ZL table because there is a date field there (datum). But RT table is cumulated by month. So I can't identify which paid hours are from which date.
    Is there any other way to find out the OT hours that have been paid off daily?
    Please help
    Thanks in advance.
    Regards,
    Lily

    Hi,
    The field 'LGART' in the ZL table can differentiate whether its a paid OT wage type or not.For your requirement,consider the hours of paid wagetype.Hope this will solve ur problem.
    Regards,
    Manoj.

Maybe you are looking for

  • Device not found after system update

    After running a system upate from 10.4.0 to 10.4.11, Final Cut Pro no longer finds my camera at startup. Refreshing device in FCP does nothing. I tried installing the Pro updates, deleting preferences, and repairing permissions. The camera is found i

  • Import Export Imges in JAVA to binary code with firebirds

    I'm having problems with a java netbeans. I want a start a disccus about how we can import and export images from and to, binary code. We can play with Blob variables, but i dont know how can we insert to a Firebird database and how we can read this

  • WebService from an Abstract Class

    Winthin JDev 10.1.2 is there a way to automatically create a J2EE WebService from an abstract class as you would with an public class? If so, how? Thank you in advance.

  • Table for  sap acript

    Hi experts, in which table all the standard scripts are stored.can any one help me. Regards, Ashok kumar.

  • Cant sign on to my favorite website

    I recently performed a recovery due to malware and unwanted add-on web browsers. I now cant sign onto a website for which I am a paid subscriber. I have tried all I know about security settings and all I can find in the PC database. I continualy get,