Read structure FIELD Dynamically
Hi All Experts,
I am working on CO-PA exit EXIT_SAPLKEAB_001.
In this exit we have a structure EP_SOURCE. This structure gets its structure dynamically. In my case this is of type CE1SN00. These CE1 tables gets generated in SAP dynamically when you maintain any Operating Concern in CO-PA. In my case Operating concern SN00 has been maintained. And in this CE1SN00 there are multiple Value fields. I have to apply a formula on one of the fields.
The problem is that I have to apply a formula on different fields everytime. I have a Z table which has fields 'Operating Concern', 'Field' and 'Active Indicator'. I have to read this Z table based on the Operating Concern and get the 'Field' name.
For example in my Z table if I have a Operating Concern 'S_AL' and field 'KWBLOK_ME'. And the EP_SOURCE structure has got an entry from table 'CE1S_AL'. I have to read 'EP_SOURCE-KWBLOK_ME' and apply the formula on it.
And next time if I have a Operating Concern 'S_AL' and field 'KWFLHR_ME'. I have to read 'EP_SOURCE-KWFLHR_ME' and apply the formula on it.
What I have done so far is I have defined a structure IT_CE1S_AL as type CE1S_AL and moving all the values from EPSOURCE to IT_CE1S_AL. Now I have to read the value of only that field which is there in 'Z' table.
I hope I have explained this well. Please help me in solving this problem.
Hi Richa,
Thanks for ur reply. But my requirement is something different. I have tried the field symbols but getting an error message - "Data object 'EP_SOURCE' does not have a component called <FS1>".
Once again my requirement is:
I have a Z table ZCO_VALUE. The structure of the table is:
MANDT | OP_CON | FIELD | A_IND |
And there 2 two entries in this table:
100 | S_AL |KWBLOK_ME | A |
100 | S_AL |KWBLHR_ME | A |
And I have a structure EP_SOURCE in user-exit which is just like CE1S_AL. KWBLOK_ME & KWBLHR_ME are technical field names in CE1S_AL. I want to read the value of either CE1S_AL-KWBLOK_ME or CE1S_AL-KWBLHR_ME.
Now in my first instance I want to read
EP_SOURCE-KWBLOK_ME, but I have KWBLOK_ME as a value in ITAB_ZCO_VALUE. I have defined a field-symbol <fs1> to get values KWBLOK_ME or KWBLHR_ME. And trying to read by write the code as:
get_value = EP_SOURCE-<fs1> or
Assign ep_source-<fs1> to get_value.
But because ep_source is not referenced to any structure I can't use any of the above statement.
Thanks
Similar Messages
-
Reading a field symbol whose structure is dynamic
Hi Experts,
I have used the concept of dynamic internal tables to select data from COSS/COSP for e.g.database tables.Field symbol of type " ANY TABLE" has been used to select data , as the dynamic structure is assigned directly to the field symbol.
To calculate the values of various fields I need to read the this field symbol for diferent line items , but I get a compilation error saying " Key not Found ". I understand that I am not able to read the field symbol because its structure is of type 'ANY TABLE' .How do I read this field symbol ?
The field symbol gets the structure of dynamic internal table as formed initially by using class concept.Is their any way in which I could get the structure of this field symbol or any other way to read it?
Thanks in advance.
Regards
ReetwikaHi Ritwika,
Even if u use the concept if dynamic internal table, u can read the each of the field of ur structure,
if u know the name of the field.
for example:
MATNR being one of the field of internal table
field-symbols : <fs> type any.
loop at <fs_it> into <fs_wa>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_wa> to <fs_matnr>.
" in this case matnr field value will be assigned to the field symbol <fs_matnr>, so it can be used further.
endloop.
" do reply if still confused.
Rohit G
Edited by: Rohit Gaharwar on Aug 12, 2009 11:51 AM -
How to get text of itab header and structure field name dynamically?
HI.
I'm just trying display itab to web.
of cause I can use <htmlb:tableView> but I need display by loop itable for my special reason.
the table is dynamic structure that means header line should be changes depends on structure description.
'<htmlb:tableView>' certainly can display header line dynamically with just itable only.
but don't know how to get these text and structure field name without 'tableView'.
help me please.
Thank you.
<TABLE border=1>
<TR style="background-color:#FFFF99" >
<TD>header 1</TD>
<TD>header 2</TD>
<TD>header 3</TD>
</TR>
<%
DATA: WA_STR TYPE FOPT_BSP_UI_REPORT.
LOOP AT TT_itab INTO WA_STRUC.
%>
<TR>
<TD nowrap><%=WA_STRUC-ORGUNIT_T%></TD>
<TD nowrap><%=WA_STRUC-PRGROUP_T%></TD>
<TD nowrap><%=WA_STRUC-PROCESS_T%></TD>
</TR>
<%ENDLOOP.%>
</TABLE>DDIC structure means struture made from SE11?
if yes,that's what I'm trying to display table.
and my sepcial reason is this:
my final purpose is download dynamic table to excel file.
but when I download table comes form "<htmlb:tableView>" with changing http response header that shows some link error and useless icon and no table grid and etc...
"<htmlb:tableView>" resulting lot of useless tags and script.
think iterator has no function removing extra tags
so I'am trying to make simple html table.
but problem is that itable is not just one structure can be more than 100 kinds of structure.
in this situation is there any way to display dynamic itab into simple html table? -
To create a deep structure for dynamic internal table.
Hello
My ALV has fields which are defined dynamically during execution.
so, i did it in the following way,
Declared Field symbolds, DREF and fieldcatalog as,
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable>.
DATA: dref_dyntab TYPE REF TO data,
dref_dynwa TYPE REF TO data.
DATA: ts_fieldcatalog TYPE lvc_t_fcat.
DATA: wa_fieldcatalog TYPE lvc_s_fcat.
Updated Fieldcatalog dynamically as,
*function module to read segment structure
CALL FUNCTION 'SEGMENT_READ'
EXPORTING
segmenttyp = v_segment_name
TABLES
segmentstructure = ts_seg_structure
EXCEPTIONS
no_authority = 1
segment_not_existing = 2
OTHERS = 3.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
MESSAGE e024.
STOP.
WHEN '2'.
MESSAGE e025 WITH v_segment_name.
STOP.
WHEN OTHERS.
MESSAGE e023.
ENDCASE.
ENDIF.
*FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
LOOP AT ts_seg_structure INTO wa_seg_structure.
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
ENDLOOP.
and generated dynamic internal table using fieldcatalog as,
*--Method to get the structure of table using fieldcatalog.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ts_fieldcatalog
IMPORTING
*--Variable of type REF TO DATA.
ep_table = dref_dyntab.
IF sy-subrc <> 0.
MESSAGE e023.
ENDIF.
*--Dynamic internal tables required when show segments selected
IF p_selseg IS NOT INITIAL.
ASSIGN dref_dyntab->* TO <t_dyntable>.
*--Create dynamic work area and assign to FS
CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
ASSIGN dref_dynwa->* TO <fs_dyntable>.
And then i populated this <t_dyntable> which is being passed as data-table to method
CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
As you might be aware, we need a field
TS_STYLEROW TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
in the output internal table <t_dyntable> to meet our requirement.
My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
I tried in the following way by adding one such field to fieldcatalog :
*Field for Styling
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = 'TS_STYLEROW'.
wa_fieldcatalog-tabname = 'TS_STYLE'.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-no_out = 'X'.
wa_fieldcatalog-inttype = 'h'. " I even mentioned this
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
Guyz and respected,
Please advice me with the solution or ur ideas....
Note : The overall requirement is create a deep structure for dynamically generated internal table.
Your help is highly appreciated and unforgettable..!!!!!!!hi,
Dynamic append
Dynamic internal table
Dynamic internal table
dynamic columns in ALV
Variant for dynamic selection
thanks -
Create object/structure like dynamic internal table
Hi,
We have created dynamic internal table with some fields.
for the above how to create structure or internal table like dynamic internal table structure .
Scenario: internal table itab1 ( with header line) have 5 fields.
Based on some of the conditions in layout of the report.
we have to create dynamic internal table.
field-symbols: <FS> type standard table.
we are able to create dynamic internal table with 3 fields
with assignment <fs> = itab1[]
the columns are not appearing but data appearing in next column.
how to solve this one
Thanks
RameshHi Ramesh,
I hope this code works...
report yup_alv_datbase .
*-Display Database table contents in ALV Grid Format
>********************************************************************
This report displays data from SAP tables, views (like SE16) *
FM : REUSE_ALV_GRID_DISPLAY *
tables:
dd02l, " SAP tables
dd03l. " Table Fields
type-pools: slis. " ALV Global Types
selection-screen :
begin of line, comment 1(35) v_1 for field p_table. "#EC NEEDED
parameters p_table like dd03l-tabname obligatory memory id dtb.
selection-screen end of line.
selection-screen :
begin of line, comment 1(35) v_2 for field p_max. "#EC NEEDED
parameters p_max(2) type n default '20' obligatory.
selection-screen end of line.
at selection-screen.
select single * from dd02l where tabname = p_table
and as4local = 'A'
and as4vers = '0000'.
if sy-subrc ne 0.
Table & is not active in the Dictionary
message e402(mo) with p_table.
elseif dd02l-tabclass = 'INTTAB'.
& is a structure, not a table
message e403(mo) with p_table.
endif.
initialization.
v_1 = 'Table'.
v_2 = 'Maximum of records'.
start-of-selection.
perform f_display_data.
Form F_DISPLAY_DATA
form f_display_data.
Macro definition
define m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
end-of-definition.
data:
l_long type i,
lp_struct type ref to data,
lp_table type ref to data, " Pointer to dynamic table
of_sdescr type ref to cl_abap_structdescr,
ls_lvc_cat type lvc_s_fcat,
lt_lvc_cat type lvc_t_fcat, " Field catalog
ls_fieldcat type slis_fieldcat_alv,
lt_fieldcat type slis_t_fieldcat_alv, " Field catalog
ls_layout type slis_layout_alv,
lt_sort type slis_t_sortinfo_alv, " Sort table
ls_sort type slis_sortinfo_alv.
field-symbols :
<fieldcat> type slis_fieldcat_alv,
<lt_data> type table, " Data to display
<fs> type any,
<components> type abap_compdescr.
Dynamic creation of a structure
create data lp_struct type (p_table).
assign lp_struct->* to <fs>.
Fields Structure
of_sdescr ?= cl_abap_typedescr=>describe_by_data( <fs> ).
loop at of_sdescr->components assigning <components>.
Field MANDT not displayed
if sy-tabix = 1 and <components>-name = 'MANDT'.
continue. " Next loop
endif.
Build Fieldcatalog
ls_lvc_cat-fieldname = <components>-name.
ls_lvc_cat-ref_table = p_table.
append ls_lvc_cat to lt_lvc_cat.
Build Fieldcatalog
ls_fieldcat-fieldname = <components>-name.
ls_fieldcat-ref_tabname = p_table.
append ls_fieldcat to lt_fieldcat.
endloop.
Create internal table
call method cl_alv_table_create=>create_dynamic_table
exporting it_fieldcatalog = lt_lvc_cat
importing ep_table = lp_table.
assign lp_table->* to <lt_data>.
Read data
select * from (p_table) up to p_max rows
into corresponding fields of table <lt_data>
order by primary key.
if <lt_data>[] is initial.
No table entries found for specified key
message i429(mo).
exit.
endif.
Read key field to Build Sort Table
select * from dd03l where tabname = p_table
and fieldname <> '.INCLUDE'
and as4vers = '0000'
and as4local = 'A'
order by position.
read table lt_fieldcat assigning <fieldcat>
with key fieldname = dd03l-fieldname.
check sy-subrc eq 0.
add dd03l-leng to l_long.
if dd03l-keyflag = 'X'.
Build Sort Table
m_sort dd03l-fieldname.
<fieldcat>-key = 'X'.
elseif l_long > 150.
<fieldcat>-tech = 'X'.
endif.
endselect.
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
tables
t_outtab = <lt_data>.
endform. " F_DISPLAY_DATA
END OF PROGRAM Z_ALV_DYNAMIC_DATA *********************
Regards,
Sampath -
Read statement on dynamic internal tables
Hello All,
I have a dynamic internal table <G_T_ITAB> with fields F1, F2, F3 & F4 .
I want to read the internal table <G_T_ITAB>. So im using the below code.
LOOP AT G_T_DATA.
READ TABLE <G_T_ITAB> INTO <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.
IF SY-SUBRC <> 0.
ELSE.
ENDIF.
ENDLOOP.
But this is giving syntax error that F1 is not the field of <G_T_ITAB>. But the field is there in <G_T_ITAB>.
Can you suggest me to solve this issue. Or is there any other approach to use READ statement on dynamic internal tables.
Thanks in advance.
Best Regards,
Sasidhar Reddy Matli.Hi ,
Read this way....
FIELD-SYMBOLS:
<fs_str> type any,
<fs_lf_fval> type any,
<fs_lt_result_rate> type any table,
<fs_ls_result_rate> type any.
DATA:
lv_fname type string.
lv_fname = 'MATNR'.
assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.
READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>
WITH KEY (lv_fname) = <fs_lf_fval>.
Thanks,
Shailaja Ainala. -
Connection between Structure Field and Table Field
Hello everybody,
I'm trying to find a connection between a field in the structure and the actual filed in the table of the database. For example in the structure CAUFVD you have the field PLNNR. This information is stored in the table AFFL in the field PLNNR.
In the transaction SE84 you can display a structure with all it's fields but I don't see anywhere from which table and field the information is gathered.
Can you please help me in finding the connection between the structure field and the table field in the database in which the displayed information is stored?
Thanks and best regards,
CALIN Marius-Bogdan
SAP - PP-KeyUserDouble-click on the structure field and you can do a where-used to find the codepoints, interface usage, etc. You might find it that way. You could also look at the flow logic of your screen and try to trace it back. Otherwise, you'd have to use watchpoints, the debugger, runtime analysis or various other developer tools to find the data population. If you are a user and not a developer as your signature indicates, you might need to find a developer for this. Sometimes, it can be incredibly frustrating with SAP because the data field will be handed off 4 or 5 times before it actually reaches its destination field. Unfortunately, I haven't worked with PP in at least 10 years so I can't give you a better answer; maybe someone else can.
-
From which table the structure field is getting populated
Hi all,
I've a requirement to run the report for process orders when AFVGD-FLG_PURS(Indicator:purchase order exist)is active. I'm not able to find from which transparent table I can populate data in this flag value.
I've tried "where-used list" to get which table is having this field, but I didn't get any table name.
Is there any way to get it?
Thanks in advance.
Regards,
BhavanaHi,
another possible solution is to do a "trace".
1.- Go to transaction is ST05.
2.- Then activate the trace.
3.- Afterwards go to the transaction where the structure field is.
4.- And then return to ST05 to deactivate the trace.
5.- Last watch carefully the log of the trace.
Here you will find all the tables and select´s involved in the process.
Best regards. -
How to add form fields dynamically
Hi
I have a form with several fields, and in one section I have one check box and two text fields in a row and also have one button "Add more"
when I click on the Add more button I need to create one more row with the above fields dynamically.
how can I do it? Could some one suggest me with any code snippet?
thanks,
Suman KUse custom tags.
Create all the new fields on the JSP page using custom tags ... i,e through Java code. -
How to change the Display Pattern for Decimal Fields dynamically
hi all,
Can any one help me how to change the display pattern for decimal fields dynamically???
Currently I am using z,zzz,zzz,zz9.999 Display pattern for Quantity Field. If the value is blank it is displaying as 0.000 on the Screen. But I don't want this to be printed.
Please help me how to solve this ASAP.
Thanks,
PrabhuHi,
Alternatively you can handle it in the context.
In the context area, click on the quantity. In the bottom, click on the conditions tab, and put a condition
<quan field> NE initial.
So the field will not be printed if there is no value.
Regards,
Vidya Chowdhary A. -
Exception Structure Field not Found
Hi all!
I'm having a strange trouble with a webdynpro app.
I have a BAPI with a structure as an Input parameter, and another structure as an Output parameter, as well as the Return table.
I imported the model to my app, created the custom controller, added the fields to the view, everything seems all right, but when I deploy and run the app, I get the exception that the field Versn of the Output structure is not found:
com.sap.tc.webdynpro.progmodel.context.ContextConfigurationException: DataNodeInfo(Main.Zbapi_Wty_Codigo_Averia_Input.Output.Wa_Averia_Output): structure field Versn not found
at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.init(DataAttributeInfo.java(Compiled Code))
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initUnmappedAttributes(NodeInfo.java(Compiled Code))
at com.sap.tc.webdynpro.progmodel.context.DataNodeInfo.doInit(DataNodeInfo.java(Compiled Code))
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java(Compiled Code))
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java(Compiled Code))
... 29 more
This is the first time it happens, I've used other BAPIs with a similar structure, but I got no errors, so I don't understand what might be wrong this time.
Has any of you have a problem like this??
Thanx.
Jesushii ,
Thanks for your response.
I did rebuild the project, restarted my j2ee engine, re-deployed my application but still getting the same error:
com.sap.tc.webdynpro.progmodel.context.ContextConfigurationException: DataNodeInfo(Tdc_DataCust.Zsm_Add_New_Project_Input.Project_Data_AddProject): structure field Skill_Id not found
at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.init(DataAttributeInfo.java:299)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:672)
at com.sap.tc.webdynpro.progmodel.context.DataNodeInfo.doInit(DataNodeInfo.java:233)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:657)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:660)
Please do suggest. -
Module pool to create input field dynamically.
Hi All,
I have a requirement in module pool programming,
Where I have one input field,based on the value given in this input I have to get the
input fields dynamically in the screen.
Is it possible to achieve this?
If yes, please do tell me the solution to approach this requirement.
With Regards,
S.Asha.Hi,
You can use IMPORT DYNPRO / EXPORT DYNPRO.
Please check this URL: [Import/Export dynpro not working|Import/Export dynpro not working]
[EXPORT DYNPRO or GENERATE DYNPRO|EXPORT DYNPRO or GENERATE DYNPRO]
Cheers, -
Does length of CBO table's field is shorter than structure field?
HI
length of CBO tables's field name is 16 and structure field name 30.
how this happen?
I was trying to make CBO table include some structure.
and that says field name is too long.
is this not possible all structucture can include CBO table?
or should I change table properties like tech. settings?
does anyone can solve this problem?
thanks.
Regards.
KimHi!
Unfortunately there is no way to enter more than 16 chars long names into tables. Nor with an included a structure.
As the sap help sais:
"There are some restrictions for certain objects. These objects are included in the following list together with the maximum length allowed:
Transparent tables and their fields: 16"
Correct the names within your structure (use less than 16 characters for the field names).
Best regards
Tamá -
Adding field dynamically on screen.
Hi All,
I have to add fields dynamically on screen based on the no. of data records.
Is there any way to add field dynamically.
I need field like this:
first a check box second not editable field third editable field.
Table control is another way to solve the problem but only constraint about check box.
Please help me find out any solution.
Thanks in advance.
Piyush Mathurwrite your code as :
AT SELECTION-SCREEN OUTPUT.
for making data set 2# inactive
IF rdt1 = c_x.
LOOP AT SCREEN.
IF screen-name EQ 'S_BELNR-LOW' OR
screen-name EQ 'S_BELNR-HIGH' OR
screen-name EQ 'P_GJAHR'.
screen-input ='0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
for making data set 1# inactive
IF rdt2 = c_x.
LOOP AT SCREEN.
IF screen-name EQ 'S_BUDAT-LOW'
OR screen-name EQ 'S_BUDAT-HIGH'
OR screen-name EQ 'S_KUNNR-LOW'
OR screen-name EQ 'S_KUNNR-HIGH'
OR screen-name EQ 'RDS1'
OR screen-name EQ 'RDS2'.
screen-input ='0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
END-OF-SELECTION. -
Table name and field name of the structure field
Hi Gurus
I am having a screen where i enter a value in a field and that field is a structure field, I would like to know in which table and what field is this value storing?
Can anyone help me out in finding the field name? and what is the procedure to find?
Thanks in advanceHi Satya,
In the field data section (technical information), you can double click on the field name then the system will take you to SE11 (Data Dictionary). From here, you can check whether the field is available in tranparent table or structure.
In general, as naren mentioned sales order header data stored in table VBAK and line item in table VBAP, VBEP, etc.
For request delivery date, it stores in table VBAK-VDATU.
Regards,
Ferry Lianto
Please close this thread if your problem solved and mark for all helpful answer.
Maybe you are looking for
-
Hello , I have purchased an itunes card 2 weeks ago and it doesnt work then we had to go back to the store to get a new one from them. And No One Has Answered Me IN 5 Days Please HELP ME
-
I Got an iPad air 2 yesterday and had no problems downloading apps. The pad has been synced to my phone. Today I am unable to download apps on either devise Tried logging out of iTunes on both but now can not connect to iTunes and do not receive an
-
Border Manger as proxy: slow internet connection
Hi, I have installed Border Manager in Netware 6.5 sp8 as a proxy. Using it makes our internet connection to slows down. What could be the cause of this problem? Thank you! Ken
-
I import from memory card. After a few seconds of importing the pictures, it goes to a black screen that says "please select a source" Using LR4 on a PC running vista. I have tried copying the picture to a folder on my harddrive but when I ask LR to
-
How to calculate query value on extended range of data
Hi, This is my first post, so let me greet all forum users. I'm reading the forum for few weeks and I'm really impressed with the force of this community. My question is based on some real problems but I'll ask in general: In a BEx query - is it poss