Moving multiple fields in a single iternal table

TABLES: mseg,mkpf,kna1.
TYPES: BEGIN OF ty_mseg,
         mblnr TYPE mseg-mblnr,
         werks TYPE mseg-werks,
         bwart TYPE mseg-bwart,
         mjahr TYPE mseg-mjahr,
         zeile TYPE mseg-zeile,
         matnr TYPE mseg-matnr,
         lgort TYPE mseg-lgort,
         charg TYPE mseg-charg,
         lifnr TYPE mseg-lifnr,
         kunnr TYPE mseg-kunnr,
         dmbtr TYPE mseg-dmbtr,
         menge TYPE mseg-menge,
         meins TYPE mseg-meins,
        END OF ty_mseg,
          BEGIN OF ty_kna1,
          name1 TYPE kna1-name1,
            kunnr TYPE kna1-kunnr,
          END OF ty_kna1,
         BEGIN OF ty_mkpf,
           mblnr TYPE mkpf-mblnr,
            budat  TYPE mkpf-budat,
            xblnr TYPE mkpf-xblnr,
           END OF ty_mkpf,
BEGIN OF ty_mseg2,
         mblnr TYPE mseg-mblnr,
         werks TYPE mseg-werks,
         bwart TYPE mseg-bwart,
         mjahr TYPE mseg-mjahr,
         zeile TYPE mseg-zeile,
         matnr TYPE mseg-matnr,
         lgort TYPE mseg-lgort,
         charg TYPE mseg-charg,
         lifnr TYPE mseg-lifnr,
         kunnr TYPE mseg-kunnr,
         dmbtr TYPE mseg-dmbtr,
         menge TYPE mseg-menge,
         meins TYPE mseg-meins,
         budat  TYPE mkpf-budat,
         xblnr TYPE mkpf-xblnr,
         name1 TYPE kna1-name1,
        END OF ty_mseg2.
     DATA:  it_mseg TYPE TABLE OF ty_mseg,
            wa_mseg TYPE ty_mseg,
            it_kna1 TYPE TABLE OF ty_kna1,
            wa_kna1 TYPE ty_kna1,
            it_mkpf TYPE TABLE OF ty_mkpf,
            wa_mkpf TYPE ty_mkpf ,
            it_mseg2 TYPE TABLE OF ty_mseg2,
            wa_mseg2 TYPE ty_mseg2.
SELECT-OPTIONS S_MBLNR FOR mseg-mblnr.
SELECT-OPTIONS s_NAME1 FOR kna1-name1.
    SELECT budat xblnr mblnr
      from mkpf
       INTO CORRESPONDING FIELDS OF TABLE it_mkpf
         where mblnr in S_MBLNR.
IF sy-subrc = 0.
     SELECT mblnr zeile bwart matnr lgort charg lifnr kunnr werks dmbtr menge meins  mjahr
           from mseg
            INTO CORRESPONDING FIELDS OF TABLE it_mseg
                   for ALL ENTRIES IN it_mkpf
                      WHERE mblnr = it_mkpf-mblnr.
  select  kunnr name1
    from kna1
    INTO CORRESPONDING FIELDS OF TABLE it_kna1
    FOR ALL ENTRIES IN it_mseg
    where kunnr = it_mseg-kunnr .
