Need to update Ztable from final internal table

Hi,
ITAB   = Final internal table has 9 fields : 1 2 3 4 5 6 7 8 9
Ztable = Ztable has 6 fields ex : 1 3 4 6 7 8
Structure of both Itab and Ztable are different.
I have data in the Final Internal table and needs to update data into a ztable.
If condition is true...
  Modify ztable from itab
endif.
Any suggestions how I can update Ztable from the INternal table
Regards,
Kittu

Hello,
First keep the loop to the final internal table then move all the records to the work area after moving to workarea then create another workarea for the Ztable then move only the field values which are there in Ztable then use modify keyword.
example
move:
y_wa_final_itab-kdauf to y_wa_zhr_item-vbeln,
y_wa_final_itab-kdpos to y_wa_zhr_item-posnr,
y_wa_final_itab-receiptno to y_wa_zhr_item-receiptno
modify zhr_item from y_wa_zhr_item

Similar Messages

  • Sending data from final internal table  to application server in xml format

    hi to all ,
    can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.

    welcome to SDN.
    are you using call transformation to convert itab to XML? the XML string is in which format?
    convert it to xstring and then use the following code to store it in application server.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    TRANSFER XML_content TO FNAME.
    CLOSE DATASET FNAME.
    where fname is the path to the file name.
    Regards
    Raja

  • Need to move the data to final internal Table

    Hi all,
    TYPES: BEGIN OF TY_MARA,
           MATNR       TYPE  MATNR,         " Material Number
           ZZBASE_CODE TYPE  ZBASE_CODE,    " Base Code
           END OF TY_MARA,
           BEGIN OF TY_MAKT,
           MAKTX       TYPE  MAKTX,         " Material Description
           END OF TY_MAKT,
           BEGIN OF TY_MARC,
           WERKS       TYPE  WERKS_D,      " Plant
           END OF TY_MARC,
           BEGIN OF TY_QMAT,
           ART           TYPE  QPART,         " Inspection Type
           END OF TY_QMAT,
           BEGIN OF TY_MAPL,
           MATNR        TYPE  MATNR,        " Material
           PLNTY        TYPE  PLNTY,        " Task List Type
           END OF TY_MAPL,
           BEGIN OF TY_PLKO,
           VERWE             TYPE     PLN_VERWE,     "     Task list usage
           END OF TY_PLKO,
          BEGIN OF TY_FINAL,
           MATNR          TYPE    MATNR,          " Material Number
           MAKTX          TYPE    MAKTX,          " Material Description
           ZZBASE_CODE    TYPE    ZBASE_CODE,     " Base Code
           WERKS          TYPE    WERKS_D,        " Plant
           CLASS          TYPE    KLASSE_D,       "     Class Number
           ART             TYPE    QPART,           " Inspection Type
           VERWE             TYPE    PLN_VERWE,       " Task list usage
         END OF TY_FINAL.
    DATA: I_MARA  TYPE  STANDARD TABLE OF TY_MARA  ,
          I_MAKT  TYPE  STANDARD TABLE OF TY_MAKT  ,
          I_MARC  TYPE  STANDARD TABLE OF TY_MARC  ,
          I_QMAT  TYPE  STANDARD TABLE OF TY_QMAT  ,
          I_MAPL  TYPE  STANDARD TABLE OF TY_MAPL  ,
          I_PLKO  TYPE  STANDARD TABLE OF TY_PLKO  ,
          I_KLAH  TYPE  STANDARD TABLE OF TY_KLAH  ,
          I_FINAL TYPE  STANDARD TABLE OF TY_FINAL ,
          WA_MARA  TYPE  TY_MARA,
          WA_MAKT  TYPE  TY_MAKT,
          WA_MARC  TYPE  TY_MARC,
          WA_QMAT  TYPE  TY_QMAT,
          WA_MAPL  TYPE  TY_MAPL,
          WA_PLKO  TYPE  TY_PLKO,
          WA_KLAH  TYPE  TY_KLAH,
         WA_FINAL TYPE  TY_FINAL.
    data: v_mtart         type    mara-mtart,
          v_matnr         type    mara-matnr,
          v_zzbase_code   type    mara-zzbase_code,
          v_werks         type    t001w-werks,
          v_beskz         type    marc-beskz.
    selection-screen skip 1.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_mtart    for v_mtart default 'halb' to 'zraw',
                    s_matnr    for v_matnr,
                    s_zzbase   for v_zzbase_code,
                    s_werks    for v_werks obligatory,
                    s_beskz    for v_beskz.
    selection-screen end of block b1.
    start-of-selection.
    select matnr
           zzbase_code
           from  mara into table i_mara
           where mtart in s_mtart       "Material Type
           and   matnr in s_matnr        "Material
           and   zzbase_code in s_zzbase."Base Code
    select maktx
           from makt into table i_makt for all entries in i_mara
           where matnr = i_mara-matnr.
    select werks
           from marc into table i_marc for all entries in i_mara
           where matnr = i_mara-matnr
           and werks in s_werks "plant
           and beskz in s_beskz."Procurement Type
    select art
           from qmat into table i_qmat for all entries in i_mara
           where matnr = i_mara-matnr
           and werks in s_werks.
    select matnr
           plnty from mapl into table i_mapl for all entries in i_mara
           where matnr = i_mara-matnr.
    select verwe
           from plko into table i_plko for all entries in i_mapl
           where plnty = i_mapl-plnty.
    this is my logic . i need to move this to final internal table i_final. how can do it. will anybody tell me with coding.
    Thanks,

    Hi,
    Include matnr field in all your type declaration and plnty in the ty_plko,  type declaration.
    loop at the internal table i_mara.
    read the other tables with read statement.
    assign the the required fields to the work area wa_final. Append it to i_final.
    start-of-selection.
      select matnr  zzbase_code
        from mara   into table i_mara
       where mtart in s_mtart "Material Type   and matnr in s_matnr "Material  and zzbase_code in s_zzbase. "Base Code
      select matnr  maktx        
        from makt   into table i_makt
         for all entries in i_mara   where matnr = i_mara-matnr.
      select matnr  werks
        from marc  into table i_marc
         for all entries in i_mara  where matnr = i_mara-matnr   and werks in s_werks "plant   and beskz in s_beskz."Procurement Type
      select matnr  art
        from qmat  into table i_qmat
         for all entries in i_mara where matnr = i_mara-matnr   and werks in s_werks.
      select matnr plnty
        from mapl into table i_mapl
        for all entries in i_mara  where matnr = i_mara-matnr.
      select plnty verwe
        from plko  into table i_plko
         for all entries in i_mapl  where plnty = i_mapl-plnty.
    Loop at i_mara into wa_mara.
    read table i_makt into wa_makt with key matnr = wa_mara-matnr.
    (do this for all the internal tables.)
    read table i_plko into wa_plko with key plnty = wa_mapl-plnty.
    wa_final-MATNR = wa_mara-matnr.
    wa_final-MAKTX = wa_makt-maktx.
    wa_final-ZZBASE_CODE = wa_mara-ZZBASE_CODE.
    wa_final-WERKS = wa_marc-werks.
    wa_final-ART = wa_qmat-art.
    wa_final-VERWE = wa_plko-verve.
    append i_final from wa_final.
    endloop.
    Hope this helps.
    Regards,
    Dhasarathy. K

  • How to insert  data from different internal  table  into a data base table

    hi all,
             I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
    in short i want to do something like the foll:
    INSERT  INTO ZMIS_CODES-CODE VALUE '1'.
    *INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

    REPORT  ZINSERT.
    tables kna1.
    data: itab LIKE KNA1.
    data lv_kUNAG LIKE KNA1-KUNNR.
    lv_kuNAG =  '0000010223'.
    ITAB-kuNNR = lv_kuNAG.
    ITAB-name1 = 'XYZ'.
    INSERT INTO KNA1 VALUES ITAB.
    IF SY-SUBRC = 0.
    WRITE:/ 'SUCCESS'.
    ELSE.
    WRITE:/ 'FAILED'.
    ENDIF.
    Here lv_kunag is ref to kna1 kunnr passed in different name
    In internal table .
    Try and let me know if this logic dint work.

  • Populate Final internal table from Dynamic internal table

    Hello,
    I have ti display data in ALV grid whose structure is fixed. I am dynamically selecting data iin an internal table.
    Now from this dynamic internal table, i need to populate my final internal table whose structurte is fixed.
    Please help.
    Rgds,
    Himanshu

    Hello Himanshu,
    When you say dynamic internal table there are two things one is the actual structure and other one is field table that holds information for all the fields used to create dynamic internal table.
    No if you want to move data from dynamic table to fixed internal table then you can try as follows:
    1.
    field-symbols <field_name> TYPE C.
    field-symbols <field_value> TYPE C.
    Now you either use
    LOOP AT fields_itab.
    ASSIGN fields_itab-fieldname to <field_name>.
    ASSIGN COMPONENT <field_name> OF STRUCTURE <structure_name> TO <field_value>
    Now you move value from <field_value> to required field in fixed internal table.
    i.e.
    itab-fieldname = <field_value>.
    Other way to do this:
    If you fields order is constant then you can also use index in assign component statement.
    do <no_of_fields> times.
        ASSIGN COMPONENT sy-index OF STRUCTURE <structure_name> TO <field_value>.
    rest is same as first method.
    Hope this help!
    I have given sudo code and you need to work on it little.
    Thanks,
    Augustin.

  • Hi, Bapi or function module to update RBCO table from an internal table.

    I have a requirement to  update RBCO table from an internal table.  is there any Bapi or function module  or any other method other than update, modify statements.
    Moderator message: Welcome to SCN!
    Moderator message: please do more research before asking, show what you have done yourself when asking.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Jul 12, 2011 12:28 PM

    I don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.

  • Help needed to get unique record from an internal table

    Hi Everybody,
    I have to get unique record from an internal table. i know we can use read statement with key condition .
    But the problem is i have to use some relational operators like GE or LE.
    eg
    read table itab into wa with key width GE itab-widthfrom
                                                       width LE itab-widthto
                                                       machno eq itab-machno.
    Its giving me error when I use the operators GE , LE.( I think since it can't find a unique record with those relational
    operators in the with key statement)
    Is there any other way to get unique record from internal table without using the loop?
    Thanks,
    Sunny

    Using the read statement you will need some kind of loop. For example.
    DO.
    READ TABLE......
      WITH KEY ......
                        READ = SPACE
    IF SY-SUBRC EQ 0
      TABLE-READ = 'X'.
      MODIFY TABLE
      ADD 1 TO W_FOUND.
    ELSE
      EXIT.
    ENDIF
    ENDDO.
    IF W_FOUND EQ 1.
    ...record is unique.
    ENDIF.

  • HOW TO CREATE A FINAL INTERNAL TABLE FROM 8 OTHER INTERNAL TABLES

    I have around 8 internal tables and I need to merge all of them into one final internal table so that I need to pass the new internal table for ALV Grid display

    Hi Balram,
    Assuming that there are logical links (ie foreign key relationships) between each of these internal tables, on way is to do several loops controlled by a binary search.
    eg. we have 2 tables:
    types: begin of ty_makt,
                matnr  type matnr,
                maktx  type maktx,
              end of ty_makt.
    types: begin of ty_mara,
                matnr  type matnr,
                bismt  type bismt,
              end fo ty_mara.
    types: begin of ty_output,
                matnr  type matnr,
                bismt  type bismt,
                maktx  type maktx,
              end of ty_output.
    data: tbl_mara type table of ty_mara with header line,
            tbl_makt type table of ty_makt with header line,
            tbl_putput type table of ty_output with header line.
    sort tbl_makt by matnr.
    loop at tbl_mara.
      read table tbl_makt with key matnr = tbl_mara-matnr binary search.
      if sy-subrc eq 0.
    * build tbl_output here
      endif.
    endloop.
    Hope this helps.
    Cheers,
    Pat.

  • Updating database table from an internal table

    Hi All,
    I am updating a database table from an internal table.
    I am changing the non-key fields in that table.
    when I check sy-subrc = 4.
    Record already exists, because I am changing non-key fields of the
    database table.
    Is there any addition like to accept the duplicate keys with update.
    Alternatively, I have used Modify, It is adding new record,
    Again, I have search the old record and use Delete on the database table.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

    Hi,
    You are right, the field which I am trying to change is a part of primary key.
    Because, sy-subrc = 4. says,
    No line with specified primary key exits in the database table.
    I have a Z-tabel, with Kunnr Vkorg Matnr Bzirk Bztxt Split_percentage
    In this table primary key consists of KunnrVkorgMatnr+Bzirk.
    I am able to change the Split_percentage using UPDATE.
    Now, my client want to change Bzirk, Bztxt also in the table.
    How can I Go.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

  • How to compare a ztable and an internal table

    Hi, experts.
    I have a transparent table ztable and an internal table itab, with same fields. What I need to do is: if those records in itab are not existing in ztable, append them to ztable; if these records in itab has been existing in ztable, update them in ztable.
    How to write codes to do above task in ABAP program?
    Thank you very much.
    Tom

    Hi
    DATA : itab1 type ztable.
    if values in itab not in itab1.
    append itab values to itab1.
      endif.
    if values exist in itab and itab1.
    modify itab1 with respect to itab
    endif.
    finally
       modify ztable from itab1.

  • How to update Ztable from Excel file and how to check conditions ,

    HI this uday,
    pls help me how can i update Ztable from Excel file and how to check conditions .
    regards
    uday
    Moderator message: please (re)search yourself before asking.
    Edited by: Thomas Zloch on Jul 13, 2010 12:00 PM

    Hi
    Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
    L_INTERN : internal table with your fields .
    make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
    LOOP AT L_INTERN INTO WA_LINTERN .
            MOVE WA_LINTERN-COL TO L_INDEX.
            ASSIGN COMPONENT  L_INDEX OF STRUCTURE WA_INREC TO <FS> .
            IF SY-SUBRC = 0.
              MOVE WA_LINTERN-VALUE TO <FS>.
            ENDIF.
            AT END OF  ROW .                                    "#EC *
              APPEND WA_INREC TO IT_DATA.  "
              CLEAR WA_INREC.
            ENDAT.
         ENDLOOP.
    Regards
    Swapnil

  • SAP Query Display data from 2 internal tables

    Hi ABAP Gurus,
    I am developing a SAP Query.
    I have created an infoset with the custom infotype 9050 and added the table ZPA9050 into the Infoset.
    How do I input values to the ZPA9050 fields? A checkbox for making a Selection field is not available in the Query (SQ01)
    For every pa9050 entry there exist multiple records of ZPA9050. I need to display the pa9050 fields in the 1st row and the corresponding zpa9050 fields in the subsequent rows.
    Kindly advise how to accomplish this task. 
    A quick reply is highly appreciated.
    Useful answers will be rewarded.
    Thanks
    Sriram

    Hi Deepika,
       Your reqirement is to print data from the two internal tables ..and if u r not using interactive alv  then u need to merge data into single internal table... if anycase u dont want to merge in the table itab as u told u can use another final internal table in which u can merge data from the two previous interal tables then u pass this final internal table to ur FM.
    Thanks & Regards
    Ashu Singh

  • To eliminate the duplicate entries while looping into final internal table

    Hi friends,
    IAam facing the follwoing problem.
    Get Shipment for the Delivery number
          SELECT tknum
                 vbeln
                 INTO TABLE lt_vttp
                 FROM vttp
                 FOR ALL ENTRIES IN lt_vbfa
                 WHERE vbeln = lt_vbfa-vbelv.
        IF sy-subrc EQ 0.
          SELECT vbeln kunnr
                 FROM likp
                 INTO TABLE lt_likp
                 FOR ALL ENTRIES IN lt_vttp
                 WHERE vbeln = lt_vttp-vbeln.
      endif.
    now iam my internal table lt_vttp i have following values
       shipment             delivery
          1000                  2000
          1000                 2001
    in my internal table lt_likp i have the follwoing values
          delivery              shipto
           2000                  ABC
           2001                  ABC
    now iam looping those values in a final internal table.
      LOOP AT lt_likp INTO ls_likp.
        CHECK sy-subrc EQ 0.
         READ TABLE lt_vttp INTO ls_vttp WITH KEY vbeln = ls_likp-vbeln BINARY SEARCH.
        CHECK sy-subrc EQ 0.
             SELECT SINGLE * FROM vttk INTO ls_vttk
                    WHERE tknum = ls_vttp-tknum.
                  CHECK sy-subrc EQ 0.
                APPEND ls_vttk TO lt_vttk.
       endloop.
    Now my problem is if the shipment is same and the shipto is same then need to eliminate the duplicate records.
            in internal table iam getting 2records with same shipment and shipto combination.
           but instead if both the shipment and shipto are same then i should elimate the duplicate entries.
    and for the same shipment if i have differnt shipto then i neeed those 2 value.
    can any body tell me how can i get that.
    Regards
    Priyanka.

    Hi Priyanka,
    In your code you are using seelct statement inside the loop which will affect the performance.
    So, declare a another internal table which contains your both shipment and shipto elements with other required fields, say the name is lt_new.
    sort lt_new by shipment shipto.
    delete adjacent duplicates from lt_new comparing shipment shipto.
    "then use for all entries to choose values from VTTK.
    Hope this helps you.
    Regards,
    Manoj Kumar P

  • Getting the final internal table of a transaction VA05

    Hi,
    Can anyone help me in getting the final internal table of a transaction VA05 when called from a program. I need to use to this internal table for further processing.
    Thanks in advance,
    Vinay.

    Hi,
    Not quite sure what you are after but the following may help.
    For a start VA05 uses FM RV_SALES_DOCUMENT_VIEW_3 to select it's data.  Your program could simply call this.  However, if you are doing a CALL TRANSACTION from your program to VA05 and you want to get the results back then you could utilise some 'old style' userexits available in VA05.
    Two choices here:
    1. At the end of FM RV_SALES_DOCUMENT_VIEW_3 there is a form END_MODIFICATION or
    2. When VA05 calls RV_SALES_DOCUMENT_VIEW_3 it performs a user sort MV75AFZ1(MV75AFZ1)
    Both of these belong to package VMOD which means you can modify them by simply registering the object in OSS (these are 'old style' exits before SMOD/CMOD and are prevelant in SD)
    From either of these you could EXPORT to memory for when control is returned back to your program.
    Thanks,
    Pete

  • Extract a value of a fields from an internal table

    hello everyone,
    i need to extract a value of a fields from an internal table, the fields is in a postion "sy-tabix" that i know, so i need to pick this value without using a loop
    thank you.

    Like this?
    DATA: FIELD1 TYPE C,
               FIELD2 TYPE C.
    READ TABLE T_TAB INDEX 3.
    FIELD1 = T_TAB-FIELD1.
    FIELD2 = T_TAB-FIELD2.
    Greetings,
    Blag.

