SQ02 - Inner Joing ABAP

Hi Guys,
Quick question, how can i do an inner joing in SQ02?
I have tried the following coding which works in ABAP but not in SQ02. What i am trying to do is a I have a table AFKU. So basically on the selection screen if I type in a a datei want it to go in to AFKO and calculate the RMNGA for the AUFNR  in there and bring the value back.
At the moment when using Queries it is very slow using abap it is very fast hence want to use both, If some one can give me the basic coding for Inner Joins that has been tried and testing in Queries SQ02 i can work the rest out
Thanks
tables: aufk.
data: zcount type i.
data: begin of i_tab occurs 0,
  aufnr like afko-aufnr,
  PLNBEZ like afko-PLNBEZ,
  rmnga like afko-rmnga,
  werks like aufk-werks,
  auart like aufk-auart.
data: end of  i_tab.
select aaufnr aPLNBEZ brmnga cwerks c~auart
  into corresponding fields of i_tab
  from ( ( afko as a
    INNER JOIN afru as b ON aaufnr = baufnr )
    INNER JOIN aufk as c ON aaufnr = caufnr ).
where a~aufnr IN SP$00001
    and b~werks EQ SP$00010.
collect i_tab.
endselect.
loop at i_tab.
  REWORK = i_tab-rmnga.
endloop.

Hi,
Wish it was simple as that i am fairly good at queries i do a bit of coding as well on queries, i want to use an inner join for performance reasons. If any1 could help me with that and have used Inner joins ABAP Coding please let me know
Thanks
Adeel

