Table control in screen programing
Hi..
i am working with table contrl. I am able to display the table layout in ouput. I need to display the retieved data from standaar table (vbak) on to the table layout in the ouput.
what i need to do???????????
hi
check this code may help you
report ztest message-id 00. " FISK999999
tables: bsis.
types: begin of fi,
bukrs type bukrs,
hkont type hkont,
gjahr type gjahr,
belnr type bsis-belnr,
buzei type buzei,
budat type budat,
blart type blart,
shkzg type shkzg,
dmbtr type dmbtr,
end of fi.
data: fi_int type table of fi with header line,
cr_amt type dmbtr,
dr_amt type dmbtr.
controls: my_ctl type tableview using screen 9999.
start-of-selection.
call screen 9999.
*& Module MOVE_DATA_TO_SCREEN OUTPUT
module move_data_to_screen output.
move-corresponding fi_int to bsis.
endmodule. " MOVE_DATA_TO_SCREEN OUTPUT
*& Module STATUS_9999 OUTPUT
module status_9999 output.
set pf-status 'STD'.
endmodule. " STATUS_9999 OUTPUT
*& Module MOVE_DATA_TO_ITAB INPUT
module move_data_to_itab input.
move-corresponding bsis to fi_int.
append fi_int.
endmodule. " MOVE_DATA_TO_ITAB INPUT
*& Module EXIT_9999 INPUT
text
module exit_9999 input.
leave program.
endmodule. " EXIT_9999 INPUT
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 -
hello friends,
i was informed that i would be working on table controls through dialogue program,
if any one has a sample code for tabel control through screens,
plz post it here, so that , i can understand which command is to use for what, and what would be most common commands.
thank you in advance.Hello,
Check this sample
********** Trancsaction code- zrtc **********************
*********** Default Screen- 1000 ************************
PROGRAM ZRAVI_TABLECONTROL message-id zrtc.
*Displaying data from VBAP,VBAK and VBKD tables using table control
tables : VBAP,VBAK,VBKD.
controls : tab_cntrl type tableview using screen '2000'.
data : begin of it_sales occurs 0,
vbeln like VBAP-vbeln,
matnr like VBAP-matnr,
erdat like VBAK-erdat,
ernam like VBAK-ernam,
auart like VBAK-auart,
konda like VBKD-konda,
kdgrp like VBKD-kdgrp,
end of it_sales.
data : l_count type i.
*& Module USER_COMMAND_1000 INPUT
* text
MODULE USER_COMMAND_1000 INPUT.
case sy-ucomm.
when 'SHOW'.
if VBAP-MATNR ne ''.
select vp~vbeln vp~matnr vk~erdat vk~ernam vk~auart vd~konda
vd~kdgrp into corresponding fields of table it_sales from
( ( VBAP as vp inner join VBAK as vk on vp~vbeln = vk~vbeln )
inner join VBKD as vd on vk~vbeln = vd~vbeln )
where vp~matnr = VBAP-MATNR.
else.
select vp~vbeln vp~matnr vk~erdat vk~ernam vk~auart vd~konda
vd~kdgrp into corresponding fields of table it_sales from
( ( VBAP as vp inner join VBAK as vk on vp~vbeln = vk~vbeln )
inner join VBKD as vd on vk~vbeln = vd~vbeln ).
endif.
** leave to list-processing.
** *For testing the query
** loop at it_sales.
** write : / it_sales-matnr.
** endloop.
** *End testing of query
call screen '2000'.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_1000 INPUT
*& Module STATUS_2000 OUTPUT
* text
MODULE STATUS_2000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'Sales Document Information'.
ENDMODULE. " STATUS_2000 OUTPUT
*& Module USER_COMMAND_2000 INPUT
* text
MODULE USER_COMMAND_2000 INPUT.
case sy-ucomm.
when 'BACK'.
leave to screen '1000'.
when 'P--'.
perform paging using 'P--'.
when 'P-'.
perform paging using 'P-'.
when 'P+'.
perform paging using 'P+'.
when 'P++'.
perform paging using 'P++'.
endcase.
ENDMODULE. " USER_COMMAND_2000 INPUT
*& Module GET_CTRL_SALES INPUT
* text
MODULE GET_CTRL_SALES INPUT.
case sy-ucomm.
when 'SAVE'.
data : line_count type i value 0.
modify it_sales index tab_cntrl-current_line.
line_count = line_count + 1.
* *VBAP,VBAK and VBKD tables
* vbeln like VBAP-vbeln,
* matnr like VBAP-matnr,
* erdat like VBAK-erdat,
* ernam like VBAK-ernam,
* auart like VBAK-auart,
* konda like VBKD-konda,
* kdgrp like VBKD-kdgrp,
* update VBAP set vbeln = it_sales
* if sy-subrc = 0.message i001.endif.
IF SY-SUBRC = 0 AND SY-TABIX > LINE_COUNT.
MESSAGE E001 WITH LINE_COUNT.
* STOP.
ENDIF.
*LEAVE TO LIST-PROCESSING.
*WRITE : 'TABIX',SY-INDEX,'LINE',LINE_COUNT.
endcase.
ENDMODULE. " GET_CTRL_SALES INPUT
*& Module FILL_TAB_CNTRL OUTPUT
* text
MODULE FILL_TAB_CNTRL OUTPUT.
read table it_sales index tab_cntrl-current_line.
l_count = sy-loopc.
* leave to list-processing.
* write : l_count,tab_cntrl-top_line.
if sy-subrc ne 0.exit from step-loop.endif.
ENDMODULE. " FILL_TAB_CNTRL OUTPUT
*& Module GET_MESSAGE INPUT
* text
MODULE GET_MESSAGE INPUT.
* if sy-subrc = 0.
* message i001 with line_count.
* endif.
ENDMODULE. " GET_MESSAGE INPUT
*& Form PAGING
* text
* -->P_0189 text
FORM PAGING USING code.
data : i type i,
j type i.
case code.
when 'P--'.
TAB_CNTRL-top_line = 1.
when 'P-'.
TAB_CNTRL-top_line = TAB_CNTRL-top_line - l_count.
message i001.
if TAB_CNTRL-top_line le 0.
TAB_CNTRL-top_line = 1.
endif.
when 'P+'.
i = TAB_CNTRL-top_line + l_count.
j = TAB_CNTRL-lines - l_count + 1.
if j le 0.j = 1.endif.
if i le j.
TAB_CNTRL-top_line = i.
else.
TAB_CNTRL-top_line = j.
endif.
when 'P++'.
TAB_CNTRL-top_line = TAB_CNTRL-lines - l_count + 1.
if TAB_CNTRL-top_line le 0.
TAB_CNTRL-top_line = 1.
endif.
endcase.
ENDFORM. " PAGING
*& Module INIT_CONTROL OUTPUT
* text
MODULE INIT_CONTROL OUTPUT.
TAB_CNTRL-top_line = 1.
ENDMODULE. " INIT_CONTROL OUTPUT
********************** flow logic of screen 2000 ********************
PROCESS BEFORE OUTPUT.
MODULE STATUS_2000.
module init_control.
loop with control tab_cntrl.
module fill_tab_cntrl.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_2000.
loop with control tab_cntrl.
field SEL module get_ctrl_sales on input.
endloop.
*module get_message.
******************** End of flow logic ************************
If useful reward.
VAsanth -
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 -
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 -
How Make Table Control full screen ?
Hi all, how can I make table control full screen?
Hello,
In the menu painter for the screen containing the table control....drag the boundaries of the table to fit the visible boundary marked..if we are calling table control using a sub screen area ..then the subscreen area in the main screen needs to be enlarged as per requirements...
Pls check and revert
Regards
Byju -
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 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 -
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. -
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 -
Table control in Screen Painter
Hi Friends,
I have created a screen using screen painter. The screen is having 4 tabs (subscreen) and in all the subscreen, i have used table control to insert multiple lines in the table.
The problem I am getting is that, the data of table control part is not getting inserted into the table.
The program part is given below for reference.
======================================================
PROCESS BEFORE OUTPUT.
MODULE SECDAM_CHANGE_TC_ATTR.
LOOP AT IT_SECDAM
INTO IT_SECDAM
WITH CONTROL SECDAM
CURSOR SECDAM-CURRENT_LINE.
MODULE SECDAM_GET_LINES.
ENDLOOP.
MODULE STATUS_0109.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'SECDAM'
LOOP AT IT_SECDAM.
CHAIN.
FIELD ZTDRDTL-DIVSN.
FIELD ZTDRDTL-MATRL.
FIELD ZTDRDTL-SLQTY.
FIELD ZTDRDTL-DMQTY.
FIELD ZTDRDTL-SSQTY.
MODULE SECDAM_MODIFY ON CHAIN-REQUEST.
endchain.
ENDLOOP.
MODULE SECDAM_USER_COMMAND.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Flow-logic part:
DATA : BEGIN OF IT_SECDAM OCCURS 0,
DIVSN LIKE ZTDRDTL-DIVSN,
MATRL LIKE ZTDRDTL-MATRL,
SLQTY LIKE ZTDRDTL-SLQTY,
DMQTY LIKE ZTDRDTL-DMQTY,
SSQTY LIKE ZTDRDTL-SSQTY,
END OF IT_SECDAM.
CONTROLS: SECDAM TYPE TABLEVIEW USING SCREEN 0109.
DATA: G_SECDAM_LINES LIKE SY-LOOPC.
MODULE SECDAM_CHANGE_TC_ATTR OUTPUT.
DESCRIBE TABLE IT_SECDAM LINES SECDAM-LINES.
ENDMODULE. "SECDAM_CHANGE_TC_ATTR OUTPUT
MODULE SECDAM_GET_LINES OUTPUT.
G_SECDAM_LINES = SY-LOOPC.
ENDMODULE. "SECDAM_GET_LINES OUTPUT
MODULE SECDAM_MODIFY INPUT.
MODIFY IT_SECDAM
FROM IT_SECDAM
INDEX SECDAM-CURRENT_LINE.
ENDMODULE. "SECDAM_MODIFY INPUT
MODULE SECDAM_USER_COMMAND INPUT.
OK_CODE = SY-UCOMM.
PERFORM USER_OK_TC USING 'SECDAM'
'IT_SECDAM'
CHANGING OK_CODE.
SY-UCOMM = OK_CODE.
ENDMODULE. "SECDAM_USER_COMMAND INPUT
=========================================================
Kindly guide me the solution.
TIA.
Regards,
Mark KHi
Try like this may be you will get it.
process before output.
module status_1000.
loop at itab with control tabctrl cursor tabctrl-top_line.
module assign_data.
endloop.
process after input.
module user_command_1000.
loop at itab.
endloop.
In flow logic.
tables vbak.
data itab like vbak occurs 0 with header line.
controls tabctrl type tableview using screen 1000.
data fill type i.
*& Module Assign_data OUTPUT
text
module assign_data output.
move itab to vbak.
endmodule. " Assign_data OUTPUT
*& Module USER_COMMAND_1000 INPUT
text
module user_command_1000 input.
case sy-ucomm.
when 'EXIT'.
set screen 0.
endcase.
endmodule. " USER_COMMAND_1000 INPUT
*& Module STATUS_1000 OUTPUT
text
module status_1000 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
select * from vbak into table itab.
describe table itab lines fill.
tabctrl-lines = fill.
Endmodule.
Regards
Haritha. -
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. -
hi all,
I am able to put a table control in subscreen of co11n using CONFPP07 exit.
but when i am trying to write pbo & pai events for the same in include ZXCOFZZZ of SAPLXCOF it is showing internal table is unkown or not declared.
how to proceed?
Regards,
Uday MadhavDeclare the global exit data in the TOP include (global data) of the exit function group main program SAPLXCOF which contains an include (ZXCOFTOP in LXCOFTOP) for this.
Usually, there is an exit function to transfer data from calling program to exit function group program (here ZXCOFU23 in EXIT_SAPLCORU_S_100) and another to wrtie back (here ZXCOFU24 in EXIT_SAPLCORU_S_101), these functions must write and update data defined in this include, as will modules included in PBO/PAI of the screen exit (in ZXCOFZZZ).
- Define global data (controls, internal table, work area, etc) in ZXCOFTOP
- Move data from caller to global data in ZXCOFU23
- Define the flow logic in exit dynpro SAPLXCOF 090x
- Define modules in ZXCOFZZZ
- Move updated data from global data in ZXCOFU24
Regards -
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
Maybe you are looking for
-
How do i have an ipod touch and an ipad sync to the same pc?
how do i have an ipad and an ipod touch sync on the same computer but they have different apps on them? i knopw it is possible but i just dont no how to do it. as my ipod touch is only 8gb and my ipad is 16gb so everything off the ipad is making the
-
Photoshop Elements 9 and Adobe Camera RAW 6.6
My Significant Other just purchased a Nikon 1 V1 camera. I have an extra copy of Elements 9 that I can install on her computer. According to the Release Notes, support for the Nikon 1 V1 started with ACR 6.6. According to the same Release Notes, ACR
-
Dear all, I have to develop a ledger report item wise and Organization wise: Item wise: Transaction date: reciept_num/ issue_number: reciept_from, reciept_to, BF Balance, Receipt Qty, Issued Qty, CF Balance, Which column in mtl_material_transactions
-
Originally I only had a question about the iCloud button on Safari, but when I was creating a username for this support site, I found another. So first off, whenever I click the iCloud button, it doesn't bring up the tabs that I have open on either m
-
User Exit regarding Sale Order
Hi All, While creating a sale order, in the header details and in conditions tab. All the condition types are displayed. Customer requirment is i need to make some changes for some particular condition type in tht sale order like. Can any one pls tel