LEFT OUTER with internal tables

hi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
  SUM( GLT0~HSLVT ) AS HSLVT
  INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
  FROM SKAT
  LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
  AND GLT0~RYEAR = I_GJAHR
  AND GLT0~BUKRS = 'comp1'
  WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Jose

hi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
  SUM( GLT0~HSLVT ) AS HSLVT
  INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
  FROM SKAT
  LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
  AND GLT0~RYEAR = I_GJAHR
  AND GLT0~BUKRS = 'comp1'
  WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Jose

Similar Messages

  • Left outer join 3 tables with where-statement

    Hi folks,
    I hope you can understand (and maybe solve) my problem.
    Generally I try to left outer join three tables. The third table is used for a WHERE-statement.
    The three table structures are the following:
    table 1 (user)   
    user1 | key
    table 2 (detail)  
    key | ID
    table 3 (header)
    ID | user2                 
    ...and I want to achieve the following structure (as example filled with data):
    user | key | ID
    |-----|----
    xy    | a    | 001
    xy    | b    | #
    z     | b     | #
    The clue ist the usage of the third table. I need the table to set user1 and user2 equal (WHERE) but there are two problems:
    1) Obviously I can't left outer join two tables with each other. In this case I already used the 'key' of table 1 to join it with the 'key' of table 2. So I can't left outer join the 'ID' of table 2 with the 'ID' of table 3. Error message that I can only left outer join a table once. Any proposals?
    2) I have to include a WHERE to equal user1 with user2. But I am not allowed to use the user2 from table 3 because of the left outer join.
    I tried this coding:
    SELECT auser1 akey b~id INTO TABLE itab FROM ( table1 AS a
      LEFT OUTER JOIN table2 AS b ON akey = bkey )
      LEFT OUTER JOIN table3 AS c ON bID = cID )
      WHERE auser1 = cuser2.
    I would really appreciate your help.
    Regards
    MrclSpdl

    IF you want to join a DB table with an internal table, you need to use the 'FOR ALL ENTRIES' statement.
    select dbfields
    into table itab2
    from dbtab
    for all entries in itab
    where dbfield1 = itab-field1.
    This will get you a second internal table with all the corresponding data for the first selection.  You can then join them with a loop through the first table and a read table on the second table (for 1 - 1 relation) or a nested loop statement on both tables (for 1 - N relation).  Make itab a hashed table when using read table with key, use a sorted table if you need to loop without key access.
    Regards,
    Freek

  • Selecting records from DB table with out using internal tables

    hi,
    i need to retrieve values from a database table based on few fields and date as well. however, i need to check whether the date is less or equal to the current date and along with that i should get the appropriate record. how can i do that with out using internal table.
    field1-----date---
    11111----
    20070219
    11111--20070214 <---
    11111----
    20070205
    in the above scenario i should get the second record
    Regards,
    Kranthi.

    Try:
    REPORT ztest MESSAGE-ID 00.
    TABLES bkpf.
    SELECT * FROM bkpf
      UP TO 1 ROWS
      WHERE budat <= sy-datum
      ORDER BY budat DESCENDING.
    ENDSELECT.
    Rob

  • I am getting problem with internal table & work area declaration.

    I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
    TYPES : BEGIN OF ty_makt,
             matnr TYPE makt-matnr,
             spras TYPE makt-spras,
             maktx TYPE makt-maktx,
             maktg TYPE makt-maktg,
             celltab TYPE lvc_t_styl,
           END OF ty_makt.
    DATA : i_makt TYPE TABLE OF ty_makt.
    DATA : wa_makt TYPE ty_makt .
        But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
    i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.

    Hi Nagasankar,
    TYPES : BEGIN OF TY_MATNR,
                  MATNR TYPE MAKT-MATNR,
                  SPRAS TYPE MAKT-SPRAS,
                  MAKTX TYPE MAKT-MAKTX,
                  MAKTX TYPE MAKT-MAKTG,
                  CELLTAB TYPE LVC_T_STYL,  " Its Working perfectly fine..
                 END OF TY_MAKT.
    DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
              WA_MAKT TYPE TY_MAKT.
    Its working perfectly fine. if still you are facing any issue post your complete code.
    Thanks,
    Sandeep

  • Left ouer join with internal table

    Good morning to everybody
    I need created a internal table with 2 internal table but 1 is primary.
    I tried use "left outer join" but it allows  only with table and not with internal tabel
    I would to be this result
    a             a xxx
    b                         
    c             c zzz
    d             d sss
    e
    f              f ttt
    How can i do it?
    Thanks a lot for your support
    Beste regatrds

    Hi,
    The following code is for your reference:
    data: begin of wa1,
          key type c,
          end of wa1.
    data: begin of wa2,
          key type c,
          var(3) type c,
          end of wa2.
    data: begin of wa3,
          key1 type c,
          key2 type c,
          var(3) type c,
          end of wa3.
    data: itab1 like standard table of wa1,
          itab2 like standard table of wa2,
          itab3 like standard table of wa3.
    wa1-key = 'a'.
    append wa1 to itab1.
    wa1-key = 'b'.
    append wa1 to itab1.
    wa1-key = 'c'.
    append wa1 to itab1.
    wa1-key = 'd'.
    append wa1 to itab1.
    wa1-key = 'e'.
    append wa1 to itab1.
    wa1-key = 'f'.
    append wa1 to itab1.
    clear wa1.
    wa2-key = 'a'.
    wa2-var = 'zzz'.
    append wa2 to itab2.
    wa2-key = 'c'.
    wa2-var = 'yyy'.
    append wa2 to itab2.
    wa2-key = 'd'.
    wa2-var = 'ttt'.
    append wa2 to itab2.
    wa2-key = 'f'.
    wa2-var = 'sss'.
    append wa2 to itab2.
    clear wa2.
    loop at itab1 into wa1.
      read table itab2 into wa2
      with key key = wa1-key
      binary search.
      if sy-subrc = 0.
        wa3-key1 = wa1-key.
        wa3-key2 = wa2-key.
        wa3-var = wa2-var.
        append wa3 to itab3.
        clear wa3.
      else.
        append wa1 to itab3.
      endif.
    endloop.
    loop at itab3 into wa3.
      write:/ wa3-key1, wa3-key2,wa3-var.
    endloop.
    Hope it helps.
    Regards,
    Chris Gu

  • Left Outer Joining multiple tables to one source table FAILS with VLD-1511

    Hi all,
    Is it me, or is OWB unable to handle left outer joining 1 source table to multiple other tables?
    I want to load a fact table so I have 1 source table with measures. This table must be outer joined to some dimensions that have their FK in the fact table.
    The SQL statement would look like this (and is perfectly valid):
    select ...
    from input, dim1, dim2
    where input.c1 = dim1.c1(+)
    and input.c2 = dim2.c2(+);
    I put the where clause in the joiner operator and validate, but that gives me message VLD-1511: A table may be outer joined to at most one other table.
    Even splitting this up into one outer join per joiner still gives this message.
    A search and look around on the forum and on metalink shows there are related issues (like bug 3334035). Seemingly creating a view is the work-around to use.....? (ie downgrading owb to a simple gui tool) }-;
    Have other people experienced this problem of not being able to outer join one input table to multiple other tables?
    Thanks,
    Ed

    I have had some feedback from Oracle. It turns out this has to do with 2 issues. Below I have pasted the text that Support gave me:
    <---------- START QUOTE ---------->
    RESEARCH
    =========
    Bug 3437036 KEY LOOKUP DOES NOT DETECT ORA-1417 IN VALIDATE/GENERATE STEP
    Unpublished Bug 4211684 FORWARD PORT OF BUG 3437036
    shows:
    Some more development has been completed when this bug is fixed in Paris.
    The following are the details:
    1. If the join condition contains a full outer join such as
    tab1.c (+) = tab2.c (+) and tab2.c (+) = tab3.c
    then the new validations implemented for this bug do not apply since
    in OWB, full outer join triggers generation of joins in ANSI syntax.
    ANSI syntax does not have the original problem the base bug of this
    bug reported.
    2. If the join condition does not contain any full outer join condition,
    then the join is generated in Oracle join syntax, which is subject two
    several restrictions. The fix to this bug check two of the restrictions.
    3. The first restriction in Oracle syntax is that the outer join operator
    "(+)" can only directly be attached to a column name. If you attach it
    to an expression, such as the following:
    (tab1.c + 1) (+) = tab2.c
    Then there will be an ORA-936 error at the time of mapping deployment.
    For this case, I have added a validation message VLD-1512 to error out
    this situation.
    4. The second restriction in Oracle syntax is that a table can only be
    outer joined to exactly one other table.
    For example, this is an invalid join in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d (+) = tab3.d
    because tab1 is left outer joined to tab2 and tab3.
    But note that the following is still valid in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d = tab3.d (+)
    because tab1 is left outer joined to tab2 and right outer joined to tab3.
    So this latter case does not violate the restriction that "same oj" to
    more than 1 table is not allowed.
    If same oj to more than 1 table is specified in a join condition,
    VLD-1511 will be issued, and the map is made invalid.
    <---------- END QUOTE ---------->
    OWB does a partial validation, ie not all access paths are (can be) checked. A full check is only done by the database itself. So some scenarios (like checking whether multiple tables are outer joined the correct way) are not checked, and in this case are flagged with an error (even though it is actually a correct scenario).
    Seemingly this was not flagged with an error in earlier versions of OWB, so beware, OWB behaviour may change when upgrading...
    Alternative solutions are (1) using key lookups, (2) using a view with all outer joins in there, (3) using intermediate result tables between the joins.
    Hope this info helps some people prevent spending too much time on a false error message,
    Ed

  • Performance with internal tables

    Hi everybody,
    I'm having trouble with the performance of a report.
    The reports selects data out of many different tables and merges them together in one extraction file. (I would really like it to be executable in dialog task, because I don't want to write the file on the application sever)
    I've done what I could using runtime analysis to improve performance of the db accesses. Now 97% of runtime is consumed by abap.
    I'm using several internal tables which will have many entries, and at the moment I'm using nested loops to gather the information out of the internal tables into one extraction file. (Reading the internal tables with key is not always possible, I do this whenever possible)
    I've tried to use loop... assigning <fs> instead of loop... into, but it doesn't really help too much.
    Any other suggestions?
    Thank you for your help, regards, Kathrin!

    Hi,
    Some of these might be able to help for improving the performance.
    1. Read table with key using binary search.
    2. While comparing two internal tables, user Kernal
       method. Eg: If I_TAB1[] = I_TAB2[]. Enfif.
    3. Instead of appending records within loop/endloop,
       use 'Append lines of'.
    4. When populate different internal tables, try to create
       with key field which will make a big difference while
       accessing the data.
    5. Sort the internal tables.
    6. Use Case/Endcase in place of If/Endif.
    7. While making values negative, use 0 - <field>, in
       place of <field> * -1.
    8. If the field structures are similar in two internal
       tables, for appending records use I_TAB2[] = I_TAB1[].
    9. After the complete usage of internal tables, release
       the resources using FREE/FREFRESH <internal table>.
    10. For data extraction, use field by field selection
        from database.
    11. Try to avoid using 'ALL ENTRIES'. If using and make
        sure that the ref.internal table have entries.
    12. Try using Inner Join using Foriegn key fields.
    13. To get sum or count use Aggregate functions.
    14. Try to use Views if need appropriately.
    Hope this helps.
    Gopakumar

  • Issue with internal table in object oriented ABAP.

    Hello Gurus,
    I am having trouble defining internal table in Object oriented ABAP. for following:
    DATA: BEGIN OF IT_TAB OCCURS 0.
            INCLUDE STRUCTURE ZCUSTOM.
    DATA    tot_sum   TYPE char40.
    DATA END OF IT_TAB.
    Can someone help ?
    Regards,
    Jainam.
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Moderator message - Please post in the correct forum. You can easily find out for yourself by looking at SAP help for internal tables using OOP - thread locked
    Edited by: Rob Burbank on Feb 5, 2010 2:49 PM

    No, you can not declare internal table with header line in OO context. You have to declare the work are/header line separately
    Example:
    TYPES: BEGIN OF ty_it_tab.
            INCLUDE STRUCTURE mara.
    TYPES:  tot_sum TYPE char40.
    TYPES: END OF ty_it_tab.
    DATA: it_tab TYPE STANDARD TABLE  OF ty_it_tab.
    DATA: wk_tab TYPE ty_it_tab.
    LOOP AT it_tab INTO wk_tab.
    ENDLOOP.
    Edited by: Dean Q on Feb 5, 2010 8:50 PM

  • Issue with Internal Table

    Hi All,
    I have defined an internal table 'with occurs 0'.
    While debuggining, i am observing that only 50,000 lines are getting populated in that internal table.
    How to increase the capacity of the internal table, so that it can hold more number of lines?
    Regards
    Pavan

    I would like to explaing you all about this issue.
    I have defined an internal table as follows...
    data:  IT_CATSDB       TYPE BAPICATS2 OCCURS 0 WITH HEADER LINE.
    I have used a BAPI called "BAPI_CATIMESHEETRECORD_GETLIST" which will retirieve the Timesheet details of all employees within a given date range.
    Now, the number of entries that we got from this BAPI are stored in the internal table it_catsdb.
    I have observed that this internal table is holding max of 50k lines.
    If i check the database table (CATSDB) for the same conditions in SE11, i am able to get around 1L lines.
    Hence my report is showing incorrect output.
    Kindly help me out with some logic, so that this internal table can hold as much as data possible without any restriction.....
    Regards
    Pavan

  • TSV_TNEW_PAGE_ALLOC_FAILED  with internal table declared with occurs 0

    HI guys,
    when the internal table is declared as occurs 0, the dump TSV_TNEW_PAGE_ALLOC_FAILED is encountered, when changing the declaration into standard table, th dump disappears. Why is this so?
    Thanks!

    There are three type of tables: Standard, sorted and hashed tables (see [here|http://help.sap.com/abapdocu_70/en/ABAPDATA_ITAB.htm]). When you define a table using the keyword OCCURS you're still defining a standard table.
    Your exception indicates that you're running out of memory. The difference in the declarations that you mention shouldn't cause that. Main difference between the two declaration versions is probably that your table defined via OCCURS has a header line, whereas your other table doesn't (unless you declared it explicitly as WITH HEADER LINE).
    I don't think though that with that little information anybody could explain the short dump. Actually it sounds rather odd that the change you mention should cause the dump (or make it go away). So I suspect you probably have to post further details. You might want to check the shortdump yourself and place a breakpoint at this place and run it for each version. Maybe you can see some difference...

  • LEFT OUTER JOIN multiple tables - using the 9i syntax

    I've always written my queries using the (+) operator for outer joins. I want to start using the new ANSI standard available in 9i. I can do it when I'm joining two tables in a simple query, but how does it work when I am joining multiple tables?
    Here is an example of some SQL that works with the (+) outer join syntax. How can I convert this to use the LEFT OUTER JOIN syntax?
    SELECT *
    FROM audit_entry aue,
    audit_table aut,
    audit_statement aus,
    audit_row aur,
    audit_row_pkey aup1,
    audit_row_pkey aup2
    WHERE aue.audit_entry_id = aus.audit_entry_id
    AND aut.table_name = 'TEST_AUDITING'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aus.audit_table_id = aut.audit_table_id
    AND aur.audit_statement_id (+) = aus.audit_statement_id
    AND aup1.audit_row_id (+) = aur.audit_row_id
    AND aup1.pk_column_name (+) = 'TEST_AUDTING_PK_1'
    AND aup2.audit_row_id (+) = aur.audit_row_id
    AND aup2.pk_column_name (+) = 'TEST_AUDITING_PK_2'
    I can join audit_statement to audit_entry easy enough, but then I want to join audit_table to audit_statement, how do I do that, do I start nesting the join statements?
    Thanks
    Richard

    Thanks for getting back so quickly, I have tried the suggested SQL with mixed results:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    I had to change the order slightly, between the first two JOINs but otherwise it executed OK. My problem is, it should only return 175 rows but its returning 30625 rows. If I comment out the second reference to audit_row_pkey I get the expected result:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    --RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    --AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    It looks the same condition is being used in each case but why do I suddenly get so many rows - its joining differently somehow. It must be to do with the order, do I need to bracket the query?
    Thanks again
    Richard

  • SAP script linking with internal table

    Hi all,
    This is my program to print invoices
    REPORT  z_g_test.
    TABLES: sbook.
    DATA sflights_wa TYPE sflights.
    DATA: itcpo LIKE itcpo.
    DATA itcpp LIKE itcpp.
    DATA sflights_itab TYPE TABLE OF sflights WITH HEADER LINE.
    DATA sbook_itab TYPE TABLE OF sbook WITH HEADER LINE.
    *SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS: s_carrid FOR sflights-carrid,
    *                s_fldate FOR sflights-fldate.
    *SELECTION-SCREEN END OF BLOCK 1.
    SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN COMMENT 1(79) text-004.
    SELECT-OPTIONS: s_custid FOR sbook-customid,
                    s_bookid FOR sbook-bookid.
    SELECTION-SCREEN END OF BLOCK 2.
    INITIALIZATION.
      s_custid-low = 00001721.
      APPEND s_custid.
    START-OF-SELECTION.
      SELECT * FROM sbook INTO sbook_itab WHERE customid IN s_custid.
    *    APPEND sbook TO sbook_itab.
        APPEND sbook_itab.
      ENDSELECT.
      CALL FUNCTION 'OPEN_FORM'
       EXPORTING
    *   APPLICATION                       = 'TX'
    *   ARCHIVE_INDEX                     =
    *   ARCHIVE_PARAMS                    =
         device                            = 'PRINTER'
         dialog                            = 'X'
         form                              = 'ZG_SCRIPT'
         language                          = sy-langu
         OPTIONS                           = itcpo
    *   MAIL_SENDER                       =
    *   MAIL_RECIPIENT                    =
    *   MAIL_APPL_OBJECT                  =
    *   RAW_DATA_INTERFACE                = '*'
    *   SPONUMIV                          =
    * IMPORTING
    *   LANGUAGE                          =
    *   NEW_ARCHIVE_PARAMS                =
    *   RESULT                            =
       EXCEPTIONS
         canceled                          = 1
         device                            = 2
         form                              = 3
         OPTIONS                           = 4
         unclosed                          = 5
         mail_options                      = 6
         archive_error                     = 7
         invalid_fax_number                = 8
         more_params_needed_in_batch       = 9
         spool_error              e         = 10
         codepage                          = 11
         OTHERS                            = 12
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'WRITE_FORM'
       EXPORTING
         element                        = 'MY_ELEMENT'
         function                       = 'SET'
         type                           = 'BODY'
         window                         = 'MAIN'
    * IMPORTING
    *   PENDING_LINES                  =
       EXCEPTIONS
         element                        = 1
         function                       = 2
         type                           = 3
         unopened                       = 4
         unstarted                      = 5
         window                         = 6
         bad_pageformat_for_print       = 7
         spool_error                    = 8
         codepage                       = 9
         OTHERS                         = 10
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
         RESULT                         = itcpp
    *   RDI_RESULT                     =
    * TABLES
    *   OTFDATA                        =
       EXCEPTIONS
         unopened                       = 1
         bad_pageformat_for_print       = 2
         send_error                     = 3
         spool_error                    = 4
         codepage                       = 5
         OTHERS                         = 6
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    My question is! i am not passing the internal table any where. Now i am trying to print the values which is already existed in internal table,so iam not getting the out put. Now what shall i do in order to get output.
    Regards,
    Lisa

    Hi all,
    the modified code is like this.
    REPORT  z_g_test.
    TABLES: sbook.
    DATA sflights_wa TYPE sflights.
    DATA: itcpo LIKE itcpo.
    DATA itcpp LIKE itcpp.
    DATA sflights_itab TYPE TABLE OF sflights WITH HEADER LINE.
    DATA sbook_itab TYPE TABLE OF sbook WITH HEADER LINE.
    *SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS: s_carrid FOR sflights-carrid,
    *                s_fldate FOR sflights-fldate.
    *SELECTION-SCREEN END OF BLOCK 1.
    SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN COMMENT 1(79) text-004.
    SELECT-OPTIONS: s_custid FOR sbook-customid,
                    s_bookid FOR sbook-bookid.
    SELECTION-SCREEN END OF BLOCK 2.
    INITIALIZATION.
      s_custid-low = 00001721.
      APPEND s_custid.
    START-OF-SELECTION.
      SELECT * FROM sbook INTO sbook_itab WHERE customid IN s_custid.
    *    APPEND sbook TO sbook_itab.
        APPEND sbook_itab.
      ENDSELECT.
      CALL FUNCTION 'OPEN_FORM'
       EXPORTING
    *   APPLICATION                       = 'TX'
    *   ARCHIVE_INDEX                     =
    *   ARCHIVE_PARAMS                    =
         device                            = 'PRINTER'
         dialog                            = 'X'
         form                              = 'ZG_SCRIPT'
         language                          = sy-langu
         OPTIONS                           = itcpo
    *   MAIL_SENDER                       =
    *   MAIL_RECIPIENT                    =
    *   MAIL_APPL_OBJECT                  =
    *   RAW_DATA_INTERFACE                = '*'
    *   SPONUMIV                          =
    * IMPORTING
    *   LANGUAGE                          =
    *   NEW_ARCHIVE_PARAMS                =
    *   RESULT                            =
       EXCEPTIONS
         canceled                          = 1
         device                            = 2
         form                              = 3
         OPTIONS                           = 4
         unclosed                          = 5
         mail_options                      = 6
         archive_error                     = 7
         invalid_fax_number                = 8
         more_params_needed_in_batch       = 9
         spool_error              e         = 10
         codepage                          = 11
         OTHERS                            = 12
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT sbook_itab.
        CALL FUNCTION 'WRITE_FORM'
         EXPORTING
           element                        = 'MY_ELEMENT'
           function                       = 'SET'
           type                           = 'BODY'
           window                         = 'MAIN'
    * IMPORTING
    *   PENDING_LINES                  =
         EXCEPTIONS
           element                        = 1
           function                       = 2
           type                           = 3
           unopened                       = 4
           unstarted                      = 5
           window                         = 6
           bad_pageformat_for_print       = 7
           spool_error                    = 8
           codepage                       = 9
           OTHERS                         = 10
      ENDLOOP.
      CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
         RESULT                         = itcpp
    *   RDI_RESULT                     =
    * TABLES
    *   OTFDATA                        =
       EXCEPTIONS
         unopened                       = 1
         bad_pageformat_for_print       = 2
         send_error                     = 3
         spool_error                    = 4
         codepage                       = 5
         OTHERS                         = 6
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    even though i am not getting the output.
    The question is with out passing the internal table how we will get the output from it?.

  • Date operations with internal table

    Dear friends
               would you like to tell me. how i determine the most recent date and time from internal table i am not supposed to sort the table by date and time... I must check date and time with other records date and time to determine which record is most recently changed...
    here the scenario is.
    id       idnumber  chdate      chtime
    1        123456    20060606    135312
    2        123456    20060606    135900
    3        123456    20060606    132300
    4        123457    20060606    140000
    5        123457    20060606    142500
    in the above scenario i must keep in my mind that the most recently changed record is identical to its idnumber i can say that:
    the record should be fetched this way
    id       idnumber  chdate      chtime
    3        123456    20060606    132300
    5        123457    20060606    142500
    because here the id 3 is the most recently changed in the idnumber 123456
    where id 5 is the most recently changed in the idnumber 123457
    please help me to determin how i am supposed to carry out this task  any suggestion, code will be great help of mine.
    regards
    Naim

    Hi Naim,
      For example if ur select statement is like this..
       select id idnumber chdate chtime from xtable into table itab  where ...<condn>..
        sort itab by  idnumber chdate chtime  descending.
         delete adjacent duplicates from itab comparing idnumber .
         Code like above statement..
       You can get result...
    id idnumber chdate chtime
    3 123456 20060606 132300
    5 123457 20060606 142500
      Reward the points if it helps.

  • ABAP transformation to XML for sap chart engine with internal table

    Hello.
    I am new to the SAP chart engine, XML and transformations so please be patient with me from an ABAP-program I am trying to call a Z-transformation and attach an internal table with two columns. In the ST program I want to loop through the table and for each row insert the two values from the table in the XML.
    In an ABAP-program I have an internal table containing datacoordinates for a scattered chart.
    The table looks like this:
    DATA: BEGIN OF coordinate,
                x_value TYPE f,
                y_value TYPE f,
               END OF coordinate,
               polygon_data LIKE STANDARD TABLE OF coordinate with header line.
    As a prototype I just add a few coordinates like this:
    polygon_data-x_value = '700'.
        polygon_data-y_value = '8'.
        APPEND polygon_data.
        polygon_data-x_value = '1400'.
        polygon_data-y_value = '3'.
        APPEND polygon_data.
        polygon_data-x_value = '1400'.
        polygon_data-y_value = '10'.
        APPEND polygon_data.
        polygon_data-x_value = '700'.
        polygon_data-y_value = '10'.
        APPEND polygon_data.
        polygon_data-x_value = '700'.
        polygon_data-y_value = '3'.
        APPEND polygon_data.
    I have created a Z-transformation and I call it like this (I also have a separate transformation for all the customizing generated with SAP chart designer but that one works fine):
    DATA: data_xml TYPE xstring.
    CALL TRANSFORMATION ztest_ce_tables2xml
          SOURCE polygon_data = polygon_data
          RESULT XML data_xml.
    Since I am trying to create a scattered chart I need to insert an X and Y value for each coordinate.In the manual SAP Chart engine - XML format description it looks like this:
    <ChartData>
    <Series>
    <Point>
    <Value type="x">1</Value>
    <Value type="y">1</Value>
    </Point>
    <Point>
    <Value type="x">2</Value>
    <Value type="y">2</Value>
    </Point>
    My ST-program that I cannot get to work looks like below. How can I loop through my internal table and get the X and thy Y value for each row in my internal table?
    BR Tommy (Sweden)
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="POLYGON_DATA"/>
    <tt:template>
    <ChartData>
    <Series>
    <tt:loop ref=".POLYGON_DATA">
       <Point>
         <Value type="x"><tt:copy ref=".POLYGON_DATA.X_VALUE"/></Value>
         <Value type="y"><tt:copy ref=".POLYGON_DATA.Y_VALUE"/></Value>
       </Point>
       </tt:loop>
    </Series>
    </ChartData>
    </tt:template>
    </tt:transform>

    Hello again.
    I found the solution and would like to share it with the forum, maybe it could help someone.
    My first error was in the call transformation statement:
    CALL TRANSFORMATION ztest_ce_tables2xml
          SOURCE polygon_data = polygon_data [] <----
    Do not forget these
          RESULT XML data_xml.
    I also had an error in the ST program, it should look like this:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="POLYGON_DATA"/>
    <tt:template>
    <ChartData>
    <Series>
    <tt:loop ref=".POLYGON_DATA">
       <Point>
         <Value type="x"><tt:value ref="$ref.X_VALUE"/></Value>
         <Value type="y"><tt:value ref="$ref.Y_VALUE"/></Value>
       </Point>
       </tt:loop>
    </Series>
    </ChartData>
    </tt:template>
    </tt:transform>

  • Problem with Internal table

    HI,
    I need to DMBE2 value as with respective of Month, Year and Inception date.
    I need the output to be like
    HKONT  BLART PRCTR DMBE2(Month) DMBE2 (Year) DMBE3 (Year)
    Below is my code
    DATA : BEGIN OF gt_lkorr OCCURS 0,
              hkont LIKE bsis-hkont,
              prctr LIKE bsis-prctr,
              bewar LIKE bsis-bewar,
              dmbe2 LIKE bsis-dmbe2,
              belnr LIKE bsis-belnr,
              budat LIKE bsis-budat,
              monat LIKE bsis-monat,
              gjahr LIKE bsis-gjahr,
              blart LIKE bsis-blart,
              shkzg like bsis-shkzg,
           END OF gt_lkorr.
    *DATA : wa_lkorr LIKE gt_lkorr OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF wa_lkorr OCCURS 0,
              hkont LIKE bsis-hkont,
              prctr LIKE bsis-prctr,
              bewar LIKE bsis-bewar,
              dmbe2 LIKE bsis-dmbe2,
              belnr LIKE bsis-belnr,
              budat LIKE bsis-budat,
              monat LIKE bsis-monat,
              gjahr LIKE bsis-gjahr,
              blart LIKE bsis-blart,
             dmbe2_2 LIKE bsis-dmbe2,
             dmbe2_3 LIKE bsis-dmbe2,
           END OF wa_lkorr.
    DATA : gt_final_lkorr LIKE wa_lkorr OCCURS 0 WITH HEADER LINE.
    FORM f_get_t030hb_tr.
      SELECT hkont lkorr FROM t030hb INTO CORRESPONDING FIELDS OF
                          TABLE gt_tr_t030hb
                          WHERE ktopl = 'KCOA'
                          AND   bwber = 'TR'
                          AND hkont IN so_hkont.
      IF gp_pprct IS INITIAL.
        SELECT hkont prctr bewar dmbe2 belnr budat monat gjahr blart
                           FROM bsis INTO CORRESPONDING
                           FIELDS OF TABLE gt_lkorr FOR ALL ENTRIES
                           IN gt_tr_t030hb
                           WHERE bukrs IN so_bukrs
                           AND gjahr IN so_gjahr
                           AND prctr IN so_prctr
                           AND hkont = gt_tr_t030hb-lkorr
                           AND vbund IN so_vbund.
      ELSE.
        LOOP AT gt_prctr.
          SELECT hkont prctr bewar dmbe2 belnr budat monat gjahr blart
                             FROM bsis INTO CORRESPONDING
                             FIELDS OF TABLE gt_lkorr FOR ALL ENTRIES
                             IN gt_tr_t030hb
                             WHERE bukrs IN so_bukrs
                             AND gjahr   IN so_gjahr
                             AND prctr = gt_prctr-prctr
                             AND hkont = gt_tr_t030hb-lkorr
                             AND vbund IN so_vbund.
        ENDLOOP.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM gt_lkorr COMPARING ALL FIELDS.
    ENDFORM.                    "f_get_t030hb_tr
    *&      Form  f_get_yearwise_data
          text
    FORM f_get_yearwise_data.
      DATA : lv_period LIKE t009b-poper.
      DATA : lv_year LIKE bsis-gjahr,
             lv_dmbe2 LIKE bsis-dmbe2.
      LOOP AT gt_lkorr.
        CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
          EXPORTING
            i_date               = sy-datum
             I_MONMIT             = 00
            i_periv              = 'K4'
         IMPORTING
           e_buper              = lv_period
             E_GJAHR              =
        EXCEPTIONS
          input_false          = 1
          t009_notfound        = 2
          t009b_notfound       = 3
          OTHERS               = 4
        IF gt_lkorr-monat EQ lv_period.
            wa_lkorr-hkont = gt_lkorr-hkont.
            wa_lkorr-prctr = gt_lkorr-prctr.
            wa_lkorr-bewar = gt_lkorr-bewar.
            wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
            wa_lkorr-blart = gt_lkorr-blart.
            if gt_lkorr-shkzg = 'H'.
              wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
            endif.
          COLLECT wa_lkorr.
        endif.
    ENDLOOP.
          LOOP AT wa_lkorr INTO gt_final_lkorr.
            write  : / gt_final_lkorr-hkont,
                     gt_final_lkorr-prctr,
                     gt_final_lkorr-bewar,
                     gt_final_lkorr-dmbe2,
                     gt_final_lkorr-blart.
          ENDLOOP.
    write : ' Inception to date'.
      LOOP AT gt_lkorr.
        CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
          EXPORTING
            i_date               = sy-datum
             I_MONMIT             = 00
            i_periv              = 'K4'
         IMPORTING
          e_buper              = lv_period
              e_gjahr              = lv_year
        EXCEPTIONS
          input_false          = 1
          t009_notfound        = 2
          t009b_notfound       = 3
          OTHERS               = 4
        IF gt_lkorr-gjahr EQ lv_year.
            wa_lkorr-hkont = gt_lkorr-hkont.
            wa_lkorr-prctr = gt_lkorr-prctr.
            wa_lkorr-bewar = gt_lkorr-bewar.
            wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
            wa_lkorr-blart = gt_lkorr-blart.
            if gt_lkorr-shkzg = 'H'.
              wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
            endif.
          COLLECT wa_lkorr.
        endif.
    ENDLOOP.
          LOOP AT wa_lkorr into gt_final_lkorr.
            WRITE : / gt_final_lkorr-hkont,
                      gt_final_lkorr-prctr,
                      gt_final_lkorr-bewar,
                      gt_final_lkorr-dmbe2,
                      gt_final_lkorr-blart.
             move : wa_lkorr-dmbe2_2 to gt_final_lkorr-dmbe2_2.
             modify gt_final_lkorr.
             clear gt_final_lkorr.
          ENDLOOP.
    loop at gt_lkorr.
            wa_lkorr-hkont = gt_lkorr-hkont.
            wa_lkorr-prctr = gt_lkorr-prctr.
            wa_lkorr-bewar = gt_lkorr-bewar.
            wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
            wa_lkorr-blart = gt_lkorr-blart.
            if gt_lkorr-shkzg = 'H'.
              wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
            endif.
          COLLECT wa_lkorr.
    ENDLOOP.
          LOOP AT wa_lkorr into gt_final_lkorr.
            WRITE : / gt_final_lkorr-hkont,
                      gt_final_lkorr-prctr,
                      gt_final_lkorr-bewar,
                      gt_final_lkorr-dmbe2,
                      gt_final_lkorr-blart.
          ENDLOOP.
    Please let me know how to do it?
    Thanks,
    Pavan.

    I think you need to insert a field in your wa_lkorr internal table for key which you should populate as M for month data, Y2 for Year data and Y3 for dmbe3 data.
    So when you want to display they are three different records.

Maybe you are looking for

  • Ichat can't see buddy

    i'm confused, i used to use ichat to video chat with friends regularly and for some reason recently cannot see the person i am chatting with when i attempt a video chat.  the other user can see/hear me, but i can't see/hear them.  help!

  • [T500] DVD recording + warranty

    Hello. I have following problem - if I try to burn a DVD-DL with built-in DVD recorder after about 3-4 GiB it returns an unknown errors. Do I have to return whole notebook or is it possible to have only FRU part on warranty (DVD recording is not esse

  • Getting a date as a unix timestamp

    Hello everyone, is the long that is returned by the getTime() method in the date class supposed to be the same as a unix timestamp? Below I have a time from yesterday, but when i compare this with System.currentTimeMillis(), the currentTime has a sma

  • Why do temporary internet files show up as a tab?

    Why are temporary internet files showing up as a tab in FF ver 8? I have the private browsing option on.

  • Pointbase ClassNotfound Error (URGENT)

    Hi all, I have encountered error when connect my jdbc, the error as below: (even i have set the path and sucessfully run in startconcole) ERROR MESSAGE ---Preloaded drivers--- No drivers listed as jdbc.drivers property. No drivers listed as being loa