Accessing data from Table control
Hi,
I created a table control using report program and i am trying to enter data in the table control which i want to update in the DB table. How can i get the data entered in table control to the report program, so that i can update the DB table.
Please help me finding out which variable will hold the data entered in table control(dynamically).
hi gautham,
1. While designing set the table control as input field.
2. In ur program create an internal table, with the same structure as your table control.
3. Whenever an entry is made in the table control, modify your internal table.
4. While saving use the internal table data to update the custom table.
If internal table name is same in both screen painter(table control) and in the program then the values will automatically come into the internal table in the program with out programming.
Otherwise we have programtically transfer the values.
In the PAI event using move or move-corresponding statement.
Check the program *RSDEMO02*
check the links
http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/content.htm
Yogesh N
Similar Messages
-
Can I create a Stored Procedure That access data from tables of another servers?
I'm developing a procedure and within it I'm trying to access another server and make a select into a table that belongs to this another server. When I compile this procedure I have this error message: " PLS-00904: insufficient privilege to access object BC.CADPAP", where BC.CADPAP is the problematic table.
How can I use more than one connection into an Oracle Stored Procedure?
How I can access tables of a server from a Stored Procedure since the moment I'm already connected with another server?
Can I create a Stored Procedure That access data from tables of another servers?You need to have a Database Link between two servers. Then you could do execute that statement without any problem. Try to create a database link with the help of
CREATE DATABASE LINK command. Refer Document for further details -
Sample pgm for moving data from table control to internal table
Hi Experts,
I am newbi to ABAP. I don't have good material for Table control . Appreciate if you direct me to some good source of knowledge on Table control.
The problem at hand : I am trying to move info/data from table control (in screen painter/ input and output mode ) to ITAB but couldn't . Sample pgm if possible.
<b>Modify ITAB index TC-Current_Line .</b>
The above statement is not inserting new lines to ITAB . Help me!
Thanks for your timehi,
do like this...
<b>PROCESS AFTER INPUT.</b>
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'
LOOP AT itab_det.
CHAIN.
FIELD itab_det-comp_code.
FIELD itab_det-bill_no.
FIELD itab_det-bill_date.
FIELD itab_det-vend_cust_code.
FIELD itab_det-bill_amt.
MODULE <b>tab1_modify</b> ON CHAIN-REQUEST.
ENDCHAIN.
FIELD itab_det-mark
MODULE tab1_mark ON REQUEST.
ENDLOOP.
<b>MODULE tab1_modify INPUT.</b>
APPEND itab_det.
<b>ENDMODULE. "TAB1_MODIFY INPUT</b> -
Update internal table data from table control
Hi GURUS,
I need help regarding one of my requirement.
I need to display data from the internal table on the screen and when the user selects a record/multiple records from screen and clicks on approve button i need to update one of the field from N to Y in the corresponding Ztable. Once the record is updated from Ztable , that should no longer be visible for the user on the screen.
I am using table control wizard to display data. I am able to update the Ztable, but that record is not refreshing from the user screen. Any suggestions would be approved.
Also please let me know if table control is the best way to do this/ alv grid control??hi
REFRESH CONTROL Control-Name FROM SCREEN '0100' -> use this command to refresh the table control
to know more, read into
https://forums.sdn.sap.com/click.jspa?searchID=2934287&messageID=673474
Re: URGENT HELP REQ IN TABLE CONTROL WIZARD
if helpful, reward
Sathish. R -
How to clear data from Table-Control
Hi all,
I am working on table control. I have some data on the table control.
When I press the 'Cancel' button, I require that the table-control should be cleared.
I tried using REFRESH CONTROL TC01 USING SCREEN 1001. But, the data doesn't get cleared.
Please advise.
Regards,
Saurabh Buksh.hi
good
try this example
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
thanks
mrutyun^ -
Reading data from table control in an internal table
Hello All,
I want to read the data entered in the screen in an internal table,screen has header segment fields of an idoc and two item segment fields with multiple occurance in form of two table control,have to read both the table control and have to pass it to idoc inbound function based on postion(posnr) of the order. can anyone provide me with the sample code for the same .
Thanks and Regards,
Gunjanhi gunjan
refer to the folllowing code. it will work for u
Creation of an IDoc generation program
The following code extract contains everything needed to generate an IDoc from data contained in a table.
FORM F_110_SEND_IDOC.
CONSTANTS:
C_MESTYP TYPE EDIDC-MESTYP VALUE 'ZVISTAPM',"message type
C_DOCTYP TYPE EDIDC-IDOCTP VALUE 'ZVISTAPM01',"idoc type
C_SEGNAM TYPE EDIDD-SEGNAM VALUE 'Z1VISTAPM'."segment name
DATA:
I_ZVISTA_PM TYPE ZVISTA_PM_T OCCURS 6000,
I_EDIDC TYPE EDIDC OCCURS 0,
I_EDIDD TYPE EDIDD OCCURS 0,
WA_ZVISTA_PM TYPE ZVISTA_PM_T,
WA_EDIDC TYPE EDIDC,
WA_EDIDD TYPE EDIDD,
WA_Z1VISTAPM TYPE Z1VISTAPM,
V_OCCMAX TYPE IDOCSYN-OCCMAX,
V_NBSEG TYPE I.
CLEAR WA_ZVISTA_PM.
CLEAR WA_EDIDC.
* Save the message type and the basic IDoc type
* in the control segment
MOVE C_MESTYP TO WA_EDIDC-MESTYP.
MOVE C_DOCTYP TO WA_EDIDC-IDOCTP.
* Retrieve the maximum number of segments in the basic IDoc
* type
SELECT MIN( OCCMAX )
FROM IDOCSYN
INTO V_OCCMAX
WHERE IDOCTYP EQ C_DOCTYP AND SEGTYP EQ C_SEGNAM.
* Save the whole ZVISTA_PM_T table content
* in the I_ZVISTA_PM internal table.
SELECT *
FROM ZVISTA_PM_T
INTO CORRESPONDING FIELDS OF TABLE I_ZVISTA_PM.
* Create a data segment for each line of I_ZVISTA_PM
LOOP AT I_ZVISTA_PM INTO WA_ZVISTA_PM.
MOVE-CORRESPONDING WA_ZVISTA_PM TO WA_Z1VISTAPM.
CLEAR WA_EDIDD.
MOVE C_SEGNAM TO WA_EDIDD-SEGNAM.
MOVE WA_Z1VISTAPM TO WA_EDIDD-SDATA.
APPEND WA_EDIDD TO I_EDIDD.
CLEAR WA_ZVISTA_PM.
CLEAR WA_Z1VISTAPM.
ENDLOOP.
* Count the number of data segments
DESCRIBE TABLE I_EDIDD LINES V_NBSEG.
* If the number of data segments exceeds the maximum
* allowed number, then edit a message in the spool,
* then display an error message (quit the program)
IF V_NBSEG GT V_OCCMAX.
WRITE:/ TEXT-003, V_OCCMAX.
MESSAGE E751.
ENDIF.
* Call the IDoc creation function
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = WA_EDIDC
TABLES
COMMUNICATION_IDOC_CONTROL = I_EDIDC
MASTER_IDOC_DATA = I_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5.
* If there was an error, display a message (quit the
* program)
IF SY-SUBRC NE 0.
MESSAGE E746.
ENDIF.
ENDFORM.
regards
ravish
<b>plz dont forget to reward points if useful</b> -
Reading the data from table control and write log.
Hi all,
In va01 trasaction i have table control 'All item'.
I want to write value of some columns,( Article no, Order, plant ) so on into ecatt Log file after saving the trasction, for all rows which is having article no.
Is there any possibility in eCATT with going to GETGUI function which is static to spacefic field.
Regards,
SreeHi Sreedhar,
There are two types of variable values you find in transactions, one system generated(generally the unique values) and then the static field values..
When you want to go for the static field values you can use GETGUI. You can use the same GETGUI n number of times according to the situation(like in loops etc) and for the system generated messages we can handle them from the message blocks.
MESSAGE.
ENDMESSAGE.
In the message block make a rule for the message that you are expecting like
'E' MSGNR(the message number) and give a variable in the fields MSGV1/MSGV2 where ever you are getting the unique generated value(according to the log) and you can use that variable for LOG purpose..
Confirm me whether you were looking for this or something else.
Best regards,
Harsha -
How to retrieve data from Table Control
Hi,
I am a Beginner to ABAP. I want to know how to fetch the selected rows from Screen table control.
Here is my scenario:
I am having one table control with selection field. Once i select some rows means the selected rows are going to be stored in one Internal Table.
If any body knows the thing means please reply me the logic as well as giving me some code sample.
Thankyou.Hi Mithun,
Try to implement this code in your requirement.
There will be some button on your screen and after selecting some or all the records from the table control you must be pressing some button for collecting the selected rows from the table control too your internal table.
Put Fcode of that button in WHEN condition in this CASE.
CONSTANTS: kc_sel_flag TYPE char01 VALUE 'X'.
CASE sy-ucomm.
WHEN kc_sel.
PERFORM f_sel_desel USING kc_sel_flag.
ENDCASE.
FORM f_sel_desel
USING p_sel_desel TYPE c.
Set the value
wa_cond_type-z_sel = p_sel_desel.
Update the Itab.
MODIFY it_cond_type
FROM wa_cond_type
TRANSPORTING z_sel
WHERE mandt EQ sy-mandt. "Where cond is only to specify all
ENDFORM. " f_sel_desel
After that all the selected records will be having 'X' in the internal table.
Regards,
Mueksh Kumar -
Getting data from table control to the report program.
Hi,
I created a table control using report program and i am trying to enter data in the table control which i want to update in the DB table. How can i get the data entered in table control to the report program, so that i can update the DB table.
Please help me finding out which variable will hold the data entered in table control(dynamically).hi,
in your table control you give some name to that table control say it_cntrl.
this only serves as the internal table to process the table control data.
like u can write like this.
loop at it_cntrl into wa_cntrl. "wa_cntrl is work area of type it_cntrl table type
......... "do your functining
end loop.
any clarification get in touch
thnks -
Reading data from table control
Hi,
Intially I have a table control and in that I am entering deliveries(manually), how to read them into internal table..plz advise
regards.Hi,
Use the FM DYNP_VALUES_READ
Regards,
Vikranth -
Accessing data from tables P2050, P2051 and P2052
Hello all,
I am trying to access the data stored in P2050, P2051, and P2052. I cannot access this data directly. Is there a way to get this data through another tables??
Thanks
SLHI!
You have to trace the transaction, which fills these structures.
Use the transaction ST05 to sqltrace them.
1. Turn on SQL trace in ST05
2. Switch to an another modus with alt-tab, enter into the transaction
3. Navigate until you will see the required data on the screen
4. Go back to ST05 with alt-tab, deactivate trace, and show results. You'll see all read tables here.
Regards
Tamá -
Method to transfer data from Table control to Internal table
hi,
Hi,
I´m working with CL_GUI_ALV_GRID and use the following methods:
- CALL METHOD grid->set_table_for_first_display, to display my ALV;
- CALL METHOD grid->get_selected_rows, to select the rows.
But i have some fields that can suffer alterarions in the values...
How can i recoup this values from the screen? Is there any method to do this?
thnks.HI,
You neeed to handle the change event.
Example below...
Definition.
Code:
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_handler DEFINITION
Implement
Code:
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed.
CONSTANTS:
lc_wa(11) TYPE c VALUE '<LW_SDITM>-'.
DATA:
l_subrc TYPE sy-subrc,
l_variable TYPE string,
lw_good TYPE lvc_s_modi.
FIELD-SYMBOLS:
<lw_sditm> TYPE /powercor/sditm,
<lw> TYPE ANY. "Generic field symbol
LOOP AT er_data_changed->mt_good_cells INTO lw_good.
Update the internal table
READ TABLE t_item_sel ASSIGNING <lw_sditm> INDEX lw_good-row_id.
IF sy-subrc EQ 0.
CONCATENATE lc_wa lw_good-fieldname INTO l_variable.
ASSIGN (l_variable) TO <lw>.
IF sy-subrc EQ 0.
<lw> = lw_good-value.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Set for your grid.
Code:
SET HANDLER g_handler->handle_data_changed FOR my_grid.
Cheers,
Chandra Sekhar. -
Download and Upload Data from Table Control
Is there any FM other than WS_download to copy the contents of TC into an Excel Sheet and vica-versa.
Regards,
Ahasanhi,
try this FM
RH_START_EXCEL_WITH_DATA
Regards,
Krishna -
How to delete data in table control
Hi,
I am doing module pool programming. After the user enters the data in table control after saving the data. if the user wants to remove the line item the line item shd be removed from the screen and data base.
Please Give me vaulable Suggestions
RegardsHi,
Screen 8002 (with table control) --> select records --> press delete button --> delete selected records
Now you wan to delete those records selected by the user at runtime when DELETE button is clicked.
Take another internal table and work area same as the initial internal table and work area used in screen 8002 which is to be used to delete the selected data.
Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
You must have passed a code in PBO of the screen for reading internal table into the table control.
So it reads the internal table into the table control whenever you perform any action on use command.
All you need to do is to write a code to modify the internal table form the table control while performing any user action.
Remember to change the LINE SEL option in attributes of table control as MULTIPLE.
At screen logic,
PROCESS BEFORE OUTPUT.
MODULE status_8002. "for pf-status
LOOP WITH CONTROL po_tab. "po_tab is table control
MODULE pass_data. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8002. "for user command(back and exit)
LOOP WITH CONTROL po_tab.
MODULE modify_data. "to modify data from table control into table control
ENDLOOP.
MODULE delete. "to delete the selected records
In PBO,
*& Module STATUS_8002 OUTPUT
MODULE status_8002 OUTPUT.
SET pf-status 'ZAB_PFSTA'. " pf-status
DATA : line_count TYPE i.
DESCIRBE TABLE it_ekpo
LINES line_count.
po_tab-lines = line_count + 10.
" to make table control scrollable
ENDMODULE. " STATUS_8002 OUTPUT
*& Module PASS_DATA OUTPUT
MODULE pass_data OUTPUT.
READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE. " PASS_DATA OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*& Module MODIFY_DATA INPUT
MODULE MODIFY_DATA INPUT.
MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA INPUT
*& Module DELETE INPUT
MODULE DELETE INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'. "when delete button is clicked
SORT IT_EKPO BY FLAG DESCENDING. "sort by flag(selection column value)
CLEAR WA_EKPO1.
CLEAR WA_EKPO.
REFRESH IT_EKPO1.
LOOP AT IT_EKPO INTO WA_EKPO WHERE FLAG = 'X'.
DATA : J TYPE I.
CLEAR J.
J = SY-TABIX. "assign index value if a record is selected
MOVE-CORRESPONDING WA_EKPO TO WA_EKPO1. "append selected records to another
"work area and append to another internal table to delete
APPEND WA_EKPO1 TO IT_EKPO1.
DELETE IT_EKPO. "delete the selected records from initial internal table
" to reflect the changes on the table control
ENDLOOP.
IF J = 0.
MESSAGE I006. "if no record selected
ELSE. "if some records are selected
DELETE ZEKPO FROM TABLE IT_EKPO1. "delete from database table
COMMIT WORK.
IF SY-SUBRC = 0.
MESSAGE S007. "success message (records deleted)
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE. " DELETE INPUT
Now at PAI, you have delete records and these changes are reflected back to the internal table.
Now when PBO is executed it will again read the initial internal table and will not show the deleted records.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
How to clear data in Table Control.
hi! all
How to clear the data in table control.
i have a Table control which displays column A data from the previous screen and allows to enter column B and column C and i have a button CLEAR, when i click CLEAR button the Data displaying in table control has to be cleared. how to do it.
Regards,
NagulanHi,
Loop over the internal table of table control & clear data from table control.
loop at tctab.
clear tctab.
modify tctab.
endloop.
Best regards,
Prashant
Maybe you are looking for
-
My computer is running windows 7, it's an HP tx2z touch screen laptop. My mouse pad scroll doesn't work on firefox 4. Also some features seem to missing such as the condensed menu bar and tab sorting that was spoken about in the introduction to firef
-
First Play "Not Permitted" on Apple DVD player
I have some duplicated DVD-Rs of a project, and the client ha reported a disutrbing error. I've been told that on several different Macs running OS 10.2 - 10.4, not only does the disc not auto launch DVD player and not auto-play the first play menu,
-
In jsp:includes , is there a flush="false" in jsp 1.1
In <jsp:includes>, is there a flush="false" in jsp 1.1...i know that it's going to be in jsp 1.2 but is there something like it that i can use in jsp 1.1.
-
New internet is extremely slow!
I had an engineer come out and install a brand new 2nd line in my home. The 1st line (that is managed by talk talk) gets 8 mbit down and 1 mbit up. Why is my new second line so slow compared to the 1st (The BT line gets 0.57 down and 0.04 up) I was p
-
Hi all, I want to protect or hide a field that appear in the selection screen of the VL10A. I 'have look for a solution "around" the User Role or the Scenario, I suppose the solution is there but I can't find the right way. Thanks for your help.