ENDIF.
sort it_mseg2 by  mblnr zeile bwart matnr lgort charg lifnr kunnr werks dmbtr menge meins  mjahr  budat xblnr  name1.
  LOOP AT it_mseg INTO wa_mseg.
  read TABLE it_kna1 into wa_mseg2 with key kunnr = wa_mseg-kunnr.
            if sy-subrc = 0.
               move wa_kna1-name1 to wa_mseg2-name1.
  read TABLE it_mkpf INTO wa_mseg2 with KEY mblnr = wa_mseg-mblnr.
            if sy-subrc = 0.
            move wa_mkpf-budat to wa_mseg2-budat .
            move wa_mkpf-xblnr  to wa_mseg2-xblnr.
            endif.
           ENDIF.
           move wa_mseg-werks to wa_mseg2-werks.
           move wa_mseg-bwart  to wa_mseg2-bwart.
           move wa_mseg-mblnr to wa_mseg2-mblnr.
           move wa_mseg-mjahr to wa_mseg2-mjahr.
           move wa_mseg-zeile to wa_mseg2-zeile.
           move wa_mseg-matnr to wa_mseg2-matnr.
           move wa_mseg-lgort to wa_mseg2-lgort.
           move wa_mseg-charg  to wa_mseg-charg.
           move wa_mseg-lifnr  to wa_mseg2-lifnr.
           move wa_mseg-kunnr to wa_mseg2-kunnr.
           move wa_mseg-dmbtr to wa_mseg2-dmbtr.
           move wa_mseg-menge to wa_mseg2-menge.
           move wa_mseg-meins to wa_mseg2-meins.
           APPEND wa_mseg2 to it_mseg2.
   Endloop.
           loop at it_mseg2 into wa_mseg2.
           write: /  wa_mseg2-werks,
                     wa_mseg2-kunnr,
                     wa_mseg2-name1,
                     wa_mseg2-bwart,
                     wa_mseg2-mblnr,
                     wa_mseg2-mjahr,
                     wa_mseg2-zeile,
                     wa_mseg2-matnr,
                     wa_mseg2-lgort,
                     wa_mseg2-charg,
                     wa_mseg2-lifnr,
                     wa_mseg2-dmbtr,
                     wa_mseg2-menge,
                     wa_mseg2-meins,
                     wa_mseg2-budat,
                     wa_mseg2-xblnr.
uline.
         ENDLOOP.
all goes well but the name1 filed in mseg2 remains blank plz help...!

Hi
You should check it with debug by yourself, anyweay a problem could be in FYSCAL YEAR: you don't use it,
MM document can be the same number in different yearts, so it's better to use fyscal yaer too:
SELECT budat xblnr mblnr MJAHR
   FROM mkpf
    INTO CORRESPONDING FIELDS OF TABLE it_mkpf
      WHERE mblnr IN s_mblnr.
IF sy-subrc = 0.
   SELECT mblnr zeile bwart matnr lgort charg lifnr kunnr werks dmbtr menge meins  mjahr
         FROM mseg
          INTO CORRESPONDING FIELDS OF TABLE it_mseg
                 FOR ALL ENTRIES IN it_mkpf
                    WHERE mblnr = it_mkpf-mblnr
                        AND MJAHR = OT_MKPF-MJAHR.
read TABLE it_mkpf INTO WA_MKPF with KEY mblnr = wa_mseg-mblnr.
read TABLE it_mkpf INTO WA_MKPF with KEY mblnr = wa_mseg-mblnr.
                                                                    MJAHR = WE_MSEG-MJAHR,
            if sy-subrc = 0.
            move wa_mkpf-budat to wa_mseg2-budat .
            move wa_mkpf-xblnr  to wa_mseg2-xblnr.
            endif.
           ENDIF.
Max

