Adding an extra line in the table control
Hi All,
How can we add an extra record in the table control after the user hits ADD button?We tried doing it by incrementing the lines field in the table control,but it is executing the PBO part again after hitting the ADD button.Any SAP standard program will be helpful.
Thanks,
Rakesh.
Hi,
I think you can do that by inerting new line to Internal table that used in your Table Control. Here the sample:
TC_DATA = Your Table Control
IT_DATA = Your Internal Table used for Table Control.
In your MODULE USER_COMMAND INPUT, add this code:
IF OK_CODE = 'ADD'.
CLEAR: IT_DATA.
APPEND IT_DATA.
ENDIF.
Regards,
Similar Messages
-
Copy more lines in the Table Control
Hi ,
I have created a table control in one of my mod pool programs,
I have to paste lines from Excel (for instance) to this table control, but it copies only to the lines in the table control which I see in the screen. if I have more lines to copy than the lines which I see in the screen, it doesn't copy it.
plz help me in this regard.......
Thanx
SHOAIB REHMANHi, Shoaib
I think you have to Program for this in Special Button like in Select-Option's (EXTENSION) Button Window you have an Button Upload from Clipboard (Shift + F12) just left side of the Cancel button.
For Copy data from Clipboard Check the Bellow Sample Code. (Copy data and Run the Bellow Code)
TYPES: BEGIN OF ty_char256,
line TYPE c LENGTH 256,
END OF ty_char256.
DATA: it_data TYPE STANDARD TABLE OF ty_char256,
wa_data LIKE LINE OF it_data,
length TYPE i.
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = it_data[]
length = length
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
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 it_data INTO wa_data.
write: wa_data-line.
ENDLOOP.
Please Reply if any Confusion.
Thanks and Regards,
Faisal -
How to find the current line in the table control in module pool ?
How to find the current line in the table control in module pool ?
This is an urgent requirement? please do help me.refer to 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<b> flights-current_line.</b>
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. -
How can we delete a line from the table control .
hi all
how can we delete a line from the table control .
situation is.
created table control in se51 which will display the data of a table.
how could i select a line from the table control ?
how could i delete the selected lines form the table.
thanks in advanceChange the Table Control attributes such that user can only select a single record(row).
<u>Tip to delete a selected record</u>
1) write a module 'Mark' in the PAI as below
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
LOOP WITH CONTROL table_view.
MODULE read_table_control.
FIELD flag MODULE mark ON INPUT.
ENDLOOP.
MODULE user_command_0100.
2) Module Mark is below.
MODULE mark INPUT.
CHECK flag = 'X'.
x = table_view-top_line + sy-stepl - 1.
Delete itab INDEX x.
ENDMODULE. " mark INPUT
Table_view is the TableControl Name.
'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
<u>award if uesful</u>
Regards,
Sudheer -
Copy selected lines in the table control
Hi friends,
I Have a screen 200 in which i have a button COPY and table control.
In my table control i have 6 lines of data.
now my requirement is when i select any lines ie : let us say i ahve selected 1 , 3 , 5 lines of my table control and when i click on the button COPY of that screen. i need those 3 selected lines 1 , 3 , 5 to be copied again in the table control
example :
line 1 selected
line2
line3 selected
line4
line5 selected .
line6
now my table control should be
line1
line2
line3
line4
line5
line6
line1
line3
line5
How can i do that
Regards
Priyanka.I have similar issue...i need help how to accomplish automatic addition on every line. example (see below)
this is how it looks right now
DATE EMPLOYEE DEPT JOB LOT OPER# LX_HRS OP_SETUP LX_TYPE COMPLETE
2/23/2009 M.Paquiao NB 1960 001 10 1.50 14.00 S NO
2/24/2009 1.00 14.00 S NO
2/25/2009 4.50 14.00 S NO
2/27/2009 3.00 14.00 S NO
2/28/2009 1.50 14.00 R YES
3/1/2009 2.00 14.00 R YES
this what I need it to do when I meant automatic addition of each line:
DATE EMPLOYEE DEPT JOB LOT OPER# LX_HRS OP_SETUP LX_TYPE COMPLETE
2/23/2009 M.Paquiao NB 1960 001 10 1.50 14.00 S NO
2/24/2009 2.50 14.00 S NO
2/25/2009 7.00 14.00 S NO
2/27/2009 10.00 14.00 S NO
2/28/2009 11.50 14.00 R YES
3/1/2009 13.50 14.00 R YES
As you can see everything is the same but on column LX_HRS, the first example one is not doing anything addition but on the second example is now doing addition. This additions were done manually, how can I tell crystal to add each line, in the example above, the
first example second example: (addition is involved)
date lx_hrs date lx_hrs
2/23/09 1.50 2/23/09 1.50
2/24/09 1.00 2/24/09 2.50 (sum of : 1.50 + 1.00 was added)
2/25/09 4.50 2/25/09 7.00 (sum of 2.50 (on date 2/24/09 & 4.50 from date 2/25/09 of the first example). -
How To delete the Chosen line from the Table Control
Hi Friends,
i am new to Module Pool Programming , i developed a Table Control in input mode and i am getting data also into that table control. my requirement is that i want to delete the current chosen line from that table control. please help me out.HI
GOOD
GO THROUGH THIS REPORT
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.
CHANGE THE CODE AS PER THIS LIGIC.
THANKS
MRUTYUN -
How to find out the selected line in the table control
Hi Guys,
i have a requirement like this. i have table control and the internal table for that table control as IT_CASE. this internal table i declared as CHECKBX, MATNR, QUANTITY. but when i am enter the values in the table control i am getting the values in MATNR and QUANTITY in the that internal table IT_CASE. but when iam selecting that that line iam not getting CHECKBOX as 'X' in that internal table IT_CASE. i declared the table control as CAS_CONTROL and in that i have given the "w/selcolum" property as IT_CASE-CHECKBOX. now i want to fill that CHECKBOX as 'X' inthat internal table IT_CASE whatever the lines we are selecting only for those lines i want to fill up as 'X' in that internal table.
Can you please suggest any one reg this.
Thanks in advance
RahulHello body,
You can give a name such as 'SEL' in w/selcol and declare SEL as char1. Then follow the coading.
in TOP.
data: sel type c.
PROCESS AFTER INPUT.
user_command_0011.
loop at <Your internal table>.
module get_data.
endloop.
Inside Module get_data.
if sy-ucomm = <Your Fcode>
if sel = 'X'.
<Your internal table>-<Field for checkbox> = 'X'.
append <Your internal table>.
endif.
endif.
I think your issue is resolved.
Regards.
S Mahanta. -
Dynamically picking the line item of table control
Hi all,
Can u suggest me a way to dynamically picking the no of line item in the table control displayed.
Regards,
Ashutosh KumarHi Ashutosh,
In BDC case, what you can do is use the "position button" instead of finding the number of lines on the table control.
Or else you can use call transaction with 'Options addition'
eg:
Call transaction parameters
clear gs_options.
<b> gs_options-defsize = 'X'. "Default size</b>
gs_options-dismode = 'N'.
gs_options-updmode = 'S'.
call transaction 'VI02' using t_bdcdata
"mode 'N'
"update 'S'
options from gs_options
messages into t_messages.
Please let us know why do you want to know the number of lines on the Table control.If the above answer doesn't satisfy you.
Regards,
Ravi -
How to handle the single line selection in table control
Hi All,
I am facing a problem in the table control of modulepool program.
I have line selection as "Single" in the table control attributes. But when i am selecting a line in the table control as long as it is in the same page,the line selection is single but when i am selecting the line in the next page,the previous selection is not deselected. So I am seeing two selection for "Single line selector" attribute.
Could any one help me solve this problem?
Thanks & Regards,
S.LakshmiHi Lakshmi,
Just Go to Table control , click on it , you can see the attributes screen , there you can see option for
<b>Line selection</b>
none
multiple selection
single selection
check the radio button single selection.
that will solve your problem..
regards
vijay -
How to fill listbox for some lines in a table control
I have a table control associated to a database table. I would like to enable several lines in the table control for the user to input data. I have a field defined as a listbox with key. In PBO -> I fill the listbox based on the value of field u201CAu201D. I execute a select using value of field u201CAu201D.
If I maintain module tc_zmovi_wm_change_tc_attr OUTPUT as the wizard created it:
MODULE tc_zmovi_wm_change_tc_attr OUTPUT.
DESCRIBE TABLE i_zmov_wm LINES tc_zmovi_wm-lines.
ENDMODULE.
I have no problem with the listbox ( it is filled normaly) but user has a unique line enabled in the table control to input data.
If I change the module in this way:
MODULE tc_zmovi_wm_change_tc_attr OUTPUT.
DATA: v_lineas type i.
tc_zmovi_wm-lines = v_lineas + 10.
ENDMODULE.
There are 10 lines enabled to input data for the user but the list is not filled whenever user filles field u201CAu201D.
How could I solve this problem?
Thanks.With this Eventcase the mouse down of the specified cell will be ignored
Attachments:
Table.png 28 KB -
How to get the Number of lines displayed in table control in bdc
Hi,
when we write a bdc for a standard transaction, if we encounter a table control, we fill the values for each record like field(01), and the second record field(02) .......and so on..
if only 3 records are displayed in the screen and if we have 5 records to be filled in the table control, how to write the logic for that?
how to track of how many lines are getting displayed in the table control .. again it depends on the screen resolution i think..
useful answers will be rewarded
shekharHi,
Here is the solution code for this :-
data for controlling paging on screen 0102
DATA: W_MAXLINES(2) TYPE N,
W_NEXT_LINE(3) TYPE N,
W_PAGE(1), "y = page forward, n otherwise
W_SCRLEN(2) TYPE I,
W_SCRLINE(2) TYPE I.
DATA: BEGIN OF W_HDR.
INCLUDE STRUCTURE D020S.
DATA: END OF W_HDR.
DATA: BEGIN OF W_FLD OCCURS 100.
INCLUDE STRUCTURE D021S.
DATA: END OF W_FLD.
DATA: BEGIN OF W_LOG OCCURS 20.
INCLUDE STRUCTURE D022S.
DATA: END OF W_LOG.
DATA: BEGIN OF W_MC OCCURS 20.
INCLUDE STRUCTURE D023S.
DATA: END OF W_MC.
DATA: BEGIN OF W_DYNPRONAME,
PROGRAM(8) VALUE 'SAPMM60X',
DYNPRO(4) VALUE '0102',
END OF W_DYNPRONAME.
FORM GET_MAX_LINES.
set w_maxlines to the number of var-loop occurrences on the screen so
that we know when to page forward on screen 0102
also initialise w_next_line to zero for GET_NEXT_LINE
this subroutine caters for all cases - including screens without loops
CLEAR: W_MAXLINES,
W_NEXT_LINE.
IMPORT DYNPRO W_HDR
W_FLD
W_LOG
W_MC
ID W_DYNPRONAME.
LOOP AT W_FLD WHERE LTYP EQ 'L'.
MOVE W_FLD-LINE TO W_SCRLINE. "first var-loop line
MOVE W_FLD-LBLK TO W_SCRLEN. "depth of loop block
EXIT.
ENDLOOP.
IF SY-SUBRC EQ 0
AND W_SCRLEN NE 0.
sy-srows = total no of lines on screen
w_scrline = actual first line of loop so that
w_scrline - 1 = number of heading lines (before loop)
4 = no of lines at top of screen - command line, pushbuttons, 2 ulines
3 = no of lines after loop - uline & Page count
w_scrlen = no of lines in loop block
w_maxlines = sy-srows - ( wscrline - 1 ) - 4 - 3
and then 1 less but not sure why!
W_MAXLINES = SY-SROWS - W_SCRLINE - 1 - 4 - 3.
W_MAXLINES = W_MAXLINES - 1.
W_MAXLINES = W_MAXLINES DIV W_SCRLEN.
ELSE.
MOVE 99 TO W_MAXLINES. "this required if no screen loop
ENDIF.
ENDFORM.
FORM GET_NEXT_LINE.
set w_page if page forward is required
W_NEXT_LINE = W_NEXT_LINE + 1.
IF W_NEXT_LINE GT W_MAXLINES.
W_NEXT_LINE = 1.
W_PAGE = 'Y'.
ELSE.
W_PAGE = 'N'.
ENDIF.
ENDFORM.
Hope it helps.
reward if helpful.
Regards,
Sipra -
After a PAI, I am not able to slect line items in the table control.
Dear All,
In GR55 Report;after a PAI triggered (by Enter button or vertical scroll bar), I am not able to select any line-items in the table control. If no PAI triggered, the I am able to select as much as line item..
Can anybody help me..
-Ullas Ubefore display, while debugging , after pai, it will go in pbo modules,
so there u need to check the structure screen for the variable select. u might have declare one variable like sel(1) type c,
these variable u have written in table control attributes in select variable as itab-sel.
so check in debugging first. -
How to transfer the contents of a line of a table control to second screen?
Hi,
I have a table control and I have entered some contents in one line of a table control .
When i click on this line and then click on the detail button on the screen , it should take me to another screen and whatever I have entered in the table control should be transferred to the second screen .
Please could anyone help me out with this .
Regards,
Sushanth H.S.Hi
U need to get the index of the line of table control by command GET CURSOR:
PROCESS PAI.
LOOP AT ITAB.
MODULE GET_CURSOR.
MODULE MODIFY_ITAB.
ENDLOOP.
MODULE USER_COMMAND.
Module to pick up the selected line:
MODULE GET_CURSOR.
GET CURSOR LINE VN_LINE.
ENDMODULE.
Module to transfer the data from table control to internal table:
MODULE MODIFY_ITAB.
ITAB-FIELD1 = <FIELD OF TABLE CONTROL>.
MODIFY ITAB INDEX <TABLE CONTROL>-CURRENT_LINE.
ENDMODULE.
U should considere the variable line has the value of the index of the line of table control, so u need to calculate the number of the corresponding line of internal table:
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'DETAIL'.
* Calculate the line of internal table:
VN_LINE = <TABLE CONTROL>-TOP_LINE + VN_LINE - 1.
* Read the data
READ TABLE ITAB INDEX VN_LINE.
* Transfer the data to the output structure of the new screen
<STRUCTURE>-FIELD1 = ITAB-FIELD1.
* Call the new screen
SET SCREEN <NEW SCREEN>.
LEAVE SCREEN.
Max -
How to pick the value of the line item in table control
My screen.
I have designed table control by referring internal table without using wizard.
I have placed button inside of that table control.
my requirement is by clicking the button it ll show the value of the line inside of the table control.
I have used "get cursor...".
But the problem is "it ll show only the cursor value of the front screen, if suppose i scroll the value of table control at the time also, it ll show the cursor value of the screen, it ll not show the exact value of the cursor inside of the table control.Wrong Forum Anand......!
-
Module pool ---Problem in finding the line index for the table control
Hi Friends,
I am working in Module pool programming.
My requirement is when i select any record on the lead selection I need to find out the index of the line on which row i have selected.
Could any one please suggest me the proper solution how to get the line index for the table control in module pool programming.
Thanks
Satish RajuHi Raju,
Follow the steps
<li>U should take one variable in your internal table or in structure which is used for table control fields.
DATA :BEGIN OF itab OCCURS 0 ,
mark TYPE c ,
matnr LIKE mara-matnr ,
matkl LIKE mara-matkl,
maktx LIKE makt-maktx,
END OF itab .
controls: tabc types tableview using screen 100.
<li>This mark variable should be given in Table control properties. follow the path
double click on the table control-->attributes .->select w/SelColumn and in that give itab-mark.
<li>Flow logic of the screen
process before output.
MODULE status_0100.
LOOP AT itab with control tabc
endloop.
process after input.
module cancel at exit-command.
LOOP AT itab.
MODULE read_table_control.
ENDLOOP.
MODULE user_command_0100.
<li>read_table_control module code
MODULE read_table_control INPUT.
MODIFY itab INDEX tabc-current_line."this will update the itab table
"mark field with 'X ' whatever we
"have selected on table control
ENDMODULE.
<li>If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
CASE okcode.
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps you.
Thanks
Venkat.O
Maybe you are looking for
-
How can a family share an iPad, specifically, using email? Seperate account
I know, you can have multiple email accounts. i have 3 on my iphone 4. But if my wife, daughter, and I all use the ipad. Can you set up email to ask for what account to load? Again, i know you can switch after the fact. I am trying to avoid the scena
-
When using FlashPaper to convert a Powerpoint presentation to Flash, I am getting vertical lines down the middle on the slides that have charts. Any help would be greatly appreciated.
-
My son has a 4th gen ipod which i've connected via a 30 pin digital AV adapter and an HDMI cable. Why can't I see it on my TV? The TV will recognize my iPad 2, but not the ipod.
-
Hello Me and my Brother both have iMac G5's, which are both connected to the same network and router. But in the Network panel in the finder window, he can see my User and access my files, but I cannot see his user at all. Is this a problem with my I
-
hi i have set my privacy settings to receive IMs from my contact list only BUT WHY AM STILL RECEIVING CONTACT REQUESTS FROM MORONS!!!! help help help