Assign a collection field name dynamically
Hi
I am new to this forum. Could you please help me out with this.
I have a main collection which has 20 columns. I need to pass each of this 20 columns in another function to validate some functionality. I am thinking of doing that in naother loop. I put all thsi 20 column names in another nested table collection. I will get the column_name form the second loop. Can I combine that with the first collection to get the value of that column_name.
I will give an example wit 2 loops.
DECLARE
V_NAME VARCHAR2(100);
V1 VARCHAR2(100);
begin
for i in (select * from employeeS)
loop
for j in(select 'DEPARTMENT_ID' COLUMN_NAME FROM DUAL)
LOOP
v_name:=j.COLUMN_NAME;
v1:=i.V_NAME;
-- I need to get the value of " i.department_id "in variable v1. I need to pass the value of i.department_id (like 20 columns) to another function.
--That is the need for second loop
DBMS_OUTPUT.PUT_LINE('V1'||V1);
END LOOP;
END LOOP;
END;
This code is not compiling. It would be great ,If you can assist me with this.
My oracle version is 11g. If you need any further information, I can provide that.
The real question is why do you want to do this. What problem are you trying to solve?
Yes, one can create an array/collection SQL projection, as oppose to the typical projection containing scalar (single column) values. But I would be hesitant to recommend this approach as there are issues with it (such as the array only supporting a single data type), that needs to be taken into consideration.
Basic example:
// create a SQL collection/array type
SQL> create or replace type TStrings is table of varchar2(4000);
2 /
Type created.
// use the array type to construct the SQL projection as an array of
// column values - as the array is of type string, all columns need to
// be of type string, or needs to be converted to type string
SQL> begin
2 for c in(
3 select
4 TStrings(
5 to_char(empno),
6 ename,
7 job,
8 to_char(hiredate,'yyyy/mm/dd')
9 ) as COL_LIST
10 from emp
11 where rownum <= 2
12 ) loop
13 dbms_output.put_line( '**new row**' );
14 for i in 1..c.Col_List.Count loop
15 dbms_output.put_line( 'col'||i||'='||c.Col_List(i) );
16 end loop;
17 end loop;
18 end;
19 /
**new row**
col1=7369
col2=SMITH
col3=CLERK
col4=1980/12/17
**new row**
col1=7499
col2=ALLEN
col3=SALESMAN
col4=1981/02/20
PL/SQL procedure successfully completed.
SQL>
Similar Messages
-
How to get the class name and field name dynamically
Hi
I have a class (ex: Contract) the fields (ex : a,b,c) .i need to get the class name and field name dynamically
ex
if( validation file for the field Contract.a){
return contract.a;
}else if(validation file for the field Contract.b){
return contract.b;
how to pass the field name and object dynamically
Please help me .............
Thanks in Advance..
Edited by: 849614 on Aug 11, 2011 6:49 AMYoungWinston wrote:
maheshguruswamy wrote:
Agreed, but IMO, i still feel its best if there is no tie in between consumer class level details and the database it talks to. A service layer is needed in between them.Sounds like you've done a bit of this before. Me, I've either been a modeller/DBA, doling out data, or a nuts and bolts programmer (and actually more toolmaker than apps, but did a bit of that too).
Do you know of a good book about the "middle ground" (ie, these service layers)? I understand it empirically, but haven't had a lot of exposure to it.
Winston
Edited by: YoungWinston on Aug 11, 2011 10:34 PM
PS: Apologies. Edited my previous post, presumably while you were composing your reply, when I finally realized what '.filed' meant.Most of my work is in web development, never been a DBA :) . The biggest 'concern' in my shop is 'separation of concerns'. The UI group reports up to a different IT head, the DB group reports up to a different IT head and so on. The looser the coupling between these systems, the lesser the project costs (Integration, QA etc) are. Martin Fowler's books contain good information about separation of concerns in an enterprise environment. The two books which i recommend are
[url http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420]Enterprise Application Architecture and
[url http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_1]Enterprise Integration Patterns -
How to get field name dynamically of a table
Hi,
I have a table which has 5 fields, now i want to know the name of the fields dynamically at run time
not the values each fields hold.
I have tried field symbols, get reference but all i got the value of the field not the field name.
is there any way i can get the field name.
regards,
mayank1. If it is a DDIC table, you can use the FM 'DDIF_FIELDINFO_GET'. Search in SDN for details.
2. If it is an internal table, check this code:
TYPE-POOLS: abap.
PARAMETERS p_table TYPE tabname .
DATA: lcl_table TYPE REF TO cl_abap_tabledescr,
lcl_struc TYPE REF TO cl_abap_structdescr,
it_fields TYPE abap_compdescr_tab,
wa_fields TYPE abap_compdescr.
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <itab> TYPE ANY.
CREATE DATA dref TYPE STANDARD TABLE OF (p_table).
ASSIGN dref->* TO <itab>.
START-OF-SELECTION.
* Get the Table details
lcl_table ?= cl_abap_typedescr=>describe_by_data( <itab> ).
* Get the table line type i.e., structure details
lcl_struc ?= lcl_table->get_table_line_type( ).
* Get the components(fields) of the table line
it_fields = lcl_struc->components.
LOOP AT it_fields INTO wa_fields.
WRITE: / wa_fields-name.
ENDLOOP.
BR,
Suhas -
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? -
Field Name of the field on the Selectiion Screen
Hi,
I am executing report program and we get a Selection Screen .The question is can we catch the field names of the fields on the selection screen dynamically.
We can find the field name by pressing F1 and looking into the Technical Information of that perticular field.
But can we fetch the field name dynamically.
Any pointers/information in this regard will be highly helpful.
Thanks & regards,
AbhijeetHello Abhijeet,
Here's what I think you're looking for -
tables spfli.
parameters : p_test like spfli-carrid.
select-options : s_carrid for spfli-connid.
DATA:
descr_ref TYPE ref to cl_abap_elemdescr.
START-OF-SELECTION.
descr_ref ?= cl_abap_typedescr=>describe_by_data( p_test ).
WRITE: / 'Typename :', descr_ref->absolute_name.
WRITE: / 'Kind :', descr_ref->type_kind.
WRITE: / 'Length :', descr_ref->length.
WRITE: / 'Decimals :', descr_ref->decimals.
WRITE: / 'Output Length:', descr_ref->output_length.
WRITE: / 'Help ID :', descr_ref->help_id.
Kind------> data type (C , I , etc.,)
Help ID---> data element (usually).
There are other classes in ABAP of the form CLABAPDESCR which can provide you with other information. These classes all belong to what is called RTTI (Run Time Type Identification). However, these are available only from 46c. You can explore the other classes, as I think they would be very interesting and useful in the future.
Regards,
Anand Mandalika. -
Re-label of field name -very urgent
Hi
How to re-label SAP standard field name.
example:Infotype organizational assignment (IT0001) and field name "Contract" to "substantive grades".
Thanks
ArchanaHi
For any change WRT standard text, it will refer the repository attributes. changeswill made with help of access key.
Ex:
You can change the Field text with help of Abaper KEY ie.. Go to SE11 --> in table fiels"PA0001" --> change mode ( it will popup access key) --> it will display all the field ---> select your field and double click --> Then you can short text descrption --> you can change there.
Good luck
Pavan
Reward points if it useful
Edited by: Pavan Tatavarthy on May 28, 2008 3:21 PM -
Dynamic field name in an assignment statement
Greetings,
Is it possible to make the field name of an assignment dynamic?
For example if I have two text fields called P1_F1 and P1_F2. Is it possible to
do something like this?
declare
X number := 0;
begin
X := 1;
:P1_F || X = 'value1';
X := 2;
:P1_F || X = 'value2';
end;Any suggestions would be appreciated.
Thanks
LarryUse the <tt>apex_util.set_session_state</tt> API method.
-
Dynamic Work Area Field name Assignment.
hi Guru,
data: it_SFLIGHT type TABLE OF SFLIGHT,
wa_SFLIGHT TYPE SFLIGHT,
lv_field TYPE string.
lv_field = 'CARRID'. " Field name
wa_SFLIGHT-<lv_field> = 'vivek'. " Assigning Value to workarea.
When i try this i am getting the error.
Regards.
Vivekananthan.SHi,
assign (p_tc_name) to <tc>.
TYPES:
BEGIN OF st_mytable,
name1 TYPE string,
name2 TYPE string,
age TYPE i,
END OF st_mytable.
DATA:
gi_mytable TYPE STANDARD TABLE OF st_mytable,
g_mytable TYPE st_mytable.
* Define field symbols
FIELD-SYMBOLS:
<myfield1> TYPE ANY,
<myfield2> TYPE ANY,
<myfield3> TYPE ANY,
<myline> TYPE ANY.
* Fill table with data
g_mytable-name1 = 'John'.
g_mytable-name2 = 'Johnson'.
g_mytable-age = 25.
APPEND g_mytable TO gi_mytable.
g_mytable-name1 = 'Claudio'.
g_mytable-name2 = 'Jensen'.
g_mytable-age = 45.
APPEND g_mytable TO gi_mytable.
* The normal way to do it
LOOP AT gi_mytable INTO g_mytable.
WRITE: / g_mytable-name1, g_mytable-name2 ,g_mytable-age.
ENDLOOP.
SKIP 2.
* Do it with field symbols
LOOP AT gi_mytable ASSIGNING <myline>.
ASSIGN COMPONENT 1 OF STRUCTURE <myline> TO <myfield1>.
ASSIGN COMPONENT 2 OF STRUCTURE <myline> TO <myfield2>.
ASSIGN component 3 OF STRUCTURE <myline> TO <myfield3>.
WRITE: / <myfield1>,<myfield2>,<myfield3>.
ENDLOOP.
* Unassign field symbols
UNASSIGN <myfield1>.
UNASSIGN <myfield2>.
UNASSIGN <myfield3>.
UNASSIGN <myline>.
Regards,
Prabhudas -
Read a structure with out specifying its field/component names-Dynamically?
Hello
My requirements:
I need to write a module pool prog., which updates a Z_material_master_data_table, which tables has 150 fields (i knew its odd having 150 fields in a master table).
On the module pool prog. i need to place the fileds in 2 columns, say left column(for current data) with 150 fields and right column(user input data for updating the Z_material_master_data_table) with 150 fields
When user opens the prog., user will be presented with a initial screen, where in user enters the material number (for which user want a updation ) then, the user will redirected to 2nd screen where in my prog. will default/prepopulate the left side fields with the current(old) data. Now user has to input his/her data (new) for updating any field of the z_master_data_table.
And after finishing the user clicks a push button with title of 'UPDATE'
Now, my prog. has update the entry in the z_material_master_data_table. The 2nd screen looks like below,
_Currnet data_ -------------------------------------- _New data_
Current Material description ---------------------- New Material description
The field will placed here ------------------------ The field will placed here to
for showing the current data inputting the new data by user
As there are 150 fields, i would not like to write validation (cross checking whether user entered the data on each field) on every field of 150 in number.
The 2nd reason, they want the prog. a kind of dynamic in nature, like going further, if the business want to add a new field, say 151_field to the the table, they dont want to change the prog. (just keeping the 151_field should enough) to address this newely added field.
By thinking field symbols approach, i created 2 structures for old data and another for new data. These structurer are replicas of z_material_master_data_table, but 2nd (new) structure field names posses a an extra 4 chararctes like '_UPD', say for example, ZZMAKTX will be the fileld name in structure_1 (old) and its name will be ZZMAKTX_UPD in 2nd structure(new)
Pls. give me some code snippet for (my above requiremnet) reading a structure DYNAMICALLY with out specifying/mentioning the field names for each and every field or give me any better idea to meet my requirement
Thank youFrom my understanding, your requirement was creating the Program to display the 150 fields of the custom Z-Table based on the material number.
Once the user enters the Material number and click enter. It has to navigate to another screen with old data in one column and second column for the new data, Update button for saving the new data to backend Z-Table.
Back end 150 fields will be changed based on the user requirement, So you need to implement it as dynamically.
Solution:
data : it_tabdescr type abap_compdescr_tab.
data : ref_table_descr type ref to cl_abap_structdescr.
DATA : cl_struct TYPE REF TO cl_abap_structdescr.
data: p_table(30) type C. value u2018Custom Z-table Nameu2019.
Return structure of the table.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_tabdescr[] = ref_table_descr->components[].
cl_struct ?= cl_abap_structdescr=>create( it_tabdescr ).
CREATE DATA dyn_line TYPE HANDLE cl_struct.
assign dyn_line->* to <fs_wa>. u201C<fs_wa> have the same structure of the Z-table
CREATE DATA dyn_line1 TYPE HANDLE cl_struct.
assign dyn_line->* to <fs_wa_update>. u201C<fs_wa_ update> have the same structure of the Z-table
Best Regards,
Manigandan D
Edited by: Manigandan Damodharan on Feb 4, 2012 8:58 PM -
Dynamic Type assignment to a Field symbol
Hi All,
I am using the below statement in one of my programs.
ASSIGN COMPONENT 1 OF STRUCTURE <lfs_dyn_colwa> TO <lfs_dyn_field>.
It works fine, but if the first field of structure <lfs_dyn_colwa> is a very large character field, only 29 characters are assigned to <lfs_dyn_field>. am I doing something wrong here.
<lfs_dyn_field> is not assigned previously. The table <lfs_dyn_colwa> is a dynamic table with field names known only at run time.
I tried a lot but could not find any solution.
Any help is appreciated.
Thanks,
MzHi Rahul, Keshav
Sorry if i didnt mention before. But i am using type any for both of my field symbols.
In the middle of processing, i am creating a structure for <lfs_dyn_colwa> dynamically as a work area.
I want to assign the first field of the work area to my second field symbol <lfs_dyn_field>.
If first field of the work area is having a character size of more than 30, only the first 29 are getting copied to the field symbol <lfs_dyn_field>.
First field of the table <lfs_dyn_colwa> is of type c10.
second field of the table <lfs_dyn_colwa> is c160.
the first field is copied alright.
the second field is copied only upto the 29th character.
Thanks for the prompt response.
Mz -
Hi all,
I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
-- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
-- 14 April 2015 09:15 AM
USE master
IF EXISTS
(SELECT 1
FROM sys.databases
WHERE name = 'ScottChangDB')
DROP DATABASE ScottChangDB
GO
CREATE DATABASE ScottChangDB
GO
USE ScottChangDB
CREATE TABLE [dbo].[marvel] (
[avenger_name] [char] (30) NULL, [ID] INT NULL)
INSERT INTO marvel
(avenger_name,ID)
VALUES
('Hulk', 1),
('Iron Man', 2),
('Black Widow', 3),
('Thor', 4),
('Captain America', 5),
('Hawkeye', 6),
('Winter Soldier', 7),
('Iron Patriot', 8);
SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
DECLARE @x XML
SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
SELECT
person.value('Marvel[4]', 'varchar(100)') AS NAME
FROM @x.nodes('.') AS Tbl(person)
ORDER BY NAME DESC
--Or if you want the completed element
SELECT @x.query('/Marvel[4]/avenger_name')
DROP TABLE [marvel]
Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
my SSMS2012:
-- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
-- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
-- [executed: 2 April 2015 15:04 PM]
-- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
-- saved in C:\Documents\XQuery-SQLServer2012
tried to run: 15 April 2015 ??? AM
USE ScottChangDB;
GO
CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
AS
N'<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="marvel">
<xsd:complexType>
<xsd:all>
<xsd:element name="avenger_name" />
<xsd:element name="ID" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>';
GO
DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
SET @x = N'<?xml version="1.0"?>
<marvel>
<avenger_name>Thor</name>
<ID>4</ID>
</marvel>';
SELECT @x;
GO
DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
GO
I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
Thanks in advance,
Scott ChangHi Scott,
2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
sample.
DECLARE @x XML
SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
SELECT @x
SELECT
n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
n.value('ID[1]','INT') ID
FROM @x.nodes('//Marvel') Tab(n)
WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
--FOR XML PATH('Marvel') --uncommented this line if you want the result as element type
3)i.check the xml schema content
--find xml schema collection
SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
select * from sys.schemas
--check the schema content,use the name,collection_name from the above query
SELECT xml_schema_namespace(N'name',N'collection_name')
3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
CREATE VIEW XSDContentView
AS
SELECT ss.name,xsc.name collection_name,cat.content
FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
CROSS APPLY(
SELECT xml_schema_namespace(ss.name,xsc.name) AS content
) AS cat
WHERE xsc.name<>'sys'
GO
SELECT * FROM XSDContentView
By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Dynamic creation of table with variable field-names
HI
I am looking for a way in order to create a table during runtime. The problem is that the field names of the table are provided in another table.
TO illustrate the case at hand, an example:
The initial table contains the fields
UserID - attribut_name - attribute_value
Example Data
d00587 - first_name - Jon
d00587 - last_name - Smith
d00587 - age - 48
d00127 - first_name - Jack
d00127 - last_name - Daniels
d00127 - position - Manager
Now I need to create a table per User that looks as follows:
for user d00587
first_name - last_name - age
**Values
Jon - Smith - 48
for user d00127
first_name - last_name - positioin
Jack - Daniels - Manager
I split the initial table by sorting it according to userID and then looping into an itab with an AT END OF userid, thus I receive the table per user:
Example iTab
UserID - attribut_name - attribute_value
Example Data
d00587 - first_name - Jon
d00587 - last_name - Smith
d00587 - age - 48
However I have no clue on how to create a new internal table with field-names = attribute_name.
Does anybody have an idea or example code for this?
Thanks a lot for your help,
Kind regards,
MingoloHello Minima
Here is some sample coding:
DATA:
gt_fcat type lvc_t_fcat,
gdo_data TYPE REF TO data.
FIELD-SYMBOLS:
<gt_itab> TYPE table.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'MARA'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
* I_STYLE_TABLE =
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = gdo_data
* E_STYLE_FNAME =
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN gdo_data->* TO <gt_itab>.
In your case, you would call the function module with your tables (D00587, D00127). Remove all fields from the fieldcatalog that you do not need before calling the static method.
Regards
Uwe -
Field name retrieval from field symbols after assigning to field in a struc
We have an internal table of about 100 columns. First 7 of them have key values and other fields are data fields. Out of remaining 93 fields, any 2 to 3 fields have data stored in it in each record. Using field symbols in a loop (93 fixed iterations), we are identifying which fields has a data in it. Once we identify the field, how do we retrieve the name of the field / column of the table. We are performing further processing based on name of the field.
Any ideas how to get the name of the column assigned to field symbols?
sample raw code piece is as below:
clear n.
Do 93 times.
n = n + 1.
assign component n of structure itab to <fs>.
if not <fs> is initial.
Get name of the field in cfname.
perform process_record using cfname.
endif.
enddo.
Thanks.
Regards.Hi,
Try this..use the function module GET_COMPONENT_LIST to get the fields of the internal table and store it in an internal table ITAB_COMP..
Then use READ TABLE ITAB_COMP INDEX sy-index..
You can get the field name from the work area..
Thanks,
Naren -
Is it possible to store a field name in a variable, then assign it a value?
Good day, everyone!
I am working on a program in which there are many different amount fields in which an amount may be assigned. For reusability purposes, I was wondering if it would be possible to write a routine that identifies the target amount field, stores it in a variable that is passed back to the calling program, and then assigns a value to it. There may be different structures having the same field name; what I'm trying to do is avoid having to code a huge IF or CASE statement for each structure. For example:
Structures S1, S2, and S3 have some fields identically named. Call one of them F1.
What I'd like to do is call a routine that identifies "F1" as my target field to populate. Then, upon return, I can assign it to the desired structure. Kinda like this:
S1-fieldname = 24.17. (but fieldname isn't a true field in the structure -- it would hold the value of the true field, "F1").
I realize this might not even be possible, but given how talented the folks are on this forum, I thought I should at least pose the question.
As always, points given for all helpful answers, and thank you!!
DaveOk. I gave that a shot, but what happens is that my ASSIGN COMPONENT statement doesn't work. It gets a sy-subrc of 4, and <column> remains unassigned. The program then abends on the line to assign <a1>-trbtr's value to the field because of <column> being unassigned.
DATA:
w_setname TYPE setleaf-setname,
w_column_name(20) TYPE c.
ASSIGN COMPONENT w_column_name OF STRUCTURE wa_expense_ng_report
TO <column>.
<column> = <a1>-trbtr.
Any thoughts on what I might be doing wrong? -
Passing form field name to the subject line of the task assign email
Hello Everyone,
I am trying to create a process that need to pass one of the field data from a form to the task email assign but could not make it work right as expected. I think I miss something but could not figure it out myself. If any one has done this before, please share your knowledge.
Thanks in advance,
Han DaoHi Jasmin,
I thought it simple thing to do by passing the xPath to the subject line but for some reasons, it does not work instead it show the whole xpath on the subject line. Here is my xpath:
{$/process_data/FormData/object/data/xdp/datasets/data/FSFIELDS_/Form1936/EmpInfoSub/UserM gr$}
where Form1936 is the pageName, EmpInfoSub is sub-form, and UserMgr is field name on the form.
Thanks,
Han Dao
Maybe you are looking for
-
Sending html through java.mail
Hello, what i am attempting to do is present a user with a survey via .jsp in a browser. When the user submits the form i am retrieving all of the parameters and reconsituting the html form via the URL class. What i would like to do at this point is
-
For the Attention of BTCare Staff. Assistance requ...
Hi there help is required immediately. Where do i start. Basically we have had problems with our broadband since we got it in a bit back and recently it got even worse. We reported this all to BT the same engineer has had too visit twice even though
-
Can I take a panoramic photo and show it in Keynote?
I have a camera that will let me take panoramic photos (similar to the iPhone 5). I'd like to show the photo as a 360 moving panorama. Is there a way to do that in Keynote? Or will I just have to import it as a movie? Thanks!
-
Itunes charged my account when songs where not purchased
I was going through the process of purchasing songs from iStore. Right after I hit "Buy Now" I would get a Windows error. I tired this 3 times figuring that nothing downloaded. Well nothing downloaded, but the songs where charged to my account each t
-
Compulsory Business place in MIRO
Hi Gurus I have a requirement from client, their requirement is in MIRO Business place has to configured as Compulsory, I tried from my side, but failed, can you plz suggest solution for this requirement. Full Points... Manoj K singh