Maybe you are looking for

  • 2 Problems with 2 different iPod Touch models.

    Hi, recently I've experienced a few problems with my First Generation iPod Touch, and my Second Generation iPod Touch also. The first gen. was updated to the most recent software, whereas the second gen. hadn't been updated with iOS 4 yet. Neither ha

  • How do i sync my iphone to my new Macbook pro?

    I recently just purchased a new Macbook Pro and i'd like to be able to sync my iphone to it and use it as my main computer.  Whenever i try to sync it though it says that it has to erase all my content.  This wouldnt be a problem since i backed up my

  • Problem with up-arrow on a long command line

    I often use the "terminal" window to open up a connection (via ssh) to linux and unix boxes. While I'm logged into the remote computer and I try to edit a previous command, I notice that my display gets all fouled up if the command that I'm trying ed

  • Problem at the last step in LSMW Direct I/P Method

    Hi all , I am trying to create the ROUTING using LSMW direct input method . After executing the last step (Start Direct Input )  .. I am getting the Following Information as errors .                Data Transfer of Routings via Direct Input          

  • Resolution questions

    Info: We use a Kramer 719 switcher/scaler, Toshiba 2800 DVD player and a computer with the same output resolution as the Kramer 719 (1024x768). Can I (and should I) increase resolution of a FC3 project if I'm playing it from the DVD player? What abou