Table Control[Accept Input Only] - "ENTER" Key
Hi Folks,
I'm reviving this unanswered thread in relation to table control: when the user press enter, all the values entered disappear.
[url]Re: Table control (Enter key)[url]
I have a table control that accepts "ONLY" input, meaning to say, there will be no pre-loading of data in the PBO, so it will loop through the table control itself instead of looping from an internal table.
Issue: Whenever I press "ENTER" in any column/row of my table control, ALL the values I entered disappear.
PBO:
PROCESS BEFORE OUTPUT.
MODULE CLEAR_OKCODE.
MODULE LOAD_TABLECTRL.
LOOP WITH CONTROL TC_DATA.
MODULE READ_DATA.
ENDLOOP.
module READ_DATA output.
READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
data : line_count type i.
"to increase the number of lines in table control dynamically
describe TABLE t_data lines line_count.
TC_DATA-lines = line_count + 10.
endmodule.
PAI:
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_DATA.
MODULE MODIFY_DATA.
ENDLOOP.
module MODIFY_DATA input.
WHEN 'CREATE'.
"subroutines are here, etc.
WHEN 'DELETE'.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
endmodule.
In my ABAP Debug, the value of SY-UCOMM is BLANK whenever I press Enter.
Thanks.
Hi
Your code seems to be rght only the MODIFY statament is useless:
module READ_DATA output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
ZQID_CHECK-WERKS = WA_ID_CHECK-WERKS.
ZQID_CHECK-MATNR = WA_ID_CHECK-MATNR.
ZQID_CHECK-LICHA = WA_ID_CHECK-LICHA.
ZQID_CHECK-LIFNR = WA_ID_CHECK-LIFNR.
ELSE.
CLEAR ZQID_CHECK.
ENDIF.
endmodule.
Now before LOOP of PBO try to set the lines of table control to be display, I've created this report on my system and it works fine:
.CONTROLS T_CTRL TYPE TABLEVIEW USING SCREEN 100.
DATA: BEGIN OF ITAB OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
LIFNR LIKE LFA1-LIFNR,
END OF ITAB.
DATA: WA LIKE ITAB.
START-OF-SELECTION.
DO 4 TIMES.
ITAB-WERKS = '5010'.
ITAB-MATNR = '1234567890'.
ITAB-LIFNR = '0000000001'.
APPEND ITAB.
ENDDO.
CALL SCREEN 100.
PROCESS BEFORE OUTPUT.
MODULE SET_T_CTRL.
LOOP WITH CONTROL T_CTRL.
MODULE READ_DATA.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL T_CTRL.
MODULE MODIFY_DATA.
ENDLOOP.
MODULE SET_T_CTRL OUTPUT.
DESCRIBE TABLE ITAB LINES T_CTRL-LINES.
ENDMODULE. " SET_T_CTRL OUTPUT
MODULE READ_DATA OUTPUT.
READ TABLE ITAB INDEX T_CTRL-CURRENT_LINE.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING ITAB TO WA.
ELSE.
CLEAR WA.
ENDIF.
ENDMODULE. " READ_DATA OUTPUT
MODULE MODIFY_DATA INPUT.
MODIFY ITAB FROM WA INDEX T_CTRL-CURRENT_LINE.
IF SY-SUBRC NE 0.
CHECK NOT WA IS INITIAL.
APPEND WA TO ITAB.
ENDIF.
ENDMODULE. " MODIFY_DATA INPUT
Similar Messages
-
How to delete a row in table control(accepts only input)?
Hi All,
I have an empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output:
http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
Edited by: Jaime Cabanban on Jan 7, 2010 8:46 PMDebugging the PBO part after deletion will help you know why the rows are getting deleted
This is the sap doc answer for you question regarding LINE.
Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.
Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control. -
JSF Portlet input text enter key submission
Hi,
I have a portlet having input text fields and having command action button(hx:commandExButton). But I have a requirment when I presss enter key in the input text fields instead of submitng form, I want submit command action button.
Could you please give the details. how I will do in JSF Portlets (code snipeet).
Currently I implemented when user press enter key I am calling java script function and submit the form.
ThanksFirstly: why using IBM's hx:commandButton instead of standard RI h:commandButton?
Well, pressing [enter] somewhere in a inputfield usually invokes the firstnext button in the form. Doesn't this happen in your form? Or is the "wrong" button being invoked? -
Is it possible to make a row in a table control as output only row?
Hi SDN,
I have created a table control with wizard.I want to make a particular row as non-editable for a condition from my program.Is it possible?yeah , make use of table SCREEN.
loop at screen.
screen-output = 'X'.
modify screen.
endloop. -
Set cursor in table control field
I have developed module using table control have done validation for one field on Enter key press.In change mode if user changes value in table control field and presses Enter key then system is showing Error message on status bar and table control gets gray out.
if user again hits Enter key then this error message clears and Table control is in Edit mode.
Here I wan that Cursor should go to same filed from which error message occurred.
I have written Get Cursor In PAI event and Set Cursor in PBO after Loop at table control. I tried Set cursor within Lop at Table control in PBO.
But cursor is not coming on that field of table control.
I have written set cursor as below:
Set Cursor Field itab-fieldname Line lineno Offset offsetval.
Here itab is internal table assigned to table control.
Please let me know why cursor is not setting on particular field on table control.Hi Ganesh,
A simpler way would be to include the fields of the table in a chain-endchain block.
in PAI section.
PROCESS AFTER INPUT.
loop at IT_FINAL.
chain.
field WA_FINAL-JOBCARD.
field WA_FINAL-MATIDTAG.
field WA_FINAL-VORNR.
field WA_FINAL-ARBPL.
field WA_FINAL-ZZPULLCONTNRQTY.
field WA_FINAL-NOOFTAGS.
field WA_FINAL-ROUTE_TO.
module validate.
endchain.
endloop.
you can issue your error messages in the module validate.
REgards,
Ravi -
Make Select rows and columns as read only in Table Control
Hi All,
I would like to know how to make certain cells in a Table Control as display only.
Table control should look like-(Those in bold are read only or in display mode)
<b>Name1 Idno1 </b> Address1
<b>Name2 Idno2</b> Address2
<b>Name3 Idno3 </b> Address3
<b>Name4 Idno4</b> Address4
(Blank row to enter name idno and address)
(Blank row to enter name idno and address)
(Blank row to enter name idno and address)
My table control should display all the above fields the way it is above of which first two colums and 4 rows should be read only,and the rest of the empty rows in the TC should be in change mode.i.e it must have provision to add new rows but not change the first two columns of existing rows.
In short I am looking at solution to hide particular no of rows and columns and <b>not the entire column.</b>In the PBO of the table control loop. just write these statements
NAME and IDNO considering the fields on the screen.
and WA_TAB is the table work area being passed to the table control to display the rows.
if not WA_TAB-NAME is initial and not WA_TAB-IDNO is initial.
loop at screen.
if screen-name = 'NAME' or
screen-name = 'IDNO'.
screen-input = <b>0</b>.
modify screen.
endif.
endloop.
endif.
which means that the fields are disabled only if NAME and IDNO are not initial.
Regards
- Gopi -
How to Populate a Dropdown field for a table control with different keys
Hi All,
I have Table control with abt eight columns (fields). Out of these eight field one field is with dropdown list. In table control Project ID is Primary key column. Depending upon this Project ID value, i have different values which is to be populated in dropdown boxes. In table control if there is only one project ID value say 'P000715' i can populate it but when i have more than one project ID (P000715, p000716, P000717.....) in display in rows of table control i want to have different values in my dropdown field corresponding to that row of project id. Experts please tell me how to achieve this functionality.
Thankx in Advance
Rizwan Ahmad SiddiquiThe only way you may be able to do this is using
MODULE PROCESS ON VALUE-REQUEST. User-programmer F4 help
in your PAI routine.
In this routine you would build the list and get the returned value to update the field.
Something like this.
DATA: BEGIN OF value_tab OCCURS 0,
field1 TYPE zlmltype,
field2 TYPE zltypex,
END OF value_tab.
* Drop down values
REFRESH it_return_tab. CLEAR it_return_tab.
REFRESH value_tab. CLEAR value_tab.
SELECT ltype ltypex
INTO TABLE value_tab
FROM zlmltyp
WHERE auth NE '9'. "System Only
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FIELD1'
value_org = 'S'
TABLES
value_tab = value_tab[]
return_tab = it_return_tab.
READ TABLE it_return_tab INDEX 1 INTO wa_return_tab.
CHECK sy-subrc EQ 0.
p_pleadtyp = wa_return_tab-fieldval. -
Dynamicaly setting SCREEN-INPUT field in TABLE CONTROL
hai guys,
in my table control i have REFNUM field and some other fields.
now my task is,
in every row,i have to enable the REFNUM field of table control for editing only if REFNUM is blank.
else i shud disable it.(when REFNUM is filled).
all other fields should be always disabled.
(right now,i am just able to either totaly enable the entire REFNUM coloumn or or totaly disable it for editing,irrespective of the values it is holding.)
shravan ramidiis this not possible?
can some one confirm it.. -
How to use table control in bdc, plz somebody tell me.
Hi Gurus,
Ples tell me
how to use table control in bdc, plz somebody tell me.
And send Sample CODE also. Thnaks in advance.hi,
Table control / step loop in BDC
Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen?
Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
we can determine the number of visible lines on Transaction Screen from our Calling BDC program.
Demo ABAP code has two purposes:
1. how to determine number of visible lines and how to calculte page number;
(the 'calpage' routine has been modify to meet general purpose usage)
2. using field symbol in BDC program, please pay special attention to the difference
in Static ASSIGN and Dynamic ASSIGN.
Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop.
Then have a look at steploop itselp, one entry of it will occupy two lines.
(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
Now we have : FixedLine = 9
LoopLine = 2(for table control, LoopLine is always equal to 1)
Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
Now we have: FirstLine = 0
or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
Step3: write a subroutine calcalculating number of pages
(here, the name of actual parameter is the same as formal parameter)
global data: FixedLine type i, " number of fixed line on a certain screen
LoopLine type i, " the number of lines occupied by one steploop item
FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1
Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
pageno type i, " you need to scroll screen how many times.
line type i, " number of lines appears on the screen.
index(2) type N, " the screen index for certain item
begin type i, " from parameter of loop
end type i. " to parameter of loop
*in code sample, the DataTable-linindex stands for the table index number of this line
form calpage using FixedLine type i (see step 1)
LoopLine type i (see step 1)
FirstLine type i (see step 2)
DataLine type i ( this is the item number you will enter in transaction)
changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
changing line type i.(visible lines one the screen)
data: midd type i,
vline type i, "visible lines
if DataLine eq 0.
Message eXXX.
endif.
vline = ( sy-srows - FixedLine ) div LoopLine.
*for table control, you should compare vline with maximum line of
*table control, then take the small one that is min(vline, maximum)
*here only illustrate step loop
if FirstLine eq 0.
pageno = DataLine div vline.
if pageno eq 0.
pageno = pageno + 1.
endif.
elseif FirstLine eq 1.
pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
midd = ( DataLine - 1 ) mod ( vline - 1).
if midd = 0 and DataLine gt 1.
pageno = pageno - 1.
endif.
endif.
line = vline.
endform.
Step4 write a subroutine to calculate the line index for each item.
form calindex using Line type i (visible lines on the screen)
FirstLine type i(see step 2)
LineIndex type i(item index)
changing Index type n. (index on the screen)
if FirstLine = 0.
index = LineIndex mod Line.
if index = '00'.
index = Line.
endif.
elseif FirstLine = 1.
index = LineIndex mod ( Line - 1 ).
if ( index between 1 and 0 ) and LineIndex gt 1.
index = index + Line - 1.
endif.
if Line = 2.
index = index + Line - 1.
endif.
endif.
endform.
Step5 write a subroutine to calculate the loop range.
form calrange using Line type i ( visible lines on the screen)
DataLine type i
FirstLine type i
loopindex like sy-index
changing begin type i
end type i.
If FirstLine = 0.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loopindex gt 1.
begin = Line * ( loopindex - 1 ) + 1.
end = Line * loopindex.
if end gt DataLine.
end = DataLine.
endif.
endif.
elseif FirstLine = 1.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loop index gt 1.
begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
if end gt DataLine.
end = DataLine.
endif.
endif.
endif.
endform.
Step6
using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
form creat_bdc.
field-symbols: , , .
data: name1(14) value 'EKPO-EMATN(XX)',
name2(14) value 'EKPO-MENGE(XX)',
name3(15) value 'RM06E-SELKZ(XX)'.
assign: name1 to ,
name2 to ,
name3 to .
do pageno times.
if sy-index gt 1
*insert scroll page ok_code"
endif.
perform calrange using Line DataLine FirstLine sy-index
changing begin end.
loop at DataTable from begin to end.
perform calindex using Line FirstLine DataTable-LineIndex changing Index.
name1+11(2) = Index.
name2+11(2) = Index.
name3+12(2) = Index.
perform bdcfield using DataTable-matnr.
perform bdcfield using DataTable-menge.
perform bdcfield using DataTable-indicator.
endloop.
enddo.
example 1
BDC table control is an area on the screen in which you can display data in tabular form. You process it using a loop. Table controls are comparable to step loop tables. While a table control consists of a single definition row, step loop blocks may extend over more than one row. Table controls are more flexible than step loops, and are intended to replace them
When you need to handle a scenario like in sales order,it may contain more than one material,if you have more than one material We have to use table control,it will have number of columns and number of rows.
Table controls allow you to enter, display, and modify tabular data easily on the screen
Check this code,
PARAMETERS: file1 LIKE rlgrap-filename.
*Internal Table Declarations
DATA: BEGIN OF itab OCCURS 0,
matnr(18) TYPE c, "MaterialNumber
werks(4) TYPE c, "Plant
vdatu(10) TYPE c, "Valid From Date
bdatu(10) TYPE c, "Valid To Date
lifnr(10) TYPE c, "Vendor Number
ekorg(4) TYPE c, "Purchasing Organization
feskz TYPE c, "Fixed
autet TYPE c, "MRP Indicator
END OF itab.
DATA: bdcdata LIKE TABLE OF bdcdata WITH HEADER LINE.
*VARIABLES Declarations
DATA: wa1 LIKE LINE OF itab. "Workarea for ITAB
DATA: n TYPE i, "Check
count TYPE i.
DATA: cnt(2), "Counter
wa(15). "Workarea to hold concatenatedvalue
DATA v_msg(100).
DATA: flag.
DATA: file TYPE string.
*Initialization event
INITIALIZATION.
*At-selection-screen event
*To provide Input help for file name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = file1.
*START-OF-SELECTION EVENT
START-OF-SELECTION.
MOVE file1 TO file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*To populate BDCDATA and start data transfer
LOOP AT itab .
To validate Plant range
IF itab-werks = '1000' OR itab-werks = '2000'
OR itab-werks = '1008'.
AT NEW werks.
CLEAR: n.
cnt = 1.
PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EORD-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EORD-MATNR'
itab-matnr.
PERFORM bdc_field USING 'EORD-WERKS'
itab-werks.
PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
PERFORM bdc_field USING 'BDC_CURSOR'
wa.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
ENDAT.
IF n = 12.
READ TABLE bdcdata WITH KEY fval = '=BU'.
bdcdata-fval = '=NS'.
MODIFY bdcdata INDEX sy-tabix TRANSPORTING fval.
PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EORD-VDATU(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
cnt = 2.
n = 2.
ENDIF.
CONCATENATE 'EORD-VDATU(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-vdatu.
CONCATENATE 'EORD-BDATU(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-bdatu.
CONCATENATE 'EORD-LIFNR(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-lifnr.
CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-ekorg.
CONCATENATE 'RM06W-FESKZ(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-feskz.
CONCATENATE 'EORD-AUTET(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-autet.
IF n <> 12.
n = cnt.
ENDIF.
cnt = cnt + 1.
AT END OF werks.
CALL TRANSACTION 'ME01' USING bdcdata
UPDATE 'S'
MODE 'A'.
CLEAR:bdcdata,bdcdata[].
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = 'EN'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = v_msg.
WRITE:/ v_msg.
CLEAR: bdcdata,bdcdata[],flag.
ENDAT.
ENDIF.
ENDLOOP.
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM.
Insert field values
FORM bdc_field USING fnam fval.
IF NOT fval IS INITIAL.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
CLEAR wa.
ENDFORM.
Sample code 2
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
Regards -
Hi Group,
When I am writting BDC for transaction in which table control occurs in the second screen,it is perfectly running when I am testing with the two records in the table control,when I increases the records (200) I am getting the error that <b>Screen is too large for Internal batch Input.</b>
Here I am attaching the part of code.
MOVE 1 TO IDX.
LOOP AT IT_DATATAB INTO WA_DATATAB.
CONCATENATE 'FKKCMP_DIA-CHCKN(' IDX ')'
INTO FNAM.
perform bdc_field using FNAM
wa_datatab-col5.
CONCATENATE 'FKKCMP_DIA-GPART(' IDX ')'
INTO FNAM.
perform bdc_field using fnam
wa_datatab-col1.
CONCATENATE 'FKKCMP_DIA-VKONT(' IDX ')'
INTO FNAM.
perform bdc_field using fnam
wa_datatab-col2 .
CONCATENATE 'FKKCMP_DIA-AUDAT(' IDX ')'
INTO FNAM.
perform bdc_field using fnam
wa_datatab-col3 .
v_betrw = wa_datatab-col4.
CONCATENATE 'FKKCMP_DIA-BETRW(' IDX ')'
INTO FNAM.
write v_betrw to fval.
perform bdc_field using fnam
fval.
IDX = IDX + 1.
ENDLOOP.
Please suggest<b>A table control can contain many records, but the no of records you see on the screen is limited. In this case, the table control can hold only 16 records at a time and then we need to enter the page down and fill in more records.</b>
here is the sample code.
*--For each record in table IT_ICE_CONFM
loop at it_ice_confm.
*--Get the correct line item from calling system.
* it_ice_confm-ebelp = it_ice_confm-ebelp / '00010'.
*-- Check for Purchasing document validity
read table lt_ekko with key ebeln = it_ice_confm-ebeln
binary search.
if sy-subrc <> 0.
"error
endif.
*-- Check for Purchasing document item validity
read table lt_ekpo with key ebeln = it_ice_confm-ebeln
ebelp = it_ice_confm-ebelp
binary search.
if sy-subrc <> 0.
"error
endif.
*--Clear local variables.
clear : lv_tabix,
lv_lfdat.
lv_tabix = sy-tabix.
lv_count1 = lv_count1 + 1.
* For every new Purchase Order, populate first screen
at new ebeln.
read table it_ice_confm index lv_tabix.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0105' 'X'.
perform field_insert: tables it_bdc
using 'BDC_OKCODE' '/00',
tables it_bdc
using 'RM06E-BSTNR' it_ice_confm-ebeln.
endat.
* For every new Purchase Order line item, populate next screen
at new ebelp.
read table it_ice_confm index lv_tabix.
* if no Confirmation control key exist and no Goods receipt indicator
* occurs for the line item, set the Confirmation control key as 0001
if lt_ekpo-bstae = ' '.
if lt_ekpo-wepos = ' '.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0120' 'X'.
perform field_insert: tables it_bdc
using 'RM06E-EBELP' it_ice_confm-ebelp,
tables it_bdc
using 'BDC_OKCODE' '/00'.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0120' 'X'.
perform field_insert: tables it_bdc
using 'RM06E-TCSELFLAG(01)' 'X',
tables it_bdc
using 'BDC_OKCODE' '=DETA'.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0111' 'X'.
perform field_insert: tables it_bdc
using 'EKPO-BSTAE' '0001',
tables it_bdc
using 'BDC_OKCODE' '=BACK'.
else.
* if no Confirmation control key exist and and if Goods receipt
* indicator occurs for this line item, mark PO and line item as error
concatenate 'Item no ' it_ice_confm-ebelp
' of Purchasing document ' it_ice_confm-ebeln
' is invalid'
into return-message.
move: 'E' to return-type,
'ZI' to return-id,
'999' to return-number.
append return.
clear return.
continue.
endif.
else.
endif.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0120' 'X'.
perform field_insert: tables it_bdc
using 'RM06E-EBELP' it_ice_confm-ebelp,
tables it_bdc
using 'BDC_OKCODE' '/00'.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0120' 'X'.
perform field_insert: tables it_bdc
using 'RM06E-TCSELFLAG(01)' 'X',
tables it_bdc
using 'BDC_OKCODE' '=BSTA'.
clear lv_tab_line.
perform select_line using it_ice_confm-ebeln
it_ice_confm-ebelp
changing lv_tab_line.
if not lv_tab_line is initial.
*--Position table control row for the first time
lv_count2 = '01'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0200' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=NP'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
endif.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0200' 'X'.
endat.
lv_count2 = lv_count2 + 1.
* Handle page down
*-- if confirmations already exist.
if not lv_tab_line is initial.
*-- Check if it is 16th record, to position next record on page down
* table control has 16 rows when default screen size,
* mode and update are set
if lv_count1 = 16.
clear: lv_count1,
lv_count2.
*-- On page down, the next record comes to 2nd row
lv_count2 = '02'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=NP'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0200' 'X'.
endif.
else.
*-- if confirmations does not exist, then check if it is 17th record.
* to position next record on page down
if lv_count1 = 17.
clear: lv_count1,
lv_count2.
lv_count2 = '02'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=NP'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0100' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=UMOD'.
perform screen_insert tables it_bdc
using 'SAPLEINB' '0200' 'X'.
*-- Initialize the table line to 1.
lv_tab_line = 1.
endif.
endif.
concatenate 'EKES-EBTYP(' lv_count2 ')' into lv_field.
perform field_insert tables it_bdc
using lv_field 'Z1'.
if not it_ice_confm-eindt is initial.
clear: lv_field,
lv_date.
concatenate 'RM06E-EEIND(' lv_count2 ')' into lv_field.
move it_ice_confm-eindt to lv_lfdat.
write lv_lfdat to lv_date.
perform field_insert tables it_bdc
using lv_field lv_date.
endif.
if not it_ice_confm-uzeit is initial.
clear: lv_field,
lv_time.
concatenate 'EKES-UZEIT(' lv_count2 ')' into lv_field.
write it_ice_confm-uzeit to lv_time.
perform field_insert tables it_bdc
using lv_field lv_time.
endif.
clear lv_field.
concatenate 'EKES-XBLNR(' lv_count2 ')' into lv_field.
perform field_insert tables it_bdc
using lv_field it_ice_confm-scacd.
clear lv_field.
concatenate 'EKES-MENGE(' lv_count2 ')' into lv_field.
perform field_insert tables it_bdc
using lv_field it_ice_confm-quantity.
at end of ebelp.
clear: lv_tab_line,
lv_count1,
lv_count2.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=BACK'.
endat.
at end of ebeln.
clear: lv_lines,
lv_msg.
perform screen_insert tables it_bdc
using 'SAPMM06E' '0120' 'X'.
perform field_insert tables it_bdc
using 'BDC_OKCODE' '=BU'.
call transaction <b>tcode</b> using it_bdc
options from x_ctu_params
messages into lt_message.
clear w_success.
if sy-subrc <> 0.
w_success = 'N'.
endif.
refresh: it_bdc,
lt_message.
endat.
endloop.
Regards,
Richa -
How to delete a row in table control?
Hi All,
I have a empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
In my code:
TOP Include
CONTROLS: tc_data TYPE TABLEVIEW USING SCREEN 9001.
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_DATA TO WA_DATA.
ENDIF.
endmodule.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
ENDLOOP.
MODULE GET_USER_ACTION.
module GET_USER_ACTION input.
WHEN 'DEL'.
LOOP AT T_DATA INTO WA_DATA WHERE MARK EQ 'X'.
DELETE T_DATA.
ENDLOOP.
In my debug, the internal table T_DATA-MARK does not have any value(s) even if I selected a particular row in my table control.
Am I missing something here?
ThanksHi All,
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output: http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
In my debug, I can now delete the internal table that has a 'X' mark on its respective row but on the SAP screen output, all of my entries are being deleted contrary to what the ABAP debugger is telling me.
Thanks -
Table control small Issues , Plz help in tracing the problem
Hello John , Rich , Anand & all
My sorting is working fine but thr is small problem
1. user has habit of pressing enter after everything,
after entering the values in editable fields in Table control , it doesnt retain the entered values but if he presses save button immediately after entering values , it saves .
how 2 hold the values after pressing enter button
2. Now with this code , it saves the table control content but doesnt display the latest values immediately on the screen .
3. User doesnt want to press SAVE button , he wants save the Table control content by pressing ENTER button,
What is the OK_CODE value for Enter Button plz ?
Plllllzzzzz help me for god sake ASAP.
<u><b>Everyone whoever make an attempt is going to get 10 pnts.</b></u>
==========================
FLOW Logic
PROCESS BEFORE OUTPUT.
MODULE SET_STATUS.
LOOP AT ITAB
WITH CONTROL TCL1
CURSOR TCL1-CURRENT_LINE .
MODULE SET_LINE_COUNT .
ENDLOOP.
PROCESS AFTER INPUT.
MODULE GET_OK_CODE .
MODULE EXIT_COMAND AT EXIT-COMMAND.
MODULE SCROLL_SORT.
LOOP AT ITAB.
MODULE UPDATE_MOD.
ENDLOOP.
==========================
REPORT ZSD_REP_ORDER_BANK_CHANGE NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES: VBAK,VBAP,VBRK,ZSD_TABL_ORDBANK,MARA,KONV.
CONTROLS: TCL1 TYPE TABLEVIEW USING SCREEN 0200.
DATA: ITAB LIKE ZSD_TABL_ORDBANK OCCURS 0 WITH HEADER LINE,
WA_ITAB LIKE ZSD_TABL_ORDBANK,
OK_CODE LIKE SY-UCOMM,
SAVE_OK_CODE LIKE SY-UCOMM,
UPD_OK_CODE LIKE SY-UCOMM,
ANSWER TYPE C,
I LIKE SY-LOOPC ,
J LIKE SY-LOOPC,
V_LINES LIKE SY-LOOPC,
LINE_COUNT LIKE SY-LOOPC,
STS TYPE N,
EMGRP LIKE MARA-EXTWG,
QTY LIKE ZSD_TABL_ORDBANK-QTY,
UPRICE LIKE ZSD_TABL_ORDBANK-UPRICE,
TOT LIKE ZSD_TABL_ORDBANK-TOT,
INO LIKE VBAP-POSNR,
COL TYPE CXTAB_COLUMN,
COPIED_ONCE ,
FLDNAME(100),HELP(100).
FIELD-SYMBOLS:
<FS_ITAB> LIKE LINE OF ITAB,
<FS_TCL1> LIKE LINE OF TCL1-COLS.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS: S_CCODE FOR ZSD_TABL_ORDBANK-CCODE
NO INTERVALS NO-EXTENSION OBLIGATORY,
S_SORG FOR ZSD_TABL_ORDBANK-SORG
NO INTERVALS NO-EXTENSION OBLIGATORY,
S_DCHAN FOR ZSD_TABL_ORDBANK-DISTCHAN,
S_DIV FOR ZSD_TABL_ORDBANK-DIV,
S_MATNO FOR ZSD_TABL_ORDBANK-MATNO,
S_CUSTNO FOR ZSD_TABL_ORDBANK-CUSTNO ,
S_QTNO FOR ZSD_TABL_ORDBANK-QTNO,
S_QTDAT FOR ZSD_TABL_ORDBANK-QTDAT,
S_QTVDAT FOR ZSD_TABL_ORDBANK-QTVALDAT,
S_SONO FOR ZSD_TABL_ORDBANK-SONO.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT * FROM ZSD_TABL_ORDBANK
INTO TABLE ITAB
WHERE CCODE IN S_CCODE
AND SORG IN S_SORG
AND DISTCHAN IN S_DCHAN
AND DIV IN S_DIV
AND MATNO IN S_MATNO
AND CUSTNO IN S_CUSTNO
AND QTNO IN S_QTNO
AND QTDAT IN S_QTDAT
AND QTVALDAT IN S_QTVDAT
AND SONO IN S_SONO .
IF SY-SUBRC EQ 0.
REFRESH ITAB.
CLEAR COPIED_ONCE.
CALL SCREEN 0200.
ELSE.
MESSAGE E012(ZQOTBANK) .
ENDIF.
*& Module SET_STATUS OUTPUT
text
MODULE SET_STATUS OUTPUT.
SET PF-STATUS '0200'.
SET TITLEBAR '0200'.
IF COPIED_ONCE IS INITIAL.
SELECT * FROM ZSD_TABL_ORDBANK
INTO TABLE ITAB
WHERE CCODE IN S_CCODE
AND SORG IN S_SORG
AND DISTCHAN IN S_DCHAN
AND DIV IN S_DIV
AND MATNO IN S_MATNO
AND CUSTNO IN S_CUSTNO
AND QTNO IN S_QTNO
AND QTDAT IN S_QTDAT
AND QTVALDAT IN S_QTVDAT
AND SONO IN S_SONO .
IF SY-SUBRC EQ 0.
DESCRIBE TABLE ITAB LINES V_LINES.
TCL1-LINES = V_LINES.
ENDIF.
COPIED_ONCE = 'X'.
REFRESH CONTROL 'TCL1' FROM SCREEN '0200'.
ENDIF.
LOOP AT ITAB.
QTY = ITAB-QTY.
UPRICE = ITAB-UPRICE.
TOT = QTY * UPRICE .
ITAB-TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-CGL_QTY.
UPRICE = ITAB-CGL_UPRICE.
TOT = QTY * UPRICE .
ITAB-CGL_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-BHEL_QTY.
UPRICE = ITAB-BHEL_UPRICE.
TOT = QTY * UPRICE .
ITAB-BHEL_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-ALSTOM_QTY.
UPRICE = ITAB-ALSTOM_UPRICE.
TOT = QTY * UPRICE .
ITAB-ALSTOM_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-SIEMENS_QTY.
UPRICE = ITAB-SIEMENS_UPRICE.
TOT = QTY * UPRICE .
ITAB-SIEMENS_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-TELK_QTY.
UPRICE = ITAB-TELK_UPRICE.
TOT = QTY * UPRICE .
ITAB-TELK_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ITAB-OTH_QTY.
UPRICE = ITAB-OTH_UPRICE.
TOT = QTY * UPRICE .
ITAB-OTH_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
MODIFY ITAB.
ENDLOOP.
ENDMODULE. " SET_STATUS OUTPUT
*& Module SET_LINE_COUNT INPUT
text
MODULE SET_LINE_COUNT OUTPUT.
LINE_COUNT = SY-LOOPC.
ENDMODULE. " SET_LINE_COUNT INPUT
*& Module GET_OK_CODE INPUT
text
MODULE GET_OK_CODE INPUT.
IF OK_CODE = 'SAVE'.
UPD_OK_CODE = OK_CODE.
ENDIF.
ENDMODULE. " GET_OK_CODE INPUT
*& Module EXIT_COMAND INPUT
text
MODULE EXIT_COMAND INPUT.
SAVE_OK_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK_CODE.
WHEN 'BACK'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Order Bank Entry'
TEXT_QUESTION = 'Do you want to Go BacK ?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'
DEFAULT_BUTTON = '2'
IMPORTING
ANSWER = ANSWER.
IF ANSWER = '1'.
LEAVE TO SCREEN 0.
ELSE.
ENDIF.
WHEN '%EX'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Order Bank Entry'
TEXT_QUESTION = 'Do you want to Exit ?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'
DEFAULT_BUTTON = '2'
IMPORTING
ANSWER = ANSWER.
IF ANSWER = '1'.
LEAVE TO SCREEN 0.
ELSE.
ENDIF.
ENDCASE.
ENDMODULE. " EXIT_COMAND INPUT
*& Module SCROLL INPUT
text
MODULE SCROLL_SORT INPUT.
SAVE_OK_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK_CODE.
WHEN 'P--'.
TCL1-TOP_LINE = 1.
WHEN 'P-'.
TCL1-TOP_LINE = TCL1-TOP_LINE - LINE_COUNT.
IF TCL1-TOP_LINE LE 0.
TCL1-TOP_LINE = 1.
ENDIF.
WHEN 'P+'.
I = TCL1-TOP_LINE + LINE_COUNT.
J = TCL1-LINES - LINE_COUNT + 1.
IF J LE 0.
J = 1.
ENDIF.
IF I LE J.
TCL1-TOP_LINE = I.
ELSE.
TCL1-TOP_LINE = J.
ENDIF.
WHEN 'P++'.
TCL1-TOP_LINE = TCL1-LINES - LINE_COUNT + 1.
IF TCL1-TOP_LINE LE 0.
TCL1-TOP_LINE = 1.
ENDIF.
WHEN 'SORTUP'.
READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
IF SY-SUBRC = 0.
SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
SORT ITAB ASCENDING BY (FLDNAME).
ENDIF.
WHEN 'SORTDN'.
READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
IF SY-SUBRC = 0.
SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
SORT ITAB DESCENDING BY (FLDNAME).
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND INPUT
*& Module UPDATE_MOD INPUT
text
MODULE UPDATE_MOD INPUT.
CASE UPD_OK_CODE.
WHEN 'SAVE'.
UPDATE ZSD_TABL_ORDBANK FROM ITAB .
STS = SY-SUBRC .
IF STS NE 0.
MESSAGE E003(ZQOTBANK) .
ENDIF.
ENDCASE.
ENDMODULE. " UPDATE_MOD INPUT
Thnx
Moni
Message was edited by: md monirujjamanPROCESS BEFORE OUTPUT.
MODULE SET_STATUS.
LOOP AT ITAB
WITH CONTROL TCL1
CURSOR TCL1-CURRENT_LINE .
MODULE SET_LINE_COUNT .
ENDLOOP.
PROCESS AFTER INPUT.
MODULE GET_OK_CODE .
MODULE EXIT_COMAND AT EXIT-COMMAND.
MODULE SCROLL_SORT.
LOOP AT ITAB.
MODULE UPDATE_ITAB.
ENDLOOP.
MODULE UPDATE_TABLE.
changed modules are ......
*& Module UPDATE_MOD INPUT
text
MODULE UPDATE_ITAB INPUT.
MODIFY TABLE ITAB FROM ITAB.
ENDMODULE. " UPDATE_MOD INPUT
*& Module TABL_UPD INPUT
text
MODULE UPDATE_TABLE INPUT.
CASE UPD_OK_CODE.
WHEN 'SAVE'.
UPDATE ZSD_TABL_ORDBANK FROM TABLE ITAB .
IF SY-SUBRC NE 0.
MESSAGE E003(ZQOTBANK) .
ENDIF.
ENDCASE.
ENDMODULE. " TABL_UPD INPUT
now i m able 2 get the latest edited values from user immediately i press enter button and getting saved by pressing SAVE button but further problems are, i have one dropdown button for status 1 field , and 1 date field are not getting updated .
So further help plz. -
Problem in the BDC Table Control for the T.Code VA01
Hi,
I faced probelm in the BDC of the VA01. In the Table Control
the records are entered upto 12 line items. after 13th line item overwrites the first record. How to solve the Problem.
Please help me.or use this
Internal table definition *
data : begin of bdcdata occurs 0.
include structure bdcdata.
data : end of bdcdata.
data: begin of messtab occurs 0.
include structure bdcmsgcoll.
data: end of messtab.
data: v_chr_opengrp type c,
r_matnr like mara-matnr, "variable for material conversion
r_werks like marc-werks, "variable for plant
v_str_fname type string.
data: begin of count2,
inrec(9) type n, " input I_MATERIAL count
create(9) type n, " create count
error(9) type n, " error count
bdc(9) type n, " count of BDC creates
end of count2.
types: begin of ty_source,
partn_numb(10) type n ,"Customer Number 1
ref(035),
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
material like vbap-matnr,
reqqty(018),
reqdate(010),
end of ty_source,
begin of ty_header ,
partn_numb(10) ,"Customer Number 1
ref(035),
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
end of ty_header,
begin of ty_item,
partn_numb(10) ,"Customer Number 1
ref(035),
material like vbap-matnr,
reqqty(018),
reqdate(010),
end of ty_item.
data : msg(240) type c, " Return Message
e_rec(8) type c, " Error Records Counter
rec_no(8) type c, " Records Number Indicator
s_rec(8) type c, " Successful Records Counter
t_rec(8) type c, " Total Records Counter
v_matnr like mara-matnr.
data: val(2) type n value 01.
data : begin of bdc_itab occurs 0.
include structure bdcdata.
data : end of bdc_itab.
data : t_source type standard table of ty_source with header line,
t_header type standard table of ty_header initial size 1,
t_item type standard table of ty_item initial size 1,
t_target type standard table of bdcdata initial size 1.
data : w_source type ty_source,
w_source1 type ty_source,
w_header type ty_header,
w_item type ty_item,
w_target type bdcdata,
count type i,
count1 type n.
Variable Declaration
data: w_fname type string,
fnam(20),
date1(10),
i(2) type n,
v_count type i,
v_group type apqi-groupid.
*& selection screen
selection-screen :begin of block bl1 with frame title text-001.
parameters : p_fname type rlgrap-filename, "Input file
p_update(1) default 'N', "Input for update mode
p_bdcgrp(12) default 'SD_ORDERS'. "Input for session name
selection-screen end of block bl1.
**&SELECTION SCREEN VALIDATIONS
at selection-screen on value-request for p_fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = 'ZMATERIAL'
dynpro_number = '1000'
field_name = 'P_FNAME'
changing
file_name = p_fname.
*& Start of selection
start-of-selection.
if p_fname is initial.
message i016(rp) with 'Please enter a file name'.
leave list-processing.
else.
move p_fname to v_str_fname.
endif.
call function 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = v_str_fname
has_field_separator = 'X'
tables
data_tab = t_source
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
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 t_source by ref partn_numb.
loop at t_source into w_source.
add 1 to count2-inrec.
w_source1 = w_source.
AT NEW PARTN_NUMB. "10/31 KVB
at new ref.
w_header-doc_type = w_source1-doc_type..
w_header-sales_org = w_source1-sales_org . "'0001'
w_header-distr_chan = w_source1-distr_chan. "'01'
w_header-division = w_source1-division. " '01'
w_header-purch_no = w_source1-purch_no.
w_header-partn_numb = w_source1-partn_numb.
w_header-ref = w_source1-ref.
append w_header to t_header.
endat.
w_item-partn_numb = w_source1-partn_numb.
w_item-material = w_source1-material.
w_item-reqqty = w_source1-reqqty.
w_item-ref = w_source1-ref.
w_item-reqdate = w_source1-reqdate.
append w_item to t_item.
clear :w_item,w_header.
endloop.
loop at t_header into w_header.
perform bdc_dynpro using 'SAPMV45A' '0101' .
perform bdc_field using 'BDC_CURSOR' 'VBAK-SPART'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'VBAK-AUART' w_header-doc_type.
perform bdc_field using 'VBAK-VKORG' w_header-sales_org.
perform bdc_field using 'VBAK-VTWEG' w_header-distr_chan.
perform bdc_field using 'VBAK-SPART' w_header-division.
perform bdc_dynpro using 'SAPMV45A' '4001' .
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'BDC_CURSOR' 'VBKD-BSTKD'.
perform bdc_field using 'VBKD-BSTKD' w_header-purch_no.
perform bdc_field using 'KUWEV-KUNNR' w_header-partn_numb.
i = 1.
loop at t_item into w_item where partn_numb = w_header-partn_numb
and ref = w_header-ref.
at new partn_numb.
clear count1.
count = 0.
endat.
count = count + 1.
if count gt 5.
clear i.
i = 2.
perform bdc_dynpro using 'SAPMV45A' '4001' .
perform bdc_field using 'BDC_OKCODE' '=POAN'.
endif.
count1 = count1 + 1.
concatenate 'VBAP-POSNR(' i ')' into fnam.
perform bdc_field using fnam
count1.
concatenate 'RV45A-MABNR(' i ')' into fnam.
perform bdc_field using fnam w_item-material.
concatenate 'RV45A-KWMENG(' i ')' into fnam.
perform bdc_field using fnam w_item-reqqty..
concatenate 'RV45A-ETDAT(' i ')' into fnam.
perform bdc_field using fnam w_item-reqdate.
concatenate 'VBKD-BSTKD_E(' i ')' into fnam.
perform bdc_field using fnam w_item-ref.
i = i + 1.
clear: w_item.
endloop.
clear w_header.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform post_transaction.
refresh bdc_itab.
clear bdc_itab.
endloop.
*endloop.
end-of-selection.
perform finalization.
Start new screen *
form bdc_dynpro using program dynpro.
clear bdc_itab.
bdc_itab-program = program.
bdc_itab-dynpro = dynpro.
bdc_itab-dynbegin = 'X'.
append bdc_itab.
endform. "bdc_dynpro
Insert field *
form bdc_field using fnam fval.
if fval <> ''.
clear bdc_itab.
bdc_itab-fnam = fnam.
bdc_itab-fval = fval.
append bdc_itab.
endif.
endform. "bdc_field
**& Form get_filename
text
--> p1 text
<-- p2 text
*form get_filename .
*call function 'WS_FILENAME_GET'
exporting
def_filename = space
def_path = file
mask = ',.,..'
mode = 'N'
title = text-015
importing
filename = file
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
*endform. " get_filename
*& Form post_transaction
text
--> p1 text
<-- p2 text
form post_transaction .
refresh messtab.
clear messtab.
call transaction 'VA01' using bdc_itab
mode p_update
update 'S'
messages into messtab.
read table messtab with key msgtyp = 'E'.
if sy-subrc eq 0.
perform process_error_messages.
add 1 to count2-bdc.
if v_chr_opengrp is initial.
perform bdc_open_group.
endif.
call function 'BDC_INSERT'
exporting
tcode = 'VA01'
tables
dynprotab = bdc_itab
exceptions
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
others = 5.
if sy-subrc <> 0.
case sy-subrc.
when 1.
write: / 'Internal error'.
when 2.
write: / 'Not open error'.
when 3.
write: / 'queue error'.
when 4.
write: / 'tcode invalid error'.
when others.
write: / 'other error'.
endcase.
endif.
else.
add +1 to count2-create.
format intensified off.
format color col_normal.
format color col_normal off.
endif.
clear bdc_itab.
refresh bdc_itab.
endform. " post_transaction
*& Form finalization
text
--> p1 text
<-- p2 text
form finalization .
if v_chr_opengrp = 'X'.
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
endif.
get time.
skip 2.
write: / 'Time', sy-uzeit.
skip.
format color col_total on.
write: / 'Total Records: ', 40 count2-inrec.
write: / 'PERNR not of Emp Group 6 ', 40 count2-error.
write: / 'Records Created: ', 40 count2-create.
write: / 'BDC Create in group: ', 40 count2-bdc.
if v_chr_opengrp = 'X'.
skip 1.
format intensified on.
format color col_negative on.
write: / 'PLEASE USE TRANSACTION "SM35" ',
'TO PROCESS THE GENERATED BDC SESSION ... ',
p_bdcgrp.
endif.
endform. " finalization
*& Form bdc_open_group
text
--> p1 text
<-- p2 text
form bdc_open_group .
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = p_bdcgrp
holddate = sy-datum
keep = 'X'
user = sy-uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
if sy-subrc eq 0.
v_chr_opengrp = 'X'.
endif.
endform. " bdc_open_group
*& Form process_error_messages
text
--> p1 text
<-- p2 text
form process_error_messages .
data: begin of loc_aux_message.
include structure message.
data: end of loc_aux_message.
data : msgno type sy-msgno.
loop at messtab.
move messtab-msgnr to msgno.
call function 'WRITE_MESSAGE'
exporting
msgid = messtab-msgid
msgno = msgno
msgty = messtab-msgtyp
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
importing
messg = loc_aux_message
exceptions
others = 1.
if sy-subrc eq 0.
format color col_negative on.
write: /10 loc_aux_message.
format color col_negative off.
else.
format color col_negative on.
write: /10 t_source-partn_numb.
write: / 'Error creating message'.
format color col_negative off.
exit.
endif.
endloop.
endform. " process_error_messages -
How To delete the Chosen line from the Table Control
Hi Friends,
i am new to Module Pool Programming , i developed a Table Control in input mode and i am getting data also into that table control. my requirement is that i want to delete the current chosen line from that table control. please help me out.HI
GOOD
GO THROUGH THIS REPORT
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
CHANGE THE CODE AS PER THIS LIGIC.
THANKS
MRUTYUN -
WSo2 BDC to delete line item in table control
Hi all,
My requirement is to delete material from wso2 table control.
The only way to delete a line item in this table control is to select the line in table control and delete it.
The recording doesnt captures any selection of row.
Any input on how to caputre particular row ??
Please dont send me links to work with table control in bdc
Regards
BhanuDaveL wrote:
I am not aware of any way to make the BDC delete the row, other than by running in 'A'-all mode and letting the user step through each screen and delete the rows that should be deleted.
Well , if the user has to run it in "A" all screen mode why a BDC is required
DaveL wrote:
Deleting them from the table control would obviously have no effect upon the database table though, would it....it would just hide a row from view in this particular table control
Really ? Well it will delete it from database too i dont know what makes you think that it wont be deleted from database.
Anways i have figured out how to capture row selection in BDC .
Thanks for your reply it proves nothing i guess
Maybe you are looking for
-
Is there a way to send video out from and iPhone 5 to 30 pin connector??
My iPhone 4S could send video to my Audi MMI, and control it within the car It WAS PERFECT, I could get my GPS to show in the car without ANY hack! everything legal. iPhone 5 with Lightning Adapter just wont. Please help me with a work around. This w
-
Idoc xml message in JMS adapter
Hi All, Question 1: My scenario is MQ series(JMS adaptr) to SAP(IDOC adptr) . In my mapping both source and target structure is same IDOC structure.Where MQ series will send IDOC xml. In such case shall i need to do content conversion at JMS adap
-
Posting Customer Payment Term Discount Separately
Hello Gurus, I have configured the system for the Customer Payment Terms in SAP but I am having hard time showing that correctly in FBL5N. For Example: Invoice Value $100 Payment Term 2% Discount Customer Pays on time $98 In FBL5N main display screen
-
Save xsd:dateTime in java.util.Date
Hi, can anybody give me a code snippet to save a String representing an xsd:dateTime (probably containing timezone information) to java.util.Date? I really don't know how to do it. Thanks, Sven
-
Accessing Local Laptop SOA suite instance
I know this is probably a really stupid question but can anyone think of why my colleague cannot access a web service running on my laptop pc. We are connected on the LAN he can se and ping my pc the web service is running but the URL does not work?