Similar Messages

  • Using SQ02 for writing ABAP programs

    Hello,
    I am using SQ02 coding section for writing some simple ABAP programs, mainly for reporting purposes. I would like introduce more power into my programs, but SQ02/SQ01 reports return "ACCESS_DENIED" when I for example try to call a function (GUI_DOWNLOAD).
    Can You advise how to extend SQ02 authorization to enable function calls?
    Maybe You know other place from which You can write programs without a developer key?
    Thanks,
    Pawel

    Hi Uday,
    do You mean that I have to first make a recording on cg3y using transaction shdb, then create a function module basing on this recording, and then use this function module in my code?
    Pawel

  • Abap coding in SQ02

    Hello,
    Since it's not possible to add IT2051 to the AdHoq Query, I was trying to create an additional structure and wrote a little program for retrieving absence data. The problem I get is that the output only shows results for 1 day and not for the entire period I select in the selection screen of PQAH. Anybody has a suggestion or some information how to add coding properly to SQ02?
    Here is the code I used:
    Data: pers_avail type table of pdpsp with header line,
          it_pers_avail type table of pdpsp with header line,
          wa_pers_avail like line of pers_avail.
    CALL FUNCTION 'HR_READ_TIMEDATA_PSP'
      EXPORTING
       BEGIN_DATE                  = PN-BEGDA
       END_DATE                    = PN-ENDDA
        PERSON_ID                   = P0001-PERNR
      PERSON_TYP                  = 'P'
      RP_BUILD_PSP_ERROR          = ' '
      TABLES
        PERS_AVAIL                  = PERS_AVAIL
    EXCEPTIONS
      NO_CAPACITY_AVAILABLE       = 1
      NO_INTEGRATION_ACTIV        = 2
      TIMEINFO_ERROR              = 3
      OTHERS                      = 4
    IF SY-SUBRC = 0.
    Loop at Pers_avail.
      dailyworkschedule = PERS_AVAIL-tprog.
      DAYOFWS = PERS_AVAIL-datum.
    Endloop.
    Thanks !!
    Philip
    Else.
      Clear dailyworkschedule.
    Endif.

    Hi,
    Wish it was simple as that i am fairly good at queries i do a bit of coding as well on queries, i want to use an inner join for performance reasons. If any1 could help me with that and have used Inner joins ABAP Coding please let me know
    Thanks
    Adeel

  • SQ02 Create a query whit the structures.

    Dear gurus ,
    i create a query SQ02 whit the initial impostation " Data retrieval by program"  and insert in the field "data structure" the name of the structures where are the value, example ( AFVGD).
    When run the query the value is blanck .
    I must for case to modify the program generated  from the system :
    REPORT  RSAQDVP_TEMPLATE.
      declarations
      (insert your declarations in this section)
    data:
      AFVGD                          type AFVGD                         ,
      it_data type standard table of AFVGD                         .
    field-symbols: <struc> type AFVGD                         .
      selection screen statements
      (define your selection-screen here)
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_HEAD>
      read data into IT_DATA
    (select your data here into internal table IT_DATA)
      output of the data
      (this section can be left unchanged)
    loop at it_data assigning <struc>.
      move-corresponding <struc> to AFVGD                         .
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_BODY>
    endloop.
    You could advise to me like?
    Thanks a lot for your help
    Daniel Pistilli

    Dear gurus,
    i need of display the data result of the transaction of the leveling capacity in the transaction (CM22).
    I find that this data is present in the structures RCYPP_GEN and after i create a inforecord and a query ( SQ02 and SQ01 ) whit this structures, but don't see the date in the query report.
    In the SQ02 this code abap don't is present in the area coding "in Record Processing section" but the system created a pulsant "data reading program" for link a the area where is present this abap code.
    Are there the soluction for my problem?
    Thanks a lot for you important help
    Daniele Pistilli

  • Query sq02-text

    HI,
    in billing header-text tab-Transporter -text is given ABC
    text ABC must be displayed through query infoset sq02
    How to call function module Read_text in sq02
    pl suggest

    Hi
    ABAP Querys are usefull for only simple reporting programs
    if you want to do some logic then you should use the NORMAL report programing.
    in ABAP Query just simple simple relations and simple output format will be available no complex programing

  • Left Outer Join not working in Infoset.

    Hello Friends,
    I have two ODSes , one for planned data (zplan) and other is billing z ods (zsd_o03).
    now the situation is such that in my planned ODS  for one sold to party .
    SOLD TO        MATERRIAL CALMONT     PLANNED QUANTIY
    14315            100                06.2007           54
    14315            200                06.2007           20
    14315            300                06.2007           30
    14315            400                06.2007           10
    But in my Billing ODS iam having for Sold to 14315
    SOLD TO        MATERRIAL CALMONT     ACTUAL QUANTIY
    14315           100           06.2007                  20
    14315           200           06.2007                  30
    And my Bex ouput should be like
    SOLD TO        MATERIAL CALMONT        planned             ACTUAL QUANTIY
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    14315            300                06.2007           30                                  0
    14315            400                06.2007           10                                0
    So for this i made one Infoset and these ODses are linked by Sold_to , Materail,
    Calmonth.
    First i tried using Inner joing option , but the bottom two lines were not ciming , so used left outer join , and activated and recreated the query but still its showiong me the output same as inner join .. i.e
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    So i checked by writing a ABAP code in Se38 , but there its showing me the correct result ..
    So please anybody help me out because iam thinking that infoset is the right way to do this kind of reporting , or esle shall i make one ODS and populate it through this ABAP code..
    Thanks in advance.

    Hi , can anybody help me in this regard..
    Thanks ..

  • Problem with infoset/query: Some data are missing

    hi all,
    i created an infoset and a query with tables AGR_AGRS (composite/single roles) and AGR_TCODES (tcodes in roles)with SQ01/02.
    Problem is that some roles without tcodes dont appear in the report(no data in AGR_TCODES)
    I tried to change properties of joints in SQ02 (external) but it doesnt work..
    Any idea? Let me know if you need further info,
    julien

    Hi Sujay,
    My infoset is built like this:
    agr_define_____________agr_agrs___________________agr_texts
    .............................................. |_______________________agr_tcodes____________________agr_texts
    I tried to change  agr_define_____________agr_agrs and agr_agrs_____________agr_tcodes using left inner joing but no result.
    I appreciate your help,
    Julien
    Edited by: JULIEN LEGAL on Aug 16, 2010 9:47 AM

  • Inner classes in ABAP

    Hello!
    Is it possible to declare inner classes, that is, classes within classes in ABAP? If yes, please provide example.
    Thanks!
    Kind regards,
    Igor

    > No. I need a class to be declared within a class, or
    > even within a method in order to make it visible only
    > to the containing class (or method).
    You cannot <b><i>nest</i></b> class declarations, but there <b><u>happens to be</u></b> a way of implementing the functionality you desire, though too tedious to be useful practically. You can use a combination of a <b>"CREATE PRIVATE"</b> class and the <b>Friendship</b> idea to do this. A quick and dirty example is :
    REPORT  zootest.
    CLASS lcl_test_outer DEFINITION DEFERRED.
    *       CLASS lcl_test_inner DEFINITION
    CLASS lcl_test_inner
                     DEFINITION CREATE PRIVATE
                     FRIENDS lcl_test_outer.
      PUBLIC SECTION.
        DATA: test.
    ENDCLASS.              
    *       CLASS lcl_test_outer DEFINITION
    CLASS lcl_test_outer DEFINITION.
      PUBLIC SECTION.
        METHODS: test_inst.
    ENDCLASS.                  
    *       CLASS lcl_test_outer IMPLEMENTATION
    CLASS lcl_test_outer IMPLEMENTATION.
      METHOD test_inst.
        DATA: ref1 TYPE REF TO lcl_test_inner.
        CREATE OBJECT ref1.
      ENDMETHOD.
    ENDCLASS.
    DATA: ref1 TYPE REF TO lcl_test_inner,
          ref2 TYPE REF TO lcl_test_outer.
    START-OF-SELECTION.
      CREATE OBJECT ref2.
    Crude, but it can be refined further, but I hope this helps
    Regards,
    Dushyant Shetty

  • ABAP QUERY(sq02)

    Hi friends,
         I am using PNP LDB in SQ02 .
         i am selecting AT SELECTION-SCREEN in "CODE tab" but it's not selected
         How to use "F4 help function module" in ABAP Query(SQ02).
    Thanks & Regards,
    Vallamuthu.M

    Hi
    Why you are using SQ01/02 query? you can't get all the facilities what you use in general abap program report
    Query is basically intended for functional consultants to get the data by joining the tables
    it is Client specific and user specific
    You can't use all the events and F4 help like thing in them.
    see the doc
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b413afab52b9e10000009b38f974/content.htm
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Step-by-step guide for creating ABAP query
    http://www.sappoint.com/abap/ab4query.pdf
    ABAP query is mostly used by functional consultants.
    SAP Query
    Purpose
    The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
    All the data required by users for their lists can be selected from any SAP table created by the customer.
    To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
    ABAP Query, as far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
    To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
    use either SQ02 ans SQ01
    or SQVI tr code
    for more information please go thru this url:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
    http://goldenink.com/abap/sap_query.html
    Please check this PDF document (starting page 352) perhaps it will help u.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    check the below link will be helpful for u
    Tutorial on SQVI
    once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • About inner join in abap

    hi
        i am new to sap , i dont no about inner join in abap coding
    plz send me some notes or coding.
                            thank u.
                                                              your regrads
                                                                    divya.

    hi
    use this links
    INNER JOIN  and OUTER JOINhttp://help.sap.com/erp2005_ehp_03/helpdata/EN/cf/21ec77446011d189700000e8322d00/frameset.htm
    JOINED TABLES
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/0f/49bd6a5d5049edba7b3afe6c7956e3/frameset.htm
    u will find all thins related to joins with example and how to use it
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 25, 2008 9:45 AM

  • SUBQUERY with INNER JOIN in ABAP

    Hi Expert
    How Can I write SUBQUERY with INNER JOIN in ABAP.
    thanks

    Thanks Sidhharth for your Respose
    Actually I need data from VBAP, VBAK, VBUP, VBUK and VBKD with all functional validation satisfied for a sales order item data. The requirement is to report all item data with other information from table VBAK, VBUP, VBUK and VBKD in a corresponding record with ALL data in VBAP.
    Your help is appriciated.
    see the below query for reference
    select   alias_vbap~vbeln from  vbap as
    alias_vbap inner join vbak as alias_vbak
    on  alias_vbapvbeln eq  alias_vbakvbeln
    "and  alias_vbak~bukrs_vf eq '2400'
    inner join vbuk as alias_vbuk
    on alias_vbukvbeln = alias_vbapvbeln
    inner join vbup as alias_vbup
    on alias_vbupvbeln = alias_vbapvbeln
    and alias_vbupposnr = alias_vbapposnr
    left OUTER join veda as alias_veda
    on alias_vedavbeln = alias_vbapvbeln
    and alias_vedavposn = alias_vbapposnr
    left outer join vbkd as alias_vbkd
    on alias_vbkdvbeln = alias_vbapvbeln
    and alias_vbkdposnr = alias_vbapposnr

  • Inner join in ABAP and exporting the data

    Hi,
    I want to use inner join in ABAP for retrieving data from 2 tables and export that data.How will i do it?

    Hi,
    Refer following code
    *--Select query to pick the data from table VBRK
    VBRP and VBPA using inner join
      SELECT a~vbeln                            "Billing document
             a~fkdat                            "Billing date
             a~fktyp                            "Billing category
             a~fkart                            "Billing type
             a~vtweg                            "Distribution channel
             a~knumv                            "Number of doc condition
             b~posnr                            "Billing item
             b~matnr                            "Material Number
             b~werks                            "Plant
             b~vgbel                            "Referance
             b~netwr                            "Net value of billing item
             b~wavwr                            "Cost in document currency
             c~kunnr                            "Partner function
             FROM vbrk AS a
             INNER JOIN vbrp AS b
             ON avbeln EQ bvbeln
             INNER JOIN vbpa AS c
             ON  bvbeln EQ cvbeln
            AND bposnr EQ cposnr
             INTO CORRESPONDING FIELDS OF TABLE it_vbrp
             WHERE fkdat IN s_erdat
             AND   parvw EQ 'ZS'.
      IF sy-subrc EQ 0.
    *--Sort table by
        SORT it_vbrp BY vgbel1.
      ENDIF.
    Regards,
    Prashant

  • Inner join Vs Outer join with ABAP code...?

    Inner join Vs Outer join with ABAP code...?

    Inner Join means, it will not select that recor at all, unless there is a matching entry in the second table.
    suppose table VBAK INNER join table VBAP on VBAKVBELN = VBAPVBELN.
    In this case, if there are no entries in VBAP, the header entry also will not show up.
    But in case of OUTER JOIN, even if there is no items, it will show the header entry(VBAK) with blank columns for fields  from item table.(VBAP)
    here is one sample for inner join.
    SELECT   A~EBELN
               A~EKORG
               A~EKGRP
               A~BSART
               A~LPONR
               A~LOEKZ
               A~LIFNR
               A~RESWK
               B~AEDAT
               B~WERKS
               B~MATNR
               B~MENGE
               B~EBELP
               B~ELIKZ
               B~PLIFZ
               B~PSTYP
               B~KNTTP
               B~MATKL
               B~ZZD_PLANT
               FROM EKKO AS A INNER JOIN EKPO AS B
               ON
               AEBELN = BEBELN
               INTO CORRESPONDING FIELDS OF TABLE T_DATA
               FOR ALL ENTRIES IN T_EKET
               WHERE
               A~EBELN EQ T_EKET-EBELN AND
               A~BSART EQ C_UBSTO      AND
               A~EKORG IN S_EKORG      AND
               A~EKGRP IN S_EKGRP      AND
               A~BSTYP EQ C_BSTYP      AND
               A~LOEKZ EQ SPACE        AND " Order not deleted
               A~RESWK IN S_RESWK      AND
               B~EBELN EQ T_EKET-EBELN AND
               B~EBELP EQ T_EKET-EBELP AND
               B~WERKS IN S_WERKS      AND
               B~MATNR IN S_MATNR      AND
               B~MATKL IN S_MATKL      AND
               B~LOEKZ EQ SPACE.           " Line item not deleted

  • ABAP Query - SQ02 and SQ01 - custom selection criteria

    Hello
    I am on 46C. In my infoset I need to define three custom fields for selections. I am able to do that. Once I create my query these appear on the selection screen. So far so good.
    1. I need to use these custom selection fields as selection criteria for the tables in the join. How do I do that ?
    2. If I need to default some values for these selection criteria, I can do that in the definition. However I need the values to be greyed out to prevent the user from editing the values entered. How do I do that ?
    Thanks
    Hari

    1. I see that the standard variant assigned at the query level in SQ01. actually protects the selection field. There is no coding to make it only display. This answers part 2 of my question.
    2. I am positive that the additional SELECTION that was created is being used in the main join that retrieves data in the query (in addition to being used for other things). I am not sure why somebody would define it that way instead of just creating a regular selection field in SQ01. Could it be because there is custom coding present for additional fields and there is reference to the selection variables needed for the additional field ?
    How does one make this additional SELECTION also a criteria on the join ? I have attached the actual join Query generates - WRK, VKO and VTW are additional selection criteria.
    FYI - this is an existing query, that I need to enhance
    Thanks
    Hari
    SELECT MBEWBWKEY MBEWMATNR MBEWPEINH MBEWSTPRS MBEW~VERPR
           MBEWVPRSV MBEWZPLP1 MARAMATNR MARAMEINS MARA~MSTAE
           MARAMTART T001KBUKRS T001KBWKEY T001BUKRS T001~SPRAS
           T001WAERS MARCMATNR MARCMMSTA MARCPRCTR MARC~WERKS
           MVKEMATNR MVKEPRODH MVKEVKORG MVKEVMSTA MVKE~VTWEG
    INTO (MBEW-BWKEY , MBEW-MATNR , MBEW-PEINH , MBEW-STPRS , MBEW-VERPR
         , MBEW-VPRSV , MBEW-ZPLP1 , MARA-MATNR , MARA-MEINS , MARA-MSTAE
         , MARA-MTART , T001K-BUKRS , T001K-BWKEY , T001-BUKRS , T001-SPRAS
         , T001-WAERS , MARC-MATNR , MARC-MMSTA , MARC-PRCTR , MARC-WERKS
         , MVKE-MATNR , MVKE-PRODH , MVKE-VKORG , MVKE-VMSTA , MVKE-VTWEG )
    FROM ( MBEW
           INNER JOIN MARA
           ON MARAMATNR = MBEWMATNR
           INNER JOIN T001K
           ON T001KBWKEY = MBEWBWKEY
           INNER JOIN T001
           ON T001BUKRS = T001KBUKRS
           INNER JOIN MARC
           ON MARCMATNR = MBEWMATNR
           AND MARCWERKS = MBEWBWKEY
           INNER JOIN MVKE
           ON MVKEMATNR = MARAMATNR )
           WHERE MBEW~MATNR IN SP$00002
             AND MARA~MTART IN SP$00001
             AND MARC~WERKS IN WRK
             AND MVKE~VKORG IN VKO
             AND MVKE~VTWEG IN VTW
             AND MVKE~PRODH IN SP$00003.

  • Create a report from ABAP Query (SQ02)

    Hi, guys.
    I must create a SE38- report that simulate the selection of a query in sq02.
    How can I do for call the query in my own report? (I know all...user group, name, structure name)
    I can do other elaboration from data after the calling of the query data?
    Thanks a lot for who answer me.
    Have a nice day.
    Edited by: Alessio Cantarelli on Feb 22, 2012 10:00 AM

    Thanks to all, it's allright.
    I found the program using the other function in 'Query' menù and copy with all the includes in my own report.
    Than, it was easy.
    Have a nice day

