Is it possible to create an internal table in XI??
Hi Experts,
My scenario is IDoc to JDBC. Some fields are direct mapping but where in my requirement is like this.
Need to create one internal table with 6 fields. In this one field would be Counter and remaining are populated with the IDoc fields data. Counter field should be added depending on IDoc segments. If the particular segment is repeating 5 times 5 records need to be populated in Internal table.
Then these 5 records should be mapped to JDBC Table.
I don't how to handle this situation?
Pl provide some ideas...
Regards,
Rams.
Hi Mahi,
Thanks for your reply. If you don't mind do I have your personal mail id so that I will send my requirement to you and help me on this. You can send your mail to my personal mail id: ramesh dot gaddale at gmailcom.
Regards,
Rams
Similar Messages
-
Is it possible to create an internal table with FOX?
Hi,
I have a requirement where I need to call a function module from FOX formula (standard functionality). It would help me if I could pass data to the FM in an internal table. Unfortunately I am not sure if this is somehow possible in FOX. I could create the internal table in the FM also, but the FOX-possibility would be more convenient.
I will appreciate if anyone can clarify this.
Regards
JanHi Jan,
Yes, calling a function module through FOX is simpler. Use 'CALL FUNCTION' to call FM "RSPC_CHAIN_START" and pass the required parameters within your FOX formula.
Chk this for reference too:
Launch a Process Chain with module fonction in Fox Formula. -
How 2 create dynamic internal table and can we pass it to gui_download FM
HI all,
How can we create a dynamic internal table?
I have a requirement where i have to create an internal table with the no. of fields depending on the selection screen values, i think tat can be possible though dynamic creation only.
How to solve this issue..?Pointers will be very much useful..
Thanks
Sunny.hi
Follow the code it will help you out....
REPORT YUSMM_TEXT2 .
*TABLES
TABLES: MARA, " General Material Data
MAKT, " Material Descriptions
T002. " Language Keys
* GLOBAL TYPE-POOL
TYPE-POOLS : SLIS.
* GLOBAL TYPES
TYPES: BEGIN OF TP_LANG ,
SPRAS LIKE T002-SPRAS,
LAISO LIKE T002-LAISO,
SRNO(3) TYPE N,
END OF TP_LANG.
TYPES: BEGIN OF TP_MATNR,
MATNR LIKE MARA-MATNR,
BEGRU LIKE MARA-BEGRU,
END OF TP_MATNR.
* DECLARATION FOR GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA:GT_MAKT TYPE STANDARD TABLE OF MAKT, "Materialkurztexte,
GT_THEAD TYPE STANDARD TABLE OF THEAD, "SAPscript: Text-Header,
GT_LINETAB TYPE STANDARD TABLE OF TLINE, "SAPscript: Text-Zeilen,
GT_T002 TYPE STANDARD TABLE OF T002. "Language key
DATA: BEGIN OF GV_TEXT_OUTPUT_LINE,
MATNR LIKE MARA-MATNR,
BEGRU LIKE MARA-BEGRU,
MAKTX LIKE MAKT-MAKTX,
LTXT40(1250) TYPE C,
SRNO(3) TYPE N,
SPRAS LIKE T002-SPRAS,
END OF GV_TEXT_OUTPUT_LINE.
DATA: GT_MATNR TYPE STANDARD TABLE OF TP_MATNR,
WA_GT_MATNR TYPE TP_MATNR.
DATA: GT_LANG TYPE STANDARD TABLE OF TP_LANG,
WA_GT_LANG TYPE TP_LANG.
DATA: GT_TEXT_OUTPUT_LINE LIKE STANDARD TABLE OF GV_TEXT_OUTPUT_LINE,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GV_FIELDCAT LIKE LINE OF GT_FIELDCAT,
CT_GT_FIELDCAT_IN LIKE GV_FIELDCAT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GV_REPID TYPE SY-REPID.
DATA: BEGIN OF GV,
FORMER_ERROR LIKE SY-MARKY, " Fehlermeldung bereits
FILE_OPEN(1), " Flag open file
REC_LENGTH TYPE I, " record length
MATNR TYPE MARA-MATNR, " material
REPID TYPE SYST-REPID,
RETCO TYPE SY-SUBRC,
END OF GV.
DATA: GV_MAKT TYPE MAKT,
GV_T002 TYPE T002,
GV_LANGU TYPE THEAD-TDSPRAS.
* DECLARATION FOR FIELD-SYMBOLS
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
DATA: IT_FLDCAT TYPE LVC_T_FCAT.
DATA: T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: L_LT TYPE SLIS_LAYOUT_ALV.
DATA: WA_IT_FLDCAT TYPE LVC_S_FCAT.
DATA: WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA: GP_TABLE TYPE REF TO DATA.
DATA: WA_NEWLINE TYPE REF TO DATA.
*DECLARATION FOR CONSTANTS
CONSTANTS:
BEGIN OF GC,
TDID_GRUN TYPE THEAD-TDID VALUE 'GRUN',
TDOBJECT_MAT TYPE THEAD-TDOBJECT VALUE 'MATERIAL',
ON(01) TYPE C VALUE 'X',
YES(01) TYPE C VALUE 'X',
TXT(25) TYPE C VALUE 'MATERIAL DETAILS',
MAT(25) TYPE C VALUE 'MATERIAL NUMBER',
AUT(25) TYPE C VALUE 'AUTHORIZATION GROUP',
FOUND TYPE SY-SUBRC VALUE '00', " Return-Code
RC_OK TYPE SY-SUBRC VALUE '00', " Return-Code
OFF TYPE SY-SUBRC VALUE '00', " return code
FALSE TYPE SY-SUBRC VALUE '00', " boolean
TRUE TYPE SY-SUBRC VALUE '01', " boolean
END OF GC.
* DECLARATION FOR VARIABLES
DATA: V(3) TYPE N,
STR TYPE STRING,
STR1 TYPE STRING,
V_VAR(3) TYPE N,
V_VAR1(3) TYPE N,
V_FIELDNAME(15) TYPE C,
V_CHAR(15) TYPE C,
V_LINES(3) TYPE N,
MAKTEXT LIKE MAKT-MAKTX,
LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA.
*SELECTION-SCREEN AND PARAMETERS
SELECTION-SCREEN: BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS:
S_MATNR FOR MARA-MATNR, "MATERIAL NUMBER
S_MTART FOR MARA-MTART, "MATERIAL TEXT
S_LANG FOR MAKT-SPRAS. "LANGUAGE
PARAMETER: GP_SIZE TYPE I DEFAULT 200. "DATA LENGTH
SELECTION-SCREEN: END OF BLOCK A1.
* AT SELECTION SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
* INITIALIZATION
INITIALIZATION.
GV-REPID = SY-REPID.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM GET_MARA_DATA
TABLES
GT_TEXT_OUTPUT_LINE
USING
S_MATNR[]
S_MTART[]
GP_SIZE
CHANGING
GV-RETCO
PERFORM GET_MAT_TEXT
TABLES
GT_MAKT
GT_TEXT_OUTPUT_LINE
GT_THEAD
GT_LINETAB
USING
GC
GV-RETCO
CHANGING
GV_TEXT_OUTPUT_LINE
GV_MAKT
PERFORM GET_LANG.
PERFORM DYNAMIC_TABLES.
PERFORM POPULATE_FINAL_TABLE.
PERFORM POPULATE_DYNAMIC_TABLE.
* END-OF-SELECTION
END-OF-SELECTION.
PERFORM DATA_OUTPUT.
*& Form get_mara_data
* Materialdaten lesen
* <->ct_gt_text_output_line Ausgabetabelle
* -->it_s_matnr Parameter Materialnummer
* -->it_s_mtart Parameter Materialart
* -->if_gp_size Parameter Anzahl Materialnummern
FORM GET_MARA_DATA TABLES CT_GT_TEXT_OUTPUT_LINE STRUCTURE
GV_TEXT_OUTPUT_LINE
USING IT_S_MATNR LIKE S_MATNR[]
IT_S_MTART LIKE S_MTART[]
IF_GP_SIZE
CHANGING IF_GV-RETCO. "#EC *
* MARA in die Übergabestruktur einlesen
SELECT MATNR BEGRU
FROM MARA UP TO IF_GP_SIZE ROWS
APPENDING CORRESPONDING FIELDS OF TABLE GT_MATNR
WHERE MATNR IN IT_S_MATNR
AND MTART IN IT_S_MTART.
IF_GV-RETCO = SY-SUBRC.
ENDFORM. " get_mara_data
*& Form get_mat_text
* Kurz- und Langtexte zum Material lesen
* <->ct_gt_makt Materialkurztexte
* <->ct_gt_text_output_line Ausgabetabelle
* <->ct_gt_thead Kopftabelle für ALV
* <->ct_gt_linetab Zeilentabelle für ALV
* -->if_gc Globale Konstanten
* <--cf_gv_text_output_line Struktur Ausgabetabelle
* <--cf_gv_makt Struktru Materialkurztexte
FORM GET_MAT_TEXT TABLES CT_GT_MAKT STRUCTURE MAKT
CT_GT_TEXT_OUTPUT_LINE STRUCTURE
GV_TEXT_OUTPUT_LINE
CT_GT_THEAD STRUCTURE THEAD
CT_GT_LINETAB STRUCTURE TLINE
USING
IF_GC LIKE GC
IF_GV-RETCO
CHANGING CF_GV_TEXT_OUTPUT_LINE LIKE
GV_TEXT_OUTPUT_LINE
CF_GV_MAKT LIKE GV_MAKT
DATA: STRG TYPE STRING,
STRG1(1255) TYPE C.
IF IF_GV-RETCO = IF_GC-FOUND.
* Materialkurztexte in alles Sprachen einlesen
SELECT * FROM MAKT APPENDING TABLE CT_GT_MAKT
FOR ALL ENTRIES IN GT_MATNR "ct_gt_text_output_line
WHERE MATNR = GT_MATNR-MATNR " ct_gt_text_output_line-matnr
* Kurztexte in die sprachabhängigen Felder bringen
LOOP AT GT_MATNR INTO WA_GT_MATNR.
LOOP AT CT_GT_MAKT INTO CF_GV_MAKT
WHERE MATNR = WA_GT_MATNR-MATNR.
CF_GV_TEXT_OUTPUT_LINE-MATNR = WA_GT_MATNR-MATNR.
CF_GV_TEXT_OUTPUT_LINE-BEGRU = WA_GT_MATNR-BEGRU.
CF_GV_TEXT_OUTPUT_LINE-MAKTX = CF_GV_MAKT-MAKTX.
CF_GV_TEXT_OUTPUT_LINE-SPRAS = CF_GV_MAKT-SPRAS.
* LANGTEXT
CLEAR CT_GT_THEAD[].
CT_GT_THEAD-TDOBJECT = IF_GC-TDOBJECT_MAT.
CT_GT_THEAD-TDNAME = WA_GT_MATNR-MATNR.
CT_GT_THEAD-TDID = IF_GC-TDID_GRUN.
CT_GT_THEAD-TDSPRAS = CF_GV_MAKT-SPRAS.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = CT_GT_THEAD
I_READONLY = IF_GC-ON
IMPORTING
E_HEADER = CT_GT_THEAD
TABLES
T_LINES = CT_GT_LINETAB[]
EXCEPTIONS
NOTFOUND = 1.
IF SY-SUBRC = IF_GC-FOUND.
LOOP AT CT_GT_LINETAB.
STRG = CT_GT_LINETAB-TDLINE.
IF STRG1 <> ' '.
CONCATENATE STRG1 ';' STRG INTO STRG1.
ELSE.
STRG1 = STRG.
ENDIF.
ENDLOOP.
CF_GV_TEXT_OUTPUT_LINE-LTXT40 = STRG1.
APPEND CF_GV_TEXT_OUTPUT_LINE TO CT_GT_TEXT_OUTPUT_LINE.
CLEAR CF_GV_TEXT_OUTPUT_LINE.
STRG1 = ' '.
ELSE.
APPEND CF_GV_TEXT_OUTPUT_LINE TO CT_GT_TEXT_OUTPUT_LINE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDFORM. " get_mat_text
*& Form data_output
* Daten mit ALV ausgeben
* <->ct_GT_FIELDCAT Feldkatalog für ALV
* <->ct_gt_text_output_line Ausgabetabelle
* -->P_GS_LAYOUT Layout für ALV
* -->if_gc Globale Konstanten
* <--cf_GV_REPID Zur Zeit aufgerufener Reportname
* <--cf_gv_fieldcat Struktur Feldkatalog
* <--cf_gv Globale Variablen
FORM DATA_OUTPUT.
PERFORM FIELDCATBUILD.
PERFORM LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GV-REPID
I_CALLBACK_PF_STATUS_SET = 'EVENT_SET_STATUS_01'
I_CALLBACK_USER_COMMAND = 'EVENT_USER_COMMAND'
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
TABLES
T_OUTTAB = <FS_2>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> GC-FOUND.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " data_output
*& Form fieldcatbuild
* text
* --> p1 text
* <-- p2 text
FORM FIELDCATBUILD. " TABLES ct_gt_fieldcat_in STRUCTURE gv_fieldcat.
LOOP AT IT_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-FIELDNAME.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ENDFORM. " fieldcatbuild
* Form event_set_status_01*
FORM EVENT_SET_STATUS_01 USING LT_EXCL TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ABCD' .
ENDFORM. "EVENT_SET_STATUS_01
*& Form Name: event_user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM EVENT_USER_COMMAND USING
IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
PERFORM POPULATE_DOWNLOAD_TABLE.
DATA: L_LENGHT TYPE I.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:data.xls'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
DAT_MODE = 'X'
IMPORTING
FILELENGTH = L_LENGHT
TABLES
DATA_TAB = <FS_22>.
IF SY-SUBRC <> GC-FOUND.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF L_LENGHT NE GC-FOUND.
MESSAGE S398(00) WITH 'DATA downloaded to c:data.xls'.
ENDIF.
ENDCASE.
ENDFORM. "event_user_command
*& Form get_lang
* text
* --> p1 text
* <-- p2 text
FORM GET_LANG.
SELECT SPRAS
LAISO FROM T002 INTO CORRESPONDING FIELDS OF TABLE GT_LANG
WHERE SPRAS IN S_LANG.
DESCRIBE TABLE GT_LANG LINES V_LINES.
LOOP AT GT_LANG INTO WA_GT_LANG.
V = V + 1.
WA_GT_LANG-SRNO = V.
MODIFY GT_LANG FROM WA_GT_LANG TRANSPORTING SRNO.
ENDLOOP.
LOOP AT GT_LANG INTO WA_GT_LANG.
CONCATENATE 'MATEDESC-' WA_GT_LANG-LAISO INTO V_FIELDNAME.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-SELTEXT = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-INTLEN = 40.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO IT_FLDCAT .
CLEAR WA_GT_LANG.
ENDLOOP.
LOOP AT GT_LANG INTO WA_GT_LANG.
CONCATENATE 'BASDAT-' WA_GT_LANG-LAISO INTO V_FIELDNAME.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-INTLEN = 255.
WA_IT_FLDCAT-SELTEXT = V_FIELDNAME.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO IT_FLDCAT .
CLEAR WA_GT_LANG.
ENDLOOP.
V_FIELDNAME = 'MATNR'.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Matnr'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO IT_FLDCAT INDEX 1.
V_FIELDNAME = 'BEGRU'.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'BEGRU'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO IT_FLDCAT INDEX 2.
ENDFORM. " get_lang
*& Form dynamic_tables
* text
* --> p1 text
* <-- p2 text
FORM DYNAMIC_TABLES.
ASSIGN LT_DATA TO <FS_DATA>.
* Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
* Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
* Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
* Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
* Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
ENDFORM. " dynamic_tables
*& Form populate_final_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_FINAL_TABLE.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
READ TABLE GT_LANG INTO WA_GT_LANG
WITH KEY SPRAS = GV_TEXT_OUTPUT_LINE-SPRAS.
IF SY-SUBRC EQ GC-FOUND.
GV_TEXT_OUTPUT_LINE-SRNO = WA_GT_LANG-SRNO.
ENDIF.
MODIFY GT_TEXT_OUTPUT_LINE FROM GV_TEXT_OUTPUT_LINE.
ENDLOOP.
ENDFORM. " populate_final_table
*& Form populate_dynamic_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_DYNAMIC_TABLE.
DATA: INDX TYPE SY-TABIX.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
AT NEW MATNR.
INDX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-MATNR.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-BEGRU.
ENDAT.
LOOP AT GT_LANG INTO WA_GT_LANG.
IF GV_TEXT_OUTPUT_LINE-SRNO = WA_GT_LANG-SRNO.
V_VAR = GV_TEXT_OUTPUT_LINE-SRNO + 2.
ASSIGN COMPONENT V_VAR OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-MAKTX.
V_VAR = GV_TEXT_OUTPUT_LINE-SRNO + V_LINES + 2.
ASSIGN COMPONENT V_VAR OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-LTXT40.
ENDIF.
ENDLOOP.
AT END OF MATNR.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
ENDLOOP.
ENDFORM. " populate_dynamic_table
*& Form LAYOUT
* text
* --> p1 text
* <-- p2 text
FORM LAYOUT.
CLEAR L_LT.
L_LT-ZEBRA = GC-YES.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = GC-TXT.
ENDFORM. " LAYOUT
*& Form populate_download_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_DOWNLOAD_TABLE.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
* Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
* Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
* Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
* Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
DATA: STRN1 TYPE STRING,
STRN2 TYPE STRING,
INDX TYPE SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GC-MAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GC-AUT.
LOOP AT GT_LANG INTO WA_GT_LANG.
V_VAR1 = WA_GT_LANG-SRNO + 2.
CONCATENATE 'MATERIALDESCRIPTION-' WA_GT_LANG-LAISO INTO STRN1.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = STRN1.
V_VAR1 = WA_GT_LANG-SRNO + V_LINES + 2.
CONCATENATE 'BASICDATA-' WA_GT_LANG-LAISO INTO STRN2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = STRN2.
ENDLOOP.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
APPEND <LWA_LINE_WA1> TO <FS_22>.
V_VAR1 = 0.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
AT NEW MATNR.
INDX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-MATNR.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-BEGRU.
ENDAT.
LOOP AT GT_LANG INTO WA_GT_LANG.
IF GV_TEXT_OUTPUT_LINE-SRNO EQ WA_GT_LANG-SRNO.
V_VAR1 = GV_TEXT_OUTPUT_LINE-SRNO + 2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-MAKTX.
V_VAR1 = GV_TEXT_OUTPUT_LINE-SRNO + V_LINES + 2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
* STR = GV_TEXT_OUTPUT_LINE-LTXT40.
* SEARCH STR FOR ';'.
* DO.
* IF SY-SUBRC = 0.
* SPLIT STR AT ';' INTO STR1 STR.
* <FA> = STR1.
* APPEND <LWA_LINE_WA1> TO <FS_22>.
* SEARCH STR FOR ';'.
* CLEAR <LWA_LINE_WA1>.
* ELSE.
* EXIT.
* ENDIF.
* ENDDO.
* <FA> = STR.
* APPEND <LWA_LINE_WA1> TO <FS_22>.
<FA> = GV_TEXT_OUTPUT_LINE-LTXT40.
ENDIF.
ENDLOOP.
AT END OF MATNR.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
ENDFORM. " populate_download_table
thanks
Nitya -
Dynamicly creating an internal table with header line
Hi experts,
I am trying to do a read on an internal table using field symbols of type any table. To be able to read more than one row at once, I'd like to read it into another internal table (instead of just one line and instead of looping through them one by one).
So far the following line rendered an error that the target internal table doesn't have a header line
read table <fs_v_tab> WITH KEY (<fs_comp>) = <fs_param>-low INTO <fs_v_tab>.
(also attempted using "<fs_v_tab>->*" & "<fs_v_tab>[]" to be silly)
Based on the following article, I was wondering if it were possible to dynamicly create an internal table with header line.
[http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html|http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html]
Any help or tips on how to dynamicly filter an internal table field-symbol is greatly appreciated!Just read the online help:
This statement reads a row from internal table itab.
Or more exact:
This statement reads one row from internal table itab.
Therefore you can not read multiple lines into another table. The header line is needed to put the result in. And this is not what you intended, the result will be in the header line, not in the table itself.
If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
At least you have to do what you dont wanna do: looping. -
Creating dynamic internal table with deep structure
Hi all,
I need to create an internal table with deep structure dynamically. I've already created tables with method 'create_dynamic_table' but I'm struggling with the deep structure.
I would need an internal table with the following structure:
DATA: BEGIN OF lt_t1,
s1 TYPE REF TO data,
s2 TYPE REF TO data,
END OF lt_t1.
S1 and S2 have to be tables.
It might be possible with RTTS but all the examples in the forums (that I've found so far) are related to at least one DDIC-structure. And that's my problem because both tables are created during runtime.
Thank you in advance
NicolaHi Frédéric,
I hope my english is good enough to explain it correctly:
We use a function builder for SEM-BPS which copies data from one Cube to another. This Cube is transactional, so you can't easily read a structure out of DDIC.
The export parameter of this function builder is a table with type 'any table'.
Until today we used a fixed definition e.g.:
TYPES:
BEGIN OF xtyp_chas,
/sie/sr_ocomp TYPE /b52/oisr_ocomp,
/sie/ts_03psp TYPE /b52/oits_03psp,
0activity TYPE /bi0/oiactivity,
0acty_elemt TYPE /bi0/oiacty_elemt,
0costelmnt TYPE /bi0/oicostelmnt,
0co_area TYPE /bi0/oico_area,
0creditor TYPE /bi0/oicreditor,
0currency TYPE /bi0/oicurrency,
0curtype TYPE /bi0/oicurtype,
0db_cr_ind TYPE /bi0/oidb_cr_ind,
0fiscper TYPE /bi0/oifiscper,
0fiscper3 TYPE /bi0/oifiscper3,
0fiscyear TYPE /bi0/oifiscyear,
0metype TYPE /bi0/oimetype,
0network TYPE /bi0/oinetwork,
0part_actty TYPE /bi0/oipart_actty,
0part_cctr TYPE /bi0/oipart_cctr,
0piobjsv TYPE /bi0/oipiobjsv,
0project TYPE /bi0/oiproject,
0unit TYPE /bi0/oiunit,
0vtdetail TYPE /bi0/oivtdetail,
0vtstat TYPE /bi0/oivtstat,
0vtype TYPE /bi0/oivtype,
0bus_area TYPE /bi0/oibus_area,
0cashdetail TYPE /bi0/oicashdetail,
0cashtype TYPE /bi0/oicashtype,
0comp_code TYPE /bi0/oicomp_code,
0coorder TYPE /bi0/oicoorder,
0cs_dimen TYPE /bi0/oics_dimen,
0cs_unit TYPE /bi0/oics_unit,
0int_bus TYPE /bi0/oiint_bus,
0part_abcpr TYPE /bi0/oipart_abcpr,
0part_coord TYPE /bi0/oipart_coord,
0part_wbsel TYPE /bi0/oipart_wbsel,
0piovalue TYPE /bi0/oipiovalue,
0profit_ctr TYPE /bi0/oiprofit_ctr,
0ps_obj TYPE /bi0/oips_obj,
0statussys0 TYPE /bi0/oistatussys0,
zfbwheroj TYPE /bic/oizfbwheroj,
END OF xtyp_chas,
BEGIN OF xtyp_kyfs,
0amount TYPE /bi0/oiamount,
0quantity TYPE /bi0/oiquantity,
zf03oaws TYPE /bic/oizf03oaws,
zf03oqty TYPE /bic/oizf03oqty,
zf03ozsta TYPE /bic/oizf03ozsta,
END OF xtyp_kyfs,
BEGIN OF xtyp_zf03g003,
s_chas TYPE xtyp_chas,
s_kyfs TYPE xtyp_kyfs,
END OF xtyp_zf03g003,
xtyp_zf03g003_t TYPE HASHED TABLE OF xtyp_zf03g003
WITH UNIQUE KEY s_chas.
DATA: lt_ibm_data TYPE xtyp_zf03g003_t,
ls_ibm_data TYPE xtyp_zf03g003.
So one table (s_chas) contains the characteristics of the Cube and the other (s_kyfs) contains the keyfigures. That's exactly the format we need for the export parameter. At the end of the program, we use the following coding to fill the export table (eto_chas):
loop at lt_ibm_data into ls_ibm_data.
collect ls_ibm_data-s_chas into eto_chas.
endloop.
So in this moment I give this table the structure that is needed to move the data into the cube. I can't change the requirement because it is a standard interface.
I would like to change that coding to be dynamically. Because if somebody changes a charasteristic or a keyfigure in the cube, we would have to change the function builder too. I don't think that the SEM-BPS department will let us know every time they've changed something anyway.
So I hope that my explanation wasn't too confusing
Nicola -
Is it possible to create bidirectional multiselect tables? Help.
Hey everyone (once again since you are in fact great in helping me out),
I was wondering if it would be possible to create bidirectional multiselect tables to interact to each other, like the behaviour qlikview has, since thats my goal.
Imagine that i have 3 tables in my schema/database:
Departments (from HR schema), with the following attributes: department_id (primary key), department_name, manager_id, location_id;
Salary_by_job (created for this purpose), with the following attributes: job_id (primary key), department_id, salary, min_salary, max_salary;
Employees (from HR schema), with the following attributes: employee_id,......, job_id, salary, manager_id, department_id
Can it be possible to creat bidirectional multiselect tables?
Like the following:
- I click on a department, it shows the data relevant to that department in the salary_by_job table and in the employees table.
And after clicking that, i could click on one employee and the department table would look the same (because its a employee from the same department) but the salary_by_job would only show the information regarding the job_id from that employee.
I'll try to show it from text in here:
Department (selected row = 1) = Department of Information (which has 3 employees)
Employees = X (with the job_id = admin), Y (with the job_id = manager) and Z (with the job_id = intern)
Salary_by_job = Admin, with data bla bla bla, Manager, with the data bla bla bla and Intern, with the data bla bla bla
And next i would click on the Employee X and the result would be:
Department (selected row = 1) = Department of Information (which has 3 employees)
Employees = X (with the job_id = admin)
Salary_by_job = Admin, with data bla bla bla
Can something like that be done? If so, how?
I'm thinking of doing that with bindings attached to each table and having the bindings go back and forth.
If someone has a idea of how to do this, please respond, it may be usefull.
Thanks so much for all the help. Have a wonderfull day!
Regards,
Frederico Barracha.
BTW, i'm using jdeveloper 12.1.2.0.0
Mensagem editada por: FredericoSBFredericoSB,
Have you tried adding a setPropertyListener for the tables and change the collectionModel for the 3rd table accordingly?
Ex : Assume you have three tables, Parent (VL)->Child (VL)->GrandChild. There is a relation between Parent (VL)->GrandChild.
Now, you can have tree bindings for both the GrandChilds (say GrandChildViaParent and GrandChildViaChild).
Your jspx could be something like
<af:table id="parent" value="#{bindings.Parent.collectionModel}"...... />
<af:table id="child" value="#{bindings.Child.collectionModel}"...../>
<af:table id="grandchild" value="#{bindings.GrandChild.collectionModel}" ..../>
If all your tables are read-only, then you could change this to something like
<af:table id="parent" value="#{bindings.Parent.collectionModel}"...... >
<af:setPropertyListener from="Parent" to="#{viewScope.tableName}" type="selection"/>
</af:table>
<af:table id="child" value="#{bindings.Child.collectionModel}".....>
<af:setPropertyListener from="Child" to="#{viewScope.tableName}" type="selection"/>
</af:table>
<af:table id="grandchild" partialTriggers="parent child" value="#{viewScope.tableName=='Parent'?bindings.GrandChildViaParent.collectionModel:bindings.GrandChildViaChild.collectionModel}" ..../>
This is just a sample. You could implement the same for all the properties in the grandchild table as EL to make it editable as well.
This is without coding. If you care to code a bit, you could use a Dynamic Table in place and bind the value accordingly in each of the table's selectionListener (which would be a neat approach)
-Arun -
How to create an internal table in a Report from File of FTP Server.
Hi All,
I want to create an internal table in a Report program. But the problem is I have to download two latest files from FTP server.
Now, based in those file I have to design internal tables in current program. The problem is the program from which these files are being generated has options to display some fields in the output. Hence, the columns of these files becomes dynamic due to which I am not able to design the internal table in my current program...Please Help.
Regards & Thanks.
Prashant.Hi,
Or you can use the RTTS classes...
Plenty of examples over here.
one external link: http://help-abap.zevolving.com/2008/09/dynamic-internal-table-creation/
Kr,
Manu. -
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, -
Problem creating an internal table dynamically
Hi,
I'm trying to create an internal table dynamically as i would be able to determine the structure of the table based on the user input.
I've used the sample code from this forum ...
REPORT ZRICH_0003 .
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
type-pools : abap.
data : it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data : ref_descr type ref to cl_abap_structdescr.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text.
parameters: p_table(30) type c.
selection-screen end of block b1.
Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_details[] = ref_descr->components[].
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
<b>* Select Data from table.
select * into table <dyn_table> from
(p_table).</b>
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.
I'm able to get the structure of the table that i want, but when i'm trying to select data from the table into this internal table..as highlighted in the sample code above..i'm getting a short dump...saying that ' the database table is 600 bytes wide but the internal table is only 576 bytes wide.
The internal table is declared as
field-symbols: <dyn_table> type standard table..
Could anyone please tell me how to rectify this.
Thanks in advance,
Harsha.Hi Smitha,
I'm building the internal table by getting the structure using the method
cl_abap_typedescr=>describe_by_name( p_table ).
where p_table is the table name determined dynamically..
Now using this structure, i'm building an internal table by calling the method
call method cl_alv_table_create=>create_dynamic_table
I've checked all the fields after the internal table has been created .. and it contains all the fields of the table that i'm supplying initially..
But when i read data into that internal table, it gives me that dump..I've described it in this post earlier.
Any more suggestions would be very helpful.
Thanks,
Harsha -
How to create an internal table with fields from different sources
Hi.
I need to create an internal table where some of the fields are from a database table, and the other fields are user specified. How do i do that?
Example:
DB table ZTAB with fields ZTAB-FIELD1, ZTAB-FIELD2.
I want to create an internal table ITAB with the fields ZTAB-FIELD1, ZTAB-FIELD2 from ZTAB. In addition, I also want to have one more field RECORD_NO, which is not from ZTAB. How do I do it? Could I do something like below?
DATA BEGIN OF ITAB.
INCLUDE STRUCTURE ZTAB.
DATA RECORD_NO TYPE I.
DATA END OF UPLINE.
Or, are there more efficient way of doing it? Thanks.hi KIan,
go:
general type
TYPE : BEGIN OF ty_itab,
field1 TYPE ztab-field1,
field2 TYPE ztab-field2,
*your own fields here:
field TYPE i,
field(30) TYPE c,
END OF ty_itab.
work area
DATA : gw_itab TYPE ty_itab.
internal table
DATA : gt_itab TYPE TABLE OF ty_itab.
hope this helps
ec -
Create an internal table with the rows of another internal table.
Hi I want to know if posible to create an internal table structure with the rows of another internal table?
ex.
If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
Now I want that the structure of my internal table be: first, second, thirdHi,
If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
Data: begin of second_table occurs 0,
first type <first_table type>,
second type <first_table type>,
third type <first_table type>,
end of second_table.
Regards
Prasenjit -
Creating Dynamic Internal table with a dynamic name
Hi,
I want to create dynamic internal tables with dynamic names.
For example:
Suppose I have a table with three fields.
1. Structure name
2.Fields
3.file
And the structure of the internal table is as follows:
TYPES:BEGIN OF table_type,
struct TYPE char70,
fields TYPE tt_type OCCURS 0,
File TYPE ttab_type OCCURS 0,
END OF table_type.
Suppose I have one record inside my internal table with struct as "STRUCTURE", fields have an internal table content of set of fields and File has some set of records.
Now I want to create dynamic internal table whose name will be "STRUCTURE" , the fields of the dynamic internal table structure[] will be as in fields, and the records will be as in File.
Like this if i have 100 records in my internal table then I have to create 100 dynamic internal table dynamically.
Can anyone suggest how to do this?
Edited by: Jjammy on Jul 22, 2009 7:52 AMHi,
Check the sample program and develop your program accordingly.
<font color=blue><pre>
REPORT ztest_notepad.
*& Declarations
*Type-pools
TYPE-POOLS:
slis.
*Types
TYPES:
ty_fcat TYPE lvc_s_fcat,
ty_fcatalog TYPE slis_fieldcat_alv.
*Work areas
DATA:
wa_fcat TYPE ty_fcat,
wa_fcatalog TYPE ty_fcatalog.
*Internal tables
DATA:
it_fcat TYPE STANDARD TABLE OF ty_fcat,
it_fcatalog TYPE STANDARD TABLE OF ty_fcatalog.
*Type reference
DATA:
it_dyn_tab TYPE REF TO data,
wa_newline TYPE REF TO data.
*Filed symbols
FIELD-SYMBOLS:
<gt_table> TYPE STANDARD TABLE,
<fs_dyntable>,
<fs_fldval> TYPE ANY,
<l_field> TYPE ANY.
*Variables
DATA:
l_fieldname TYPE lvc_s_fcat-fieldname,
l_tabname TYPE lvc_s_fcat-tabname,
l_fieldtext TYPE lvc_s_fcat-seltext,
l_index TYPE char2.
"Selection-screen
PARAMETERS:
p_colms TYPE i.
*& start-of-selection.
START-OF-SELECTION.
PERFORM build_fieldcat.
PERFORM create_dynamic_table.
DO 20 TIMES.
DO p_colms TIMES.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
<l_field> = sy-index.
ENDDO.
INSERT <fs_dyntable> INTO TABLE <gt_table>.
ENDDO.
LOOP AT it_fcat INTO wa_fcat.
PERFORM fieldcatalog1 USING: wa_fcat-fieldname
wa_fcat-tabname
wa_fcat-seltext.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST_NOTEPAD'
it_fieldcat = it_fcatalog
TABLES
t_outtab = <gt_table>.
*& Form BUILD_FIELDCAT
FORM build_fieldcat .
CLEAR: l_fieldname,
l_tabname,
l_fieldtext,
l_index.
DO p_colms TIMES.
CLEAR l_index.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
CONCATENATE 'Field' l_index INTO l_fieldtext.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
ENDDO.
ENDFORM. " BUILD_FIELDCAT
*& Form CREATE_DYNAMIC_TABLE
FORM create_dynamic_table .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_dyn_tab.
ASSIGN it_dyn_tab->* TO <gt_table>.
Create dynamic work area and assign to FS
CREATE DATA wa_newline LIKE LINE OF <gt_table>.
ASSIGN wa_newline->* TO <fs_dyntable>.
ENDFORM. " CREATE_DYNAMIC_TABLE
*& Form FIELDCATALOG
FORM fieldcatalog USING field table f_txt.
wa_fcat-fieldname = field.
wa_fcat-tabname = table.
wa_fcat-seltext = f_txt.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " FIELDCATALOG
*& Form FIELDCATALOG1
FORM fieldcatalog1 USING field table f_txt.
wa_fcatalog-fieldname = field.
wa_fcatalog-tabname = table.
wa_fcatalog-seltext_m = f_txt.
APPEND wa_fcatalog TO it_fcatalog.
CLEAR wa_fcatalog.
ENDFORM. " FIELDCATALOG1 </pre>
</font>
Thanks
Venkat.O -
Can we create global internal table in data dictionary
help me
i want to know whether we can create global internal tables in data dictionaryHi Swathi,
The whole concept of internal table is to manipulate the data at runtime.
This replaces the concept of two dimentional array in other languages.
The power of internal tables is it gets lakhs of records at runtime. I mean it can accomodate lots of records at runtime.
So you can create a table type in DDIC and use it to declare your internal table.
Yes, You can create global internal tables for function modules.
By declaring the internal table in top include you can use this internal table all the function modules of that function group. So if one function module is filling the data another can use it as it is stored globally.
Hope this answers your curiosity.
Award points if useful else getback.
Aleem. -
Creating Dynamic internal table
Hi,
Can we create a dynamic internal table using data of an existing internal table.
i.e. if itab1 is have data like :
row col value
1 1 ab
1 2 cd
1 3 ef
2 1 gh
2 2 ij
2 3 kl
and I want to create itab2 dynamically like this :
row col1 col2 col3
1 ab cd ef
2 gh ij kl
The issue lies only while creating internal table using non DDIC structure i.e. internal table of program.
Thanks
VipinHi,
This is the sample report for DYNAMIC ALV report.
REPORT YMS_DYNAMICALV.
TYPE-POOLS: SLIS.
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
<DYN_WA>.
DATA: ALV_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FLDCAT TYPE LVC_T_FCAT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FLDS(5) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
build the dynamic internal table
PERFORM BUILD_DYN_ITAB.
write 5 records to the alv grid
DO 5 TIMES.
PERFORM BUILD_REPORT.
ENDDO.
call the alv grid.
PERFORM CALL_ALV.
Build_dyn_itab
FORM BUILD_DYN_ITAB.
DATA: NEW_TABLE TYPE REF TO DATA,
NEW_LINE TYPE REF TO DATA,
WA_IT_FLDCAT TYPE LVC_S_FCAT.
Create fields .
DO P_FLDS TIMES.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = SY-INDEX.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-INTLEN = 5.
APPEND WA_IT_FLDCAT TO IT_FLDCAT .
ENDDO.
Create dynamic internal table and assign to FS
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FLDCAT
IMPORTING
EP_TABLE = NEW_TABLE.
ASSIGN NEW_TABLE->* TO <DYN_TABLE>.
Create dynamic work area and assign to FS
CREATE DATA NEW_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN NEW_LINE->* TO <DYN_WA>.
ENDFORM. "build_dyn_itab
Form build_report
FORM BUILD_REPORT.
DATA: FIELDNAME(20) TYPE C.
DATA: FIELDVALUE(5) TYPE C.
DATA: INDEX(3) TYPE C.
FIELD-SYMBOLS: <FS1>.
DO P_FLDS TIMES.
INDEX = SY-INDEX.
Set up fieldvalue
CONCATENATE 'FLD' INDEX INTO
FIELDVALUE.
CONDENSE FIELDVALUE NO-GAPS.
<b> assign component index of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.</b>
ENDDO.
Append to the dynamic internal table
APPEND <DYN_WA> TO <DYN_TABLE>.
ENDFORM. "build_report
CALL_ALV
FORM CALL_ALV.
DATA: WA_CAT LIKE LINE OF ALV_FLDCAT.
DO P_FLDS TIMES.
CLEAR WA_CAT.
WA_CAT-FIELDNAME = SY-INDEX.
WA_CAT-SELTEXT_S = SY-INDEX.
WA_CAT-OUTPUTLEN = '5'.
APPEND WA_CAT TO ALV_FLDCAT.
ENDDO.
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = ALV_FLDCAT
TABLES
T_OUTTAB = <DYN_TABLE>.
ENDFORM. "call_alv
Thanks,
Sankar M -
Creating dynamic internal table(Not field symbol table)
Hi Experts,
I am facing problem creating Intarnal table
I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
I have written----
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fldcat
it_fieldcatalog = me->gt_fieldcat
i_length_in_byte =
IMPORTING
ep_table = lt_new_table
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
above logic creating dynamic field symbol table.... But I want create normal internal table.
Thanks,
RajasekharHi
What do you mean?
It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
Max
Maybe you are looking for
-
Hi All, My web application has been running great all these years with WebLogic 7.0 SP2. I am upgrading it to Weblogic 8.1 SP4. Few classes have the following code snippet: throw new weblogic.utils.AssertionError("impossible case: " + idx); Here idx
-
Software required for communicating with ipod is not installed correctly
I got the error message today! 'the software required for communicating with the ipod is not installed correctly' I have reinstalled itunes and all my music etc. has been saved but I still get the message!? Dont know what to do? HELP!
-
Failure to initialize error message
When i run the adobe installer dvd for photoshop elements 11 I get an error message that reads "installer failed to initialize". Whats going on?
-
Why do images become blurry after resizing in lightroom?
Please help. I do not know why the images are becoming blurry after resizing them in lightroom and exporting them? Any advice? Thanks.
-
Search function for Product description in shopping cart
Hi, We are using SRM 5.5 version. We have a problem when we are searching the Product with the Product description. Shop -> Create Shopping Cart -> Internal Goods/Services Enter a pattern between the stars such as *cap* and then Click Start. System i