Update value of internal table in table control

hi friends,
              i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
help me with some sample coding.

Hi,
As I can understand, you want
1. To enter details in two fields. You want to enter data there and then press an enter Button.
2. This two fields are part of table control in the next screen and it has some data present there. You want to add data of this two fields in the Internal table.
THere are few options.
1. Define a Global internal Table.
2. Fetch Data in that internal Table in your 1st Screen Say 100 with the 2 text fields.
3. On click of the button. In PAI append data of the fields in the Global Internal Table.
4. Display internal table by looping on it in the next screen say 200.
Hope this is the answer you are looking for.
Try to solve, if you can't then send me message or email.
Cheers.
Darshan
<b><i>** Please reward points if this helps u. It motivates us to write more answer and put more efforts.</i></b>

Similar Messages

  • How to update value in internal table from cdpos taking fname n value_new?

    hello everyone,
              i want to insert  value in internal table from cdpos table taking field name  from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value  which is the field name.
    for example
    i
    fieldname
    value
    name1
    raj
    name2
    sharma
    i want to update field name1. this name1 is there in fname with updated value in value_new  how to make name1 with fname value
    thanks and regards
    laxmikant soni

    Hi Laxmikant,
    If I have understood your requirement correctly, you need to update an internal table with latest 'value_new' from cdpos table where  'fname' = 'fieldname' .
    Hope the below logic will help you:
    FIELD-SYMBOLS: <wa_intab> LIKE LINE OF lt_intab.  "the internal table you want to change
    LOOP AT lt_intab ASSIGNING <wa_intab> .
       READ TABLE lt_cdpos INTO wa_cdpos           "lt_cdpos contains latest data selected from CDPOS
        WITH KEY fname = <wa_intab>-fieldname.
       IF sy-subrc = 0.
         <wa_intab>-value = wa_cdpos-value_new.    
       ELSE.
         "//logic if the name is not there in CDPOS
       ENDIF.
       CLEAR  wa_cdpos.
    ENDLOOP.
    If you wish to improve performance, I suggest using
    1. "transporting value_new" addition in READ TABLE,
    2.  select only the data which you require from CDPOS,
    3.  create the internal tables with only fields which you require,
    4.  when you are using SELECT,LOOP AT statements, limit records by using WHERE condition
    Regards,
    Kavya

  • Update values of custom fields in table HRPAD506-Additional Data for PAD506

    Hi Experts,
    my requirement is write a report program to upload a file with records.
    I have to capture this records into an internal table and have to update values of 5 custom fields based on ADATANR.
    Can anyone suggest me about any FM or any way of doing this.
    Urgent requirement.
    Will HRIQ_RFC_BOOKING_CHANGE help.
    thankx.
    Duttad.

    hi,
    Above mentioned that when the values are entered in the customised fields they are not updating in the to the table mara.
    so, the program name and screen number which you are configuring in the spro, in that program name and in that screen number code it as below:
    (you could find the field statements in that screen for the standard fields like FIELD MARA-MEINS.)
    for example:
    PROCESS BEFORE OUTPUT.
           PROCESS AFTER INPUT.
          FIELD MARA-zzfieldname.
    Refer the oss note : 38229
    Thanks and regards.

  • Update value from internal table into table control

    hi friends,
    i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
    help me with some sample coding.

    hi Karthik ,
    Here you go with the sample coding of moving internal table values to table control on module pool programs :
    in screen painter flow-logic ............
    process before output.
    module status_3000.
    loop at g_tab_con_01_itab
         into g_tab_con_01_wa
         with control tab_con
         cursor tab_con-current_line.
    module tab_con_move.
    endloop.
    process after input.
    module exit at exit-command.
    module user_command_3000.
    module clear_ok_code.
    loop at g_tab_con_01_itab.
    module read_tab_con.
    endloop.
    in your program .............
    include z_tab_ctrl_top                          .    " global Data
    program  z_tab_ctrl.
    tables : sflight,sbook,zsflight.
    types:begin of t_tab_con_01 ,
            carrid like sflight-carrid,
            connid like sflight-connid,
            sel type c,
           end of t_tab_con_01.
    data: g_tab_con_01_itab type  t_tab_con_01 occurs 0 with header line,
          g_tab_con_01_wa type t_tab_con_01,
          g_tab_con_01_copied ,
          g_tab_con_01_lines like sy-loopc,
          ok_code like sy-ucomm,
          lines type i,
          init ,
          fill type i.
    controls: tab_con type tableview using screen 3000.
    module status_3000 output.
      set pf-status 'ST100'.
      set titlebar 'T100'.
    endmodule. 
    module update_table_control input.
      describe table g_tab_con_01_itab lines tab_con-lines.
    endmodule.  
    module exit input.
      ok_code = sy-ucomm.
      if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
        leave program .
      endif.
    endmodule.        
    module clear_ok_code input.
    clear ok_code.
    endmodule.      
    module fill_tab_con output.
    read table g_tab_con_01_itab into zsflight index tab_con-current_line.
    endmodule.                 " fill_tab_con  OUTPUT
    module read_tab_con input.
    *lines = sy-loopc.
    read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
    if sy-subrc eq 0.
    move-corresponding sflight to g_tab_con_01_wa.
    modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
    else.
    move-corresponding sflight to g_tab_con_01_wa.
    append g_tab_con_01_wa to g_tab_con_01_itab.
    endif.
    module tab_con_move output.
    move-corresponding g_tab_con_01_wa to sflight.
    endmodule.                 " tab_con_move  OUTPUT
    module tab_con_get_lines output.
    g_tab_con_01_lines = sy-loopc.
    endmodule.                 " tab_con_get_lines  OUTPUT
    module tab_con_modify input.
    move-corresponding sflight to g_tab_con_01_wa.
      modify g_tab_con_01_itab
          from g_tab_con_01_wa
          index tab_con-current_line.
    endmodule.                 " tab_con_modify  INPUT
    module populate_tab_ctrl input.
    if sy-subrc eq 0.
    endif.
    endmodule.
    Look at the following modules in the above program ....
    fill_tab_con
    tab_con_modify
    tab_con_get_lines
    update_table_control
    This will definately solve your problem or give an idea for solution ....
    reward if helpful,
    Regards,
    Ranjita

  • Updating values with in the same table for other records matching conditions

    Hi Experts,
    Sorry for not providing the table structure(this is simple structure)
    I have a requirement where i need to update the columns of a table based on values of the same table with some empid and date  match. If the date and empid match then i have take these values from other record and update the one which is not having office details. I need the update query
    Before update my table values are as below
    Sort_num     Emp_id   office      start_date
    1                      101     AUS    01/01/2013
    2                      101                01/01/2013
    3                      101               15/01/2013
    4                      103     USA    05/01/2013
    5                      103               01/01/2013
    6                      103                05/01/2013
    7                      104     FRA    10/01/2013
    8                      104               10/01/2013
    9                      104                01/01/2013
    After update my table should be like below
    Sort_num     Emp_id   office      start_date
    1                      101     AUS    01/01/2013
    2                      101     AUS    01/01/2013
    3                      101               15/01/2013
    4                      103     USA    05/01/2013
    5                      103               01/01/2013
    6                      103    USA     05/01/2013
    7                      104     FRA    10/01/2013
    8                      104     FRA     10/01/2013
    9                      104                01/01/2013
    Thanks in advance

    I do not have time to create the table with data but basically you should be able to code the following
    update table a
    set office = ( select office from table b where b.emp_id = a.emp_id
                                                                 and     b.start_date = a.start_date
                                                                 and     b.office is not null
    where exists ( [same query as in set]  )
    and a.office is null
    I believe that will do the trick.
    HTH -- Mark D Powell --

  • Update value for XABLN in LIKP  table

    Hi ,
    Is there any way to update the LIKP-XABLN filed yhrough BAPI?
    I tried with this FM    BAPI_OUTB_DELIVERY_CHANGE , but could not succeed.
    Edited by: nancy coner on Jan 27, 2010 9:39 AM

    Hi,
    I need to update LIKP-XABLN field from a Smart Form driver program programaticaly only when the Form is successfully printed.
    I dint find any BAPI / Std Function Module which does the update.
    I dont know how MB_XAB_NUMBER_GET works to update the XABLN field?
    Edited by: nancy coner on Feb 1, 2010 8:03 AM

  • BRFplus: Problem updating values in an internal table in a loop expression

    Hi
    I'm looking into the loop expression type of BRFplus and I have come across a problem updating an internal table, I'm trying to create and populate the table using a loop, here is the functionality I'm trying to achieve:
    In a rule set create an internal MONTH_TBL table containing 12 rows of two columns: MONTH_NUM containing values 1 through 12 and MONTH_VAL containing an amount (initially 0,00 EUR in all 12 rows).
    After initializing the table traverse through SFLIGHT table and for each row add PRICE from the table to MONTH_VAL in the row of MONTH_TBL corresponding to the month of FLDATE field in SFLIGHT.
    The initialization of MONTH_TBL works as intended, as does the traversal of and retrieval of values from SFLIGHT. The problem however is the update of the internal table MONTH_TBL (defined as result data object for the function). I don't get an error, but the tables does not get updated, and I cannot seem to find out what the problem is. I would have attached an XML extract of the function + ruleset for information, but it dosen't seem like that is possible, I could e-mail it on request (for SAP employees with access to system QU5 the function is LOOP_TEST in application Z_KLAUS_TEST).
    I hope that this is sufficient information to understand the issue that I'm dealing with.
    best regards
    Klaus Stenbæk, KMD

    Hi Klaus,
    The Loop expression is part of NW 7.02 which is not yet released. When you experience the problem as part of a test you should have a contact at SAP for dealing with problems/errors. Usually SAP-internal messages are used for this purpose. Please clarify with your SAP contact how the model is.
    BR,
    Carsten

  • How to update values in the table control at  Cat2 transaction,

    Hi,
    i am working on cat2 transaction, here
    i am using the exit_saplcats_006 and updating values at catsdb table, but i want to display this values at the table control in the cat2 transaction.
       can any one provide me solution for this same.
    Regards

    Hi Suresh
      this is actual requirement
    in the CAT2.
    1. Add a new column for WBS description and derive the value as per the FS
    2. Retrieve project number and description and update in the column specified
    3. When a service order is selected it should do the same for 2.
    4. Finally repeat for the worklist view (which is the section above)
       here i am able to display values at data entry area
    for service order and network but not worklist area ?
        updation is not coming, can u plz go throw it..
    Thanks
    Chinna

  • Update statement in Internal Table

    Plz tell me the syntax and e.g. of update statement in Internal Table program
    Moderator message: Welcome to SCN, please research yourself before asking basic questions.
    Edited by: Thomas Zloch on Feb 25, 2010 12:47 PM

    Hi,
    Use UPDATE statement , check below description from SAP help.
    UPDATE dbtab FROM TABLE itab. or UPDATE (dbtabname) FROM TABLE itab.
    Effect
    Mass update of several lines in a database table.Here, the primary key for identifying the lines tobe updated and the values to be changed are taken from the lines of theinternal table itab. 
    The system field SY-DBCNT contains the number of updated lines,i.e. the number of lines in the internal table itab which havekey values corresponding to lines in the database table.
    Regards
    L Appana

  • How to update Records from Internal table to u2018Zu2019 table?

    Hi Friends,
    How to update Records from Internal table to u2018Zu2019 table.
    I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
    ( my internal table & u2018 Zu2019 table structures are same.)
    Thanking you.
    Regards,
    Subash

    Hi,
    loop at internal table.
    modify <Z- table > from values < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    endloop.
    or
    UPDATE <Z- table > from table < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    Prabhudas

  • Fetch the values from internal table inside an internal table (urgent!!)

    data : BEGIN OF PITB2_ZLINFO occurs 0,
             BEGDA LIKE SY-DATUM,
             ENDDA LIKE SY-DATUM,
             PABRJ(4) TYPE N,                       "Payroll Year
             PABRP(2) TYPE N,                       "Pay. Period
             ZL LIKE PC2BF OCCURS 0,
           END OF PITB2_ZLINFO.
    I have a internal table like this,
    How to Fetch the values from internal table inside an internal table.
    Kindly Help me on this..
    Regards,
    Ram.

    Hi,
    Try this....
    Loop at PITB2_ZLINF0.
    Loop at PITB2_ZLINF0-ZL.
    endloop.
    Endloop.
    Thanks...
    Preetham S

  • All values in internal table are not displaing in the script print program

    Hi,
    I am calling the script program.In main window all values in the internal table are not displaying. I wrote
    write-form statement in loop. But not all the values are getting displayed. Only thel ast values getting dispalyed. 
    *& Report  ZSCRIPT_116719
    REPORT  ZSCRIPT_116719.
    ************Table decleration***************
    TABLES: mara, mbew, makt.
    loop at i_makt into wa_makt.
      endloop.
    loop at i_MARA into wa_mara.
      endloop.
    LOOP AT I_MBEW INTO WA_MBEW.
      ENDLOOP.
    lv_price = 0.
    ********************Total Price******************
      LOOP AT i_mbew INTO wa_mbew.
        lv_price = lv_price + wa_mbew-stprs.
      ENDLOOP.
    end-of-selection.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
      DEVICE                            = 'PRINTER'
      DIALOG                            = 'X'
       FORM                              = 'ZSCRIPT_719'
       LANGUAGE                          = SY-LANGU
      OPTIONS                           =
      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                       = 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 'START_FORM'
    EXPORTING
      ARCHIVE_INDEX          =
       FORM                   = 'ZSCRIPT_719'
       LANGUAGE               = SY-LANGU
      STARTPAGE              = ' '
       PROGRAM                = 'ZSCRIPT_116719'
      MAIL_APPL_OBJECT       =
    IMPORTING
      LANGUAGE               =
    EXCEPTIONS
      FORM                   = 1
      FORMAT                 = 2
      UNENDED                = 3
      UNOPENED               = 4
      UNUSED                 = 5
      SPOOL_ERROR            = 6
      CODEPAGE               = 7
      OTHERS                 = 8
    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 I_MBEW INTO WA_MBEW.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'DATA'
       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.
    *ENDLOOP.
    If I give only one value it is showing the output. When I am fetching the data for range of values it i sshowing start_form is not there.
    Plz let me know how to get the aa  internal table values  to be displayed

    hi
    I shortened your program a bit. So we can go to essentials of your question.
    You said you put in it in a loop.
    What i see in your prog is:
    REPORT zscript_116719.
    ************table decleration***************
    TABLES: mara, mbew, makt.
    LOOP AT i_makt INTO wa_makt.
    ENDLOOP.
    LOOP AT i_mara INTO wa_mara.
    ENDLOOP.
    LOOP AT i_mbew INTO wa_mbew.
    ENDLOOP.
    lv_price = 0.
    ********************total price******************
    LOOP AT i_mbew INTO wa_mbew.
      lv_price = lv_price + wa_mbew-stprs.
    ENDLOOP.
    END-OF-SELECTION.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          form     = 'ZSCRIPT_719'
          language = sy-langu.
      CALL FUNCTION 'START_FORM'
        EXPORTING
          form     = 'ZSCRIPT_719'
          language = sy-langu
          program  = 'ZSCRIPT_116719'.
    *LOOP AT I_MBEW INTO WA_MBEW.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element  = 'DATA'
          function = 'SET'
          type     = 'BODY'
          window   = 'MAIN'.
    *endloop.
    1. Your loop is not a loop with this '*' in front of it.
    2. Are you printing &wa_mbew-???& variables in your sap-script
    3. is itab I_MBEW properly filled
    Let me know.
    Gr. Frank

  • HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE

    HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE.
    DATA : BEGIN OF ITAB OCCURS 0,
               FIELD1(2) TYPC C DEFAULT   '12',
               FIELD2     TYPE C ,
               END OF ITAB1.
    IT'S GIVING ERROR MESSAGE.
    PLZ LOOK INTO THIS AND GIVE ME CORRECT SOLUTION.
    THANKS
    SURI

    DATA : BEGIN OF ITAB OCCURS 0,
    FIELD1(2) TYPC C,
    FIELD2 TYPE C ,
    END OF ITAB1.
    itab-field1 = '12'.
    itab-field2 = 'A'.
    append itab.
    clear itab-field2.
    itab-field1 = '12'.
    itab-field2 = 'B'.
    append itab.
    clear itab-field2.
    Now everytime u'll have the value for field1 = '12'.
    Regards
    Vasu

  • How can i pass calculated value to internal table

    Hi
    i have to pass calculated value into internal table
    below field are coming from database view and i' m passing view data into iznew1
    fields of iznew1
                 LIFNR  LIKE EKKO-LIFNR,
                 EBELN  LIKE EKKO-EBELN,
                 VGABE  LIKE EKBE-VGABE,
                 EBELP  LIKE EKBE-EBELP,
                 BELNR  LIKE EKBE-BELNR,
                 MATNR  LIKE EKPO-MATNR,
                 TXZ01  LIKE EKPO-TXZ01,
            PS_PSP_PNR  LIKE EKKN-PS_PSP_PNR,
                 KOSTL  LIKE EKKN-KOSTL,
                 NAME1  LIKE LFA1-NAME1,
                 NAME2  LIKE LFA1-NAME2,
                 WERKS  LIKE EKPO-WERKS,
                 NETWR  LIKE EKPO-NETWR,
                 KNUMV  LIKE EKKO-KNUMV,
                 GJAHR  LIKE EKBE-GJAHR,
    and now i want to pass
    one field ED1  which i has calculated separatly and i want to pass this value into iznew1
    but error is coming that iznew1 is a table with out header line  has no component like ED1.
    so how can i pass calculated value to internal table iznew1,

    When you declare your internal table , make an addtion occurs 0
    eg . data : begin of iznew occurs 0 ,
                    fields ...
       add the field here ed1.
               end of iznew.
    now when you are calculating the value of ed1,
    you can pass the corresponding value of  ed1 and modify table iznew.
    eg
    loop at iznew.
    iznew-ed1 = ed1.
    modify iznew.
    endloop.

  • Update table a columns using columns from table b (values of 2 columns of table b need to taken from table c)

    Guys,
    I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
    Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
    table a and table b has col1 and col2 in common.
    i am trying something like this.
    Update a
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from table_c c where c.col2=b.col5),
    a.col6 = (select col1 from table_c c where c.col2=b.col6)
    from table_A a inner join table_b
    on  a.col1=b.col1 and a.col2=b.col2
    can someone help me reframe above update query?
    thanks in advance for your help.

    Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
    create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableA values(1,2,3,4,5,6)
    create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableB values(1,2,30,40,50,60)
    create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableC values(100,50,30,40,2,2)
    --Insert into tableC values(200,50,30,40,2,2)
    Insert into tableC values(100,60,30,40,2,2)
    Select * From tablea
    Update a Set
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
    a.col6 = (select col1 from tablec c where c.col2=b.col6 )
    from tableA a inner join tableb b
    on a.col1=b.col1 and a.col2=b.col2
    --Update a Set
    --a.col3 = b.col3,
    --a.col4 = b.col4,
    --a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
    --a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
    --from tableA a inner join tableb b
    --on a.col1=b.col1 and a.col2=b.col2
    Select * From tablea
    Drop table tablea,Tableb,TableC

Maybe you are looking for