Linking the fields to fetch the data

Hi friends,
on my selection screen i have 3 fields
S_BSTNK  =  Customer Purchase Order number
S_TKNUM = Shipment
S_KUNNR = Ship to
Now my requiremnt is
when the user enters the value in S_BSTNK , i should get all the invoices fromVBRK table.
and later for those all invoices i should get the deliveries from VBFA table.
Now for all those deliveries i should  get the SHIPMENT & SHIPTO  and should check for the values entered in S_TKNUM and S_KUNNR   ( ie : if the user enters shipment and shipto in S_TKNUM and S_KUNNR  it should get only those values which are entered ).
now later i should get Customer purchase order number ( BSTNK )  Shipment (TKNUM ) and shipto ( KUNNR ) in one internal table .
Can any one tell me how to link it.
Regards,
Priyanka.

Hi Priyanka,
Write like this.
If s_BSTNK is not initial.
CONCATENATE  l_cond 'BSTNK IN S_BSTNK'  INTO  l_cond SEPARATED BY space."#EC NOTEXT
    l_flag = 'X'.
select *from vbrk into it_vbrk where (l_cond).
endif.
if s_BSTNK is not initial.
  if flag = 'X'.
select * from VBFA into table it_VBFA for all entires in it_vbrk where (l_cond)
endif.
endif.
if S_TKNUM is not initial.
if l_flag = 'X'.
CONCATENATE  l_cond 'AND' INTO  l_cond SEPARATED BY space.
endif.
CONCATENATE  l_cond 'TKNUM IN s_tknum'  INTO  l_cond SEPARATED BY space.
select * from vtfa into table it_vtfa where (l_comd).
endif.
if S_KUNNR is not initial.
if l_flag = 'X'.
CONCATENATE  l_cond 'AND' INTO  l_cond SEPARATED BY space.
endif.
CONCATENATE  l_cond 'KUNNR IN s_KUNNR'  INTO  l_cond SEPARATED BY space.
select * from kna1 into table it_vtfa where (l_comd).
endif.
This how you have to write dynmic selection.
Id on't which tables and fields u want to get
jsut i have written using * u can write u r own fields.
I think it will solve u r pblm.
If not please let me know i will help you.
Thanks,