Maybe you are looking for

  • Prob in using rank in pl/sql ,need logic same of rank function in any way

    I have a query as of the following <br> <br> SELECT sr_no,cod_acct_no,dat_arrears_due,amt_arrear_due<br> FROM ( select cod_acct_no,dat_arrears_due,sum(amt_arrears_due) <br>amt_arrear_due,rank() over (partition by cod_acct_no order by <br>dat_arrears_

  • Quicktime Only Works with Direct3d Disabled

    I mentioned this on the end of another post but I thought I'd give it its own topic in hopes that someone would have a solution for me. Quicktime will play files in the standalone player but when I try to play a mov in a browser (either Firefox or IE

  • Payment block in F-53 even if the amount is due for payment

    Hi Gurus While we are making payment through F-53 we are getting an error message "1 item(s) was/were not activated due to online payment blocku201D Message no. F5528. Issue: 1.     Amount is already due for payment. 2.     Payment block is needed if

  • Mail attachment .ics is transformed to .msg and lost content

    Hello, I've a little problem in sending a mail with attachment with SO_NEW_DOCUMENT_ATT_SEND_API1 The System is ECC6 I've made a little function to generate and send a mail with an ICS file attached (iCal, i send a meeting request) My problem is when

  • Stock transfer between one ware house to another warehouse

    hi all,        i moved the the stock within the warehouse(bin to bin).my client requirement is move the stock  from  one ware house to another warehouse  in same plant /storage location. so i need the configuration steps for that. appreciate your hel