Table control in report program
Hi all...
Please help me to create a table control in my report program. my requirement is to enable the user to enter two fields (company code and cost center) on the selection screen. I wish to do this using table control..
example codes will be extremely helpful..
Thanks in advance..
-Pranati.
Hi,
We can not do the Table control on the selection screen, but we can do the Tab strip control.
To define a tabstrip area with tab pages, use the following statements in your selection screen definition:
SELECTION-SCREEN: BEGIN OF TABBED BLOCK <tab_area> FOR <n> LINES,
TAB (<len>) <tab1> USER-COMMAND <ucom1>
[DEFAULT [PROGRAM <prog>] SCREEN <scrn>],
TAB (<len>) <tab2> USER-COMMAND <ucom2>
[DEFAULT [PROGRAM <prog>] SCREEN <scrn>],
END OF BLOCK <tab_area>.
See the below SAP link for the sample programs
http://help.sap.com/saphelp_46c/helpdata/EN/00/deb23789e95378e10000009b38f8cf/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/e7/deb237b9a9a968e10000009b38f8cf/content.htm
See the example code
REPORT znr1 NO STANDARD PAGE HEADING
LINE-SIZE 80 LINE-COUNT 60.
TABLES : sscrfields.
DATA activetab(6) TYPE c .
DATA mat_des TYPE makt-maktx.
DATA pl_des TYPE t001w-name1 .
SELECTION-SCREEN BEGIN OF SCREEN 001 AS SUBSCREEN NO INTERVALS.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-002 NO
INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 14(18) text-002 FOR FIELD matnr.
PARAMETERS matnr TYPE mara-matnr.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN END OF SCREEN 001.
SELECTION-SCREEN BEGIN OF SCREEN 002 AS SUBSCREEN NO INTERVALS.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003 NO
INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 14(18) text-003 FOR FIELD matnr.
PARAMETERS werks TYPE t001w-werks.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN END OF SCREEN 002.
SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 5 LINES NO INTERVALS.
SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND ucomm1
DEFAULT SCREEN 001.
SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2.
* DEFAULT SCREEN 002 .
SELECTION-SCREEN END OF BLOCK tabb1.
INITIALIZATION.
tabs1 = text-002.
tabs2 = text-003.
activetab = 'TABS1'.
AT SELECTION-SCREEN .
CASE sscrfields-ucomm.
WHEN 'UCOMM1'.
tabb1-prog = sy-repid.
tabb1-dynnr = 001.
tabb1-activetab = 'TABS1'.
activetab = 'TABS1' .
WHEN 'UCOMM2'.
tabb1-prog = sy-repid.
tabb1-dynnr = 002.
tabb1-activetab = 'TABS2'.
activetab = 'TABS2'.
ENDCASE.
START-OF-SELECTION.
CASE activetab.
WHEN 'TABS1'.
SELECT SINGLE maktx FROM makt INTO pl_des WHERE matnr = matnr.
WRITE: 'Material ' , matnr , mat_des .
WHEN 'TABS2'.
SELECT SINGLE name1 FROM t001w INTO pl_des WHERE werks = werks.
WRITE: 'Plant ' , werks ,pl_des.
Regards
Sudheer
Similar Messages
-
Write the syntax for declaring table control in dialog programming?
1) Write the syntax for declaring table control in dialog programming?
2) Write the syntax to call a selection screen in a modal dialog box?hi,
check this code for table control.
DIALOG PROGRAMMING
TABLE CONTROL
IN SE51
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITVBAK WITH CONTROL TABCTRL. ## TABLE CONTROL NAME
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
LOOP AT ITVBAK.
ENDLOOP.
IN PAI FLOW LOGIC
PROGRAM YMODULE_PR4 .
TABLES : KNA1, VBAK.
DATA : BEGIN OF ITVBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
ERNAM LIKE VBAK-ERNAM,
NETWR LIKE VBAK-NETWR,
END OF ITVBAK.
CONTROLS : TABCTRL TYPE TABLEVIEW USING SCREEN '0100'.
TO ACTIVATE SCROLL BAR
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN SPACE.
SELECT VBELN ERDAT ERNAM NETWR
FROM VBAK
INTO TABLE ITVBAK
WHERE KUNNR = KNA1-KUNNR.
TABCTRL-LINES = SY-DBCNT.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT -
Table control in Reports.....
Hi Champs,
How to display the Table Control in report....? If anybody knows please help me....
Thanx in adv,
Reg,
<b>Suresh.V</b>Hi Lakshman!
How to do achieve this using grid..... give me some guidence....
Reg,
Suresh.V -
How to read a current line in table control in dialoug program ?
How to read a current line in table control in dialoug program ?
this code required to provide F4 help.Hi,
You can use the variable <tablecontrol>-Currentline as Ebus says but there is a problem with this.Suppose there are 10 records in the table control with only 5 records visible then when u press a page down and press F4 the first record in page 2, <tablecontrol>-Currentline will have value of 1 instead of 6.So you will need to write a small logic for that.
index = ( <tablecontrol>-topline - <tablecontrol>-currentline ) + 1.
read internal table itab at index.
Hope this helps.
Regards,
Vivek -
Table control in module program
hi,
i don't know about table control in module program.so please send the faq's ?hi
ganapathi
Table Controls in ABAP Programs
To handle table controls in ABAP programs, you must declare a control in the declaration part of the program for each table control using the following statement:
CONTROLS .
if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.
this is all information about table control still if u have any quiries my mailid is [email protected]
plzz reward if usefull
dont forget to reward -
TABLES statement in report program
Hi,
Is there any performance issue in using TABLES statement in report program? Because I have got an review point from QA insisting me to avoid TABLES statement. Is it recommended by SAP to avoid TABLES statement in report program?
Thanks in advance.
Regards,
Balaji Viswanath.Balaji,
If you use TABLE statement it will provide the work area of the given table.
EX: Decalre any fields of table in slection scereen
without declarin g the tabel name in TAble statement.It will give error.
This will give error.
SELECT-OPTIONS : s_matnr LIKE MARA-matnr.
This will work.
TABLES: mara.
SELECT-OPTIONS : s_matnr LIKE MARA-matnr.
It means it will occupy some area.
Don't forget to reward if useful. -
Getting values from the table control to the program
Hi Gurus,
i created a program for sales order creation to transfer order creation and to insert multiple values i defined my own selection screen by inserting table control before that the code executed succesfully but after inserting the table control it is not creating any documents
code before inserting table control:-
REPORT zcl120_sales_n_delivery.
SALES DOCUMENT CREATION
PARAMETERS: p_auart TYPE auart OBLIGATORY.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
*ITEM
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
DATA DECLARATIONS.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
HEADER DATA
header-doc_type = p_auart.
headerx-doc_type = 'X'.
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
item-material = p_matnr.
item-plant = p_plant.
item-target_qty = p_menge.
item-target_qu = 'ST'.
item-item_categ = p_itcat.
APPEND item.
itemx-updateflag = 'I'.
itemx-material = 'X'.
itemx-plant = 'X'.
itemx-target_qty = 'X'.
itemx-target_qu = 'X'.
itemx-item_categ = 'X'.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE / return-message.
WRITE: / 'Error in creating document'.
ELSE.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
DELIVERY ORDER CREATION
*PARAMETERS: p_vbeln LIKE vbak-vbeln.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
kwmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr kwmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = v_vbeln
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-kwmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
READ TABLE t_created INDEX 1.
WRITE: / 'Delivery Number : ',
t_created-document_numb.
CREATE TRANSFER ORDER
DATA: w_tanum TYPE ltak-tanum.
CALL FUNCTION 'L_TO_CREATE_DN'
EXPORTING
i_lgnum = '010'
i_vbeln = t_created-document_numb
IMPORTING
e_tanum = w_tanum
EXCEPTIONS
foreign_lock = 1
dn_completed = 2
partial_delivery_forbidden = 3
xfeld_wrong = 4
ldest_wrong = 5
drukz_wrong = 6
dn_wrong = 7
squit_forbidden = 8
no_to_created = 9
teilk_wrong = 10
update_without_commit = 11
no_authority = 12
no_picking_allowed = 13
dn_hu_not_choosable = 14
input_error = 15
OTHERS = 16
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK AND WAIT.
WRITE: / 'Transfer order number',
w_tanum.
Code after inserting table control:-
REPORT zcl120_sales_n_delivery.
SALES DOCUMENT CREATION
DATA: p_auart TYPE auart .
DATA: p_vkorg TYPE vkorg .
DATA: p_vtweg TYPE vtweg .
DATA: p_spart TYPE vtweg .
DATA: p_sold TYPE kunnr .
DATA: p_ship TYPE kunnr .
*ITEM
data:
begin of it_item occurs 0,
p_matnr TYPE matnr,
p_menge TYPE kwmeng,
p_plant TYPE werks_d,
p_itcat TYPE pstyv,
end of it_item.
DATA DECLARATIONS.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
DATA:
W_COUNTER TYPE I,
IT_NUM(6) TYPE C value '000010',
IT_LINE(4) TYPE C value '0001'.
CALL SCREEN 100.
HEADER DATA
header-doc_type = p_auart.
headerx-doc_type = 'X'.
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
loop at it_item.
CLEAR ITEM.
item-material = it_item-p_matnr.
item-plant = it_item-p_plant.
item-target_qty = it_item-p_menge.
item-target_qu = 'ST'.
item-item_categ = it_item-p_itcat.
APPEND item.
W_COUNTER = W_COUNTER + 1.
endloop.
DO W_COUNTER TIMES.
itemx-updateflag = 'I'.
itemx-material = 'X'.
itemx-plant = 'X'.
itemx-target_qty = 'X'.
itemx-target_qu = 'X'.
itemx-item_categ = 'X'.
APPEND itemx.
ENDDO.
Fill schedule lines
LOOP AT IT_ITEM.
CLEAR lt_schedules_in.
lt_schedules_in-itm_number = IT_NUM.
lt_schedules_in-sched_line = IT_LINE.
lt_schedules_in-req_qty = IT_ITEM-p_menge.
APPEND lt_schedules_in.
IT_NUM = IT_NUM + 10.
IT_LINE = IT_LINE + 1.
ENDLOOP.
IT_NUM = '000010'.
IT_LINE = '0001'.
Fill schedule line flags
LOOP AT IT_ITEM.
CLEAR lt_schedules_inx.
lt_schedules_inx-itm_number = IT_NUM.
lt_schedules_inx-sched_line = IT_LINE.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
IT_NUM = IT_NUM + 10.
IT_LINE = IT_LINE + 1.
ENDLOOP.
Call the BAPI
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE / return-message.
WRITE: / 'Error in creating document'.
ELSE.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
DELIVERY ORDER CREATION
*PARAMETERS: p_vbeln LIKE vbak-vbeln.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
kwmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr kwmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = v_vbeln
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-kwmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
READ TABLE t_created INDEX 1.
WRITE: / 'Delivery Number : ',
t_created-document_numb.
CREATE TRANSFER ORDER
DATA: w_tanum TYPE ltak-tanum.
CALL FUNCTION 'L_TO_CREATE_DN'
EXPORTING
i_lgnum = '010'
i_vbeln = t_created-document_numb
IMPORTING
e_tanum = w_tanum
EXCEPTIONS
foreign_lock = 1
dn_completed = 2
partial_delivery_forbidden = 3
xfeld_wrong = 4
ldest_wrong = 5
drukz_wrong = 6
dn_wrong = 7
squit_forbidden = 8
no_to_created = 9
teilk_wrong = 10
update_without_commit = 11
no_authority = 12
no_picking_allowed = 13
dn_hu_not_choosable = 14
input_error = 15
OTHERS = 16
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK AND WAIT.
WRITE: / 'Transfer order number',
w_tanum.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB_CON1' ITSELF
CONTROLS: TAB_CON1 TYPE TABLEVIEW USING SCREEN 0100.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB_CON1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE TAB_CON1_CHANGE_TC_ATTR OUTPUT.
DESCRIBE TABLE IT_ITEM LINES TAB_CON1-lines.
ENDMODULE.
*& Module STATUS_0100 OUTPUT
text
module STATUS_0100 output.
SET PF-STATUS 'MENU'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module USER_COMMAND_0100 input.
IF SY-UCOMM EQ 'START'.
LEAVE to screen 0 .
ENDIF.
endmodule. " USER_COMMAND_0100 INPUT
*& Module APPEND_IT_ITEM INPUT
text
module APPEND_IT_ITEM input.
APPEND IT_ITEM.
CLEAR IT_ITEM.
endmodule. " APPEND_IT_ITEM INPUT
plz help me where the error isHi,
Do same as suggested by Ramesh. Add one user command button after clicking that do the looping and call new screen.
Ashven. -
How to move the selected rows from a table control in dialog programming
hiiiiiiii Every1
I have to update some fields for a slected row in table control on click of a button and save it in database.
Regards
Sachin Dhingrasee below example, I have added INSERT option after DELETE option, you can use same table or you can use differnt table by populating into that table and insert into the db table. If you want to use same internal table then use below code
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
insert into table from itab.
ENDLOOP.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA cols LIKE LINE OF flights-cols.
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 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'.
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.
WHEN 'INSERT'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
itab1 = itab.
modify itab1.
ENDLOOP.
ENDIF.
if not itab1 is initial.
INSERT dbtab FROM TABLE itab1.
endif.
ENDCASE.
ENDMODULE. -
How to save the selected records from Table control in dialog programming
Hiiiiiiii Every1
Actually the problem is like this:-
I have to select some records from table control and then want to save the selected records in DB table.
Example
I have some rows having inforamtion bout employees...
Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
Sachin Dhingrasee below example, I have added INSERT option after DELETE option.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA cols LIKE LINE OF flights-cols.
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 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'.
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.
WHEN 'INSERT'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
itab1 = itab.
modify itab1.
ENDLOOP.
ENDIF.
if not itab1 is initial.
INSERT dbtab FROM TABLE itab1.
endif.
ENDCASE.
ENDMODULE. -
How to create a table control from a program internal table
Hi all,
I try to create a table control that matches following requirements :
- the source table is an internal table from program (not a dictionary table)
- I need to specify my own column header titles
- the fields need to be editable
- some of the columns fields must be displayed as checkboxes, other one as texts
When I try using "Table Control WIth Wizard", the generated TabControl has the expected columns titles but the fields are not displayed as checkboxes. Moreoever, when I look at "Dictionnary, program Fields list", the table fields choosed using wizard are locked (a padlock is displayed in front of the line) So, I can not check "checkbox display"
When I try using simple Table Control -I mean without ALV-, I can use the "checkbox display" for wanted fields but I don't know how to specify the resquired columns headers titles
So, could you please help me ? How to do both : maage columsn header titles and display some of the columns as checkboxes ?
thanks for help
Regards
morganHi Morgan,
Create an Interanal Table in Top Include and activate it first. Then go the Screen Layout and Drag and Drop a Table control.
Enter a name like TC. now press F6 (Dictionary/Program Fields Window). Enter the Interanal Table and Press
Get From Program Push button. Select the required Columns and transfer them. Double click on the Table Control Area only (any corner of the TC) now you get attribute window POP UP. now select the check box for with column Header or remove the available column header and place your own Text Field and give meaningful Text for them. With in the Table control you can Drag and Drop a Check Box which will occupy all the rows. Make sure you include one more column in the TOP include type C with length one.
Hope this is very Clear to YOU.
Cheers
Ram -
Table control in report selection screen
I have a selection screen with some fields. Now, below these fields, I need a table control in which i will have input parameters with 3 fields so that i can enter data in combinations and use the same while executing the report like an internal table.
1. I should be able to save it as a Variants.
2. I should be able to schedule a background job.
I found similar notes but they dont help me save variants and with job schedules.
Request your help in this regard.
Regards
KasiHi
In the selection-screen u can generated a tabstrip:
SELECTION-SCREEN BEGIN OF TABBED BLOCK MAX FOR 22 LINES.
SELECTION-SCREEN TAB (25) TABS1 USER-COMMAND UCOMM1
DEFAULT SCREEN 100.
SELECTION-SCREEN END OF BLOCK MAX.
So the system'll generate a tabstrip in the selection-screen, here it'll load only the screen 100.
By screen painter u have to create a subscreen 100 where u insert your table control.
Max -
Table control in dialog programming
why we are using loops in pbo and pai events?
Hi
First have to know the concept of Table control
The main purpose of table control is to display multiple records in a table like format.
so when to wants to display the multiple records, the internal table from which the table control has to be populated has to be kept in loop both in PAI and PBO.
see the doc
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
reward points if useful
regards
Anji -
Modifying table control in standard program
Hi ,
Can any one tell me how to add a column in table control? My requirement is to add two columns ( custom fields ) into table control ( It is a standard program). I have added the column in the table and also in the table control. But when I am running the standard program, The newly added column is not there. But I have added in the perticular screen. Change is not reflected.
Actually in the standard screen totally 94 columns are there but where as when you run the program it is showing only 15 columns. can you tell me the reason?
I am working on Invoice payments F-28 screen 6102.
Can anyone help me on this please.In the IMG (transaction SPRO), look at the path:
Financial Accounting
Accounts receivable and accounts payable
Business transactions
Incoming Invoices/Credit Memos
Carry out and Check document settings.
There may be something there that will help.
Rob -
How to determine fixed line of table control using BDC program ?
Dear All,
I create program using BDC that contains table control.
Unfortunately the table control line of BDC program will depend on the resolution of our PC setting.
Sometime I have 2 lines, sometime 3 lines (in different PC).
How to determine fixed line of table control?
So it will never be confusing me whether I have 2 or 3 lines.
Thnx - Regards,
(Taufik K.)Hi Taufik,
Check the table CTU_PARAMS and field DEFSIZE for setting fixed line of a table control.
CALL TRANSACTION 'VA01' USING it_bdcdata
OPTIONS FROM OPT
MESSAGES INTO it_mesg.
opt of type ctu_params.
WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
WA_CTU_PARAMS-UPDMODE = 'S'. "synchronus update
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
Default size will play good role in terms of resoultion. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resoultion. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
Reward if helps.
Regards,
Senthil
Message was edited by: senthil kumar -
Strange issue with table control in dialog programming! Please help!
Hello everyone:
I have a table control on screen painter and I have atleast 10 rows on display when user calls the screen. If I have 15 columns then ofcourse user has to scroll down to see extra rows. I have line selection set to "single" for table control so that user can select only one row at a time. This works fine when user does not have to scroll to see extra rows. It is tough for me to explain i.e., if the table control displays 10 rows when the screen opens up then they can only select single row at a time (rows 1 -10). For example user selected row 7 and now they scroll down to see extra rows (for example 13) then it lets them select row 13 also even though I set line selection to "single" in the properties for table control! They should be able to select only one row at a time. Is this some limitation with table control in SAP? Please give me any information you have.
Thanks.
MithunHi,
As you suspected, this is a limitation in the table control. You need to take care of the single-selection functionality yourself except for the rows that are actually being displayed. See [Note 588284|https://service.sap.com/sap/support/notes/588284] for the official SAP explanation.
Regards,
Jamie
Maybe you are looking for
-
I first copied my 667 titanium (inactive laptop) iphoto library (iphoto 2.0.1) to an external hard drive. Then I copied that folder which I had renamed "Pictures from 667" to the desktop of my 2009 Macbook Pro running iPhoto 11, running 9.4.3. I dow
-
Screen hungs with color mess.
Hello. I had issue with mac macbook pro mid 2010. https://discussions.apple.com/message/21177190#21177190 Then i took it to the Apple Authorized Service Provider, they help it for almost 2 months then gave it me back. It is my working computer, and i
-
Loading multiple external jpgs...
I'm trying to go through a for loop, create a movieclip for each database entry, add the image by url stored. The problem is the code I have only does the last image. I know it's because something is not incrementing and they all have the same name.
-
Downloaded Flash Player update but still doesn't work!
Hi I have downloaded several times the new update for Flash Player and every time I go on to watch iPlayer it still asks to download the software. I have done the instructions about 6 times now and its really annoying! Its a Mac laptop - can anyone h
-
Check talbe in the mapping sheet
Hello Gurus, following is a line from mapping sheet, what is check table used for in our sap bw project in general sense ? R/3 Table R/3 Field Name R/3 Field Type R/3 Field Length R/3 Check Table D