Similar Messages

  • In XI Mapping multiple fields mapping to single target field.

    Hi Friends,
    In XI Mapping multiple fields mapping to single target field.
    For example my requirement is :
    Source Fields:(This RFC BAPI Structure)
    Empno                0-1
    EmpName           0-1
    Address             0-1
    Taget Field is:
    Details               0-1
    The above three fields passed to the Details Field. Here i am using Concat function
    But i have one query on that on,Every field having "line Break" required.
    Can you please help me out above this requirement.
    Thanks in Advance,
    Sateesh N.

    If you want a line break between the three fields, then try
    passing a,b,c to the udf and in the udf you would have
    return a+"\n"+b+"\n"+c;

  • Send Multiple field values to Single Target field in Message Mapping

    Hi,
    My  Requirement is to Map Multiple fields to Single field in Target side.I have to send all the values concatenated and pass the same to target Field in Message Mapping.
    We can use Concat function,but more that 15 fields are there.If using concat,the mapping will be complex.
    Is there any way to simplify this requirement or we can use any UDF for this,kindly suggest.
    Regards,
    Madhu

    >>>We can use Concat function,but more that 15 fields are there.If using concat,the mapping will be complex.
    I don't think it's complex but  just that it occupies more mapping area
    Just write a simple UDF - a one line code and pass all your input variables.
    return var1+var2+var3+var4+...+var15;

  • How to display results set of multiple reports into a single report table

    Our goal is to create a single report (or dashboard) that shows the "funnel" of object creations related to each campaign. The flow goes from Activity to Lead to Opportunity as well as multiple steps within each (ie. Unqualified Lead -> Qualified Lead, etc).
    We currently have 3 separate reports in three different subject areas, each reporting the different metrics and we would like to combine the output into a single Unified report.
    For example what we currently have is:
    Activities:
    Campaign Name # of Activities
    Campaign A 12
    Campaign B 26
    Leads:
    Campaign Name # of Leads # of Qualified Leads
    Campaign A 10 4
    Campaign B 20 18
    Opportunities:
    Campaign Name # of Opportunities # of Opps per Sales Stage ... # of Wins Closed Revenue
    Campaign A 3 2 1 $1,000.00
    Campaign B 10 8 3 $2,800.00
    What we want to see is:
    Combined:
    Campaign Name - Campaign Cost - # of Activities - # of Leads - # of Qualified Leads - # of Opportunities - # of Opps per Sales Stage - # of Wins - Closed Revenue
    Campaign A - $423.00 - 12 - 10 - 4 - 3 - 2 - 1 - $1,000.00
    Campaign B - $ 1,000.00 - 26 - 20 - 18 - 10 - 8 - 3 - $2,800.00
    We have tried using the "Combine with similar analysis" but the number of columns for each subject area differ. We also tried creating multiple UNION criteria (one for each column), but in the case of # of Opps per Sales Stage and Closed Revenue, those are not "Metrics" fields, so they won't combine.

    Hi, You may have to create some dummy fields to equate the no. of field in each of the report matching the data type too and get a one single report using combined analytics and then using the resultant data you can create a simple pivot like below. Haven't tried it before
    -- Venky CRMIT
    Hi Venky,
    I am facing the same problem. Can you please say Steps how to create resultant data and Combine in pivot Table .
    Please Help me .
    Thanks in Advance .
    My mail id is :
    [email protected]

  • Regarding reading multiple records into a single internal table..

    hi experts,
    Need your help, i have a requirement like this.
    i will have a input file like this
    D 123   Suresh    12/01/2008
    E ven   sha         5432
    E ven   sha       5432
    D 153   Sachin    11/01/2008
    E ven   sha      5432
    Now all i need to consider from D to E  (i.e., before next D) as a single record and i need to preare a separate excel,
    So that E records can be max 9. So we cant expect this will be always 2 or 3 or 4.
    So how can i do this upload and process..
    give some idea.
    Thanks,
    Suresh

    Hi,
    Once you transfer the values from input file to internal table.
    loop through all records of internal table .
    check the first letter using offset
    e.g  if Itab-field+0(1)  = 'D'
           elseif  Itab-field+0(1)  = 'E'.
           endif.
         Populate the work area of internal table until you find the next 'D' once you find 'D' again ...append the work area to internal table......clear work area.
    Regards,
    Rahul

  • How to add aggregation on multiple objects in a single webi table?

    Hi experts,
    I recently face an requirement that show a report table in a specific format.
    Let me show you in a simple example, let's say we have three dimensions and one measure. Product, Region, Quarter and Sales. When put these objects in an vertical table, it display data in this way.
    Product
    Region
    Quarter
    Sales
    TV
    North
    Q1
    37
    TV
    North
    Q2
    6
    TV
    North
    Q3
    4
    TV
    North
    Q4
    89
    TV
    East
    Q1
    81
    TV
    East
    Q2
    5
    TV
    East
    Q3
    32
    TV
    East
    Q4
    99
    Mobile
    North
    Q1
    13
    Mobile
    North
    Q2
    50
    Mobile
    North
    Q3
    95
    Mobile
    North
    Q4
    65
    Mobile
    East
    Q1
    58
    Mobile
    East
    Q2
    80
    Mobile
    East
    Q3
    76
    Mobile
    East
    Q4
    97
    However, we expect to append some aggregation value in this table as this.
    Product
    Region
    Quarter
    Sales
    TV
    North
    Q1
    37
    TV
    North
    Q2
    6
    TV
    North
    Q3
    4
    TV
    North
    Q4
    89
    TV
    East
    Q1
    81
    TV
    East
    Q2
    5
    TV
    East
    Q3
    32
    TV
    East
    Q4
    99
    Mobile
    North
    Q1
    13
    Mobile
    North
    Q2
    50
    Mobile
    North
    Q3
    95
    Mobile
    North
    Q4
    65
    Mobile
    East
    Q1
    58
    Mobile
    East
    Q2
    80
    Mobile
    East
    Q3
    76
    Mobile
    East
    Q4
    97
    TV
    All region
    Q1
    TV
    All region
    Q2
    TV
    All region
    Q3
    TV
    All region
    Q4
    Mobile
    All region
    Q1
    Mobile
    All region
    Q2
    Mobile
    All region
    Q3
    Mobile
    All region
    Q4
    All product
    North
    Q1
    All product
    North
    Q2
    All product
    North
    Q3
    All product
    North
    Q4
    All product
    East
    Q1
    All product
    East
    Q2
    All product
    East
    Q3
    All product
    East
    Q4
    All product
    All region
    Q1
    All product
    All region
    Q2
    All product
    All region
    Q3
    All product
    All region
    Q4
    As you see, we add "All region" and "All product" here, and combine them with real product, region and quarter value to show aggregations.
    Can anyone tell me how to get such table in webi? Can we implement it simply in report level?
    Best regards and thank you,
    Ocean

    Actually, this question is more focus on the report structure. I know the calculation context. In my first thought, I create the report similar with above one. The problem is in that case, there are a lot of duplicate rows. If you don't know what I am talking about, you can just take a little try in a real webi report sample.
    The key of the question is about how to put the aggregated "All product", "All region" rows in the right place with right frequency and in a single table. As I said, it is more about the format/structure problem.
    Any thought?

  • Updating multiple fields using a single update statement.

    Hi All,
    I am a beginner to Oracle. I have used the following Hint in an update query that is executed in Oracle 10G. We recently updated the Oracle to version 11g and when executing the query getting the following Error: ORA-01779: cannot modify a column which maps to a non key-preserved table. PFB the query. Please suggest me some ways that I can do to avoid this error.
    UPDATE /*+ bypass_ujvc */
    (SELECT t1.STG_DEL_CONDITION, t2.condition
    FROM stg_reports_membenft_latest T1 JOIN (select ods_ssn_grp,sys_id, first_value(STG_DEL_CONDITION) over(PARTITION BY ods_ssn_grp,sys_id
    ORDER BY STG_DEL_CONDITION DESC) AS
    condition from stg_reports_membenft_latest) T2
    ON T1.ods_ssn_grp = T2.ods_ssn_grp AND T1.SYS_ID=T2.SYS_ID ) x
    SET x.STG_DEL_CONDITION = x.condition;
    Thanks and Regards,
    Karthik Sivakumar.

    I used the below query and got the Result.
    Thank You all
    MERGE INTO stg_reports_membenft_latest x1
    USING (SELECT distinct ods_ssn_grp,
    sys_id,
    First_value(STG_DEL_CONDITION) OVER(partition BY ods_ssn_grp,sys_id
    ORDER BY STG_DEL_CONDITION DESC)
    AS condition
    FROM stg_reports_membenft_latest) x2
    ON ( x1.ods_ssn_grp = x2.ods_ssn_grp
    AND x1.SYS_ID = x2.sys_id )
    WHEN matched THEN
    UPDATE SET x1.STG_DEL_CONDITION=x2.condition;

  • Multiple fields on one line on an interview screen?

    Hi
    I need to implement an interview screen with lines on the form:
    "Enter income for 2012 [inputfield] [income2011] [income2010]"
    The user should be able to input the income for 2012 in an editable field and on the same line after the input field, two non editable fields should show the income for the previous years 2011 and 2010. These values are available from a database.
    I am unable to find any hints on how to do this - when the fields are to be shown on the same line...
    kind regards
    Carsten

    Having multiple fields on a single line cannot be configured in the screens file out-of-the-box. It sounds like something which could be done with a custom property though, so you'll need a technical person involved.
    There's information in the OPA Developer's Guide about custom properties: http://docs.oracle.com/html/E38272_01/toc.htm (note that this is different to the OPM User's Guide).
    Cheers,
    Jasmine

  • Multiple clob fields in a single table

    Are there any known performance issues associated with having 4 CLOB fields in a single table... the table as such will be relatively small.. like 100 MB... with most rows being << 50k.

    Not really. If you need 4 CLOB columns and it makes sense to have alll the columns in a single table, go for it.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Passing multiple values for a single field in URL to call sap Transaction

    Hi All,
    I need to pass multiple values for a single field to SAP transaction .
    means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
    Let me know pls.
    Regards,
    Sirisha.R.S.

    Hi Satyajit,
    I need to call a transaction with multiple values which gives me the report based on those values.
    So I need to pass multiple values for a single parameter.
    I hope u got it.
    Regards,
    Sirisha.R.S.

  • Why do we create multiple aliases to a single table?

    <h4>{color:#0000ff}Hi,{color}</h4>
    <h4></h4>
    <h4></h4>
    <h4>{color:#0000ff} Why do we create multiple aliases to a single table in the same query?{color}</h4>
    <h4></h4>
    <h4></h4>
    <h4>{color:#0000ff}{color:#000000}For Ex: {color}{color}</h4>
    <h4>
    {color:#000000}select name,address,phone, from emp e, emp e1{color}</h4>
    <h4></h4>
    <h4>{color:#000000}where e.empid = e1.empid;{color}</h4>
    <h4>
    {color:#0000ff}ofcourse the above query's where condition is not correct, but i am giving as an example only{color}</h4>
    <h4>{color:#0000ff}I have seen similar kind of queries where a single table name is aliased 10 times in the same query{color}</h4>
    <h4>{color:#0000ff}can someone help me to understand the logic behind it?{color}</h4>
    <h4>{color:#0000ff}Thanks in advance{color}</h4>
    <h4>{color:#0000ff}greddy.{color}</h4>
    Edited by: greddy on Oct 24, 2008 2:46 AM

    Hi,
    When you say
    FROM    emp  e
    ,       emp  e1you are using two copies of the same table.
    Can you imagine using two copies of the same book at the same time?
    Say you see a word (like "hyrax") that you don't know. You might look up that word in the dictionary.
    The English sentence "Open the dictionary to the page containing the new word." is like this SQL query:
    FROM    dictionary
    WHERE   :unknown_word  BETWEEN low_guide_word and high_guide_wordWhat if you saw that word while reading a book (let's call it book_a).
    You might want to leave book_a open, and place the dictionary beside book_a, so you can easily compare how the word is used in book_a with the definition in the dictionary.
    This corresponds to joining two tables in SQL:
    FROM    book_a     
    JOIN    dictionary  ON unknown_word BETWEEN low_guide_word AND high_guide_word
    WHERE   book_a.page  = whatever  -- NOTE: both tables have a column called pageor you can use aliases for one or both of the tables
    FROM    book_a      a
    JOIN    dictionary  d  ON a.unknown_word BETWEEN d.low_guide_word AND d.high_guide_word
    WHERE   a.page  = whatever  -- NOTE: both tables have a column called pageNow, imagine that book_a is itself the dictionary. Say you saw the word "hyrax" while you were looking up another word, "ibex".
    You can do a side-by-side comparison, as above, if you have two copies of the dictionary. Leave one copy open to "ibex", and open the other copy to "hyrax".
    This corresponds to a self-join in SQL:
    FROM    dictionary  a
    JOIN    dictionary  d  ON a.unknown_word BETWEEN d.low_guide_word AND d.high_guide_word
    WHERE   a.page  = whatever  -- NOTE: both tables have a column called pageNotice that this last bit of code is identical to the previous one, except that book_a is replaced with dictionary.
    In this case, you must you a table alias, at least for one copy. It wouldn't make any sense to say "Leave the dictionary open to "ibex" and open the dictionary to "hyrax". You have to have some unique way of referring to each copy, such as "Leave the dictionary on my left open to "ibex" and open the dictionary on my right to "hyrax"."

  • Is it possible to create a form with multiple form fields on a single line?

    Is it possible to create a form with multiple form fields on a single line?  I can't find anything in the documentation or a template that does this.
    I am trying to create a "documents received" checklist with a check box on the left margin, a date-received field to the right of the check box and and a description of the document (Formatted Text) on the far right.
    In the past I have entered the Fixed Text with a word processor, published it to a PDF file, then added the check box and date fields with the Acrobat Forms editor.  I would prefer to use FormsCentral if it is possible.

    We now support multiple fields on one line. This post provides a brief overview.
    Give it a try and send us your feedback.
    Sorry it took so long.
    Randy

  • Creating external table - from a file with multiple field separators

    I need to create an external table from a flat file containing multiple field separators (",", ";" and "|").
    Is there any way to specifiy this in the CREATE TABLE (external) statement?
    FIELDS TERMINATED BY "," -- Somehow list more than just comma here?
    We receive the file from a vendor every week. I am trying to set up a process for some non-technical users, and I want to keep this process transparent to them and not require them to load the data into Oracle.
    I'd appreciate your help!

    scott@ORA92> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\oracle'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE external_table
      2    (COL1 NUMBER,
      3       COL2 VARCHAR2(6),
      4       COL3 VARCHAR2(6),
      5       COL4 VARCHAR2(6),
      6       COL5 VARCHAR2(6))
      7  ORGANIZATION external
      8    (TYPE oracle_loader
      9       DEFAULT DIRECTORY my_dir
    10    ACCESS PARAMETERS
    11    (FIELDS
    12         (COL1 CHAR(255)
    13            TERMINATED BY "|",
    14          COL2 CHAR(255)
    15            TERMINATED BY ",",
    16          COL3 CHAR(255)
    17            TERMINATED BY ";",
    18          COL4 CHAR(255)
    19            TERMINATED BY ",",
    20          COL5 CHAR(255)
    21            TERMINATED BY ","))
    22    location ('flat_file.txt'))
    23  /
    Table created.
    scott@ORA92> select * from external_table
      2  /
          COL1 COL2   COL3   COL4   COL5
             1 Field1 Field2 Field3 Field4
             2 Field1 Field2 Field3 Field4
    scott@ORA92>

  • How to print multiple fields in single barcodes

    Hello friends,
    How to create a single barcodes with multiple fields in smartforms and retrieve same multiple fields while scanning also.
    My requirement is, i want to create barcodes which contains material no, serial no, material description and quantity all fields together in a single barcodes.
    While scanning how to identify all this different fields. For e.g. from single barcodes how we will identify while scanning which is material no, serial no, material description and quantity.
    Thanks in advance.......
    Regards,
    Dev

    Hello friends,
    How to create a single barcodes with multiple fields in smartforms and retrieve same multiple fields while scanning also.
    My requirement is, i want to create barcodes which contains material no, serial no, material description and quantity all fields together in a single barcodes.
    While scanning how to identify all this different fields. For e.g. from single barcodes how we will identify while scanning which is material no, serial no, material description and quantity.
    Thanks in advance.......
    Regards,
    Dev

  • Multiple Hierarchies from Single Dimension Table in OBIEE-11g?

    Is it possible to have Multiple Hierarchies from Single Dimension Table in OBIEE-11g?
    Like 1)Year-Qtr-Month-Weeks 2)Year-Month-Days

    Hi,
    or if your lowest level is the same like
    Day->month->year->Total
    Day->businessMonth->businessyear->Total
    Then yes, it is.
    Create the first, then you start to create the second by adding your top(business year) level on the same level as the one you have (year) both under your total.
    Then when you would add your second base level, there is a special option for it, something like use other hierarchy level/shared level (sorry can't recall and does not have a connection right now) then you select your existing day level under your businessmonth level.
    Hope this helps,
    Regards,
    D

Maybe you are looking for