How to Maintain Values in the Table control?
Hi,
I'm Saikumar.
I've done a table control program.
When I click SAVE or ENTER Button, the values are getting saved into the database(This is working alright)......but when I click those buttons, The values entered in the table control are getting cleared.
What should I do in order to have those values in the table control itself when I click SAVE/ENTER? (I need to create multiple records at a time)
What I've done is:
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into <database table> values wa_matgl.
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
Refresh it_matgl.
endif.
I tried many ways but the vales are getting cleared in the table control? (I need to create multiple records at a time).
Please suggest a way to overcome it.
Thanks in advance,
saikumar
Hi ...
Just to add...
were there any values in the internal table it_matgl initially in the PBO screen to be shown to the users ?
<u>if the answer is no...then......</u>
i came across the same coding in DEMO_DYNPRO_TABCONT_LOOP_AT.....
here also in PAI..when we press enter..the values are not retained...
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
<b>because i believe the modify statement is not working.coz the it_matgl is empty..pls check if sy-subrc = 0....after the modify statement....if it is not...then we need to insert the data into the it_matgl using an append statement</b>
for this it_matgl needs to be with header line...
Pls explore the following....
data : it_matgl type table of XXXX with header line.
in the section
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into <database table> values wa_matgl.
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
<i>if sy-subrc <> 0.
move corresponding wa_matgl to it_matgl.
append it_matgl.
clear it_matgl.
endif.
endif.</i>
Pls check and revert
Regards
Byju
Similar Messages
-
How to get value on the table control in infotyp e0008
Dear Freinds
I have written a user exit ZXPADU02 for my requirement
as per the requirement in i have calculated wa-poo8-bet01 = wa_p0008-ansal/12 and i have passed on to the INNNN structure .
Nowe when do a Create or Copy for a rcord in infotype 0008 iam not
getting value on Q0008-betrg field on the SCREEN , since it is table control how to get data on the table Control Cell .
Please let me knlow
regardsHi Syamala,
The try to find the name of the table control and pass the values to it.
Of course you have to loop and endloop, the table control and mofidy it from the work area.
Message was edited by:
Sera -
How to update values in the table control at Cat2 transaction,
Hi,
i am working on cat2 transaction, here
i am using the exit_saplcats_006 and updating values at catsdb table, but i want to display this values at the table control in the cat2 transaction.
can any one provide me solution for this same.
RegardsHi Suresh
this is actual requirement
in the CAT2.
1. Add a new column for WBS description and derive the value as per the FS
2. Retrieve project number and description and update in the column specified
3. When a service order is selected it should do the same for 2.
4. Finally repeat for the worklist view (which is the section above)
here i am able to display values at data entry area
for service order and network but not worklist area ?
updation is not coming, can u plz go throw it..
Thanks
Chinna -
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. -
Exit in DP90 and how to get value in the table
Hi all,
My requirement is when execute DP90(create billing request), the amount in the table must be validated when I click the "Billing Request" button.
Please tell me the user_exit, BADI or any other enhancement which can I use to validate the amount in that transaction.
And how to get the amount(amount to be Billed, Amount rejected) value in the table after that??
ThanxHi Teja,
Check the BADI (SE18) - BADI_SD_DPBP - Extensions in SD for DP90 with Billing Plan -
Read and display the field values in the table control
Hi Experts,
I am new to the Table Control. I have created table control using the wizard where i have mentioned the ztable while creating which consist of the following fields.
Item Number
Material number
Material Description
Net Price.
I would like to retrieve the material description, Order quantity and Netprice based on the selection of the material number from the table control field.
Thanks in advance.
Sunil Kumar.Hi,
Try to implicate the following code to your requirement..
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
LOOP AT itab INTO wa_itab.
CHAIN.
FIELD wa_itab-item.
FIELD wa_itab-material MODULE fetch_desc_price ON CHAIN-REQUEST.
FIELD wa_itab-mat_desc.
FIELD wa_itab-price.
ENDCHAIN
MODULE modify_itab.
ENDLOOP.
Inside the module.
MODULE fetch_desc_price INPUT.
SELECT maktx FROM makt INTO itab-mat_desc
WHERE matnr = itab-material.
SELECT STPRS or resp fld from MBEW
INTO itab-price WHERE matnr = itab-material.
ENDMODULE.
MODULE modify_itab INPUT.
MODIFY itab from wa_itab INDEX <table control name>-CURRENT_LINE.
ENDMODULE. -
How to update and retrieve the table control entries and field entries.
Hello everyone,
i have a requirement,
i have company code , plant, fiscal year, posting period fields in the selection screen and then below that i have a table control which contains 4 fields invoice no., check number, check date and amount.
i have to enter the values and when i press SAVE button , these values have to update in a custom table which i had created.
please send me the coding how to do this object.
will be rewarded.
thanks in advance.Hi Suresh
this is actual requirement
in the CAT2.
1. Add a new column for WBS description and derive the value as per the FS
2. Retrieve project number and description and update in the column specified
3. When a service order is selected it should do the same for 2.
4. Finally repeat for the worklist view (which is the section above)
here i am able to display values at data entry area
for service order and network but not worklist area ?
updation is not coming, can u plz go throw it..
Thanks
Chinna -
How to display(binding) values in the table from more than one node?
Hi,
I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?
When i bind second one, first one is getting replaced.Hi Mog,
Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.
If you have a table control, have a look at the properties and the elements belonging to it.
First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.
Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.
Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.
If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.
Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).
If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.
Ciao, Regina -
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. -
HAI FRIENDS,
I HAVE DISPLAYED THE VALUES IN THE TABLE CONTROL
I HAVE DEFINED 'CHECK' FOR SELECTING THE FIELDS OF TABLE CONTROL
THE ISSUE STARTS HERE
WHEN I CHECK TOP FIELDS OF TABLE CONTROL
THEN SCROLLED VERTICALLY, THE TABLE CONTROL TO SELECT I.E CHECK THE
BOTTOM FIELDS OF TABLE CONTROL.
THE TOP FIELDS WATEVER CHECK WHERE CHECKS DISPAPEARS FOR TOP FIELDS .
BY THIS I UNABLE TO SELECT THE FIELDS OF TABLE.
PLZ HELP ME URGENTLY NEEDED.
MY MONDAY I NEEDEDYou use an internal table for values in table control..
One of the fields( very first field) in that itab is used for check - uncheck..
u have make it 'X' when u click any row...
I think this might be the problem in ur case.. when u scroll PAI starts... in that PAI check the value of check box for that particular field...
Regards
Prax -
How to clear the table control?
Hi experts,
I have a table control in the selection screen of my program.When i enter some input values in the selection screen and execute it some process is done in the background and get a status message on the selection screen itself that the process is finished.Once this is done i want to clear all the lines entered in table control in the selection screen.Can anyone please tell me how to do this?
Thanks.
dp.Hi,
If the table control is created using internal table , then in PBO just clear and refresh that table
PROCESS BEFORE OUTPUT
CLEAR itab.
REFRESH ITAB.
The <internal table> here should be the internal table that u use to diaply in the table control
Regards,
Priyanka. -
How to refresh the table control on some action
Hi All,
In a web Dynpro application, I am filling data to the Table control through Supply function. When I do some action (like save new record ) i want to refresh the table control means add the newly added record.
How to refresh the Table control.
Thanks
Hemalathahi hema........
if you are using a select query inside the supply function...
then...
you can just use node->invalidate(). method..
it just invalidates the node that is bound to the table.
so the supply function will be called again, which again uses the select query to fetch the values.. so that your table gets refreshed.
---regards,
alex b justin -
How to clear the table control content
Hi All,
I am doing BDC for cost estimate change. In this the transaction KKPB contains table control. So when ever i process with particular cost estimate, i need to fill the table control with the values. Here when i am doing the BDC for change, i need to clear all the contents of the table control then i need to fill with new entries.
So my problems is how to clear the table control entriee?? please help me in this??
Many Thanks,
Raghu.Hi this might help u.
Check the below link.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
THis is example to upload the Bank details of the Vendor which has the TC.
REPORT zprataptable2
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA : BEGIN OF itab OCCURS 0,
i1 TYPE i,
lifnr LIKE rf02k-lifnr,
bukrs LIKE rf02k-bukrs,
ekorg LIKE rf02k-ekorg,
ktokk LIKE rf02k-ktokk,
anred LIKE lfa1-anred,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
land1 LIKE lfa1-land1,
akont LIKE lfb1-akont,
fdgrv LIKE lfb1-fdgrv,
waers LIKE lfm1-waers,
END OF itab.
DATA : BEGIN OF jtab OCCURS 0,
j1 TYPE i,
banks LIKE lfbk-banks,
bankl LIKE lfbk-bankl,
bankn LIKE lfbk-bankn,
END OF jtab.
DATA : cnt(4) TYPE n.
DATA : fdt(20) TYPE c.
DATA : c TYPE i.
INCLUDE bdcrecx1.
START-OF-SELECTION.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'C:\first1.txt'
filetype = 'DAT'
TABLES
data_tab = itab.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'C:\second.txt'
filetype = 'DAT'
TABLES
data_tab = jtab.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-LIFNR'
itab-lifnr.
PERFORM bdc_field USING 'RF02K-BUKRS'
itab-bukrs.
PERFORM bdc_field USING 'RF02K-EKORG'
itab-ekorg.
PERFORM bdc_field USING 'RF02K-KTOKK'
itab-ktokk.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-LAND1'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFA1-ANRED'
itab-anred.
PERFORM bdc_field USING 'LFA1-NAME1'
itab-name1.
PERFORM bdc_field USING 'LFA1-SORTL'
itab-sortl.
PERFORM bdc_field USING 'LFA1-LAND1'
itab-land1.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKN(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
cnt = 0.
LOOP AT jtab WHERE j1 = itab-i1.
cnt = cnt + 1.
CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-banks.
CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-bankl.
CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
PERFORM bdc_field USING fdt jtab-bankn.
IF cnt = 5.
cnt = 0.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
ENDIF.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-FDGRV'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFB1-AKONT'
itab-akont.
PERFORM bdc_field USING 'LFB1-FDGRV'
itab-fdgrv.
PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFM1-WAERS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LFM1-WAERS'
itab-waers.
PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_transaction USING 'XK01'.
ENDLOOP.
PERFORM close_group.
Header file:
1 63190 0001 0001 0001 mr bal188 b in 31000 a1 inr
2 63191 0001 0001 0001 mr bal189 b in 31000 a1 inr
TC file:
1 in sb 11000
1 in sb 12000
1 in sb 13000
1 in sb 14000
1 in sb 15000
1 in sb 16000
1 in sb 17000
1 in sb 18000
1 in sb 19000
1 in sb 20000
1 in sb 21000
1 in sb 22000
2 in sb 21000
2 in sb 22000
REPORT zmm_pr_upload_mat
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF i_pr OCCURS 0,
Header Screen
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
lpein(001), " Category of Del Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
Item Details
matnr(018), " Material No
menge(017), " Quantity
badat(010),
frgdt(010),
preis(014), " Valuation Price
waers(005), " Currency
peinh(005),
wepos(001),
repos(001),
sakto(010), " GL Account
kostl(010), " Cost Center
bnfpo(005),
END OF i_pr.
Internal Table for header Data
DATA: BEGIN OF it_header OCCURS 0,
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
END OF it_header.
Internal Table for Item Data
DATA: BEGIN OF it_item OCCURS 0,
sno(3), " SNo
matnr(018), " Material No
menge(017), " Quantity
preis(014), " Valuation Price
sakto(010), " GL Account
kostl(010), " Cost Center
END OF it_item.
Data Variables & Constants
CONSTANTS : c_x VALUE 'X'. " Flag
DATA : v_l(2), " Counter
v_rowno(5), " Row No
v_2(2), " Counter
v_rows LIKE sy-srows, " Rows in TC
v_field(45). " String
Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_pr
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT i_pr BY sno.
LOOP AT i_pr.
MOVE-CORRESPONDING i_pr TO it_item.
APPEND it_item.
CLEAR it_item.
AT END OF sno.
READ TABLE i_pr INDEX sy-tabix.
MOVE-CORRESPONDING i_pr TO it_header.
APPEND it_header.
CLEAR it_header.
ENDAT.
ENDLOOP.
SORT it_header BY sno.
SORT it_item BY sno.
v_rows = sy-srows - 6.
Upload the Data from Internal Table
LOOP AT it_header.
Header Data
PERFORM bdc_dynpro USING 'SAPMM06B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-BEDNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-BSART'
it_header-bsart.
PERFORM bdc_field USING 'RM06B-EPSTP'
it_header-epstp.
PERFORM bdc_field USING 'EBAN-KNTTP'
it_header-knttp.
PERFORM bdc_field USING 'RM06B-EEIND'
it_header-eeind.
PERFORM bdc_field USING 'RM06B-LPEIN'
it_header-lpein.
PERFORM bdc_field USING 'EBAN-WERKS'
it_header-werks.
PERFORM bdc_field USING 'EBAN-LGORT'
it_header-lgort.
PERFORM bdc_field USING 'EBAN-EKGRP'
it_header-ekgrp.
PERFORM bdc_field USING 'EBAN-MATKL'
it_header-matkl.
PERFORM bdc_field USING 'EBAN-BEDNR'
it_header-bednr.
PERFORM bdc_field USING 'EBAN-AFNAM'
it_header-afnam.
Item Details
v_l = 0.
To add no. of rows
v_2 = 0 .
As the screen is showing 13 rows defaulted to 130
v_rowno = 130 .
LOOP AT it_item WHERE sno = it_header-sno.
v_l = v_l + 1.
IF v_l = 14 .
IF v_2 = 12 .
v_2 = 12 .
v_l = 2 .
From second time onwards it is displaying 12 rows only
v_rowno = v_rowno + 120 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ELSE.
V_2 initialized to 12 for second screen purpose
v_2 = 12 .
v_l = 2 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno .
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDIF.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CLEAR v_field.
CONCATENATE 'EBAN-MATNR(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-matnr.
CLEAR v_field.
CONCATENATE 'EBAN-MENGE(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-menge.
PERFORM bdc_dynpro USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-PREIS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-PREIS'
it_item-preis.
PERFORM bdc_dynpro USING 'SAPMM06B' '0505'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBKN-SAKTO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'EBKN-SAKTO'
it_item-sakto.
Cost Center
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
it_item-kostl.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
Call The Transaction
PERFORM bdc_transaction USING 'ME51'.
ENDLOOP.
Close the BDC Session
PERFORM close_group.
with regards,
Hema Sundara. -
How to validate the dates in the table control ?
How to validate the dates in the table control ?
Can I write like this ?
LOOP AT it_tab .
CHAIN.
FIELD : it_tab-strtdat,it_tab-enddat.
module date_validation.
ENDCHAIN.
ENDLOOP.
Module Date_validation.
ranges : vdat type sy-datum.
vdat-sign = 'I'.
VDAT-LOW = it_tab-STRTDAT.
VDAT-HIGH = it_tab-ENDDAT.
VDAT-OPTION = 'BT'.
APPEND VDAT.
WHAT CODE I have to write here to validate ?
and If I write like this How can we know which is the current row being add ?
It loops total internal table ..?
Bye,
Muttu.Hi,
I think there is no need to put chain endchain.
To do validation you have to write module in PAI which does required validations.
Thanks
DARSHAN PATEL -
How to delete a column from the table control in module pool?
Hi,
can any one please tell How to delete a column from the table control in module pool?
thanks in advance
warm regards
HareeshKumar Nhi hareesh,
I think it is better to hide it.
How to hide: You can check this link
Dynamic Hide column in table control
Maybe you are looking for
-
Is it possible to have two receive activities in a single bpel process
Hi, I have a requirement where I will get a input from a service and I have to pass this input dynamically to file adapter which then retrieved the files from a location based on the input provided and passes it to other service. I have used one rece
-
How to POST Message to HTTP Adpater?
HI @, I have a requirement where I need to post XML message directly to HTTP adapter from webdynpro application. I have tried using HTTP Client availbale and it works fine. But I need help on how to achieve the same in Wed Dynpro for Java? Regards
-
How do I copy an entire document from pages into email (not pdf) and have color and format the same as the document created in pages?
-
My MacBook Pro Unrecognised DVD Stuck in drive
Tried all easy options to remove DVD Drive makes a sound on boot up then stops.
-
I've been downloading particular series episodes each week. However, the latest episode isn't available (it is available on Amazon). How do I find out about this episode?