Dynamic Programming - table popins
Hi,
I am trying to create a table pop in using dynamic programmimg and works fine except that when I use a tablepopintogglecell to expand or collapse the op ins in all the table rows are getting expanded or collapsed simultaneously. How to make it for the only one row?
In WDDOMODIFYVIEW I am using the following code:
Set the pop in for the table
CONCATENATE 'CTX_PARTIC_CURRBOOK.' node_name '.SELECTED_POPIN' INTO popin_context.
table_ui->BOUND_SELECTED_POPIN( CONTEXT_NODE_PATH_NAME = popin_context ).
Create the table pop in
table_popin = CL_WD_TABLE_POPIN=>NEW_TABLE_POPIN( ID = popin_id ON_CLOSE = 'CLOSE_POPIN' ).
Now attach the table pop in to the table
table_ui->SET_POPIN( THE_POPIN = table_popin ).
Add column for popin toggle to table
popintoggle_column = CL_WD_TABLE_COLUMN=>NEW_TABLE_COLUMN( ).
Create caption for this column and add
caption_refcolumn = CL_WD_CAPTION=>NEW_CAPTION( ).
caption_refcolumn->SET_TEXT( value = l_popin_column_text ).
popintoggle_column->SET_HEADER( THE_HEADER = caption_refcolumn ).
popintoggle_column->SET_SELECTED_CELL_VARIANT( VALUE = 'SELECTEDCURRELEMS' ).
Create table pop in toggle
popintoggle = CL_WD_TABLE_POPIN_TGL_CELL=>NEW_TABLE_POPIN_TGL_CELL( ).
popintoggle->SET_VARIANT_KEY( VALUE = 'SELECTEDCURRELEMS' ).
Now attach the table popin toggle to the table
table_cellvariant ?= popintoggle.
popintoggle_column->ADD_CELL_VARIANT( THE_CELL_VARIANT = table_cellvariant ).
table_ui->ADD_COLUMN( THE_COLUMN = popintoggle_column ).
Am I missing any coding here?
Regards,
Srini.
Hi Srinivasa,
My guess is that although the attribute is there, it's not used. Look at this part of your coding:
* Set the pop in for the table
CONCATENATE 'CTX_PARTIC_CURRBOOK.' node_name '.SELECTED_POPIN' INTO popin_context.
table_ui->BOUND_SELECTED_POPIN( CONTEXT_NODE_PATH_NAME = popin_context ).
Here you first create the binding path, but later on you call the bound_* instead of the bind_* method, which overwrites the content of popin_context.
I believe that the attribute of the table is not bound to the context and hence has the same value for all rows.
Best regards,
Thomas
Similar Messages
-
View Container UI element in a table popin dynamically
Hello people,
I create a WD Table dynamically using the runtime class. I also create the table popin and then I set it in the table using the method SET_POPIN from the runtime class.
Now my requirement is that I should be able to add the 'View Container UI Element' into this popin so that I can embed any other views into this VC UI E. I cannot find a way in which I can achieve this. I am able to do it statically but not dynamically.
Even though it is suggested that such a design would lead to performance issues, but I have to achieve this.
Regards
RohanHi Anita,
you cannot set metadata at element level of a node. When you set the metadata ( example mime type or file name ) for a particular element in the node , it changes for all the element. So you are always getting the file for the last row. ( most recent set metadata ).
Try using the inteface IWDCachedWebResource for file download.
For each row add a button, and associate an action "DownloadFile" for it. Use the following "onAction" for the said action.
public void onActionDownloadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionDownloadFile(ServerEvent)
int selectedIndex = wdContext.nodeFileTab().getLeadSelection();
IPrivateView_pdfView.IFileTabElement file = wdContext.nodeFileTab().getFileTabElementAt(selectedIndex);
try {
IWDCachedWebResource webResource = WDWebResource.getWebResource(
this.
getByteArrayFromResourcePath("/sapmnt/PCD/global/config/cm/etc/pdf/"+
wdContext.nodeFileTab().getFileTabElementAt().getFilename(selectedIndex),
WDWebResourceType.PDF);
wdComponentAPI.getWindowManager().createExternalWindow(webResource.getURL(),"Download File",true).open();
catch(Exception e) {
// take some action
wdComponentAPI.getMessageManager().reportException(e.toString(),true);
//@@end
Hope you get a solution.
Regards
KK. -
Download a special kind of internal table (dynamic programming)
Hi guys,
with dynamic programming, i've created a complex internal table of this type :
KNA1 |
KNB1 |
GS_CUSTOMERADDRESS |
GS_CUSTOMERGENERALDETAIL |
The declaration of the internal table is :
TYPES: BEGIN OF gty_record,
table TYPE tabname,
dataref TYPE REF TO data,
END OF gty_record.
This means that each line, has a different line-type. In the first field of the table, i have the name of the structure. In the second, the data-part (in debug double click on leads to structure contents - field by field).
The structure KNA1 contains C and packed (P) fields also so when i pass the internal table to FM GUI_DOWNLOAD, i have this short-dump : UC_OBJECTS_NOT_CONVERTIBLE.
Is there a way to solve this problem quickly?
The goals is download all data of a customer into a local file. Data is distribuited on different structures, readed by standard bapi 'BAPI_CUSTOMER_GETDETAIL2'. This file will be read in another program, of another system.
Any hints/suggestion will be appreciated.
Thanks a lot.
AndreaHi Sandra,
thx for you suggestions.
About your answer :
" Or use a DO. ASSIGN COMPONENT sy-index OF STRUCTURE ... to loop at each field, and do whatever you want with them (using WRITE ... TO ... for example, to convert numbers into text)."
I cannot use this approach to the problem, because i should keep in mind the dimension of single fields and the blanks should be concatenated also, but RESPECTING BLANK switch of concatenate instruction doesen't exists in 4.7 abap.
Sure, i can use a workaround, but i'll have a lot of programming.
"you could use XML for instance. It's rather standard! By using CALL TRANSFORMATION ID SOURCE dataObject RESULT XML string."
This could be the solution. I've already read some posts about it before write mine. I should test it: i don't know if in 4.7 release works. So i could transform the internal table to xml and save to text file.
But then, how i can read xml string and mapping again in this special kind of table ?
Is CALL TRANSFORMATION ID SOURCE XML String RESULT Dataobject instruction sufficient to perform this task?
Thanks a lot
Andrea
BR
Sandra -
Passing Dynamic Internal Table values to another program
Hi,
I have a program ZSAPNEW.
In this I have created a Dynamic internal table <fs_emp>. The number of fields differ for each run. The values are passed into <fs_emp> in this program. Now I need to submit thsi program from a main program ZHEAD and then display the values got from ZHEAD. For this I need to access the values retrieved from ZSAPNEW in <fs_emp> in ZHEAD. I cant figure out how to do this. I tried IMPORT ing the reference of teh field symbol too/ But its not allowing references in IMPORT/EXPORT. And since the table is of type ANY( as structure varies) I cant assign it to an internal table and then pass. Can some one suggest a solution please.
SuzieHi
You need to know how the strcture of your table is generated In both programm:
- Calling program:
DATA: LR_VALUE_DESCR TYPE REF TO CL_ABAP_ELEMDESCR,
COMPONENT TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
LT_COMPONENTS TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
DATA: LT_STRUC TYPE REF TO CL_ABAP_STRUCTDESCR,
LT_TAB TYPE REF TO CL_ABAP_TABLEDESCR.
DATA: L_INDEX TYPE C.
DATA: W_LINE TYPE REF TO DATA,
INT_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <WA> TYPE ANY,
<ITAB> TYPE TABLE,
<VALUE> TYPE ANY.
DO 4 TIMES.
CLEAR COMPONENT.
MOVE SY-INDEX TO L_INDEX.
CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
COMPONENT-TYPE = LR_VALUE_DESCR.
INSERT COMPONENT INTO TABLE LT_COMPONENTS.
ENDDO.
* Workarea
LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
P_STRICT = 'X' ).
CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
ASSIGN W_LINE->* TO <WA>.
* Table
LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
ASSIGN INT_TABLE->* TO <ITAB>.
DO 3 TIMES.
CLEAR <WA>.
DO 4 TIMES.
MOVE SY-INDEX TO L_INDEX.
CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
ASSIGN COMPONENT COMPONENT-NAME OF STRUCTURE <WA> TO <VALUE>.
MOVE SY-INDEX TO <VALUE>.
ENDDO.
APPEND <WA> TO <ITAB>.
ENDDO.
DATA: WA_INDX TYPE INDX.
WA_INDX-USERA = SY-UNAME.
WA_INDX-PGMID = 'MAXMAX'.
EXPORT TAB = <ITAB>
TO DATABASE INDX(XY)
FROM WA_INDX
CLIENT SY-MANDT
ID 'TABLE'.
Called program:
DATA: LR_VALUE_DESCR TYPE REF TO CL_ABAP_ELEMDESCR,
COMPONENT TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
LT_COMPONENTS TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
DATA: LT_STRUC TYPE REF TO CL_ABAP_STRUCTDESCR,
LT_TAB TYPE REF TO CL_ABAP_TABLEDESCR.
DATA: L_INDEX TYPE C.
DATA: W_LINE TYPE REF TO DATA,
INT_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <WA> TYPE ANY,
<ITAB> TYPE TABLE,
<VALUE> TYPE ANY.
DO 4 TIMES.
CLEAR COMPONENT.
MOVE SY-INDEX TO L_INDEX.
CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
COMPONENT-TYPE = LR_VALUE_DESCR.
INSERT COMPONENT INTO TABLE LT_COMPONENTS.
ENDDO.
* Workarea
LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
P_STRICT = 'X' ).
CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
ASSIGN W_LINE->* TO <WA>.
* Table
LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
ASSIGN INT_TABLE->* TO <ITAB>.
DATA: WA_INDX TYPE INDX.
WA_INDX-USERA = SY-UNAME.
WA_INDX-PGMID = 'MAXMAX'.
IMPORT TAB = <ITAB>
FROM DATABASE INDX(XY)
TO WA_INDX
CLIENT SY-MANDT
ID 'TABLE'.
LOOP AT <ITAB> ASSIGNING <WA>.
WRITE: / <WA>.
ENDLOOP.
The sample above use IMPORT/EXPORT from database: if the called program can't know the structure of the dynaic table, you need to transfer it by the same way you transfer the data
Max -
How to populate data in dynamic internal table
Hi Expert,
fyi. My dynamic internal table field is created base on data selected. Eg. select table qpcd has 5 records. These 5 recods will become fieldname to my dynamic internal table. My dynamic internal table will be
...itab
01
02
03
04
05
The 5 records from qpcd is populated in another table call viqmel. I need to find the occurance of each code in viqmel and populate the number of occurance in itab in each of column. The final dynamic itab will be like this
table itab
01 02 03 04 05 -
> field name
2 0 1 0 1 -
> data
my source code like below
Report ZPLYGRND2.
TABLES: mara, makt.
TYPE-POOLS: slis, sydes.
DATA:it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat,
ls_layout TYPE slis_layout_alv.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data,
new_line TYPE REF TO data,
ob_cont_alv TYPE REF TO cl_gui_custom_container,
ob_alv TYPE REF TO cl_gui_alv_grid,
vg_campos(255) TYPE c,
i_campos LIKE TABLE OF vg_campos,
vg_campo(30) TYPE c,
vg_tables(60) TYPE c.
types : begin of t_qpcd,
codegruppe like qpcd-codegruppe,
code like qpcd-code,
end of t_qpcd.
data:wa_qpcd type t_qpcd,
i_qpcd type standard table of t_qpcd initial size 0.
FIELD-SYMBOLS: <l_table> TYPE table,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
select * into corresponding fields of wa_qpcd from qpcd
where katalogart = 'D'
and codegruppe = 'OOT01'.
append wa_qpcd to i_qpcd.
endselect.
loop at i_qpcd into wa_qpcd.
is_fcat-fieldname = wa_qpcd-code.
APPEND is_fcat TO it_fcat.
endloop.
LOOP AT it_fcat INTO is_fcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-ref_fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
*... Create the dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
if sy-subrc = 0.
endif.
*... Create a new line
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
LOOP AT <l_table> INTO <l_line>.
ENDLOOP.hello dear i m giving u a code in this a dynamic table is made on the basis of table in database , and u can download this data correct it , see it, or even change it....and upload in tht table help full if u dont know the table name...in advance.
also the code to populate data in dynamic table is in this code like:
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
look at the whole program .hope this solve ur problem thanks.
REPORT ZTESTA MESSAGE-ID ZIMM .
TYPES : DATA_OBJECT TYPE REF TO DATA.
DATA : MITAB TYPE REF TO DATA .
TYPE-POOLS : SLIS .
DATA : IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE .
DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT .
DATA : WA_FIELDCATALOG TYPE LVC_S_FCAT .
DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME .
DATA : I_CALLBACK_PROGRAM LIKE SY-REPID .
DATA : DYN_LINE TYPE DATA_OBJECT .
FIELD-SYMBOLS : <FS_ITAB> TYPE STANDARD TABLE .
DATA : TABLE_NAME_IS_VALID TYPE C .
DATA : DYNAMIC_IT_INSTANTIATED TYPE C .
CONSTANTS BUTTONSELECTED TYPE C VALUE 'X' .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_TABL.
PARAMETERS : MTABLE_N LIKE RSRD1-TBMA_VAL
MATCHCODE OBJECT DD_DBTB_16 OBLIGATORY .
DATA CHECKTABLED.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_FILE.
PARAMETERS : MFILENAM LIKE RLGRAP-FILENAME .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_DOWN.
PARAMETERS : P_DOWNLD RADIOBUTTON GROUP GRP1
USER-COMMAND M_UCOMM .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_CHKF.
PARAMETERS : P_CHKFIL RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_UPLD.
PARAMETERS : P_UPLOAD RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_SHOW.
PARAMETERS : P_SHOW_T RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN OUTPUT .
PERFORM CHECK_FILENAME .
AT SELECTION-SCREEN.
IF SY-UCOMM = 'ONLI'.
CHECKTABLED = MTABLE_N+0(1).
IF CHECKTABLED NE 'Z'.
MESSAGE I017.
LEAVE TO SCREEN 1000.
ENDIF.
IF SY-UNAME NE 'KAMESH.K'.
MESSAGE I023 WITH SY-UNAME.
LEAVE TO SCREEN 1000.
ENDIF.
ENDIF.
IF SY-UCOMM = 'PRIN'.
CHECKTABLED = MTABLE_N+0(1).
IF CHECKTABLED NE 'Z'.
MESSAGE I017.
LEAVE TO SCREEN 1000.
ENDIF.
IF SY-UNAME NE 'KAMESH.K'.
MESSAGE I023 WITH SY-UNAME.
LEAVE TO SCREEN 1000.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MFILENAM .
PERFORM F4_FOR_FILENAME .
INITIALIZATION .
T_TABL = 'Table Name' .
T_FILE = 'File Name' .
T_DOWN = 'Download Table' .
T_CHKF = 'Check File to Upload' .
T_UPLD = 'Upload File' .
T_SHOW = 'Show Table Contents' .
START-OF-SELECTION .
PERFORM CHECK_TABLE_NAME_IS_VALID .
END-OF-SELECTION .
IF TABLE_NAME_IS_VALID EQ ' ' .
MESSAGE I398(00) WITH 'INVALID TABLE NAME' .
ELSE .
PERFORM INSTANTIATE_DYNAMIC_INTERNAL_T .
CHECK DYNAMIC_IT_INSTANTIATED = 'X' .
CASE BUTTONSELECTED .
WHEN P_DOWNLD .
PERFORM SELECT_AND_DOWNLOAD .
WHEN P_CHKFIL .
PERFORM CHECK_FILE_TO_UPLOAD .
WHEN P_UPLOAD .
PERFORM UPLOAD_FROM_FILE .
WHEN P_SHOW_T .
PERFORM SHOW_CONTENTS .
ENDCASE .
ENDIF .
FORM CHECK_TABLE_NAME_IS_VALID.
DATA MCOUNT TYPE I .
TABLES DD02L .
CLEAR TABLE_NAME_IS_VALID .
SELECT COUNT(*) INTO MCOUNT FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'TABL'
AND OBJ_NAME = MTABLE_N .
IF MCOUNT EQ 1 .
CLEAR DD02L .
SELECT SINGLE * FROM DD02L WHERE TABNAME = MTABLE_N .
IF SY-SUBRC EQ 0.
IF DD02L-TABCLASS = 'TRANSP' .
TABLE_NAME_IS_VALID = 'X' .
ENDIF .
ENDIF.
ENDIF .
ENDFORM. " CHECK_TABLE_NAME_IS_VALID
FORM SELECT_AND_DOWNLOAD.
CLEAR : <FS_ITAB> .
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
PERFORM CHECK_FILENAME.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC EQ 0.
MESSAGE I398(00) WITH 'Table' MTABLE_N
'successfully downloaded to '
MFILENAM .
ENDIF.
ENDFORM. " SELECT_AND_DOWNLOAD
FORM UPLOAD_FROM_FILE.
DATA : ANS TYPE C .
DATA : LINES_OF_ITAB TYPE I .
DATA : MSY_SUBRC TYPE I .
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
TEXTLINE1 = 'Are you sure you wish to upload'
TEXTLINE2 = 'data from ASCII File to DB table '
TITEL = 'Confirmation of Data Upload'
IMPORTING
ANSWER = ANS.
IF ANS = 'J' .
PERFORM CHECK_FILENAME.
CLEAR MSY_SUBRC .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
IF SY-SUBRC EQ 0.
DESCRIBE TABLE <FS_ITAB> LINES LINES_OF_ITAB .
IF LINES_OF_ITAB GT 0 .
MODIFY (MTABLE_N) FROM TABLE <FS_ITAB> .
MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
ENDIF .
ENDIF.
IF MSY_SUBRC EQ 0 .
MESSAGE I398(00) WITH LINES_OF_ITAB
'Record(s) inserted in table'
MTABLE_N .
ELSE .
MESSAGE I398(00) WITH
'Errors occurred No Records inserted in table'
MTABLE_N .
ENDIF .
ENDIF .
ENDFORM. " UPLOAD_FROM_FILE
FORM F4_FOR_FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = 'C:\'
MASK = ',.,..'
MODE = '0'
IMPORTING
FILENAME = MFILENAM
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
ENDFORM. " F4_FOR_FILENAME
FORM CHECK_FILENAME.
IF MFILENAM IS INITIAL
AND NOT ( MTABLE_N IS INITIAL )
AND P_SHOW_T NE BUTTONSELECTED.
CONCATENATE 'C:\'
MTABLE_N '.TXT' INTO MFILENAM.
ENDIF .
ENDFORM. " CHECK_FILENAME
FORM INSTANTIATE_DYNAMIC_INTERNAL_T.
CLEAR DYNAMIC_IT_INSTANTIATED .
I_STRUCTURE_NAME = MTABLE_N .
CLEAR IT_FIELDCAT[] .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = I_STRUCTURE_NAME
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
LOOP AT IT_FIELDCAT .
CLEAR WA_FIELDCATALOG .
MOVE-CORRESPONDING IT_FIELDCAT TO WA_FIELDCATALOG .
WA_FIELDCATALOG-REF_FIELD = IT_FIELDCAT-FIELDNAME .
WA_FIELDCATALOG-REF_TABLE = MTABLE_N .
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG .
ENDLOOP .
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FIELDCATALOG
IMPORTING
EP_TABLE = MITAB .
ASSIGN MITAB->* TO <FS_ITAB> .
DYNAMIC_IT_INSTANTIATED = 'X' .
ENDIF.
ENDFORM. " INSTANTIATE_DYNAMIC_INTERNAL_T
FORM SHOW_CONTENTS.
CLEAR : <FS_ITAB> .
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
I_CALLBACK_PROGRAM = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
IT_FIELDCAT = IT_FIELDCAT[]
TABLES
T_OUTTAB = <FS_ITAB>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " SHOW_CONTENTS
FORM CHECK_FILE_TO_UPLOAD.
PERFORM CHECK_FILENAME.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC EQ 0.
I_CALLBACK_PROGRAM = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
IT_FIELDCAT = IT_FIELDCAT[]
TABLES
T_OUTTAB = <FS_ITAB>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDIF .
ENDFORM. " CHECK_FILE_TO_UPLOAD
Message was edited by:
SAURABH SINGH
SENIOR EXECUTIVE
SAMSUNG INDIA ELECTRONICS LTD.,NOIDA -
Column names of a dynamic internal table
Hi Friends,
I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
The declaration of this dynamic internal table :
FIELD-SYMBOLS:
<l_t_data> TYPE STANDARD TABLE.
Can you please tell me how to get the column names?
Thanks,
GauravHi,
You can use ABAP Runtime Type Identification to get the column names of the internal table.
e.g >
>lo_itab holds reference to description object of internal table whose column names i have to extract.
>Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
>Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
>Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
>The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
So loop at the table to get all the column names stored in column 'name' of table 'components'.
Thank You. -
How to do parallel processing with dynamic internal table
Hi All,
I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
Any help will be highly appreciated.
Thanks and regards,
Ashintry the below code...
DATA: w_subrc TYPE sy-subrc.
DATA: w_infty(5) TYPE c.
data: w_string type string.
FIELD-SYMBOLS: <f1> TYPE table.
FIELD-SYMBOLS: <f1_wa> TYPE ANY.
DATA: ref_tab TYPE REF TO data.
CONCATENATE 'P' infty INTO w_infty.
CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
ASSIGN ref_tab->* TO <f1>.
* Create dynamic work area
CREATE DATA ref_tab TYPE (w_infty).
ASSIGN ref_tab->* TO <f1_wa>.
IF begda IS INITIAL.
begda = '18000101'.
ENDIF.
IF endda IS INITIAL.
endda = '99991231'.
ENDIF.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr
infty = infty
begda = '18000101'
endda = '99991231'
IMPORTING
subrc = w_subrc
TABLES
infty_tab = <f1>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
subrc = w_subrc.
ELSE.
ENDIF. -
Error while creating dynamic internal table.
Hello Expert,
While creating a dynamic internal table, it throw an run time error as :
" LOAD PROGRAM NOT FOUND
CX_SY_PROGRAM_NOT_FOUND"
i tried to debug the program, it found this error comes while calling
CALL METHOD cl_alv_table_create=>create_dynamic_table
please anyone help me out to resolve this problem.
what could be the reason of error? and how to avoid it?
<REMOVED BY MODERATOR>
thanks in advance.
~ shweta.
Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PMHi,
Go through this program.
Report z_dynamic.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
start-of-selection.
perform get_structure.
perform create_dynamic_itab.
perform get_data.
perform write_out.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
endform.
Regards, -
At end of field, for dynamic internal table entries ?
Dear All,
I've data in my dynamic internal table.
But, to understand in a better way I created a test program with static entries.
Case 1 -->
DATA: BEGIN OF itab OCCURS 0,
year TYPE char4,
name TYPE char10,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
year TYPE char4,
name TYPE char10,
count TYPE i,
END OF itab2.
DATA: gv_count TYPE i,
gv_flag TYPE char1.
itab-name = 'AAAA'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAB'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAC'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAD'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBB'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBA'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBC'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBD'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCC'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCA'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCB'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCD'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCE'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCf'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDD'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDA'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDB'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDC'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDE'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
SORT itab BY year.
LOOP AT itab.
* Counter
gv_count = gv_count + 1.
AT END OF year.
itab2-count = gv_count.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR gv_count.
WRITE:/ itab2-name,
itab2-year,
itab2-count.
CLEAR itab2.
CLEAR gv_flag.
ENDAT.
ENDLOOP.
Now for the above program the Output is :
Name Year Count
********** 2005 5
********** 2006 6
********** 2007 4
********** 2008 4
" Forget about the asterisk values as it's an example !
The above output is correct, But in my real case the table structure is not like the above .
The order of the field are in reverse.
i.e. The internal table is like this :
Case 2 -->
DATA: BEGIN OF itab OCCURS 0,
name TYPE char10,
year TYPE char4,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
name TYPE char10,
year TYPE char4,
count TYPE i,
END OF itab2.
In this case if I'm using at end of year the output is coming wrong.
Even on change of is also not working.
Request you guys to help me out so that I can achieve the same output as of case 1 with the table declaration as of CASE 2.
Regards,
Deepu.kHello Rich Heilman,
Again you came for my rescue ............
My code for this scenario is like this :
DATA: BEGIN OF itab OCCURS 0,
name TYPE char10,
year TYPE char4,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
name TYPE char10,
year TYPE char4,
count TYPE i,
END OF itab2.
DATA: gv_count TYPE i,
gv_flag TYPE char1.
itab-name = 'AAAA'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAB'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAC'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAD'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBB'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBA'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBC'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBD'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCC'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCA'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCB'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCD'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCE'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCf'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDD'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDA'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDB'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDC'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDE'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
SORT itab BY year.
LOOP AT itab.
* Counter
gv_count = gv_count + 1.
IF sy-tabix GT 1.
ON CHANGE OF itab-year.
itab2-count = gv_count.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR gv_count.
WRITE:/ itab2-name,
itab2-year,
itab2-count.
CLEAR itab2.
CLEAR gv_flag.
ENDON.
ENDIF.
ENDLOOP.
The Output is :
DDDC 2005 2
CCCf 2006 4
BBBD 2007 6
AAAD 2008 4
The above output is wrong.
Can u correct me where I'm doing wrong ?
Regards,
Deepu.K -
Dynamic Internal Table creation and population
Hi gurus !
my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
Letu2019s use only EKPO, and only field MENGE.
For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
Here it comes:
DATA: element_ref TYPE REF TO cl_abap_elemdescr,
vl_fieldname TYPE string,
tl_components TYPE abap_component_tab,
sl_components LIKE LINE OF tl_components_alv,
linetype_lcl TYPE REF TO cl_abap_structdescr,
ty_table_type TYPE REF TO cl_abap_tabledescr,
g_resultset TYPE REF TO cl_sql_result_set
u2026
CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
* sg_columns-table_name contains 'EKPO'
* sg_columns-column_name contains 'MENGE'
* getting the element as a component
element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
sl_components-name = sg_columns-column_name.
sl_components-type ?= element_ref.
APPEND sl_components TO tl_components.
* dynamic creation of internal table
linetype_lcl = cl_abap_structdescr=>create( tl_components ).
ty_table_type = cl_abap_tabledescr=>create(
p_line_type = linetype_lcl ).
u2026
* Then I will create my field symbol table and line. Code has been cut here.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
u2026
* Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
g_resultset = g_stmt_ref->execute_query( stmt_str ).
* Then structure for the Resultset is set
CALL METHOD g_resultset->set_param_struct
EXPORTING
struct_ref = dy_line.
* Fetching the lines of the resultset => Dumpu2026
WHILE g_resultset->next( ) > 0.
ASSIGN dy_line->* TO <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.
ENDWHILE.
Anyone has any clue to how prevent my Dump ??
The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !Hello
I have expanded your sample coding for selecting three fields out of EKPO:
*& Report ZUS_SDN_SQL_RESULT_SET
*& Thread: Dynamic Internal Table creation and population
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
*& NOTE: Coding for dynamic structure / itab creation taken from:
*& Creating Flat and Complex Internal Tables Dynamically using RTTI
*& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
*& Complex+Internal+Tables+Dynamically+using+RTTI
REPORT zus_sdn_sql_result_set.
TYPE-POOLS: abap.
DATA:
go_sql_stmt TYPE REF TO cl_sql_statement,
go_resultset TYPE REF TO cl_sql_result_set,
gd_sql_clause TYPE string.
DATA:
gd_tabfield TYPE string,
go_table TYPE REF TO cl_salv_table,
go_sdescr_new TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_handle TYPE REF TO data,
gdo_record TYPE REF TO data,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
<gs_record> TYPE ANY,
<gt_itab> TYPE STANDARD TABLE.
START-OF-SELECTION.
continued. -
Creation of dynamic internal table is not synchronous
In my code following lines are used to create a dynamic table.
REFRESH : INCTABL .
CLEAR INCTABL .
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec,'. APPEND INCTABL.
INCTABL-LINE = 'sourcing like zopsdwbom-sourcing,'. APPEND INCTABL.
INCTABL-LINE = 'zmatgrp like zrmrpmaterial-zmatgrp,'. APPEND INCTABL.
INCTABL-LINE = 'zcollection like zrmrpmaterial-zcollection,'.
APPEND INCTABL.
INCTABL-LINE = 'fiscintrodt like zrmrpmaterial-zfiscintrodt,'.
APPEND INCTABL.
INCTABL-LINE = 'bednr like ekpo-bednr,'. APPEND INCTABL.
INCTABL-LINE = 'revlv like ekpo-revlv,'. APPEND INCTABL.
INCTABL-LINE = 'ematn like ekpo-ematn,'. APPEND INCTABL.
INCTABL-LINE = 'menge like mara-eannr,'. APPEND INCTABL.
INCTABL-LINE = 'stprs like mara-eannr,'. APPEND INCTABL.
*inctabl-line = 'kbetr like cdred-f_new,'. append inctabl.
DATA : T_KBETR(72) .
DATA :CNT(2).
DO LIN TIMES .
CNT = SY-INDEX .
CONCATENATE 'kbetr' CNT ' like cdred-f_new,' INTO T_KBETR .
CONDENSE T_KBETR .
INCTABL-LINE = T_KBETR . APPEND INCTABL.
ENDDO .
INCTABL-LINE = 'end of dyntab. '. APPEND INCTABL.
INSERT REPORT 'zcrchangereport_3'(001) FROM INCTABL.
but during run time it is using the previously created dynamic internal table structure and then creating currently required internal table.
how to overcome this problem/
Thanks.Hello,
Instead of creating report, create subroutine pool. Like
INCTABL-LINE = 'report ztest.'. APPEND INCTABL.
INCTABL-LINE = 'form main'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec.'. APPEND INCTABL.
INCTABL-LINE = 'data: end of dyntab.'. APPEND INCTABL.
CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
GENERATE SUBROUTINE POOL inctabl NAME l_name
MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.
ENDCATCH.
IF L_MESSAGE IS INITIAL.
PERFORM (L_FORM) IN PROGRAM (L_NAME).
ELSE.
WRITE : L_MESSAGE, L_LINE.
ENDIF.
You can get the message in L_message variable, if any error occurs.
Regards,
Naimesh -
Need information on Dynamic internal table
Hi All,
I need some information on dynamic internal table.
I want what are the field names and the values in dynamic internal table.
Is there any function module, which tells us the field names and values of corresponding fields from a dynamic internal table ?
Thank you very much in advance.Hi,
Program to display/edit database tables dynamically.
REPORT zdyn_table_display.
PARAMETERS: p_table TYPE tabname OBLIGATORY,
p_rows TYPE I.
* Creation of dynamic internal table
DATA: lv_dref TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: lv_table TYPE string.
START-OF-SELECTION.
* Dynamic internal table.
CREATE DATA lv_dref TYPE TABLE OF (p_table).
ASSIGN lv_dref->* TO <fs_table>.
IF sy-subrc EQ 0.
* EXIT.
ENDIF.
data i type i.
* Get the data
SELECT *
FROM (p_table)
UP TO p_rows ROWS
INTO TABLE <fs_table>.
CONCATENATE 'Table contents : ' p_table INTO lv_table.
* display the table control.
CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
EXPORTING
header = lv_table
tabname = p_table
no_button = space
TABLES
table = <fs_table>
EXCEPTIONS
no_more_tables = 1
too_many_fields = 2
nametab_not_valid = 3
handle_not_valid = 4
OTHERS = 5.
IF sy-subrc EQ 0.
EXIT.
ENDIF.
Getting internal table definition
Try this...
DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.
l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).
Now l_descr_ref->components holds the entire list of fields in itab.
Thanks & Regards,
ShreeMohan -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva -
How to pass data from dynamic internal table to standard internal table
hi experts,
below is the piece of code which i have used in my requirement but the data is not moved.
LOOP AT <tab> ASSIGNING <tab1>.
MOVE-CORRESPONDING <tab1> TO wa.
append wa TO gt_outtab.
ENDLOOP.
here
<tab> - dynamic internal table.
<tab1>-dynamic internal table work area.
gt_outtab - standard internal table.
wa- standard internal table work area.
i am not getting what additional thing i have to write.
pls help me in this regard.
thankx in advance.
soham.p.Hello soham p ,
I am also using the same logic but in my program it is working fine so you declare the fieldsymols like this and try and also check the dynamic internal contain the data or not.
FIELD-SYMBOLS : <y_i_table> TYPE STANDARD TABLE,
<y_wa_table> TYPE ANY.
LOOP AT <y_i_table> ASSIGNING <y_wa_table>.
MOVE-CORRESPONDING <y_wa_table> TO y_wa_vfscaid.
APPEND y_wa_vfscaid TO y_i_vfscaid.
CLEAR y_wa_vfscaid.
ENDLOOP. -
How to populate data into Dynamic Internal Table.
Hi Experts,
I had created one Dynamic Internal table and one static internal table.I want to move data from Static Internal table to Dynamic interal table.And aslo the number of coloum of these two tables are not same.
So please help me for solving this issue.
Thanks,
<u><i><b>Seema.</b></i></u>Hi,
Check out this sample program for dynamictable report.
REPORT YMS_DYNAMICDEMO
NO STANDARD PAGE HEADING
MESSAGE-ID zcs_c2c_001.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
start-of-selection.
perform get_structure.
perform create_dynamic_itab.
perform get_data.
perform write_out.
form get_structure.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
endform.
form get_data.
Select Data from table.
select * into table <dyn_table>
from (p_table).
endform.
form write_out.
Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index
of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
endform.
Thanks,
Shankar
Maybe you are looking for
-
AccessControlException with Windows Vista
I have Java-Applet running for several month and alot of customers are working well. Now I get a customer reply that it's not possible to log in. On my machine everything is working well, but the customer is using Windows Vista, which I don't have. T
-
Window Clock Listed 4 Times in Startup Items
Hello, all! On the job I work on a Mac running 10.3.9, and I have an odd little question. Everything runs fine, but I was curious about this. In my System Preferences I have the Date & Time control panel set to show the Date and Time, view in window,
-
The update "Keynote Updater" cannot be installed
The digital signature for this package is incorrect. The package may have been tampered with or corrupted since being signed by "Apple". I am getting this message from software update. Is there a way round it? Thanks Andy
-
Hi Experts, I made configuration in material master & create new request but when i check in t code STMS i could not found that so please help me for the issue. Thanks & regards Ronny
-
Leopard Server's Mail Server Storage Format
I'm hoping to get some help with a migration project to Mac OS X 10.5 Server's mail server from another mail server. One of the main tasks is going to be migrating our archived mail from the old system to the Server's mail server. To do this I need t