TABLE CONTROL USED IN BDC
MAY ANY ONE SUGGEST ME THE IDEA OF TABLE CONTROL USED IN BDC
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
check the below link also u may find answers for all your q's
http://help.sap.com/saphelp_webas630/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
<b>ex----</b>
*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.
ENDFORM.
Similar Messages
-
How to determine fixed line of table control using BDC program ?
Dear All,
I create program using BDC that contains table control.
Unfortunately the table control line of BDC program will depend on the resolution of our PC setting.
Sometime I have 2 lines, sometime 3 lines (in different PC).
How to determine fixed line of table control?
So it will never be confusing me whether I have 2 or 3 lines.
Thnx - Regards,
(Taufik K.)Hi Taufik,
Check the table CTU_PARAMS and field DEFSIZE for setting fixed line of a table control.
CALL TRANSACTION 'VA01' USING it_bdcdata
OPTIONS FROM OPT
MESSAGES INTO it_mesg.
opt of type ctu_params.
WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
WA_CTU_PARAMS-UPDMODE = 'S'. "synchronus update
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
Default size will play good role in terms of resoultion. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resoultion. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
Reward if helps.
Regards,
Senthil
Message was edited by: senthil kumar -
How can I work lsmw with table control using mm01 appl?
Hi
How can I work lsmw with table control using mm01 appl?
Is it difefrent the way we handle table control in BDC?
Thank YouHi
How can I work lsmw with table control using mm01 appl?
Is it difefrent the way we handle table control in BDC?
Thank You -
Dear abaper
Can u Pl let me to how to handle table control in ME51 BDC.
if u have program send it to [email protected]
rgds,
SimhaRegarding Table comtrols in BDC...
Normally all the screns with table controls will have buttons to add(Insert) a Row, Delete a Row etc..
After adding data to 1st Row (it will have index 1)... press that insert button so a new Row is inserted again at 1st row..so this will have index 1.
So in this way you can hard code the index to one.
The advantage is that if there are many rows then you will not have to keep a track of how many rows are inserted and when to press the page down button.
I am giving a small example.... Just copy paste this example and run it in all mode...
Run it in all mode so that you can see what I am trying to do...
Note : this is an relatively easy method.. not the only method to do...
report ZTEST_BDC
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE'.
perform bdc_field using 'BDC_OKCODE'
'=CHANGE_RADIO'.
perform bdc_field using 'RSRD1-TBMA'
perform bdc_field using 'RSRD1-TBMA_VAL'
'EKPO'.
perform bdc_field using 'RSRD1-DDTYPE'
'X'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE_VAL'.
perform bdc_field using 'BDC_OKCODE'
'=ADD'.
perform bdc_field using 'RSRD1-TBMA_VAL'
'EKPO'.
perform bdc_field using 'RSRD1-DDTYPE'
'X'.
perform bdc_field using 'RSRD1-DDTYPE_VAL'
'ztest_Str'.
perform bdc_dynpro using 'SAPLSED1' '0100'.
perform bdc_field using 'BDC_CURSOR'
'D_100-STRU'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'D_100-DTEL'
perform bdc_field using 'D_100-STRU'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'bukrs'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'bukrs'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_LINE_INSERT'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'kostl'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'kostl'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_LINE_INSERT'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'wrbtr'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'wrbtr'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_SAVE'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_dynpro using 'SAPLSTRD' '0100'.
perform bdc_field using 'BDC_CURSOR'
'KO007-L_DEVCLASS'.
perform bdc_field using 'BDC_OKCODE'
'=TEMP'.
perform bdc_field using 'KO007-L_AUTHOR'
'VARUN'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/EWB_CANCEL'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/EABR'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE_VAL'.
perform bdc_transaction using 'SE11'.
perform close_group.
I hope this helps.....
Please mark points if it helps.. -
Table control resolution in BDC
Hi
All
I have one doubt regarding table control resolution in BDC .I know how to handle table control like if i have 5 rows in my TABLE CONTROL.I write the logic according to this rows and if more than 5 rows are there in my flat file i extend the atble control.But this logic will fail in some other system if more than 5 rows are there in that syatem. But I have read from some where that we can use ctu_params structure and if we pass default size as 'x' then it automatically take cares in every sysem.But my doubt is while writing the code initially how can we write ie i mean how many rows i have to mention initially in my logic .
Please tell me the answer to this question if you have already face this type of problem.
Thanks and regards
VenkateswarHi,
The numeber of lines of table control for BDC depend on screen resolution, but It can't be managed by program.
So the better solution is to create a bdc doesn't depend on resolution.
It can do that using always the first two lines of table control.
When you start the simulation, first record has to be placed in first line of tc and the second in second one.
Before placing the third record, it needs to place the second record to the top and so the third record can be placed in the second line.
Before placing the next record, it needs to place the third record to the top and so the fourth record can be placed in the second line and so.
In this way your BDC'll use alwways the first two lines of tc and your program won't depend on resolution.
The problem is the transaction you need to simulate by BDC has to have a scroll functionality to allow to place the last record was elaborated to the top of tc, so the second line of tc can always be used to place the new record.
If there isn't this functionality, it's better to use a BAPI instead of BDC.
check these...
http://www.abaplearning.com/index.php?option=com_fireboard&Itemid=2&func=view&id=11&catid=8
BDC - standard screen resolution required?
https://forums.sdn.sap.com/click.jspa?searchID=739193&messageID=823953
Regards,
Omkaram. -
Retrieving values from table control using DYNP_VALUES_READ
Hi all,
I am trying to retrieve the values from the table control using the FM DYNP_VALUES_READ. I have a situation where user enter values in table control in T.code FB60 in Withholding tab for validation purpose. There i'll have to check based on some entries maintained in SET.
I am unable to get the values when i scroll to the next page in the table control. FM raising an exception invalid_dynprofield.
Expecting reply...You have to populate the dynpfields internal table before calling the function,
data: repid like sy-repid.
dynpfields-fieldname = 'PNAME'.
append dynpfields.
repid = sy-repid.
call function 'DYNP_VALUES_READ'
exporting
dyname = repid
dynumb = sy-dynnr
tables
dynpfields = dynpfields
exceptions
others.
read table dynpfields index 1.
pname = dynpfields-fieldvalue.
Now you will have the field value in pname
Hope this helps
Vinodh Balakrishnan -
How to implement line selectability for a table control using table Wizard?
Hello SDN Community,
I have created a table control using the Table Wizard. I found my exact question in this forum, but unfortunately it had not been andsered. While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
1) SE51
2) Create new screen 0100
3) Click Layout button
4) Clidk Table Control (with Wizard) and draw box on canvas.
5) Step is "Start" - click Continue
6) Step is "Name of Table Control" - provided name
7) Step is "Table Name" - provided name of dictionary table (AUFK)
8) Step is "Definition of Columns" - selected order numver and order text
9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
I would like to have a selectability column for my table. Would appreciate any insight into how to do this.
Thank you,
Dean Atteberry.This is a puzzling...
For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
The puzzling is in regards to the "Selection col. fld" entry field.
If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
So it looked like it wanted to know the name of my selection column. So I type in "CHAR1". and got the message "The field "CHAR1" for the selection column is already contained in the table."
Hmmmmm.... don't understand............
Dean Atteberry. -
Create Table Control using Dynamic Internal Table.
Hi,
I have requirement in which I will create a Dynamic Internal Table and then I need to create a Table Control Using that Internal Table. Now this can't be done using Screen Editor as it requires a pre-defined internal table or a DDIC Object.
Please Help.This should be correct answer(I am not author of code below):
REPORT ztablemaintace NO STANDARD PAGE HEADING.
TYPE-POOLS: rsds.
DATA: is_x030l TYPE x030l,
it_dfies TYPE TABLE OF dfies,
is_dfies TYPE dfies,
it_fdiff TYPE TABLE OF field_dif,
is_fdiff TYPE field_dif.
DATA: w_selid TYPE rsdynsel-selid,
it_tables TYPE TABLE OF rsdstabs,
is_tables TYPE rsdstabs,
it_fields TYPE TABLE OF rsdsfields,
it_expr TYPE rsds_texpr,
it_ranges TYPE rsds_trange,
it_where TYPE rsds_twhere,
is_where TYPE rsds_where,
w_active TYPE i.
DATA: it_content TYPE REF TO data,
it_modif TYPE REF TO data,
it_fcat TYPE lvc_t_fcat.
DATA: w_okcode TYPE sy-ucomm.
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
<ntab> TYPE STANDARD TABLE.
* Macros
DEFINE table_error.
message e398(00) with 'Table' p_table &1.
END-OF-DEFINITION.
DEFINE fixed_val.
is_fdiff-fieldname = is_dfies-fieldname.
is_fdiff-fixed_val = &1.
is_fdiff-no_input = 'X'.
append is_fdiff to it_fdiff.
END-OF-DEFINITION.
* Selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME.
PARAMETERS: p_table TYPE tabname OBLIGATORY "table
MEMORY ID dtb
MATCHCODE OBJECT dd_dbtb_16.
SELECTION-SCREEN: BEGIN OF LINE,
PUSHBUTTON 33(20) selopt USER-COMMAND sel,
COMMENT 55(15) selcnt,
END OF LINE.
SELECTION-SCREEN: SKIP.
PARAMETERS: p_rows TYPE i. "rows
SELECTION-SCREEN: END OF BLOCK b01,
SKIP,
BEGIN OF BLOCK b02 WITH FRAME.
PARAMETERS: p_displ TYPE c AS CHECKBOX. "display
SELECTION-SCREEN: END OF BLOCK b02.
* Initialization
INITIALIZATION.
MOVE '@4G@ Filter records' TO selopt.
* PBO
AT SELECTION-SCREEN OUTPUT.
IF w_active IS INITIAL.
CLEAR: selcnt.
ELSE.
WRITE w_active TO selcnt LEFT-JUSTIFIED.
ENDIF.
* PAI
AT SELECTION-SCREEN.
IF p_table NE is_x030l-tabname.
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
tabname = p_table
IMPORTING
x030l_wa = is_x030l
TABLES
dfies_tab = it_dfies
EXCEPTIONS
OTHERS = 1.
IF is_x030l IS INITIAL.
table_error 'does not exist or is not active'.
ELSEIF is_x030l-tabtype NE 'T'.
table_error 'is not selectable'.
* ELSEIF is_x030l-align NE 0.
* table_error 'has alignment - cannot continue'.
ENDIF.
* Default values for system fields
REFRESH: it_fdiff.
is_fdiff-tabname = p_table.
LOOP AT it_dfies INTO is_dfies.
IF is_dfies-datatype = 'CLNT'.
fixed_val sy-mandt.
ELSEIF is_dfies-rollname = 'ERDAT'
OR is_dfies-rollname = 'ERSDA'
OR is_dfies-rollname = 'AEDAT'
OR is_dfies-rollname = 'LAEDA'.
fixed_val sy-datum.
ELSEIF is_dfies-rollname = 'ERTIM'
OR is_dfies-rollname = 'AETIM'.
fixed_val sy-uzeit.
ELSEIF is_dfies-rollname = 'ERNAM'
OR is_dfies-rollname = 'AENAM'.
fixed_val sy-uname.
ENDIF.
CALL FUNCTION '/SAPDMC/DATAELEMENT_GET_TEXTS'
EXPORTING
name = is_dfies-rollname
IMPORTING
text_middle = is_dfies-reptext
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.
MODIFY it_dfies FROM is_dfies.
ENDLOOP.
* Prepare free selection on table
REFRESH it_tables.
is_tables-prim_tab = p_table.
APPEND is_tables TO it_tables.
CLEAR: w_selid.
ENDIF.
IF sy-ucomm = 'SEL'.
IF w_selid IS INITIAL.
* Init free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
expressions = it_expr
IMPORTING
selection_id = w_selid
expressions = it_expr
TABLES
tables_tab = it_tables
EXCEPTIONS
OTHERS = 1.
ENDIF.
* Display free selection dialog
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = w_selid
title = 'Selection'
status = 1
as_window = 'X'
IMPORTING
expressions = it_expr
field_ranges = it_ranges
number_of_active_fields = w_active
TABLES
fields_tab = it_fields
EXCEPTIONS
OTHERS = 1.
ENDIF.
* Start of processing
START-OF-SELECTION.
PERFORM f_create_table USING p_table.
PERFORM f_select_table.
PERFORM f_display_table.
* FORM f_create_table *
FORM f_create_table USING in_tabname.
FIELD-SYMBOLS: <fcat> TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = in_tabname
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
* Complete field catalog
LOOP AT it_fcat ASSIGNING <fcat>.
<fcat>-tabname = in_tabname.
ENDLOOP.
CALL FUNCTION 'LVC_FIELDCAT_COMPLETE'
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE: 'Error building field catalog'.
STOP.
ENDIF.
* Create dynamic table for data
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_content.
IF sy-subrc = 0.
ASSIGN it_content->* TO <itab>.
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
* Create dynamic table for modif
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_modif.
IF sy-subrc = 0.
ASSIGN it_modif->* TO <ntab>.
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
ENDFORM. "f_create_table
* FORM f_select_table *
FORM f_select_table.
IF w_active = 0.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <itab>
UP TO p_rows ROWS.
ELSE.
* Selection with parameters
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
EXPORTING
field_ranges = it_ranges
IMPORTING
where_clauses = it_where.
READ TABLE it_where INTO is_where WITH KEY tablename = p_table.
SELECT * FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <itab>
UP TO p_rows ROWS
WHERE (is_where-where_tab).
ENDIF.
IF sy-dbcnt = 0.
WRITE: 'No record selected'.
STOP.
ENDIF.
ENDFORM. "f_select_table
* FORM f_display_table *
FORM f_display_table.
DATA: l_answer TYPE c,
l_eflag TYPE c.
CLEAR: w_okcode.
REFRESH: <ntab>.
* Display table contents
CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
EXPORTING
header = p_table
tabname = p_table
display_only = p_displ
endless = 'X'
no_button = space
IMPORTING
okcode = w_okcode
TABLES
* nametab = it_dfies
table = <itab>
* fielddif = it_fdiff
modif_table = <ntab>
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
IF p_displ IS INITIAL AND w_okcode = 'SAVE'.
* Confirm update
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = p_table
text_question = 'Do you want to update table ?'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = l_answer
EXCEPTIONS
OTHERS = 1.
IF l_answer = '1'.
* Apply modifications
IF NOT <ntab>[] IS INITIAL.
PERFORM f_add_system USING space.
MODIFY (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
l_eflag = 'X'.
ENDIF.
ENDIF.
* Apply deletions
IF l_eflag IS INITIAL.
REFRESH: <ntab>.
CALL FUNCTION 'STC1_GET_DATA'
TABLES
deleted_data = <ntab>
EXCEPTIONS
OTHERS = 1.
IF NOT <ntab>[] IS INITIAL.
DELETE (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
* Apply creations
IF l_eflag IS INITIAL.
REFRESH: <ntab>.
CALL FUNCTION 'STC1_GET_DATA'
TABLES
new_data = <ntab>
EXCEPTIONS
OTHERS = 1.
IF NOT <ntab>[] IS INITIAL.
PERFORM f_add_system USING 'X'.
INSERT (p_table) FROM TABLE <ntab>.
IF sy-subrc NE 0.
ROLLBACK WORK.
l_eflag = 'X'.
ENDIF.
ENDIF.
ENDIF.
IF l_eflag IS INITIAL.
COMMIT WORK.
MESSAGE s261(53).
ELSE.
MESSAGE s075(3i).
PERFORM f_select_table.
ENDIF.
ENDIF.
* Display table again
PERFORM f_display_table.
ENDIF.
ENDIF.
ENDFORM. "f_display_table
* FORM f_add_system *
FORM f_add_system USING new TYPE c.
FIELD-SYMBOLS: <irec> TYPE ANY,
<upd> TYPE ANY.
LOOP AT it_fdiff INTO is_fdiff.
READ TABLE it_dfies INTO is_dfies
WITH KEY fieldname = is_fdiff-fieldname.
LOOP AT <ntab> ASSIGNING <irec>.
ASSIGN COMPONENT is_fdiff-fieldname OF STRUCTURE <irec> TO <upd>.
IF is_dfies-datatype = 'CLNT'.
<upd> = sy-mandt.
ELSE.
CASE is_dfies-rollname.
WHEN 'AENAM'.
<upd> = sy-uname.
WHEN 'AEDAT' OR 'LAEDA'.
<upd> = sy-datum.
WHEN 'AETIM'.
<upd> = sy-uzeit.
WHEN OTHERS.
ENDCASE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. "f_add_system -
Uploading multiple lines in a table control using ECATT
Hi,
I want to upload muliple lines in a table control using ECATT. When I tried to upload only the first line is getting filled.What I have to do for that. Please reply at the earliest.
With warm regards,
Biju K.GeorgeHello ,
To insert multiple lines into the table you have to record the transaction for one entry and loop the same step multiple times to create multiple entries in the table.
Thanks,
Ajay -
BDC table control using Excel sheet upload
Hi All,
I am working BDC table control.I want to upload the From excel sheet.I am using the FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the the data into my internal table.The data is populating in the internal table.
Now i have problem tat how to populate this excel sheet data to the Bdc table control.
Can nybody help me out.\[removed by moderator\]
Thanks,
Swapna.
Edited by: Jan Stallkamp on Jul 25, 2008 10:57 AMafter fetching data from EXCEL sheet, each column data (in excel sheet) will be uploaded to individual record into your internal table along with row number and column number, loop through that internal table and collect all your excel data into record format.pls refer the below code.
data:
i_excel type alsmex_tabline occurs 0 with header line,
l_row type i value 1.
data:
begin of x_data occurs 0,
kunnr like RF02L-KUNNR,
klimk(17) type c,
CTLPC like knkk-CTLPC,
end of x_data,
begin of x_data1 occurs 0,
data(106),
end of x_data1.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_fname
i_begin_col = 1
i_begin_row = 1
i_end_col = no.of columns in your excel file
i_end_row = no.of rows in your file
tables
intern = i_excel.
if sy-subrc = 0.
loop at i_excel.
if l_row <> i_excel-row.
append x_data.
clear x_data.
endif.
case i_excel-col.
when 1.
x_data-kunnr = i_excel-value.
when 2.
x_data-klimk = i_excel-value.
when 3.
x_data-CTLPC = i_excel-value.
endcase.
l_row = i_excel-row.
clear i_excel.
at last.
append x_data.
endat.
endloop.
endif.
then loop through the internal table X_DATA, pass the data to your table control like.
tbl_control-field1(1) = x_data-field1.
tbl_control-field2(1) = x_data-field2.
tbl_control-fieldn(1) = x_data-fieldn.
Regards,
Sreeram. -
How to delete record from table control using BDC?
Hello friends,
I am running a BDC program to delete records.
I have file with following records and i got these records into t_itab.
Material Plant Start date End date Cost
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100004 S002 09/01/2008 09/31/2008 56.00
MQ100008 S003 09/01/2008 09/31/2008 57.00
Now, I have BDC transaction in which table control screen which contains following structure.
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100002 S002 09/01/2008 09/31/2008 56.00
MQ100004 S003 09/01/2008 09/31/2008 47.00
MQ100005 S004 09/01/2008 09/31/2008 25.00
MQ100006 S012 09/01/2008 09/31/2008 76.00
MQ100007 S033 09/01/2008 09/31/2008 17.00
MQ100008 S011 09/01/2008 09/31/2008 95.00
MQ100009 S002 09/01/2008 09/31/2008 46.00
I have recorded from SHDB in which first record will be delete.
So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
Which i don't want to.
Is there any facility in BDC to put records on top which i want to delete?
Please guide me.
Regards,
RHOne option is to identify the table and find out the location as the number of row which should be deleted from the table and then in the bdc program instead of postioning the cursor on the row 1(using the statement perform bdc_cursor ....(01)), replace the 01 with the row number.
Second option is that if a filter control is available for the table control, then filter the data each and every time with the material number to be deleted and then delete the first row.
Regards
Farzan -
Hi,
I have a BDC program ( Trasaction C202 - To assign operations to compoents in the material Tab) which has a table control.
Affter i do a P+ the record which becomes the first record in the table control is not constant. It keeps changing with different sets of data.
How can i handle this P+..?
Regards,
Sriram.Hi Srirama,
You follow your coding in that way:
LOOP AT i_itemdata INTO wa_itemdata. [IN I_ITEMDAT TABLE YOU WILL GET ITEM DETAILS]
l_index = l_index + 1.
IF l_index > 16 . [YOU CHECK DEFAULT NO OF TABLE CONTROL DURING RECORDING]
CLEAR l_index.
PERFORM bdc_dynpro USING 'SAPMM06E' '0320'.[YOU CHANGE PROGRAM NAME & SCREEN NO ]
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
l_index = 1.
l_index = l_index + 1.
ENDIF.
WRITE DOWN BDC RECORDING
CONCATENATE 'EKPO-EMATN(' l_index ')' INTO l_field. [CHANGE FIELD NAME ACC YOUR REQUIREMENT]
PERFORM bdc_field USING 'BDC_CURSOR' l_field.
ENDLOOP.
Hope this can solve your problems.
Regards,
Tutun -
How to handle table controls using LSMW
Hi All,
how to use LSMW to handle table control like header and item details eg. VA01 , ME21 etc. To handle these kind of trnasactions can we use LSMW instead BDC to upload data. Please let me know.
Thanks in advance.
Regards,
KalpanaHi Kalpana,
You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
Its little bit complex. You need to register you custom program in table through SM30.
SDX0 - Program Definition ( BI or DI )
SDX1 - Program Assignment
SDX2 - Declaring Structures
SDX3 - Declaring field identifiers for structures
You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
<b>AS</b> -
Regarding table control handling in BDC
Hi,
how to Handle table control in BDC ,how to handle resolution of table control in BDC?
Pls send urgentlyHi,
chk this excellent link.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Regards
Anver
if helped pls mark points -
Creating and accessing a Table control using CL_TABLE_VIEW_MM
Hi everybody.,
I am new to Module Pool Programming using Abap Object Oriented Programming .I need to create a Table Control in my Screen .I debugged the standard ME21n Tracsaction and found that it used class CL_TABLE_VIEW_MM .How can i make use of this class effictively for my Custom Program .Guide me on this .
Regards.,
S.Sivakumarsolved myself
Maybe you are looking for
-
Is there a way to edit, or link to other tables Forms on Numbers?
I was trying to edit a Form in Numbers, and also try to use multiple tables for a Form, and on that same topic, how can I link a cell from a table on a different tab to another table, i also tryed to format a cell as popup menu, and than poin the opt
-
SPA112 goes catatonic, crashes, no dialtone
Hi, I am a home user and ex-programmer. I'm using the Cisco SPA112 with the latest firmware 1.2.1 (004). Every two or three days the ATA crashes. Here are the symptoms: a) no dial tone b) line 1 LED is ON (as normal) c) ATA i
-
Why does shockwave stop working and my entire computer freeze??
my firefox page freezes then a box opens that says shockwave has stopped working would you like to continue i say yes it stays frozen then opens again asking the same question so i hit no and it works for a little while then does it all again, i've u
-
Illustrator window resize issue
Hi there, Getting this a lot when trying to open a file by association: It makes the window very small too - this is the creative cloud version. Any idea? Thanks, Shaun
-
Mail opens new window after mail is sent
(I suppose since the last security update) everytime I send an eMail, Mail always opens a new blank mail window after I sent the mail - any hints on this?