Similar Messages

  • Link the data in excel to dreamweaver

    I don't know how to link the data in the cell of the
    excel(2003); isn't the excel file. It's just the data in the cell
    or coulmn.
    I want to expess the data in the web page.
    I think the solution about it, so I tried the function of
    publish in excel , and I success to publishing the page.
    but it have the problem. The data was just refreshed. For the
    refresh, opened the page have to refresh.
    It's difficult to me, so could give me the advice about
    it...

    My thoughts are
    To me (IMHO) your problem is
    - excel spreadsheet is not on webserver
    - database is a better repository for
    storing/updating/displaying data
    If people need the data in a spreadsheet from time to time,
    the data
    (from database) could be formatted in a query and exported to
    a local
    machine where a csv file could be imported into Excel.

  • Link the data between 2 blocks!!!

    Oracle Gurus,
    I have a control Text item, which gets value from an LOV in Block 1. when I select a value, in another block the corresponding records in the table a has to be populated. how can I achieve this.
    Also How can I handle this if the control item is a list item? I mean How I see the values, when I click the list item at run time. and also how this selection will populate the Block 2?
    This may be basic, but I am new to forms.
    Please let me know.
    Thanks,
    Message was edited by:
    Forms

    Hi....
    After selecting the item in the list box
    GO_BLOCK(BLOCK_TO_POPULATE);
    EXECUTE_QUERY;
    In Pre-Query of BLOCK_TO_POPULATE
    :BLOCK_TO_POPULATE.item=value_of_list_item;
    Hope it helps..
    Benj

  • How to fetch the data & display the data if fields got the same name in alv

    hi frnds, i need ur help.
    how to fetch the data & display the data if fields got the same name in alv grid format.
    thanks in advance,
    Regards,
    mahesh
    9321043028

    Refer the url :
    http://abapexpert.blogspot.com/2007/07/sap-list-viewer-alv.html
    Go thru the guide for OOPs based ALV.
    Use SET_TABLE_FOR_FIRST_DISPLAY to display the table:
    CALL METHOD grid->set_table_for_first_display
     EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'     “Structure data
    CHANGING
    IT_OUTTAB = gt_sflight.          “ Output table
    You can also implement
    Full Screen ALV, its quite easy. Just pass the output table to FM REUSE_ALV_GRID_DISPLAY. 
    For controlling and implementing the FS-ALV we have to concentrate on few of the components as follows :
    1. Selection of data.
    2. Prepare Layout of display list.
    3. Event handling.
    4. Export all the prepared data to REUSE_ALV_GRID_DISPLAY.
    Regd,
    Vishal

  • How to fetch,update,insert the data using database link on diff. servers

    I am using two oracle server.
    1st) Oracle 9i ( Server1 )
    2nd) Oracle 10g ( Server2 )
    3) Forms 6i
    I have created a database link on Server 1 for connecting to Server 2.
    I written a piece of code which will be executed in Forms 6i and is connected to Server1.
    The piece of code brings the data from SErver2 via cursor and I try to insert / update the relevant records
    in my Server1 database users.
    The Insert/Update runs sucessfully but at the time of commit I get the following errors
    in Forms ORA-01041:internal error. hostdef does not exist.
    Then it forcefully rollback the data and come out of the application.
    contact :email-id : [email protected]

    Suggest you test your code from sqlplus before running from forms.
    Start by testing a simple "select sysdate from dual@<database link>;" then test select from application_table@<database link> then test the insert/update code. After it works from sqlplus, then try it from forms.

  • Fetching the data using Db link through cursor

    Hi ,
    I created the cursor in which i want to access the data using Db link , can u tell the way to access the data
    Code Which gives error
    for rec in (
         SELECT ac_no as ac_code,drcr_ind as dr_cr,lcy_amount as amt
              FROM actb //"Public Synonym Of Db Link "
              Where period_code <> 'FIN'
              And AC_NO = '100130000'
              AND AC_BRANCH = '254'
    Its Urgent.
    With Regards,
    Anand

    An ORA-00600 error indicates an internal Oracle error. There are literally thousands of possible reasons that you might get one of these, but it generally boils down to Oracle bugs (you should never get this sort of error).
    - You'll need to log a support request with Oracle Support
    - There should be a number of parameters (generally rather cryptic) that come with the ORA-00600 error. You should look up those particular parameters in the Metalink ORA-00600 lookup tool
    - Hopefully, that tool will point you at a patch or a workaround. If not, you'll need to get support to figure out what's going on behind the scenes.
    Justin

  • RFC is to be created in ECC that should fetch the data from CRM

    Hi Gurus,
    I am facing with a problem in knowing the fields and table to develop an RFC in ABAP.
    My exact requirement is :
    ABAP :  the field PERNR is passed as exporting parameter  to RFC and imporitng paramter is an internal table that consists of   PERNR and overpayment status field.
             ABAP                                                                             CRM
    Exporting Parameter = PERNR                                  Importing Parameter= ? " Which field should i take as importing field"
    Importing Parameter = LT_ITAB                                Exporting Parameter= ? " internal table consisting input field and                                                                               
    overpayment status field "
    NOTE : In order to provide a means of progressing overpayments and to provide a statistical analysis of overpayments, RFC  is required that combines the information in CRM with that in ECC6 for overpayment details.
    Pls Can u Help me by providing table and field name in CRM
    Thanks,
    Reddy..

    Hi Kalpana,
    if you want to fetch ecc data to crm you have to create one rfc enabled function module in ecc use that function module in crm.
    calling a smart form is different scenario go through this links you can get to know how to call..
    **************** - Calling an RFC function module from one system to another
    Print an Adobe Form from CRM Web UI - CRM - SCN Wiki
    Call a Smartform in webUi
    example:
    sample code:
    clear lv_client.
    IF  sy-mandt = '110'.
         CONCATENATE 'ECDCLNT' sy-mandt INTO lv_client.
       ELSEIF sy-mandt = '200'.
         CONCATENATE 'ECQCLNT' sy-mandt INTO lv_client.
       ELSEIF sy-mandt = '300'.
         CONCATENATE 'ECPCLNT' sy-mandt INTO lv_client.
    endif.
    call function 'zfunction_module'  destination lv_client
    exporting
      is_date = lv_date
      tables
      ot_tab  = ot_tab.
    Thanks & Regards,
    Srinivask

  • About the fetching the data

    Here is the requirement for a new Z report that lists customer addresses in an ALV display for customers with activity over a certain period. 
    Use database table VBRK - the billing document header and customer master table KNA1.
    1.            Selection on sales org.  VBRK-VKORG
    2.            Selection on activity period based on Billing Date VBRK-FKDAT
    3.            Selection on the payer customer  VBRK-KUNRG
    4.            List u2013 Customer number,
                               country,
                               Name 1,
                               Name 2,
                               Street ,
                               Postal Code
                               city,
                               Region,
               PO Box,
               PO box postal code
                              last activity date ( last VBRK-FKDAT value fetched from VBRK selection )
    So for each customer on the selection screen , there will be 1 record in the output.
      how ot read the data... from this table....

    Hi ,
    The tables VBRK and KNA1 are linked using the field :
    VBRK-KNKLI   = KNA1-KUNNR.
    Make inner join on those two tables and get the values u need. In the inner join put where as :
    SELECT a~<field name>
                 a~<field name>
                 b~<field name>
                 b~<field name>
    INTO CORRESPONDING FIELDS OF TABLE <internal table name>
    FROM VBRK AS a INNER JOIN KNA1 AS b
    ON aKNKLI = bKUNNR
    WHERE <condition>.
    Regards,
    Raghu

  • Want the data store values to be displayed in input field of form

    Hi,
    I wanted to know wether is there possibility of displaying the data in a input field instead of expression field.
    In our model i have used a form which has material type,plant and Vendor connected to data service1 in turn gives the out put in chart and i also have the second input form which has To(0CALMONTH) combo box which is connected to Data service2 and gives the data in table.
    But what i wanted is to i also want to use the input fields of first form to second Data service2 and get the data based on on inputs of form1 and form2i.e also To field.
    We can connect the port from form1 to DS2 but problem is we need to click the submit of form1 and form2 and it doesnt gives the output according the input of form1 and form2 as it gives the output of that form when we click that submit button.
    I have followed help.sap for data tore procdure.
    So i have used a datstore where i will store the values of form1 and call it in expression field which i will add and hide it in form2(hide because user should not see that input fields).
    Formula used in data store for expression field.
    IF(CONTAINS(STORE@matltype,@Material_Type),STORE@matltype,STORE@matltype &(IF(LEN(STORE@matltype)>0,'; ',''))&@Material_Type)
    But whats happening is the value is getting concatenated when i goon change the values in input field, so i wanted to get the values to be replaced as soon as i change input field of form1(if  use replace function its not working) and also it would be more preferrable if we use input field instead of expression field.
    I would also like to know is there any alternate solution for the above requirement instead of datastore.
    Thank You
    K.Srinivas

    Hi,
          I have Form1 connected to Data service1 displays the data in a Chart and i have another Form2 connected to Dataservice2 displays the data in table.
    In form1 there are Material Type,plant, and Vendor and form2 i have To (0CALMONTH)SO now i want also Form1 inputs for Table which gets teh data from Dataservice2.
    What i have said earlier is connecting Form1 to Dataservice doesnt fetch the data correectly,its because if i click submit in form1 i get the data of those 3 inputs and i need to click the submit button in form2 after giving input which shows the data accordingly where it doesnt fulfill the requirement.
    So i wanted some solution for that.For that reason i have used the data store and the procedure i have followed the help.sap as i said in my above mesage.
    If Data store is also suggestable than i want to display the data in Text input Field  instead of Expression field which should replace the previous values as soon as values change in data store.
    Hope i have tried to be clear if still it is not i am ready to explain again.
    Thank You
    K.Srinivas

  • Not able to fetch the data by Virtual Cube

    Hi Experts,
    My requirement is I need to fetch the data from Source System (From Data base table) by using Virtual Cube.
    What I have done is I have created Virtual Cube and created corresponding Function Module in Source System.
    That Function MOdule is working fine, if Data base table is small in Source System.But If data base table contains huge amount of data (millions of record), I am not able to fetch the data.
    Below is the code I have incorporated in my function module.
    c_th_mapping TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_TH_IOBJ_FLD_MAPPING.
      DATA:
        l_s_map TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_S_IOBJ_FLD_MAPPING.
      l_s_map-iobjnm = '0PARTNER'.
      l_s_map-fldnm  = 'PARTNER'.
      insert l_s_map into table l_th_mapping.
    create object l_r_srv
        exporting
           i_tablnm              = '/SAPSLL/V_BLBP'
          i_th_iobj_fld_mapping = l_th_mapping.
      l_r_srv->open_cursor(
        i_t_characteristics = characteristics[]
        i_t_keyfigures      = keyfigures[]
        i_t_selection       = selection[] ).
       l_r_srv->fetch_pack_data(
        importing
          e_t_data = data[] ).
      return-type = 'S'.
    In the above function Module,Internal table L_TH_MAPPING contains Info Objects from Virtual Cube and corresponding field from Underlying data base table.
    The problem where I am facing is, in the method FETCH_PACK_DATA, initially program is trying to fetch all the recordsfrom data base table to internal table.If Data base table so lagre, this logic is not working.
    So would you please help me how to handle these kind of issues.

    Hi Experts,
    My requirement is I need to fetch the data from Source System (From Data base table) by using Virtual Cube.
    What I have done is I have created Virtual Cube and created corresponding Function Module in Source System.
    That Function MOdule is working fine, if Data base table is small in Source System.But If data base table contains huge amount of data (millions of record), I am not able to fetch the data.
    Below is the code I have incorporated in my function module.
    c_th_mapping TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_TH_IOBJ_FLD_MAPPING.
      DATA:
        l_s_map TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_S_IOBJ_FLD_MAPPING.
      l_s_map-iobjnm = '0PARTNER'.
      l_s_map-fldnm  = 'PARTNER'.
      insert l_s_map into table l_th_mapping.
    create object l_r_srv
        exporting
           i_tablnm              = '/SAPSLL/V_BLBP'
          i_th_iobj_fld_mapping = l_th_mapping.
      l_r_srv->open_cursor(
        i_t_characteristics = characteristics[]
        i_t_keyfigures      = keyfigures[]
        i_t_selection       = selection[] ).
       l_r_srv->fetch_pack_data(
        importing
          e_t_data = data[] ).
      return-type = 'S'.
    In the above function Module,Internal table L_TH_MAPPING contains Info Objects from Virtual Cube and corresponding field from Underlying data base table.
    The problem where I am facing is, in the method FETCH_PACK_DATA, initially program is trying to fetch all the recordsfrom data base table to internal table.If Data base table so lagre, this logic is not working.
    So would you please help me how to handle these kind of issues.

  • Newly added field in the data Source not getting populated

    Hello All,
    We have added few fields in the Data Source. The Data Source is based on the InfoSet. We have included the field in the Infoset and have updated the code to fetch the value for the newly added fields.
    When we perform the test extraction for this Data Source in RSA3, the newly added fields are not getting populdated with the value. In the system generated query's selection list, the newly added fields are not selected.
    Please let mw know how to get the newly added field selected in the system generated query of the infoset.
    Regards,
    -Purnima

    Hi,
    As you said you have added the filed in Info Set. Have you included the same in data source? try if not.
    If you are trying to create a query in source system to check the data. I guess in R/3 (ECC) then you have to include the new field in slection critera (ther is an option available on top menu).
    I would suggest before creating any query go to RSO2 select the data source. Display the field structure and check if the filed is there or not. You maysee Infoset level data directly by data display from top menu. Try that optionas well to check.
    I hope it will help.
    THanks,
    S

  • Link on a pivot table to see the data behind summary figures

    Hello,
    I need your support because I am not sure if what I need to do is possible.
    I have a flattened table and I have created several pivot tables and slicers based on it. Once I have created the scenario I want to analyze (using slicers), I get some summarized figures in the pivot table. What I need is a way to put a link on those figures
    to allow me to see the data associated to them.
    For instance, if after applying some slicer I get one figure 3, another 2 and grand total 5, I need to see the 2, 3 or 5 records behind them filtered in the existing data (not just double-click and create a new worksheet) .
    Thanks in advance for your comments,
           Parseval

    Hyperlinks in pivots are not supported.
    There is some limited drill through functionality built into pivots, but you can't do a lot to configure how it behaves.
    If it is enabled, which I believe it is by default, you show be able to double click on a aggregated total and a new sheet will pop up with the underlying records.  If your measure is a relatively simple aggregation and the underlying data is a
    flat file then this should work pretty well.  The results can be unexepected if the measures are complex or there are a lot of underlying relationships in the model.
    The other possibility is to use the pivots ability to collapse/expand fields. If you can put the row ID for the individual records into the rows of your pivot beneath what ever aggregated row you are currently displaying, then you should be able to expand
    into the rows and see the lower levels of the "hierarchy".  By default, all rows in you pivot would be collapsed, but then a user could click the little plus sign next to the row label and expand it to see the underlying records.

  • F4 help for a field Based on the data in the other fields

    Hi,
    We have a selection screen(Report Program) with three fields Bill Number, Billing Date and Plant. Bill Number and Plant are stored in one table and Bill Number and Billing Date are stored in another table, Bill number is common in Both the Tables. We want to  have a F4 Help for Bill Number based on Both the Plant and Billing date. For this we are trying to get it thorugh Search Help,, Can any of you help us in this context.
    Thanks & Regards,
    Satish P.

    hi,
    FORM F_GET_details .
    REFRESH INT_RET.
    *--THIS WILL FETCH THE details
    SELECT aBill aplant Number b~BillingDate
    INTO TABLE int_table
                    FROM ( ztable_numplant AS a
                      INNER JOIN
                        ztable_numdate AS b
                          ON  abillnimber = bbillnumber ).
      IF SY-SUBRC NE 0.
    *--MESSAGE IS 'NO data found'
      ELSE.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            RETFIELD        = 'screen field'
            VALUE_ORG       = 'S'
          TABLES
            VALUE_TAB       = INT_tab
            RETURN_TAB      = INT_RET
          EXCEPTIONS
            PARAMETER_ERROR = 1
            NO_VALUES_FOUND = 2
            OTHERS          = 3.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        READ TABLE INT_RET INDEX 1 INTO INT_RET.
        WF_data_needed = INT_RET-FIELDVAL.
      ENDIF.
    ENDFORM. 
    if hlped rwrd points
    anver

  • How to populate the data for additional fields in custom report of fbl5n tr

    hallo friends,
    i ha ve to add some fields to the output of custome report of transaction FBL5N.
    Till now i have only added the fields to the output.
    Now i have to write the code to populate the data for those fields in the program.
    1.     Customer Credit Group(ACM/RCM): (Table: KNKK; Field Name: VKORG )
    2.     Credit Representative Group: (Table: KNKK; Field Name: SBGRP)
    3.     Customer Account Number(CAN#): (Table: KNKK; Field Name: KNKLI)
    4.     Alternative Payer(ALTP#) : (Table: KNA1; Field Name: KUNNR)
    5.     Risk Category: (Table: KNKK; Field Name: CTLPC)
    6.     Credit Info Number: (Table: KNKK; Field Name: KRAUS)
    7.     Rating: (Table: KNKK; Field Name: DBRTG)
    8.     Payment Index: (Table: KNKK; Field Name: DBPAY)
    9.     Credit control area: (Table: KNKK; Field Name: KKBER)
    10.     Company code: (Table: KNB1; Field Name: BUKRS)
    11.     Sales Organization: (Table: KNVV; Field Name: VKORG)
    These are al fields i have to populate in the program..
    MY ATTEMPTS:
    I tried getting the data for KNKK table by GET KNKK ,but it is giving some garbage values...
    And Logical database used here is DDF,and i have to add the VKORG of KNVV too...but KNVV is not there in DDF...
    Can anybody tell me how should i proceed..
    thanks in advance.

    Thnx Andreas,
    i have following doubts again..
    I have to add sales organisation field to the selection screen...(this is given in the req.)
    now if i will say GET KNKK...it would not keep account of this 'sales organisation' field...so how should i fetch the data with these input data( i.e. 'compny code' and 'customer' are the fields given by LDB and 'sales oraganisation' is the field i put it on the selection screen)
    And what about the KNVV-VKORG ,because the KNVV is not present in the LDB.

  • Parts of the Data went missing when linking two data sets

    Hello Everyone!
    I have two data sets for my report:
    1. an essbase cube which is transformed to a relational star shema transformed by BI Administraion, Im calling the cube with sql (not mdx)
    2. a single relational table
    In the report Im iterating on the 'product' dimension of the cube and I need to join the cube with the single relational table, because that table holds all the detailed information on each product (mostly text therefore it is not in the cube).
    What I did was, joined the two data sets with a Master/Detail link. So far so good. But the thing is, more than half of my data goes missing in the xml-Output when I join those too. If I delete the join, all the data is back again in the xml-ouptut but I cant refer to the details of the relational table.
    I tried different things to fix that problem. So I sorted the 1. dataset and joined it again with the 2. dataset. As a result there was still a lot of data missing, but not the same as before.
    I find this behaviour really strange and don't have a clue what to do differently.
    I would really appreciate some help, because I already spent hours trying to fix that problem.
    Thank you!
    Edited by: 981323 on 27.02.2013 06:49

    Thanks for that. Typically I found this 5 minutes after I posted the request on the forum.
    Problem is every time I try and do this the system does not recognise my <?for-each> containing the parameter and says the parameter is not defined. WHen I validate the template it seems to ignore the F completely and complains about to many ends.
    I just can't see why it does not work. I am using four records, 2 of each set I am using which link over item number. I can show them seperately but as soon as I add the variable loop ( <?for-each:/INV_GL/GL[GLLITM= $ITM]?> where ITM is my variable and GLITM is that field in the data) it stops working.

  • How to print the data  if we take different fields from diffrent tables

    Hi ABAPers,
    I take diff fields from 3 tables. Those are
    these fields from EKBE
           EBELN
           EBELP
           BELNR
           BUZEI
           BWART
           BUDAT
           AREWR
           REEWR
           WERKS
           MWSKZ
    these fields from EKKO
           BUKRS
           BSART
           WAERS
    these field from EKPO
           TXZ01
           MATNR
           MTART
    I want to print the data all fields.What logic can i write?
    Please help me for this question and i am waiting for your response.
    Regards,
    Raja Sekhar.

    Hi,
    First you have to fetch data from all the three tables and then consolidate into final table.
    In Declaration:
    1.Declare Internal Table for EKKO holding:
    EBELN
    BUKRS
    BSART
    WAERS
    2.Declare Internal Table for EKPO holding:
    EBELN
    EBELP
    TXZ01
    MATNR
    MTART
    3.Declare Internal Table for EKBe holding:
    EBELN
    EBELP
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    *==> This table has
    MANDT
    EBELN
    EBELP
    ZEKKN
    VGABE
    GJAHR
    BELNR
    BUZEI
    as Primary keys field,you should have values for all the PK aotherwise you will get multiple entries*
    4.Declare a Final Internal Table i_final with all the fields you want
    EBELN
    EBELP
    BUKRS
    BSART
    WAERS
    TXZ01
    MATNR
    MTART
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    Data Fetching
    select EBELN
    BUKRS
    BSART
    WAERS
    from EKKO
    into table i_ekko
    where .........<selection criteria>.
    if not i_ekko is initial.
    select EBELN
    EBELP
    TXZ01
    MATNR
    MTART
    from EKPO
    into table i_ekpo
    for all entries in i_ekko
    where EBELN = I_EKKO-EBELN
    AND ......<If any other selection criteria>.
    if not i_ekpo is initial.
    select EBELN
    EBELP
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    from EKBE
    into table i_ekbe
    for all entries in i_ekpo
    where ebeln = i_ekpo-ebeln
    and ebelp = i_ekpo-ebelp
    and ..........<If any othet selection criteria>
    endif.
    endif.
    Consolidate
    sort i_ekko by ebeln.
    sort i_ekpo by ebeln ebelp.
    sort i_ekbe by ebeln ebelp.
    LOOP AT i_ekbe into wa_ekbe.
    read table i_ekko into wa_ekko with key ebeln = wa_ekbe-vbeln binary search.
    if sy-subrc = 0.
    ====>Move all the required firlds from I_EKKO to i_final  , like
    wa_final-BUKRS = wa_ekko-BUKRS.
    endif.
    read table i_ekpo into wa_ekpo with key ebeln = wa_ekbe-vbeln
    ebelp = wa_ekbe-ebelp binary search.
    if sy-subrc = 0.
    ====>Move all the required firlds from I_EKPO to i_final  , like
    wa_final-EBELP = wa_ekko-EBELP.
    wa_final-TXZ01 = wa_ekko-TXZ01.
    endif.
    ==>Also all the required fields from EKBE to final table, like
    wa_final-BELNR = wa_ekbe-BELNR.
    endloop.

Maybe you are looking for