Enhancement Point Creation in Internal table
Hi,
I want to create a Enhancement Point in Internal table declared in Customize Program.
This is more related to clarification of concept related to Enhancment Point.
But when i am putting the cursor inside the internal table and right click and Enhancment -> create ,it is giving me a message
that "Position of enhancement section/point statement is not allowed".
This means that we can't create Enhancement point or Enhancement Section inside the Internal table and solution is we can use
only Implicit Enhancement point.
But the doubt is that i had seen SAP programs where they have created the Enhancement point in the internal table declarations.
How that is possible then?
Please provide your helpful answers to get me more clarification on Enhancement Point/
Thanks,
Manish
Hi Afzal,
Below is the code from standard program :-
DATA: BEGIN OF lbbes OCCURS 10, "Tabelle für LB-Bestände
lifnr LIKE ekko-lifnr,
matnr LIKE mdpm-matnr,
werks LIKE mdpm-werks,
charg LIKE lifbe-charg, " SC-batch: Key-Feld
lgort LIKE resb-lgort, " SC-batch
lbmng LIKE lifbe-lblab, "LB-Bestandsmenge
erfmg LIKE mdpm-bdmng, "Verfügbare Menge
erfme LIKE mdpm-lagme, "Basismengeneinheit
wamng LIKE mdpm-bdmng,
waame LIKE mdpm-lagme,
vstel LIKE tvstz-vstel,
ladgr LIKE marc-ladgr,
sernp LIKE marc-sernp,
lblfa LIKE t161v-lblfa,
bdmng LIKE mdpm-bdmng, "sum of dep. requirements from SC POs
bdbam LIKE mdpm-bdmng, "sum of dep. requirements from SC req's
rsmng LIKE mdpm-bdmng, "sum of transfer reservations
slbbm LIKE mdpm-bdmng, "sum of third-party SC requisitions
slbmg LIKE mdpm-bdmng, "sum of third-party SC POs
lfimg LIKE komdlgn-lfimg, "sum of open deliveries
maktx LIKE mdpm-maktx,
selkz LIKE sy-calld.
ENHANCEMENT-POINT rm06ellb_03 SPOTS es_rm06ellb STATIC.
$$-Start: RM06ELLB_03----
$$
ENHANCEMENT 3 /CWM/APPL_MM_RM06ELLB. "active version
DATA: /cwm/waame LIKE mdpm-lagme,
/cwm/lbmng LIKE lifbe-lblab, "LB-Bestandsmenge in ParallelME
/cwm/erfmg LIKE mdpm-bdmng, "Verfügbare Menge in ParallelME
/cwm/erfme LIKE mdpm-lagme, "ParallelME
/cwm/meins LIKE mdpm-lagme, "CW-BasisME
/cwm/bdmng LIKE mdpm-bdmng, "sum of dep.req.< SC POs in PME
/cwm/lfimg LIKE komdlgn-lfimg, "sum of open deliveries in PME
/cwm/rsmng LIKE mdpm-bdmng, "sum of transfer reservations
/cwm/slbbm LIKE mdpm-bdmng, "sum of third-party SC requisitions
/cwm/slbmg LIKE mdpm-bdmng, "sum of third-party SC POs
/cwm/bdbam LIKE mdpm-bdmng. "sum of dep. req´s from SC req's
ENDENHANCEMENT.
$$-End: RM06ELLB_03----
$$
DATA:
END OF lbbes.
Now in the internal table lbbes they have created the enhancement point and in implementation of enhancement point they have declare some extra fields.This is not a implicit enhancement but it is a explicit enhancment implementation with the help of enhancement point.
Similarly if i have to do in my customize program then how to go ahead?
I knew that it is possible with Implicit Enhancement point and i can implement that also.
Let me know your views about this.
Thanks,
Manish
Similar Messages
-
Creation of internal table dynamically based on the Date Range entered
Hi SAPgurus,
I have been facing one issue i.e creation of internal table dynamically based on the date range entered in the selection screen. For example the date range I am giving as 06/2006 to 08/2006, it should display the Fieldcatelog dynamically, this part i have completed but the only issue I am facing is to populate the sales data into that fields.
Right now my program is displaying the ALV like this.
Ex:
<b>CSR District 06/2006 07/2006 08/2006 totals</b>
Shiva New York 10.00
Shiva new york 30.00
Shiva new york 40.00
but it should display like this
<b>CSR District 06/2006 07/2006 08/2006 totals</b>
Shiva New York 10.00 30.00 40.00
80.00
Please help me in this scenario, how to acheive like this..
Thanks & Regards,
Sivaram KandulaHi Sivaram,
I also got the same requirement . i saw rich and your code whatever you have uploaded.i have created dynamic internal table but i am facing the issue to populating the data to my dynamic internal table.
Sivaram, can you please explain your code after this.
*<dyn_table>
*tab_item.
LOOP AT tab_item.
ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <dyn_table>.
ASSIGN COMPONENT 2 OF STRUCTURE <dyn_wa> TO <dyn_table>.
* <dyn_wa> = tab_item-bztxt.
* <dyn_wa> = tab_item-total.
* APPEND <dyn_wa> TO <dyn_table>.
** <dyn_wa> = tab_item-total.
** ASSIGN tab_item-bezei TO <dyn_wa>.
* APPEND <dyn_table>.
ENDLOOP.
how you are puting the loop at tab_item. but tab_item is already commented.
can you send me the code after that.
i am sending some part of my code.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fCAT1
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
select vbeln
fkart
vkorg
vtweg
fkdat
spart
fksto
from vbrk
client specified
into table gt_vbrk
where mandt = sy-mandt
and fkart in ('ZF5','ZFR')
and vkorg = '1100'
and vtweg = '20'
and fkdat in s_fkdat
and spart = '06'
and fksto = ' '.
if gt_vbrk[] is not initial.
select vbeln
fkimg
prsdt
netwr
matnr
arktx
werks
mwsbp
from vbrp
client specified
into table gt_vbrp
for all entries in gt_vbrk
where vbeln = gt_vbrk-vbeln
and werks in s_werks
and matnr in s_matnr.
endif.
select mnr ltx spras from t247
into table it_t247
where spras = 'E'.
data: lv_month1 type vbrp-prsdt,
name1(3) type c,
s_month type string,
s_month1 type string,
s_month2 type string.
* lv_netwr1 type vbrp-netwr,
* lv_mwsbp1 type vbrp-mwsbp.
loop at gt_vbrp into gs_vbrp.
gs_final2-matnr = gs_vbrp-matnr.
gs_final2-arktx = gs_vbrp-arktx.
gs_final2-fkimg = gs_vbrp-fkimg.
lv_month1 = gs_vbrp-prsdt.
read table it_t247 into wa_t247 with key mnr = lv_month1+4(2).
if sy-subrc eq 0.
name1 = wa_t247-ltx.
endif.
concatenate name1
lv_month1(4) into s_month SEPARATED BY '_' .
CONCATENATE S_MONTH 'QTY' INTO S_MONTH1 SEPARATED BY ''.
CONCATENATE S_MONTH 'VALUE' INTO S_MONTH2 SEPARATED BY ''.
gs_final2-month = s_month.
lv_netwr1 = gs_vbrp-netwr.
lv_mwsbp1 = gs_vbrp-mwsbp.
gs_final2-MONTH_QTY = S_MONTH1.
GS_FINAL2-MONTH_VAL = S_MONTH2.
gs_final2-value = lv_netwr1 + lv_mwsbp1.
append gs_final2 to gt_final2.
clear: gs_final2. "lv_name2.
endloop.
if gt_final2[] is not initial.
sort gt_final2 by matnr month ascending .
loop at gt_final2 into gs_final2.
gs_final2_01 = gs_final2.
collect gs_final2_01 into gt_final2_01.
endloop.
endif.
ENDIF..
Regards
Ankur -
Point to dynamical internal table
hi friends,
i have a dynamic internal table A holding some data based on an ddic-structure.
now i have a second table B - self defined - that should in one column hold kind of a pointer ( or better the row data ) to a row of table A. how to achieve this ?
i know this is quite special, but if anyone has some hint for me to go for i will reward generously!
Regards,
Clemensi guess you are talking about the first option (of have a string column in table B)
you have to use field symbols to read dynamic itabs.
if you search the forum for reading dynamic itab or updating dynamic itab you will get lot of code samples.
Raja -
Dynamic creation of internal table based on alv layout
Hi experts!!
I have the following request from my client:
I am displaying an alv report and i need to download it in txt format based on the columns showed in the current layout (i.e. if the user chooses to hide some columns, then they should not appear in the txt file ). In the alv i am using the Function Modules of the alv and not ABAP Objects.
I thought of dynamically creating the internal table, but i am not sure how to do it.
I also thaught of creating an internal table with only one field with the maximum length, but how can i check which fields are diplayed, and how can i get their values??
Please Help!!
Thank u in advance!!!
Please - no duplicate posts
Edited by: Rob Burbank on Feb 24, 2009 2:16 PMAfter call the above said function module you will get the exporting table for field catalog ie
call function 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
importing
es_layout = ls_slis_layo
et_fieldcat = lt_slis_fcat
if you check the lt_slis_fcat internal table if the field are hide in the layout by the user then in this internal table check for field NO_OUT will X.
Take the fields where NO_OUT ne X
then for creating dynamic internal table
field-symbols : <ptab> type standard table.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = lt_slis_fcat
importing
ep_table = i_content.
if sy-subrc = 0.
assign i_content->* to <ptab>.
else.
write: 'Error creating internal table'.
stop.
endif.
Here is the dynamic internal table
a® -
Creation of Internal Table from Object created by OOPS
HI All,
go_obj_ref = cl_abap_typedescr=>describe_by_data( go_drvr ).
I have got the data in go_drvr object. From that I want to create an internal table. So that I can display output using ALV Grid. Please help me.Hi athul,
data : idetails type abap_compdescr_tab.
As i know go_obj_ref is a work area.
idetails[] = go_obj_ref->components[].
now loop this and teh data to u r internal table and you can assign it to ur alv.
Thanks -
Can we create our own enhance point in standard program ie I want to create a point where i need to change & implement the new logic at that point.plz suggest
Hi ,
You can create your own enhancement points.Go to the standard report in which you want to add your own code.Press SHIFT + F4, ths standard code will come in Edit mode , but you can not edit it.
Now goto
EDIT ->Enhancement operations ->Show Implicit Enhancemet Options.Yellow lines will come at few places.These are the points where you can create your own enhancement points and add your code.You need to figure it out , where you can add your code. Right click on the yellow line ->enhancement implementation -> create, here you will be asked whether you want to create declaration or write your code.At the begining of the enhancement point you need to write declarations.
At the end of the enhancement point , again follow same procedure , here you need to write your code logic.
And then you have to activate the enhancement point.
Hope it helps
Edited By
Tejaswini Khante -
Dynamic Creation of Internal table WITH HEADER LINE
Dear,
Please show me the way of creating Internal table WITH HEADER LINE dynamically..
Thanks,
Nirav<font color='blue'>Hi Parekh,
Have a look at the sample program for Dynamic internal table
This program has been developed to update any table data in the dictionary. We give table name and File name as Input fields.
<pre>
REPORT znpmmm0201.
*Types
TYPES:
BEGIN OF ty_file,
data(4096) TYPE c,
END OF ty_file.
*Type-pools
TYPE-POOLS:
truxs.
*Work areas
DATA:
wa_file TYPE ty_file.
*Internal tables
DATA:
it_file TYPE STANDARD TABLE OF ty_file,
it_data TYPE truxs_t_text_data.
DATA:
gv_dref TYPE REF TO data,
file_name TYPE string.
*FIELD-SYMBOLS
FIELD-SYMBOLS:
<gf_itab> TYPE STANDARD TABLE,
<wa> TYPE ANY.
*& Selection-screen
PARAMETERS:
p_table TYPE rsrd1-tbma_val,
p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_for_p_file CHANGING file_name .
*& START-OF-SELECTION
START-OF-SELECTION.
CREATE DATA gv_dref TYPE TABLE OF (p_table).
ASSIGN gv_dref->* TO <gf_itab>.
PERFORM upload_data USING file_name.
MODIFY (p_table) FROM TABLE <gf_itab>.
*& Form UPLOAD_DATA
FORM upload_data USING file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
filetype = 'ASC'
TABLES
data_tab = it_file.
APPEND LINES OF it_file TO it_data.
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA: l_field_seperator.
l_field_seperator = cl_abap_char_utilities=>horizontal_tab.
REPLACE ALL OCCURRENCES OF '|' IN TABLE it_data WITH l_field_seperator.
CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
EXPORTING
i_field_seperator = l_field_seperator
i_tab_raw_data = it_data
TABLES
i_tab_converted_data = <gf_itab>.
ENDFORM. " UPLOAD_DATA
*& Form F4_FOR_p_file
FORM f4_for_p_file CHANGING file.
DATA:
l_field_name LIKE dynpread-fieldname VALUE 'P_FILE'.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = l_field_name
IMPORTING
file_name = p_file.
file = p_file.
ENDFORM. " F4_FOR_p_file </pre>
Thanks,
Venkat.O</font> -
Dynamic creation of internal tables
Hi all,
i very urgently need a sample code which will help me to create an internal table dynamically at the click of a pushbutton using alv.Awaiting reply shortly .
thank you.
Regards,
Lailu PhilipHi,
Check this.I got it from SDN.
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SYST'
CHANGING
ct_fieldcat = it_fcat[].
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
MOVE-CORRESPONDING is_fcat TO is_fieldcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP. -
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. -
Field-symbols and internal table
Hello,
How do I declare a field-symbol as an intenal table?
I have a internal table declared, but i need to declare a field symbols as my internal table´s type. How do I do it?
What I wrote was this:
DATA: BEGIN OF IT_INTE OCCURS 0,
FIELD(3) TYPE C,
END OF IT_INTE.
FIELD-SYMBOLS: isn´t defined as an internal table, how do I fix it.
Thanks!!!
Gabriel.It is very much possible to have a field symbol point to a internal table. Here is some sample code.
report zrich_0001.
data: begin of itab1 occurs 0,
fld1(10) type c,
fld3(10) type c,
fld5(10) type c,
end of itab1.
data: wa1 like line of itab1.
field-symbols: <fs_table> type table.
field-symbols: <fs_wa>.
field-SYMBOLS: <fs_field>.
* Setup the data
itab1-fld1 = '0000000001'.
itab1-fld3 = '0000000002'.
itab1-fld5 = '0000000003'.
append itab1.
itab1-fld1 = '0000000004'.
itab1-fld3 = '0000000005'.
itab1-fld5 = '0000000006'.
append itab1.
assign itab1[] to <fs_table>.
assign wa1 to <fs_wa>.
loop at <fs_table> into <fs_wa>.
* Write out each field of the line
do.
assign COMPONENT sy-index of structure <fs_wa> to <fs_field>.
if sy-subrc <> 0.
exit.
endif.
write:/ <fs_field>.
enddo.
skip 2.
endloop.
Regards,
Rich Heilman -
Create a dynamic internal table
Hi ,
Can any one send me some code for creating dynamic internal table
My req is like this
Input table:
OP QUAN DATE
1 2 10/10/2009
2 3 10/10/2009
3 2 11/10/2009
4 1 12/10/2009
Output table should look like this ( there are 3 different dates in above input and my output should have 3 additional columns and quan should fall under date)
OP 10/10/2009 11/10/2009 12/10/2009
1 2 0 0
2 3 0 0
3 0 2 0
4 0 0 1
Any quick respone will be greatlt appreciated
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Dec 16, 2009 4:52 PMThe dynamic creation of internal tables has been discussed many times before in the forum. Please search the forum for them. If you have difficulties after that, post a new message with the code you have to create the table along with a description of your difficulty.
Rob -
How to create our own fields in workarea in internal tables
hai
can u help me out in creating our own fields in workarea in an internal table (without header line..................)what kinda theory do u want???
* Internal table with HEADER LINE
DATA : BEGIN OF it_output occurs 0 with header line,
c_icon TYPE icon-id,
bukrs TYPE anla-bukrs,
anln1 TYPE anla-anln1,
anln2 TYPE anla-anln2,
grufl TYPE anla-grufl,
grufl_n TYPE anla-grufl,
leabg TYPE sy-datum,
leabg_n TYPE sy-datum,
message TYPE bapiret2-message,
END OF it_output.
The above declaration is same as the below declaration in relation to the previous thread.
* Data declarations for ty_output
DATA : it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0, " Internal table declaration
is_output TYPE ty_output." Work Area declaration
Please reward for useful answers with appropriate points
Regards
Gopi
" Internal table without HEADER LINE
DATA : BEGIN OF it_output occurs 0,
c_icon TYPE icon-id,
bukrs TYPE anla-bukrs,
anln1 TYPE anla-anln1,
anln2 TYPE anla-anln2,
grufl TYPE anla-grufl,
grufl_n TYPE anla-grufl,
leabg TYPE sy-datum,
leabg_n TYPE sy-datum,
message TYPE bapiret2-message,
END OF it_output.
Message was edited by:
Gopi Narendra -
How to create New columns for the Internal Table Dynamically?
HI Guys,
In my logic i have to create new columns depending on the logic which i am executing.
My requirement is .I have to display o/p like this
Material || Year || Period || Mix ratio || Vendor ||Mix Ratio || Vendor || Mix Ratio Vendor || Mix ratio || Vendor || Mix ratio.............................from table's CKMLMV003 and CKMLMV001.Her i have to display the o/p in the above format and i have to display Vendor and Mix Ratio for 5 columns irrespective of data .If i have more than 5 columns for any record then i have to create a New columns dynamically for Vendor and Mix ratio.If anybody want my code i can Submit But plz tell with example how to do?
<b>The O/P must be finally shown in ALV Grid</b>
Thanks,
GopiYou must create the entire internal table dynamically, you can not add columns to a statically define internal table. Here is an example of creating a dynamic internal table.
Creation of internal table dynamically based on the Date Range entered
Regards,
Rich Heilman -
Dynamically create Internal Table
Hi,
I have a parameter in the program table name.
I want to create an Internal Table like the table name entered for this parameter.
Is this kind of dynamic creation of internal table from a variable possible.
If yes, can you guys please help me with it.
Thanks,
CDSure, its possible. HEre is an example. And you will find thousands more, when you search this forum.
report zrich_0002.
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>.
* Select Data from table.
select * into corresponding fields of table <dyn_table>
from (p_table).
* 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.
Regards,
Rich Heilman -
Enhancement point in billing doc creation at invoice number generation
I need to find an enhancement during billing document creation.
This is my requirement. Within function module RV_INVOICE_DOCUMENT_ADD, standard SAP determines the invoice number using Function Module NUMBER_GET_NEXT. now, there is an enhancement point available immediately after the standard SAP invoice number has been determined.
I need to find that enhancement point.
Please advice what enhancement points are available at this point.
Any advice is appreciated. Thanks in advance..Hi
Here is a little program that when you type in the t-code it will give you all the user exits available.
<Code>
*& Report Z_FIND_USER_EXIT *&
REPORT z_find_user_exit NO STANDARD PAGE HEADING.
TABLES : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
TABLES : tstct.
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) text-001.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name EQ enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
SELECT * FROM tadir INTO TABLE jtab WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transactie Code - ', 20(20) p_tcode, 45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline, 2 'User exit', 21 sy-vline , 22 'Omschrijving', 95 sy-vline.
WRITE:/(95) sy-uline.
LOOP AT jtab.
SELECT SINGLE * FROM modsapt WHERE sprsl = sy-langu
AND name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline, 2 jtab-obj_name HOTSPOT ON, 21 sy-vline , 22 modsapt-modtext, 95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'Aantal gevonden user-exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No user-exit Found'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transactie code bestaat'.
ENDIF.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
<Code>
Hope it helps.
Regards
Vic
Maybe you are looking for
-
Windows 8.1 Update 1 Kiosk Mode difference
We have a number of stations running modern IE on Windows 8.1 in Kiosk Mode. I ran the in-place upgrade on a few of them to test Windows 8.1 Update 1. Everything runs fine except that hitting the Windows key 5 times no longer takes you to the login
-
Question about comment command
I have to update comments on a lot of tables. I want to only update date them when the field is null. Does anyone know how this can be accomplished? I want something like COMMENT ON COLUMN TEST.REPORTS.ID IS 'Primary Key' where TEST.REPORT.ID IS NULL
-
what is th difference between Movement type 647,648,641,642 647-TF to stck in trans 648-TR to stck in trans 641-TF to stck in trans. 642-TR to stck in trans. please Elaborate in Detail ?
-
How to save layered PDD file as JPG?
Hi, folks: [running Photoshop CS3 under Windows XP Pro/SP3 ] I have a PSD file with about 14 layers. A few are hidden. I want to save as a jpg, so I go to file -> save as and save as a jpg file (the yellow alert icon shows next to "layers" in the sav
-
How do I insert an object in an array?
How can I insert an object in an array of variable size? I input two numbers from keyboard 1 2that form the following object (Pair) (1,2) how can I add such objects to an array private Pair s[]; e.g. public PairList(int x){ top = -1; s = new Pair[x];