Developing table control...
hi,
i have read posts on creating the table control by program rather than using the wizard. i want to try that.. can anyone point me to some good material or let me know the steps or sampl code ??
all i need is
1. a table control to display data from my internal table.
2. user must be able to select/deselect multiple rows
3. there can be a button to sort in ascending and descending order, but then which column ?? can he choose the column ?
4. i need scrollbars in that table control.
5. provision to validate those selected lines. if they dont match the criteria then they must be allowed to select to deselect the rows again !!
pretty much a simple expectation...any help ? thks
hey,
one question..how are the table control's columns built ??
i have dragged a table control on my screen. how do i speciy the columns it has to display ??
i am not able to follow the logic to populate the table. any help ?
in table control wizard we will have a link between the ITAB and the table control automatically. here how do i do that manually ?
thks
Similar Messages
-
SAP Portal development-Table Controls having link to table cell content
Hello all,
I am creating the SAP portal in which i am using Table controls to display the data. I want the function should be called whenever user clicks the table cell content. i.e. i want to create the function link to table cell.
Please reply soon.
Regards,
PrashantHi Prashant,
You haven't mentioned if you are using Webdynpro or HTMLB JSPDynPages.
If its the webdynpro, you can declare then and there itself that the content to the table column is a row my changing the property.
If it is a HTMLB component TableVIew that you are trying to use, you can include a TableCellRenderer Class which renders the cells of the table at the runtime as links or buttons or whatever you want to put.
So let me know, what exactly you are trying to use, then finding a solution will be more clear.
regards,
Sujana -
Table control related...
Hi,
My question is - how can I develop table control having three columns with only one column editable?Hi,
write module in PBO as below
*& Module FIELD_STATUS_9012 OUTPUT
text
module FIELD_STATUS_9012 output.
LOOP AT SCREEN.
CASE screen-name.
The following are the screen field names
WHEN 'WA_LC_BG_ACCT-BELNR' OR
'WA_LC_BG_ACCT-WRBTR' OR
'WA_LC_BG_ACCT-ZFBDT' OR
'WA_LC_BG_ACCT-PYDATE' OR
'WA_LC_BG_ACCT-BCHARG' OR
'WA_LC_BG_ACCT-INTRST'.
screen-input = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
endmodule. " FIELD_STATUS_9012 OUTPUT
Regards,
Raju. -
Hi,
Currently using SAP 4.7 SAPKB62011
The need was to develop a program, which based on a selection-criteria displays a table(editable) and some changes will be done in the table and data should get saved.
The best approach I assumed was to
a) Create a report, define the selection screen parameters
b) Do validation in at selection-screen
c) If all validations are proper, select values to be shown in table control
d) call screen 9000
Everything is working perfectly, except for adding new lines in table control.
When I execute select query in AT SELECTION-SCREEN event before calling the screen 9000, then I am not able to add values to table control.
But if I put the select query in the PBO of screen 9000, I am able to add new values. Only those values which are already present in table control can be changed. I am not able to add any new entries.
In my opinion, there should not be a select query in PBO, because that query would hit the database in all possible events.
Any particular reason, why.
<b>AT SELECTION-SCREEN code</b>
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'ONLI'.
lv_pernr = p_pernr.
lv_lifnr = p_lifnr.
* SELECT *
* FROM zpersoninfo
* INTO TABLE lt_zpersoninfo
* WHERE personno = lv_pernr.
* IF sy-subrc <> 0.
* ENDIF.
* APPEND INITIAL LINE TO LT_ZPERSONINFO.
CALL SCREEN 9000.
ENDCASE.
<b>Dynpro code</b>
PROCESS BEFORE OUTPUT.
MODULE pbo_9000.
LOOP AT lt_zpersoninfo INTO zpersoninfo WITH CONTROL tablecontrol CURSOR
tablecontrol-current_line.
MODULE pbo_tc_9000.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP.
MODULE pai_tc_9000.
ENDLOOP.
MODULE pai_9000.
<b>PBO_9000</b>
MODULE pbo_9000 OUTPUT.
SET PF-STATUS lv_pfstatus.
pa0315-pernr = lv_pernr.
SELECT *
FROM zpersoninfo
INTO TABLE lt_zpersoninfo
WHERE personno = lv_pernr.
IF sy-subrc <> 0.
ENDIF.
APPEND INITIAL LINE TO LT_ZPERSONINFO.
ENDMODULE. " PBO_9000 OUTPUT
<b>PBO 9000 - Table Control Code</b>
MODULE pbo_tc_9000 OUTPUT.
LOOP AT SCREEN.
IF lv_pfstatus = 'DISPLAY'.
CASE screen-name.
WHEN 'ZPERSONINFO-SERVICENO'.
screen-input = '1'.
screen-active = '1'.
WHEN 'ZPERSONINFO-MANDATORY'.
screen-input = '1'.
screen-active = '1'.
ENDCASE.
ELSEIF lv_pfstatus = 'CHANGE'.
CASE screen-name.
WHEN 'ZPERSONINFO-SERVICENO'.
screen-input = '0'.
WHEN 'ZPERSONINFO-MANDATORY'.
screen-input = '0'.
ENDCASE.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.
Let me know if I have skipped some information, which you may find it useful to find the solution.
Regards,
Subramanian V.That is because I didn't upate the 'LINES' field in tablecontrol. How silly !!
Regards,
Subramanian V. -
Internal table not getting modified from Table Control
Hi Guys,
I am developing a <b>Module Pool </b>Program where I am inserting data directly in table control of the main screen.
In the flow logic of the Table control I have written :
PROCESS BEFORE OUTPUT.
LOOP AT itab WITH CONTROL tc1 CURSOR tc1-current_line.
MODULE read_data.
ENDLOOP.
MODULE status_0100.
PROCESS AFTER INPUT.
LOOP AT itab.
MODULE mod_data.
ENDLOOP.
MODULE user_command_0100.
Module mod_data input.
MODIFY itab INDEX tc1-current_line.
Endmodule.
At modify, when I am debugging it's showing sy-subrc = 4 (Entry not appending in Int Table though it is there in the header line). But, if I use append itab, it's working (Problem is that while inserting 2nd record a copy of first record is also appending which I don't want).
Please let me know what's wrong in Modify statement or what is solution for inserting records of tablecontrol in internal table.
TIA,
NitinHi Nitin,
use the following code wor module.
Module mod_data input.
READ ITAB INDEX TC1-CURRENT_LINE.
IF SY-SUBRC = 0.
MODIFY itab INDEX tc1-current_line.
ELSE.
APPEND ITAB.
ENDIF.
Endmodule. -
Get all rows from a table control
Hi All,
I have a table control with one column. What function should I use to retrieve all the rows ? Do I need to iterate row by row and read each row or is it possible to do it in one function ?
Thanks,
Kanu
Solved!
Go to Solution.Supposing vells in the column have all the same data type, you can retrieve the whole column with a single instruction:
GetTableCellRangeVals (panel, control, VAL_TABLE_COLUMN_RANGE (1), array, VAL_COLUMN_MAJOR);
The array passed must be large enough to retrieve all data. Alternatively, you may substitute the macro VAL_TABLE_COLUMN_RANGE with the appropriate MakeRect instruction.In case your table was dinamically built, you can obtain the nu,ìmber of rows using GetNumTableRows and dimension your array accordingly.
The above macro is defined in userint.h together with some other useful macros that can be used to access data in a table.
There are some precautions to take in case of string values or some cell type (ring, combo box, button...) that are described in the hell for the function.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
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 -
Drop down list in Table Control - Value disappeared after pressing ENTER
Dear Gurus,
I have a problem in one of my development where I used a table control in which one field is a drop down list.
I used VRM_SET_VALUES and VRM_GET_VALUES for populating the values from the programand not use any domain level value table for that field.
My problem is when I select one value from this list , and pressing enter , the value get disappeared. But if I use a domain for this field with value table then everything working properly.
My doubt is am I doing some miss coding or using the VRM_ function modules improperly ?
I am sharing some code with you
in PAI :
CALL FUNCTION 'VRM_GET_VALUES'
EXPORTING
id = 'ITAB-FIELD3' "This is drop down list element on screen
IMPORTING
values = values[] " even it is not the expor parameter...it will work..
EXCEPTIONS
id_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
No sy-subrc check required.
ENDIF.
IN PBO
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'IVBAP-ERNAM'
values = values[].
Can you please help me.
Thanks .HI,
The link contains the list box creation, just check if this might help.
Re: Getting values back from a listbox.
Regards and Best wishes. -
Multiple record update in TABLE Control.
Hi All,
I m developing dialog program with table control.
I want to know how to update multiple records through the table control if user selects more than one.
Also depending on some condition i want to change the status of one reocrd and not the column as a display field and won't be editable. I have tried with loop at screen and modify screen, but it is showing the whole column as display only.
ANy solution let me knowHi,
pls chk this standard pgms.
for examples on table control
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
RSDEMO_TABLE_CONTROL
chk a sample code.
DATA :BEGIN OF int_table OCCURS 0,
fld1 TYPE ztable-fld1,
fld2 TYPE ztable-fld2,
fld3 TYPE ztable-fld3,
chk(1),
END OF int_factor.
*write the blow code in PAI
LOOP AT int_table WHERE chk = 'X'.
*modify the data base table
MODIFY ztable FROM int_table. "from header
clear int_table
ENDLOOP.
regards
Anver -
Description of field from data element in table control
hello people !!! I need help !!
Im using a table control in my module pool program. I create this table through wizard, taking the fields from an internal table. This internal table was defined like this:
Table Control ; posting items
DATA: t_postitems TYPE stucture_fd OCCURS 0 WITH HEADER LINE.
Where <b>stucture_fd</b> is strucuture with the fields.
The problem that I have is that the titles of the fields does not take their description from the data element.
How I create this table control from the internal table and that takes the description from the data element? It is very important this, because this development will be used in different languages.
From already I am thanking for any answer.
Thank so much.
Best regards, Esther.Gracias, es mas facil para mi en espanol.
tables: tab_prb.
types: begin of <b>ti</b>.
include structure <b>tab_prb</b>.
types: end of <b>ti</b>.
data: <b>ti_b</b>kpf type table of ti,
<b>wa_bkpf</b> type ti.
Explicacion:
tab_prb, es una tabla transparent que contiene la estructura <b>struct_fd</b> que tiene los campos mas un flag para la seleccion de fila (flag).
Defini esta tabla transparente, para que los campos tomen su decripcion desde los elementos de datos.
Si creo el TB directo de la tabla tab_prb, no me permite seleccionar el campo flag como campo de seleccion, cuya funcion es marcar linea simple.
Si yo hago la definicion anterior en mi programa, cuando creo el TB, va todo bien, hasta <b>ti_bkpf</b> que seria mi tabla interna, pero cuando me pide el work area, le ingreso <b>wa_bkpf</b> me indica que no esta definido en mi programa o ne es una estrucutura.
Espero haber aclarado un poco mi respuesta.
Muchas gracias !!!
Esther.- -
Dear Friends!
How are you,
I am having one doubt to ask. I have developed one table control application, With the help of table control I am changing the record of table, and saves it to the internal table this what i am supposed to do.
what I am doing is:
I have fiil the table control from the internal table like this way:
name -
number
abc 23423
efg 56456
jgf 64564
now i want to change the number column and save it again to internal table this way:
name -
number <- on save event or ok_code = save.
abc 22222
efg 55555
jgf 66666
i have dont this flow logic programing.
process before output.
*&spwizard: pbo flow logic for tablecontrol 'MY_TAB'
module my_tab_change_tc_attr.
*&spwizard: module MY_TAB_change_col_attr.
loop at it_item
into wa_item
with control my_tab
cursor my_tab-current_line.
module my_tab_get_lines.
*&spwizard: module MY_TAB_change_field_attr
endloop.
module status_0100.
module set_curson.
module get_date.
module ok_code.
process after input.
*&spwizard: pai flow logic for tablecontrol 'MY_TAB'
loop at it_item.
chain.
field wa_item-item_no.
field wa_item-material_code.
field wa_item-description.
field wa_item-unit_of_measure.
field wa_item-quantity.
field wa_item-rflag.
module my_tab_modify on chain-request.
endchain.
endloop.
module my_tab_user_command.
*&spwizard: module MY_TAB_change_tc_attr.
*&spwizard: module MY_TAB_change_col_attr.
module user_command_0100.
module get_vendor_name.
module move_data_from_table. <----- here i m copying the data from table control to internal table.
process on value-request.
field mseg-mblnr module get_mat_doc.
module move_data_from_table input. <---PAI code.
to move the data from the table control to internal table.
it_item-name = my_tab-name.
it_item-number = my_tab-number.
append it_name.
clear it_name.
endmodule. " move_data_from_table INPUT
now i m receiving the error.. data object my_tab doesnot have the componet called it_item.
here my_tab is table control name.
apparently my code is not perfect as i dont know how to do processes over Table control please help me to develop such application
Any help would be appreciated.
Regards
NaeemHi,
Your code should be in loop endloop of PAI
MODIFY <internal table> INDEX <table control>-CURRENT_LINE. -
Hai Experts,
i have problem with table control in bdc, can any tell me wat exact code for table control in bdc,n plz give flat file for this prm or any related
HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
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-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
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'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-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'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORMHi Rajesh,
I will send a sample code 4 ur problem check it once.And also i will attach a FLAT FILE at the end of program check it once.Plz copy the below code and execute it ok...
*& Report YBDC_MB1C_HEADER_ITEM_CALLTRA *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : UPLOAD DATA(T.CODE = MB1C) INTO DATABASE(CALL TRANS) *
*& CREATION DT: 5/12/2007 *
*& REQUEST : ERPK900035 *
REPORT YBDC_MB1C_HEADER_ITEM_CALLTRA.
Global BDC And Message Structures
DATA: gt_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
gt_msgtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
Global Variables For File Path And Messages
DATA: gv_infile TYPE string, "For Path Selection
gv_msg TYPE string. "For Message Printing
For Elimination Of Illegal Screens
DATA: opt TYPE ctu_params.
Global Variables
DATA: gv_num(2) TYPE n,
gv_matnr(20),
gv_erfmg(20).
gv_num = 1.
Internal Table
DATA: BEGIN OF gt_data OCCURS 0,
f1(20),
f2(20),
f3(20),
f4(20),
f5(20),
f6(20),
f7(20),
f8(20),
f9(20),
END OF gt_data.
Selection Criteria
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename,
p_mode.
SELECTION-SCREEN : END OF BLOCK b1.
Selection Path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM selection_path.
START-OF-SELECTION.
opt-nobinpt = 'X'.
opt-defsize = 'X'.
opt-updmode = 'A'.
Upload the data
PERFORM upload_data.
END-OF-SELECTION.
Populate Data Into BDCDATA Structure
PERFORM populate_data.
*& Form selection_path
text
--> p1 text
<-- p2 text
FORM selection_path .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
gv_infile = p_file.
ENDFORM. " selection_path
*& Form upload_data
text
--> p1 text
<-- p2 text
FORM upload_data .
REFRESH : gt_data.
CLEAR : gt_data.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_infile
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = gt_data
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.
ENDFORM. " upload_data
*& Form Populate_data
text
--> p1 text
<-- p2 text
FORM populate_data .
LOOP AT gt_data.
*Header Information
IF gt_data-f1 = 'H'.
PERFORM firstscreen.
CLEAR gt_data.
ENDIF.
*Item Information
IF gt_data-f1 = 'I'.
PERFORM secondscreen.
*Save data and call the Call Transaction Method
AT END OF f1.
PERFORM save.
CALL TRANSACTION 'MB1C' USING gt_bdcdata MODE p_mode
MESSAGES INTO gt_msgtab.
PERFORM messages.
REFRESH gt_bdcdata.
CLEAR gv_num. "USED IN CONCATENATE STEP
ENDAT.
gv_num = gv_num + 1.
ENDIF. "End of Item Data
ENDLOOP.
ENDFORM. " Populate_data
*& Form firstscreen
text
--> p1 text
<-- p2 text
FORM firstscreen .
PERFORM bdc_dynpro USING 'SAPMM07M' '0400'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MKPF-BKTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MKPF-BLDAT'
gt_data-f2.
PERFORM bdc_field USING 'MKPF-BUDAT'
gt_data-f3.
PERFORM bdc_field USING 'MKPF-BKTXT'
gt_data-f4.
PERFORM bdc_field USING 'RM07M-BWARTWA'
gt_data-f5.
PERFORM bdc_field USING 'RM07M-WERKS'
gt_data-f6.
PERFORM bdc_field USING 'RM07M-LGORT'
gt_data-f7.
PERFORM bdc_field USING 'XFULL'
'X'.
PERFORM bdc_field USING 'RM07M-WVERS2'
'X'.
PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSEG-ERFMG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
ENDFORM. " firstscreen
*& Form secondscreen
text
--> p1 text
<-- p2 text
FORM secondscreen .
CONCATENATE 'MSEG-MATNR(' gv_num ')' INTO gv_matnr.
CONCATENATE 'MSEG-ERFMG(' gv_num ')' INTO gv_erfmg.
PERFORM bdc_field USING 'MSEGK-KUNNR'
gt_data-f2.
PERFORM bdc_field USING gv_matnr
gt_data-f3.
PERFORM bdc_field USING gv_erfmg
gt_data-f4.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
ENDFORM. " secondscreen
*& Form save
text
--> p1 text
<-- p2 text
FORM save .
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
ENDFORM. " save
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR gt_bdcdata.
gt_bdcdata-program = program.
gt_bdcdata-dynpro = dynpro.
gt_bdcdata-dynbegin = 'X'.
APPEND gt_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR gt_bdcdata.
gt_bdcdata-fnam = fnam.
gt_bdcdata-fval = fval.
APPEND gt_bdcdata.
ENDFORM. "BDC_FIELD
*& Form messages
text
--> p1 text
<-- p2 text
FORM messages .
LOOP AT gt_msgtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = sy-langu
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = gv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF sy-tabix EQ 1.
WRITE:/ 'Process Log' COLOR 3.
ENDIF.
WRITE:/ gv_msg.
ENDLOOP.
REFRESH : gt_msgtab.
CLEAR : gt_msgtab.
ENDFORM. " messages
FLAT FILE
*H 10012005 20022005 HEADER 451 1000 0001
*I 1 100-300 5
*I 1 100-400 3
*I 1 100-100 12
*H 12012005 12022005 HEADER 451 1000 0001
*I 2 100-200 4
General Information(t.code= MB1C)
*DOC DATE : 10.1.2005 POSTING DATE : 20.2.2005
*HEADER TEXT : HEADER
*MATERIAL TYPE :451 PLANT : 1000
*STORAGE LOCATION : 0001
*CUSTOMER :1
*MATERIAL NO : 100-300
*QUANTITY : 5
*BUSINESS AREA : 0001
Award points if helpful
Kiran Kumar.G.A -
Table Control in ITS is getting wrongly displayed
Hi All,
I Have developed a program(say abc) and created a screen for that program(abc).
My issue is that,i have kept the table control in the box .
When i execute the screen in se80 under the program(abc) ,its displaying properly ( i mean table control is inside the box).
I have created an internet service program in se80 where i am passing the transaction code of that program(abc) in the parameters tab.
**problem is***
but when i execute the internet service program(xyz) after publishing then the
table control is coming out of the box in ESS ,
i mean the width of the table control is not getting reduced.
It(table control) has to get fit inside the box.
even though its working properly through screen.
please help me out of this issue.
thanks,
bhavani.
Edited by: BHAVANI MADIREDDY on Jul 26, 2008 9:53 AMHi ,
I have set vertical scroll bar to 'X' but still when I scroll the scroll bar the counter is getting incremented and the last entered value is appended many times in the table control.
What can be done to overcome this issue? -
How to add rows in table control for data recording BDC?
hello,
pl tell me the way to upload data through BDC in table control of screen .
how to add fields inrecording of table control?
Please give some code in this regard.
I am generous in giving points..pl help!Hi,
While doing code under recording first you need to do the recording with sample data under a particular transaction like T-code XK01 (Vendor creation).
Take an example of create vendor using T-code XK01:
Go to t-code 'SHDB' under make recording for XK01 with sample data and once if you complete the recording means after vendor creation check the source code bye by pressing the button 'Program', it shows the total coding for recording of what you entered the test data.
Then you will create one program and copy that source code of recording into your program, and now you have to remove the values at perform statement and give the internal table field name.
Like that you can develop your own code along with your validations.
my best suggestion is dont see the example code of recording method because any one for standard t-code should get the code from recording with sample data, so first tryout with your own recording method and you can understand the code step by step.
With these I hope you will get some idea of recoding method.
Let me know for further doubts.
Regards,
Vijay. -
How to show data through table control
Hi Experts,
I have created an table control through wizard using table EKKO.
I have to populate one internal table( type ekko ), and then show it in output through table control.
Please advise, how to do that and in where i have to write the codes.
I will reward points for every suggestion
Thanks in advance.
regardshi saubrab,
This is kiran kumar.G.I am sending some sample code to populate data into table control check it once.
i will give input in 100 screen. and display table control in 200 screen.check it once once ..ok....
SE38 :(CODE)
*& Module pool YMODULEPOOL_TABLECONTROL1 *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : TABLE CONTROL DEMO *
*& CREATION DT : 17/12/2007 *
*& T.CODE : YMODTABLECONTROL1 *
*& REQUEST : ERPK900035 *
PROGRAM ymodulepool_tablecontrol1.
Tables
TABLES: yvbap, "Sales Document: Item Data
vbak. "Sales Document: Header Data
Controls
CONTROLS: my_table TYPE TABLEVIEW USING SCREEN 200.
Global Variables
DATA: gv_lines TYPE i,
gv_lines1 type i,
gv_temp type i,
gv_flag(20) TYPE c VALUE 'DISP',
gv_mode1 TYPE c,
gv_mode TYPE c VALUE 'C'. " C: Change, D :Display
Internal Table
DATA: BEGIN OF gt_item OCCURS 0,
vbeln LIKE vbap-vbeln, "Sales Document Number
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
cflag, "Deletion Indicator
END OF gt_item.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTABLECONTROL' OF PROGRAM 'YMODULEPOOL_TABLECONTROL'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'DISP'.
SELECT single vbeln
erdat
angdt
bnddt
FROM vbak
INTO (vbak-vbeln,vbak-erdat,
vbak-angdt,vbak-bnddt)
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*Fetch the table control data and place them in Internal Table
SELECT vbeln
posnr
matnr
matkl
arktx
FROM yvbap
INTO TABLE gt_item
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*NO OF line in the Internal Table
DESCRIBE TABLE gt_item LINES gv_lines.
my_table-lines = gv_lines + 20.
ENDIF.
ENDIF.
*Call Screen 200.
SET SCREEN 200.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
*Exit from the Program
CALL TRANSACTION 'SESSION_MANAGER'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
module STATUS_0200 output.
SET PF-STATUS 'ZTABLECONTROL1'.
endmodule. " STATUS_0200 OUTPU
*& Module copy_data OUTPUT
text
module copy_data output.
*Fetch the current line data from the Table control
read table gt_item index my_table-current_line.
if sy-subrc eq 0.
*Populating data into screen fields
gt_item-vbeln = gt_item-vbeln.
gt_item-posnr = gt_item-posnr.
gt_item-matnr = gt_item-matnr.
gt_item-matkl = gt_item-matkl.
gt_item-arktx = gt_item-arktx.
endif.
SE51:CODE (SCREEN 100)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
SE51 :CODE (SCREEN 200)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
loop at gt_item with control my_table cursor my_table-current_line.
module copy_data.
endloop.
PROCESS AFTER INPUT.
loop at gt_item.
MODULE USER_COMMAND_0200.
endloop.
HAVE A NICE DAY..
Award points if helpful,kiran kumar.G
Maybe you are looking for
-
Can not find the SSIS in the msdb
Hi Everyone, I'm using a SQL Server 2k5, and recently i was stuck with a SSIS issue. I have one job which needs to be changed. The job property is as below As we can see, the instance name is "DE-S-0157580\DE_S_0157580". Then I connect to the Integra
-
hi i have a products introduction video and i would like to generate a video with the same template (but of course change the attributes for each and photo...) instaed of doing it manually for a thousand products thanks a lot
-
Portal is not displayed correctly
Hi, I had Browser Lab and Firebug installed and tried to capture the screen on a web page from intranet. The page consisted of 3 x 2 portals, 3 rows and 2 columns. On the result displayed, the portals were displayed sequentially row by row. Kindly ad
-
Transformation not generating-Flat file loading
Hello guys, I hope you can help me with this little confusion I have on BI7 Flat file loading. I got a File (CSV) on my workstation. I am trying to load Master Data. Here is the example of my file and issues: Lets say, I have CSV file named "CarModel
-
Is it advisable to use inheritance when reusing dialogs/frames?
Hi! While working on a project, I've noticed that there are instances when I could reuse code by creating general forms (as dialogs or windows) and subclassing them. For example, I have this set of dialogs which have a similar function: each dialog h