Mixed Data Type Table Control for Data Entry
Hi Guys --
I'm attempting to do error-checked data entry,
My data is mixed: path, boolean, and numeric. The natural organization is an array of clusters. For instance, the cluster element would look like "path, boolean, numeric, numeric" and I would have many rows of this data cluster. To further complicate things I have to dynamically define the number of numeric elements in the cluster (tricky already) and also dynamically define the length of the array.
I find the table control to be ideal to handle the dynamic nature of the data for editing. I can easily use scroll bars to navigate to the appropriate part of the data. I can delete rows and columns etc.
On the other hand, the table can only handle string data. I find that doing data checking and type conversion on the table elements to be extremely cumbersome.
I think what I'm looking for is a Table Control with ability to handle controls as elements. From what I've read in this list and personally experienced, that functionality doesn't exist.
Does LV have in-built functionality that I'm overlooking to resolve this problem? Is there a third-party library that would do the job?
Thanks,
John
Hi Ben --
I think perhaps that I wasn't clear in my description.
As I pointed out, my data is organized naturally as an Array of Clusters. More descriptively, my data looks like spreadsheet data; some text, some numbers. I need to add rows and columns dynamically. I need to be able to resize column widths dynamically... and while the program is executing.
The Table Control does all of this. The intuitive way that the Table Control permits a user to enter data is also good for my user. The Array of Cluster data looks like spreadsheet data and a Table looks close enough to a spreadsheet. A Table permits one to insert and delete rows, resize columns widths, and scroll around.
I don't see that I get these features with an Array of Clusters Control.
The issue with the Table Control is the lack of in-built data types, so I spend an inordinate amount of time doing type-conversion and range-checking.
At this point I'm pretty much convinced that LV doesn't have the in-built capability that I'm looking for.
I am curious if there are any LV libraries or Active-X controls somewhere that would implement the functionality that I require?
Similar Messages
-
Data Type mismatch in for all entries.
Dear Friends,
I have a problem...please advice me for that..... I m using code as following...actually the isse is when ever i am using
WHERE docno = it_j_1iexchdr-rdoc (along with FOR ALL ENTRIES IN) the error is occured data type mismatch.
becoz DOCNO is field of(j_1iexchdr) and RDOC is a character field of same table...but i want to get reference data..so i need to compare both field...u can undersdand my requirement in following coding.. Error line is denoted by (<----
DATA: BEGIN OF it_j_1iexchdr OCCURS 0,
bukrs LIKE j_1iexchdr-bukrs, " Company Code.
exnum LIKE j_1iexchdr-exnum, " Excise Invoice No.
exdat LIKE j_1iexchdr-exdat, " Excise Invoice Dt.
kunag LIKE j_1iexchdr-kunag, " Sold-to-party
kunwe LIKE j_1iexchdr-kunwe, " Ship-to-party
rdoc LIKE j_1iexchdr-rdoc,
rdoc TYPE j_1iexchdr-docno,
addldata1 LIKE j_1iexchdr-addldata1, " Reason for Issueing Excise Invoice
exbed LIKE j_1iexchdr-exbed, " Excise Duty
ecs LIKE j_1iexchdr-ecs, " 2%Cess
exaddtax1 LIKE j_1iexchdr-exaddtax1, " Shec
trntyp LIKE j_1iexchdr-trntyp, " OTHR
END OF it_j_1iexchdr.
DATA: wa_j_1iexchdr LIKE it_j_1iexchdr.
DATA: BEGIN OF it_j_1iexchdr1 OCCURS 0,
trntyp LIKE j_1iexchdr-trntyp,
docno LIKE j_1iexchdr-rdoc,
rdoc LIKE j_1iexchdr-rdoc,
END OF it_j_1iexchdr1.
DATA: wa_j_1iexchdr1 LIKE it_j_1iexchdr1.
SELECT bukrs exnum exdat kunag kunwe rdoc
addldata1 exbed ecs exaddtax1 trntyp
FROM j_1iexchdr
INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr
WHERE bukrs IN v_bukrs
AND exdat IN v_exdat
AND trntyp = 'OTHR'.
IF it_j_1iexchdr[] IS NOT INITIAL.
SELECT trntyp docno rdoc
FROM j_1iexchdr
INTO CORRESPONDING FIELDS OF table it_j_1iexchdr1
FOR ALL ENTRIES IN it_j_1iexchdr
WHERE docno = it_j_1iexchdr-rdoc <----
I
AND trntyp = 'DLFC'.
ENDIF.
Pl help me as soon as possible...
Thanks & Regards,
Swapnika PanseHi,
In table j_1iexchdr, there are two fields
RDOC J_1IRDOC1 CHAR 10 Reference Document 1
DOCNO J_1IDOCNO NUMC 10 Internal Excise Document Number
RDOC is of character type and DOCNO is of numeric type.
Your declaration for fields is :
docno LIKE j_1iexchdr-rdoc,
rdoc LIKE j_1iexchdr-rdoc,
And in the select query you are trying to fetch docno which is of type j_1iexchdr-rdoc. SO, change your declaration from
docno LIKE j_1iexchdr-rdoc,
to
docno LIKE j_1iexchdr-docno,
This should solve your problem.
Thanks,
Archana -
How to add rows in table control for data recording BDC?
hello,
pl tell me the way to upload data through BDC in table control of screen .
how to add fields inrecording of table control?
Please give some code in this regard.
I am generous in giving points..pl help!Hi,
While doing code under recording first you need to do the recording with sample data under a particular transaction like T-code XK01 (Vendor creation).
Take an example of create vendor using T-code XK01:
Go to t-code 'SHDB' under make recording for XK01 with sample data and once if you complete the recording means after vendor creation check the source code bye by pressing the button 'Program', it shows the total coding for recording of what you entered the test data.
Then you will create one program and copy that source code of recording into your program, and now you have to remove the values at perform statement and give the internal table field name.
Like that you can develop your own code along with your validations.
my best suggestion is dont see the example code of recording method because any one for standard t-code should get the code from recording with sample data, so first tryout with your own recording method and you can understand the code step by step.
With these I hope you will get some idea of recoding method.
Let me know for further doubts.
Regards,
Vijay. -
How to insert data into table control
hi experts,,
i have inserted data into data base table through table control .
now i want to insert data into table control through database table.
how to delete data from table control for selected rowHi
go through this link.
http://www.****************/Tutorials/ABAP/TableControl/Demo.htm -
Data in table control not seen for the Standard Transaction Iview
Hi
I am creating one Standard Transaction Iview for CATS .
While doing print preview in IE 6 , I am not able to see data in Table control(Data Entry Area ).
Can you please provide me the solution for how I can see the data in Table Control
Regards
RuturajHi David,
I too struggled a lot to find the solution ....atlast got it....It possible by exporting and importing the table control values to Database Index.
1. AT SELECTION SCREEN OUTPUT event triggers when you SAVE and GET the variant.
2. So write the logic in AT SELECTION-SCREEN OUTPUT event.
CONSTANTS: c_vari TYPE char30 VALUE
'(SAPLSVAR)RSVAR-VARIANT'.
FIELD-SYMBOLS: <lfs_vari> TYPE ANY.
ASSIGN: (c_vari) TO <lfs_vari>.
IF sy-subrc = 0.
IF <lfs_vari> IS NOT INITIAL.
IF ok_code = 'SPOS'.
EXPORT gt_chars[] TO DATABASE vari(tc) ID <lfs_vari>.
ELSEIF ok_code = space.
IMPORT gt_chars[] FROM DATABASE vari(tc) ID <lfs_vari>.
ENDIF.
ENDIF.
ENDIF.
In the above logic if OK_CODE is 'SPOS', that is for saving the variant with the name <lfs_vari>.
Similarly if the OK_CODE is other than, 'GET'....that is for retrieving the variant. But in case of getting the variant OK_CODE is not filled with 'GET', but variant will be filled. We should take variant filling as base and do as done above.
It worked for me..... -
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> -
Problem in changing(updating) the data in table control
Dear ABAP Experts,
I have a screen with 2 tables fields. 1st table(ZESTHEADER) fields are normal fields in the screen.
2 nd table fileds(ZESTDETAILS) are table control fields in the same screen .
Now i can update the 1st table fields(ZESTHEADER) succesfully But 2 nd table fields(ZESTDETAILS) are not at all updating. please review the below code and let me knwo where iam wrong.
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
loop at itab1 with control VCONTROL CURSOR VCONTROL-CURRENT_LINE.
MODULE STATUS_0100.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
loop at itab1.
endloop.
module mod1.
module user_exit.
CODE:
PROGRAM ZEST_HEADER2 message-id ymsg.
tables: zestheader,zestdetails.
data: itab like zestheader occurs 0 with header line.
data: itab1 like zestdetails occurs 0 with header line.
controls: vcontrol type tableview using screen '100'.
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'ENTR'.
refresh itab.
select * from ZESTHEADER INTO ITAB where ESTMATE_NBR = ZESTHEADER-ESTMATE_NBR.
append itab.
endselect.
if itab is not initial.
refresh itab1.
SELECT * FROM ZESTDETAILS INTO table ITAB1 for all entries in itab wHERE ESTMATE_NBR = itab-ESTMATE_NBR.
select * from zestdetails INTO ITAB1 where ESTMATE_NBR = itab-ESTMATE_NBR.
append itab1.
endselect.
endif.
when 'UPDA'.
move zestheader to itab.
append itab.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
update zestdetails from table itab1.
append itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZESTCHNG'.
SET TITLEBAR 'ZESTCHNG2'.
MOVE-CORRESPONDING ITAB TO ZESTHEADER.
MOVE-CORRESPONDING ITAB1 TO ZESTDETAILS.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE User_exit INPUT.
case sy-ucomm.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " User_exit INPUT
*& Module mod1 INPUT
text
MODULE mod1 INPUT.
ENDMODULE. " mod1 INPUTHi Ramesh,
For performance : Change the code.
1. select * from ZESTHEADER INTO table ITAB
where ESTMATE_NBR = ZESTHEADER-ESTMATE_NBR.
2. if itab is not initial.
refresh itab1.
SELECT * FROM ZESTDETAILS INTO table ITAB1
for all entries in itab wHERE ESTMATE_NBR = itab-ESTMATE_NBR.
append itab1. No need of append itab1 here.
3.This part i am not able to under stand.
when 'UPDA'.
move zestheader to itab.
append itab.
Above code by writing move zestheader to itab" how data will move from database table"
***In below code without loop how you are moving data to internal table itab1.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
update zestdetails from table itab1.
append itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
I think you have not pasted full code -
How to populate data in table control .
hi all,
i put matnr no. in screen no. 103
validation is done at that screen only.
now when i want to modify dat record
when i put matnr no. at screen 103
so how i will get all data of dat number to table control screen.Hi Darshan,
Here is a detailed description of how to update data in table controll.
Updating data in table control
The ABAP language provides two mechanisms for loading the table control with data from the internal table and then storing the altered rows of the table control back to the internal table.
Method 1: Read the internal table into the Table Control in the screenu2019s flow logic. Used when the names of the Table Control fields are based on fields of the internal table.
Method 2: Read the internal table into the Table Control in the module pool code. Used when the names of the Table Control fields are based on fields of the database table.
Method 1 (table control fields = itab fields)
In the flow logic we can read an internal table using the LOOP statement. Define the reference to the relevant able control by specifying WITH CONTROL <ctrl>
Determine which table entry is to be read by specifying CURSOR <ctrl>-CURRENT_LINE.
After the read operation the field contents are placed in the header line of the internal table. If the fields in the table control have the same name as the internal they will be filled automatically. Otherwise we need to write a module to transfer the internal table fields to the screen fields.
We must reflect any changes the user makes to the fields of the table control in the internal table otherwise they will not appear when the screen is redisplayed after PBO processing, (eg, after the user presses Enter or scrolls) However, this processing should be performed only if changes have actually been made to the screen fields of the table control (hence the use of the ON REQUEST)
PROCESS BEFORE OUTPUT.
LOOP AT ITAB_REG WITH CONTROL TCREG
CURSOR TCREG-CURRENT_LINE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
MODULE MODIFY_ITAB_REG.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2 (table control fields = dict. fields)
If using a LOOP statement without an internal table in the flow logic, we must read the data in a PBO module which is called each time the loop is processed.
Since, in this case, the system cannot determine the number of internal table entries itself, we must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TCREG.
MODULE READ_ITAB_REG.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG
ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE READ_ITAB_REG OUTPUT.
READ TABLE ITAB_REG INDEX TCREG-CURRENT_LINE.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING ITAB_REREG TO TCREG.
ELSE.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
MODIFY ITAB_REG INDEX
TCREG-CURRENT_LINE.
ENDMODULE.
Updating the internal table
Method 1
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: TCREG-REG,
TCREG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Updating the database
MODULE USER_COMMAND_100.
CASE OK_CODE.
WHEN u2018SAVEu2019.
LOOP AT ITAB-REG.
CHECK ITAB_REG-MARK = u2018Xu2019.
MOVE-CORRESPONDING ITAB_REG TO TCREG.
UPDATE TCREG.
ENDLOOP.
WHEN u2026
u2026
ENDCASE.
ENDMODULE.
Hope this will solve your problem.
Regards,
Pavan.
Edited by: PAVAN CHANDRASEKHAR GANTI on Aug 3, 2009 12:48 PM -
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 Populate Internal table data to Table Control in a Report Program
Dear All,
How to Populate Internal table data to Table Control in a Report Program? It is a pure report program with out any Module pool coding involved, which is just used to display data. Till now it is being displayed in a report. Now the user wants the data to be displayed in a table control. Could someone tell me how to go about with this.
Thanks in Advance,
Joseph ReddyIf you want to use a table control, you will need to create a screen.
In your report....
start-of-selection.
perform get_data. " Get all your data here
call screen 100. " Now present to the user.
Double click on the "100" in your call screen statement. This will forward navigate you to the screen. If you have not created it yet, it will ask you if you want to create it, say yes. Go into screen painter or layout of the screen. Use the table control wizard to help you along the process. It will write the code for you. Since it is an output only table control, it will be really easy with not a lot of code.
A better way to present the data to the user would be to give it in a ALV grid. If you want to go that way, it is a lot easier. Here is a sample of the ALV function module. You don't even have to create a screen.
report zrich_0004
no standard page heading.
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of imara.
* Selection Screen
selection-screen begin of block b1 with frame title text-001 .
select-options: s_matnr for imara-matnr .
selection-screen end of block b1.
start-of-selection.
perform get_data.
perform write_report.
* Get_Data
form get_data.
select mara~matnr makt~maktx
into corresponding fields of table imara
from mara
inner join makt
on mara~matnr = makt~matnr
where mara~matnr in s_matnr
and makt~spras = sy-langu.
endform.
* WRITE_REPORT
form write_report.
perform build_field_catalog.
* CALL ABAP LIST VIEWER (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
tables
t_outtab = imara.
endform.
* BUILD_FIELD_CATALOG
form build_field_catalog.
data: fc_tmp type slis_t_fieldcat_alv with header line.
clear: fieldcat. refresh: fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material Number'.
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
fc_tmp-col_pos = 2.
append fc_tmp to fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material'.
fc_tmp-fieldname = 'MAKTX'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '40'.
fc_tmp-col_pos = 3.
append fc_tmp to fieldcat.
endform.
Regards,
Rich Heilman -
How to show data through table control
Hi Experts,
I have created an table control through wizard using table EKKO.
I have to populate one internal table( type ekko ), and then show it in output through table control.
Please advise, how to do that and in where i have to write the codes.
I will reward points for every suggestion
Thanks in advance.
regardshi saubrab,
This is kiran kumar.G.I am sending some sample code to populate data into table control check it once.
i will give input in 100 screen. and display table control in 200 screen.check it once once ..ok....
SE38 :(CODE)
*& Module pool YMODULEPOOL_TABLECONTROL1 *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : TABLE CONTROL DEMO *
*& CREATION DT : 17/12/2007 *
*& T.CODE : YMODTABLECONTROL1 *
*& REQUEST : ERPK900035 *
PROGRAM ymodulepool_tablecontrol1.
Tables
TABLES: yvbap, "Sales Document: Item Data
vbak. "Sales Document: Header Data
Controls
CONTROLS: my_table TYPE TABLEVIEW USING SCREEN 200.
Global Variables
DATA: gv_lines TYPE i,
gv_lines1 type i,
gv_temp type i,
gv_flag(20) TYPE c VALUE 'DISP',
gv_mode1 TYPE c,
gv_mode TYPE c VALUE 'C'. " C: Change, D :Display
Internal Table
DATA: BEGIN OF gt_item OCCURS 0,
vbeln LIKE vbap-vbeln, "Sales Document Number
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
cflag, "Deletion Indicator
END OF gt_item.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTABLECONTROL' OF PROGRAM 'YMODULEPOOL_TABLECONTROL'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'DISP'.
SELECT single vbeln
erdat
angdt
bnddt
FROM vbak
INTO (vbak-vbeln,vbak-erdat,
vbak-angdt,vbak-bnddt)
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*Fetch the table control data and place them in Internal Table
SELECT vbeln
posnr
matnr
matkl
arktx
FROM yvbap
INTO TABLE gt_item
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*NO OF line in the Internal Table
DESCRIBE TABLE gt_item LINES gv_lines.
my_table-lines = gv_lines + 20.
ENDIF.
ENDIF.
*Call Screen 200.
SET SCREEN 200.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
*Exit from the Program
CALL TRANSACTION 'SESSION_MANAGER'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
module STATUS_0200 output.
SET PF-STATUS 'ZTABLECONTROL1'.
endmodule. " STATUS_0200 OUTPU
*& Module copy_data OUTPUT
text
module copy_data output.
*Fetch the current line data from the Table control
read table gt_item index my_table-current_line.
if sy-subrc eq 0.
*Populating data into screen fields
gt_item-vbeln = gt_item-vbeln.
gt_item-posnr = gt_item-posnr.
gt_item-matnr = gt_item-matnr.
gt_item-matkl = gt_item-matkl.
gt_item-arktx = gt_item-arktx.
endif.
SE51:CODE (SCREEN 100)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
SE51 :CODE (SCREEN 200)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
loop at gt_item with control my_table cursor my_table-current_line.
module copy_data.
endloop.
PROCESS AFTER INPUT.
loop at gt_item.
MODULE USER_COMMAND_0200.
endloop.
HAVE A NICE DAY..
Award points if helpful,kiran kumar.G -
How to use same Data Type and Length for two fields
How to use same data type and length for two fields when using 'FOR ALL ENTRIES IN' in a select statement? For instance the select queries are :
SELECT bukrs gjahr belnr lifnr budat bldat zlspr dmbtr waers shkzg
FROM bsik
INTO TABLE it_bsik
WHERE bukrs = p_bukrs
AND lifnr IN s_lifnr.
IF it_bsik IS NOT INITIAL.
SELECT belnr gjahr awkey awtyp
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsik
WHERE belnr = it_bsik-belnr
AND gjahr = it_bsik-gjahr.
IF it_bkpf IS NOT INITIAL.
SELECT belnr gjahr lifnr xblnr
FROM rbkp
INTO TABLE it_rbkp
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-awkey+0(10)
AND gjahr = it_bkpf-awkey+10(4).
ENDIF.
ENDIF.
Here it gives an error in the 3rd select query that 'When you use the addition "FOR ALL ENTRIES IN itab", the fields "GJAHR" and "IT_BKPF2-AWKEY+10(4)" must have the same type and the same length.'
Kindly clarify.Hi Saurabh,
Please see the example code that I have developed for you. It will help you solve the problem.
REPORT ZTEST_3 .
tables : BKPF.
data : begin of it_bkpf occurs 1,
belnr type RE_BELNR,
awkey type awkey,
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf.
data : begin of it_bkpf1 occurs 1,
belnr type RE_BELNR,
awkey type gjahr, " change the data type
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf1.
data : begin of it_rbkp occurs 1,
belnr type BELNR_D,
gjahr type gjahr,
lifnr type LIFRE,
xblnr type XBLNR,
end of it_rbkp.
select belnr
awkey
awtyp
gjahr
from bkpf
into table it_bkpf
where BUKRS = 'TELH'.
loop at it_bkpf.
it_bkpf1-belnr = it_bkpf-belnr.
it_bkpf1-awkey = it_bkpf-awkey+10(4). "Here only append the required length.
it_bkpf1-awtyp = it_bkpf-awtyp.
it_bkpf1-gjahr = it_bkpf-gjahr.
append it_bkpf1.
clear it_bkpf1.
endloop.
select belnr
gjahr
lifnr
xblnr
from RBKP
into table it_rbkp
for all entries in it_bkpf1
where belnr = it_bkpf1-belnr
This is just an example. Change the fields according to your requirement.
Regards
Abhii
Edited by: Abhii on Mar 9, 2011 9:08 AM -
How to modify data in table control
hi
i have created table control where i have displayed data into table control
logic used
screen 200
PROCESS BEFORE OUTPUT.
MODULE SELECT_RECORD.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_200'
MODULE TBC_200_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
LOOP AT IT_MARA
INTO WA_MARA
WITH CONTROL TBC_200
CURSOR TBC_200-CURRENT_LINE.
MODULE TBC_200_GET_LINES.
*&SPWIZARD: MODULE TBC_200_CHANGE_FIELD_ATTR
ENDLOOP.
MODULE STATUS_0200.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_200'
LOOP AT IT_MARA.
CHAIN.
FIELD WA_MARA-MATNR.
FIELD WA_MARA-ERSDA.
FIELD WA_MARA-ERNAM.
MODULE TBC_200_MODIFY ON CHAIN-REQUEST.
ENDCHAIN.
FIELD WA_MARA-MARK
MODULE TBC_200_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_200_USER_COMMAND.
*&SPWIZARD: MODULE TBC_200_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
module -
MODULE SELECT_RECORD.
MODULE SELECT_RECORD OUTPUT.
SELECT MATNR ERSDA ERNAM
FROM MARA
INTO CORRESPONDING FIELDS OF TABLE it_mara.
ENDMODULE. " SELECT_RECORD OUTPUT
and
another thing
i have made field MARA-ERSDA. and FIELD WA_MARA-ERNAM editable by
input possible using layout
so
now those 2 fields contents are editable
i want to know how to edit and save the data
some body guide.
and i want to put the lock so that i can update
can tell how to implement lock.
Thanks
Edited by: viju bangalore on Jan 27, 2011 10:40 AMHi Viju,
In PAI do something like this
LOOP AT itab.
MODULE mod_table_control.
ENDLOOP.
MODULE user_command_0100.
at module mod_table_control put this
MODULE mod_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
if sy-subrc ne 0.
insert itab.
endif.
ENDMODULE.
for saving you can create at custom gui status with a save button, and at MODULE user_command_0100 save the data. -
ERROR OGG-01148 programming error, data type not supported for column
I am getting following error when I put null in insert statement
2011-03-31 18:30:45 ERROR OGG-01148 programming error, data type not supported for column TXID in table advoss.tblaudittrail.
I am replicating MySQL 5.5.9 to Oracle 11g rel2 via goldengate 11I am able to diagnose what is cuasing the problem
unsigned flag was the culprit of this error
I am able to insert null after removing unsigned flag.
thank you very much for your kind support -
Table Name for Date Profile & SLA
Hi,
What is the table name for Data Profile / Date Type etc and also for SLA tables?
Rgds,
VR.Hi
here are the table for date profile, service profile and response profiles.
1. Date profile:- CRMC_DATES_PRF
2. Service profile:- crmd_serwi
3. Response profile :-crmd_escal
Regards
Naresh
Maybe you are looking for
-
I'm FURIOUS with Verizon and this is my LAST straw before I goto another company!
I am writing this in hopes that I can resolve an ONGOING issue that I have addressed many times in the past with different levels of Verizon Wireless "customer service". I have 1 phone call recorded(same way I am being recorded when I call in for tr
-
Hi Experts, We have implemented the BADI ME_PROCESS_PO_CUST to perform some checks and block the PO creation when there is any error in the method CHECK. The error messages are being triggered as expected. The issue is that we get the pop-up with th
-
Hi i want to exit the program if no file found by FM call file_get name
HI I am calling a function module which is picking up a file from utility server presently its giving error message that if no file found it propts for error msg no file found or file could not be opened i suppose its coming by the FM only now i wan
-
I'm pretty new to this, so I appreciate any help in advance. I have imported a clip. I can see it and hear it fine. I've made in & out edit points and can drag it around (copy it etc.) on the timeline. But here's the odd thing... I can hear it when t
-
http ://lazyfirefox .co .cc/ is this a valid firefox webpage? I opened a new page to do a search and what looked like an authentic notification from firefox said I needed to update my flash. After clicking on the update and download, I didn't notice