Dynamic program Title
Hi all,
i am have to make a dynamic attribute for a report, can anyone please help me? actually i made 6 pushbutton on selection screen and after click of every pushbutton i want to call same Z program with different program title.
can anyone please help me?
regards
hello all,
thanx for reply...actually i made Text element for all the title and now on user selection i m transferring it in SY-TITLE under event AT SELECTION-SCREEN OUTPUT, but still it is not changing. i putted the program title &1&2 while creating program but now it is not overwriting.
can anyone plz help me?
code:
AT SELECTION-SCREEN OUTPUT.
IMPORT GC_FLG1 FROM MEMORY ID 'GV_FLG'.
if GC_FLG1 ne lc_blk.
lv_flg = GC_FLG1.
sy-title = text-008.
endif.
IMPORT GC_FLG2 FROM MEMORY ID 'GV_FLG'.
if GC_FLG2 ne lc_blk.
lv_flg = GC_FLG2.
sy-title = text-009.
endif.
IMPORT GC_FLG3 FROM MEMORY ID 'GV_FLG'.
if GC_FLG3 ne lc_blk.
lv_flg = GC_FLG3.
sy-title = text-010.
endif.
IMPORT GC_FLG4 FROM MEMORY ID 'GV_FLG'.
if GC_FLG4 ne lc_blk.
lv_flg = GC_FLG4.
sy-title = text-011.
endif.
IMPORT GC_FLG5 FROM MEMORY ID 'GV_FLG'.
if GC_FLG5 ne lc_blk.
lv_flg = GC_FLG5.
sy-title = text-012.
endif.
IMPORT GC_FLG6 FROM MEMORY ID 'GV_FLG'.
if GC_FLG6 ne lc_blk.
lv_flg = GC_FLG6.
sy-title = text-013.
endif.
IMPORT GC_FLG7 FROM MEMORY ID 'GV_FLG'.
if GC_FLG7 ne lc_blk.
lv_flg = GC_FLG7.
sy-title = text-014.
endif.
regards.
Similar Messages
-
Is there any way to create a dynamic GUI title for my Dynpro???
I mean, i could change the text in runtime.
Thankshi Jose,
SET TITLEBAR - Dynpro
Syntax
SET TITLEBAR title [OF PROGRAM prog]
[WITH text1 ... text9].
Extras:
1. ... OF PROGRAM prog
2. ... WITH text1 ... text9
Effect
During screen processing, this statement specifies the GUI title (specified in title) for the subsequent screens. The title is displayed in the title bar from the next sending of one screen until the end of the program or until the next SET TITLEBAR statement. The name of the current GUI title is displayed in the system field sy-title.
A character-type data object that contains the name of a GUI title of the main program of the current program group or of the program specified in prog in upper case is expected for title. If the title does not exist, sy-subrc is set to 4 and the word "SAP" is displayed in the title bar.
System fields
sy-subrc Meaning
0 GUI title is set.
4 GUI title cannot be found.
Notes
The GUI title of the screen must be set before the PBO event. If no GUI title is set for a screen, the word "SAP" is displayed in the title bar.
The title bar can contain a maximum of 70 characters. A title that exceeds this limit after the replacement of placeholders is truncated to the right.
The statement SET TITLEBAR contains a variant for the GUI status of lists.
Addition 1
... OF PROGRAM prog
Effect
By default, a GUI title defined in the current main program is used. When using the addition OF PROGRAM, a GUI title of the progam specified in prog can be set. A character-type data object is expected for prog that contains the name of a ABAP program in upper case.
Addition 2
... WITH text1 ... text9
Effect
When using the addition WITH, you can replace the placeholders of the GUI title with the contents of data objects text1 to text9. Data objects text1 to text9 must be of a character-type flat data type. The placeholders of the GUI title can be defined in the form "&" or "&i", where i can be a number between 1 and 9. The characters are replaced as follows:
The numbered placeholders "&i" are replaced with the contents of the data objects text1 to text9, whose names contain the same number i for the second digit.
The non-numbered placeholders "&" are replaced with the contents of the remaining data objects text1 to text9 according to their order.
If no data object is specified for a placeholder, it is represented by a blank character. Two successive "&" characters "&&" in the title bar are not replaced with the contents of text1 to text9, but with the character "&".
Example
In the following example, the GUI title TITLE_0100 of the program specified in prog is set in a PBO module, where the placeholders "&1" and "&2" of the title are replaced with the contents p1 and p2.
DATA: title TYPE string,
prog TYPE string,
p1(10) TYPE c,
p2(10) TYPE c.
MODULE status_0100 OUTPUT.
title = 'TITLE_0100'.
prog = '...'.
p1 = '...'.
p2 = '...'.
SET TITLEBAR title OF PROGRAM prog WITH p1 p2.
ENDMODULE.
SET TITLEBAR
Syntax Forms
Set title of screen
1. SET TITLEBAR title [OF PROGRAM prog]
[WITH text1 ... text9].
Set title of list
2. SET TITLEBAR title [OF PROGRAM prog]
[WITH text1 ... text9].
SET TITLEBAR - Liste
Syntax
SET TITLEBAR title [OF PROGRAM prog]
[WITH text1 ... text9].
Extras:
1. ... OF PROGRAM prog
2. ... WITH text1 ... text9
Effect
During list processing, this statement sets the GUI title, specified in title, for the display window of the current list level and all following list levels up to the next statement SET TITLEBAR. The statement has - for the most part - the same syntax and semantics as for screens.
In contrast to the screens of dynpros, each list level automatically remains linked to the title set for it. When you return from the display of a higher list level to the display of a lower list level, the latter is displayed with the title that was set for it.
Addition 1
... OF PROGRAM prog
Addition 2
... WITH text1 ... text9
Effect
As for screens.
Reward points if helpful.
Regards
Nilesh -
Download a special kind of internal table (dynamic programming)
Hi guys,
with dynamic programming, i've created a complex internal table of this type :
KNA1 |
KNB1 |
GS_CUSTOMERADDRESS |
GS_CUSTOMERGENERALDETAIL |
The declaration of the internal table is :
TYPES: BEGIN OF gty_record,
table TYPE tabname,
dataref TYPE REF TO data,
END OF gty_record.
This means that each line, has a different line-type. In the first field of the table, i have the name of the structure. In the second, the data-part (in debug double click on leads to structure contents - field by field).
The structure KNA1 contains C and packed (P) fields also so when i pass the internal table to FM GUI_DOWNLOAD, i have this short-dump : UC_OBJECTS_NOT_CONVERTIBLE.
Is there a way to solve this problem quickly?
The goals is download all data of a customer into a local file. Data is distribuited on different structures, readed by standard bapi 'BAPI_CUSTOMER_GETDETAIL2'. This file will be read in another program, of another system.
Any hints/suggestion will be appreciated.
Thanks a lot.
AndreaHi Sandra,
thx for you suggestions.
About your answer :
" Or use a DO. ASSIGN COMPONENT sy-index OF STRUCTURE ... to loop at each field, and do whatever you want with them (using WRITE ... TO ... for example, to convert numbers into text)."
I cannot use this approach to the problem, because i should keep in mind the dimension of single fields and the blanks should be concatenated also, but RESPECTING BLANK switch of concatenate instruction doesen't exists in 4.7 abap.
Sure, i can use a workaround, but i'll have a lot of programming.
"you could use XML for instance. It's rather standard! By using CALL TRANSFORMATION ID SOURCE dataObject RESULT XML string."
This could be the solution. I've already read some posts about it before write mine. I should test it: i don't know if in 4.7 release works. So i could transform the internal table to xml and save to text file.
But then, how i can read xml string and mapping again in this special kind of table ?
Is CALL TRANSFORMATION ID SOURCE XML String RESULT Dataobject instruction sufficient to perform this task?
Thanks a lot
Andrea
BR
Sandra -
Help needed regarding Dynamic Programming
Hi,
While doing dynamic programming , we bind the context variable with two types of
values .
1 . ddic
2 . extern
My doubt is in which case we should use ddic and where to use extern .
Can anybody help me out regarding this.
Thanks a lot.Hi Ki,
Predefined, Web Dynpro UI-specific, and user-defined Dictionary types all have the
prefix ddic:.
wdContext.getNodeInfo()
.addAttribute(
"Visibility",
"ddic:com.sap.ide.webdynpro.uielementdefinitions.Visbility")
Logical Dictionary types from Adaptive RFC models have the prefix extern:.
Check this links
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9214b1e5-0601-0010-fdb0-ec32d43b06e0
/people/dipankar.saha3/blog/2007/05/31/how-to-create-dynamic-approval-process-using-conditional-loop-block-in-guided-procedure
Regards,
Mithu -
GOS - Generic Object Services - Change dynamically the title of attachments
Dear Experts,
how can I change dynamically the title of the single attachment in the attachment-list of cl_gos_manager?
I hope you can help me.
Thanks in advance.Thanks for reply.
I solved the problem by the following way:
- Function ARCHIV_GET_CONNECTIONS for getting all linked documents
- Showing list in popup with ALV-Grid
- SET HANDLER handle_double_click
- Function ALINK_DOCUMETS_DISPLAY_MIX for viewing selected document on popup
Marco -
Hi All
Can anyone send me some good documents in the below topics, it is urgent
1) Dynamic Programming
2) ABAP Objects
A Good documents will get rewarded.
Thanks PrasadParameter mapping
normal ABAP is process oriented, where is OOP-ABAP is a new methodology in ABAP which uses object oriented programming.
we have C++, java, C#, etc as OOP languages.
ABAP has also implemented the OOP technology.
it uses classes, methods and interfaces instead of functiongroups and function modules.
As part of SAPs long-standing commitment to object technology, Release 4.0
of R/3 will contain object-oriented enhancements to the ABAP programming
language. SAPs object strategy is based on SAP Business Objects and now
covers modeling, programming, interfacing, and workflow. By using principles
like encapsulation, inheritance, and polymorphism, the object-oriented
extensions of ABAP will support real object-oriented development. This will
result in improvements in the areas of reusability, maintenance, and quality of
code. SAP offers an evolutionary approach toward objects which leverages
SAPs own and its customers investments in existing business processes,
functionality and data.
follow this link ABAP OBJECTS with good examples.......
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
check the below links lot of info and examples r there
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
these are the links
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
http://www.sap-img.com/abap-function.htm
Classical ALV:
http://www.geocities.com/mpioud/Abap_programs.html
OOPS ALV:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Also Chk this standard Programs.
ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
Reward points if found helpful -
DYNAMIC PROGRAMMING IN WEBDYNPRO ABAP.
Hi Experts
How to create input field dynamical and when i click on the input field drop down ui should display,If i click n time the input field that many drop down should be displayed this should be done using dynamic programming.
Waiting for Reply.
Thanks & Regards.
kittuHi,
Please search before posting.. discussed many times.
To create Input field dynamically, follow like this...
DATA LR_CONTAINER TYPE REF TO CL_WD_UIELEMENT_CONTAINER.
DATA LR_INPUT TYPE REF TO CL_WD_INPUT_FIELD.
DATA LR_LABEL TYPE REF TO CL_WD_LABEL.
DATA LR_TABLE TYPE REF TO CL_WD_TABLE.
DATA LR_BUTTON TYPE REF TO CL_WD_BUTTON.
DATA LR_GRID_DATA TYPE REF TO CL_WD_GRID_DATA.
DATA LR_FLOW_DATA TYPE REF TO CL_WD_FLOW_DATA.
DATA LR_MATRIX TYPE REF TO CL_WD_MATRIX_HEAD_DATA.
LR_CONTAINER ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
CALL METHOD CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD
EXPORTING
BIND_VALUE = ATTRIBUTE
ID = ATTRIBUTE
RECEIVING
CONTROL = LR_INPUT.
lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_input ).
lr_input->set_layout_data( lr_matrix ).
LR_CONTAINER->ADD_CHILD( LR_INPUT ).
ENDIF.
Cheers,
Kris. -
Submitting a dynamic program with layout name
Hi,
I searched many blogs and the SDN forum but couldn't find a solution.
I need to know the layout fields of an ALV report for a later usage. Let me explain it with code:
I used below code to extract data of a dynamic program.
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_true
data = abap_true ).
Submit (program) USING SELECTION-SET variant EXPORTING LIST TO MEMORY
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lf_ref ).
ASSIGN lf_ref->* TO <lt_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
CREATE DATA lf_ref1 LIKE LINE OF <lt_data>.
ASSIGN lf_ref1->* TO <lt_line>.
What I need is to submit program with a (known) layout. If it is not possible, how can i modify the ALV report to fit a layout's display properties. (If I can manage to get -dynamic program- layout's visible fields, it will work too.)
Thank you.Hi ,
Check this LINK you can take help from this
create dynamic varient and pass to Submit program .
[how to create a variant dynamically and get it?;
OR :
you can use function module to get layout names and reprot
ranges: lr_report for ltdx-report,
lr_handle for ltdx-handle,
lr_log_group for ltdx-log_group,
lr_username for ltdx-username,
lr_variant for ltdx-variant,
lr_type for ltdx-type.
call function 'LT_VARIANTS_READ_FROM_LTDX'
exporting
i_tool = r_tool
i_text = r_text
tables
et_variants = rt_variants
it_ra_report = lr_report
it_ra_handle = lr_handle
it_ra_log_group = lr_log_group
it_ra_username = lr_username
it_ra_variant = lr_variant
it_ra_type = lr_type
exceptions
not_found = 1
others = 2.
regards
Deepak.
Edited by: Deepak Dhamat on Jan 23, 2012 8:18 AM -
How to display dynamic header title in the report?
I have a req to display dynamic header title in the report.
When a id is entered in the prompt text, it will display the user data based on that user_id.
so similarly....the header title should vary each time when you select different user_id.
How can we implement this?>
Zack H wrote:
> Lazaro,
>
> It depends on what you want displayed in the heading for each id.
> Please elaborate.
>
> Thanks,
> Zack H.
Zack..I have several projects listed under several project id's...
so when a user selects project id 00164 then it should display something like "Project document for Jon Doe"
again when the user selects project id as 00192 then it should display something like "project document for Zimmerman"
Did you get it?? -
Simple type values retrieving in dynamic programming
Hello,
Can somebody help me to get the values of a simple type in dynamic programming. I am using the following code:
wdcontext.currentcustomergraph().getgraphstyle().
After the values selected in the drop-down, I am not able to get the selected value in dynamic code. Please help.
Thanks,
Sunita.Hello Vishwas,
I already did everything what you mentioned. When I use this in WdDoModifyView( )
wdContext.currentContextElement().getCustomerGraphStyles()
I am not able to retrieve the values inside customerGraphStyles().
Thanks,
Sunita. -
Regarding Dynamic Programming in HR-ABAP
Hi,
I have problem on the dynamic programming. The Reqirement is like, Infotype
0008 if shows one Initial screen , into that infotype we have to add five fields this is
an Enhancement and after we adding that fields into that infotype we should do some logics based on the wagetype , and once we enter an input to that IT 0008
we get that five field values l. How can i solve this problem please help me.
Regards,
SadanandamPlease this is and Urgent Requirement
-
Dynamic Programing : WebDynPro ABAP
Hi expert ,
I need to create UI element (Text_view) dynamically ,
can anyone send the code for that one .
Thanks & Regards
Sankar.MHi,
Refer to this link -
Dynamic Programing
Regards,
Lekha. -
Dynamic programming How to assign a static UI element to a static tray
Hi There,
We are enhancing a standard WDA application and we have a few static UI element created on the view. And now we want to rearrange these element to look like this.
Current:
Root
-> Transparent container1
-> ZTray
-> Transparent container2
target
Root
-> ZTray
-> Transparent container1
-> Transparent container2
Can you help me to find out me how can i perform this 'move" assignment using dynamic programming.
Thanks for your inputs.
RgdsHi Sudhir,
You can start trying something like this in WDDOMODIFYVIEW.
DATA:
lo_element type ref to cl_wd_uielement,
LO_CONTAINER TYPE REF TO CL_WD_UIELEMENT_CONTAINER.
IF first_time = abap_true.
LO_CONTAINER ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_element = LO_CONTAINER->REMOVE_CHILD( ID = 'ZTRAY' ).
LO_CONTAINER->ADD_CHILD( INDEX = 1
THE_CHILD = LO_ELEMENT ).
ENDIF.
I never did something like that. I guess that depending on the layout type of the view this code will need some changes (e.g matrix layout). I tried a simple test with flow layout and worked fine here. -
Dynamic Programming - Attribute Mapping
Hi
Im working on Web Dynpro for ABAP Application where Im using dynamic programming.
I've created node and attributes dynamically (using ADD_NEW_CHILD_NODE & ADD_ATTRIBUTE methods resp.) & bound the dynamically created Textedit UI elements to those attributes. The application is running fine upto this.
Now I want to get the text entered in textedit field from the context. For this I'm using GET_ATTRIBUTE method. Here Im getting dump with error message 'Could not find attribute V_TEST.1.CN_INPUT.1.ATTR11 '. When I debug the GET_ATTRIBUTE method, I found out that the internal table DYNAMIC_ATTRIBUTES is initial. The internal table ATTRIBUTES->* is getting populated in the metod ADD_ATTRIBUTE.
Pls suggest the solution or any alternative method for this.Hi ,
this is happening because the attributes are added dynamically . to get the attribute value at runtime u have to follow the below procedure .
DATA : LR_ROOT_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO ,
LR_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO,
LR_STRUCTDESCR TYPE REF TO CL_ABAP_STRUCTDESCR ,
LS_COMPONENT TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
LT_COMPONENTS TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,
LR_TYPE TYPE REF TO CL_ABAP_DATADESCR .
LR_TYPE ?= cl_abap_TYPEdescr=>describe_by_name( p_name = 'MATNR' ).
LS_COMPONENT-NAME = 'MATNR'.
LS_COMPONENT-TYPE = LR_TYPE .
APPEND LS_COMPONENT TO LT_COMPONENTS.
LR_TYPE ?= cl_abap_TYPEdescr=>describe_by_name( p_name = 'MAKTX' ).
LS_COMPONENT-NAME = 'MAKTX'.
LS_COMPONENT-TYPE = LR_TYPE .
APPEND LS_COMPONENT TO LT_COMPONENTS.
CALL METHOD cl_abap_structdescr=>create
EXPORTING
p_components = LT_COMPONENTS
receiving
p_result = LR_STRUCTDESCR
CATCH cx_sy_struct_creation .
*ENDTRY.
LR_ROOT_INFO = WD_CONTEXT->GET_NODE_INFO( ).
CALL METHOD lr_root_info->add_new_child_node
498 EXPORTING
499 * supply_method =
500 * supply_object =
501 * dispose_method =
502 * dispose_object =
503 * static_element_type =
504 name = 'DATA' " NODE NAME
505 * is_mandatory = ABAP_FALSE
506 * is_mandatory_selection = ABAP_FALSE
507 * is_multiple = ABAP_TRUE
508 * is_multiple_selection = ABAP_TRUE
509 * is_singleton = ABAP_FALSE
510 is_initialize_lead_selection = ABAP_false
511 static_element_rtti = LR_STRUCTDESCR
512 * is_static = ABAP_TRUE " ADD ATTRIBUTE AS STATIC
513 * attributes =
514 receiving
515 child_node_info = LR_NODE_INFO .
Regards
Yash -
Dynamic Programming - RTTC - Appending lines
I give up! Maybe someone else can help me with this Dynamic Programming problem.
I am using RTTC to create an itab. Now I want to append lines and for some reason can't seem to crack the syntax I need.
My latest attempt looks like this...
FIELD-SYMBOLS: <table> TYPE ANY TABLE,
<row> TYPE ANY.
lo_sdescr = cl_abap_structdescr=>create( lt_components ).
lo_tdescr = cl_abap_tabledescr=>create( lo_sdescr ).
CREATE DATA lr_alloc->alloc_table TYPE HANDLE lo_tdescr.
CREATE DATA lr_struct TYPE HANDLE lo_rdescr.
ASSIGN lr_alloc->alloc_table->* TO <table>.
APPEND INITIAL LINE TO <table> ASSIGNING <row>.
The syntax check I get on the APPEND statement is "You cannot use explicit or implicit index operations on tables with type "ANY TABLE".
All the doco and examples I can find use a simple "SELECT * ... INTO CORRESPONDING FIELDS OF TABLE <table>" syntax which it not what I need to do.
Any help it appreciated.
Thanks
Graham RobboHello Graham
The solution is quite simple (at least to overcome your syntax error):
FIELD-SYMBOLS:
<gt_itab> TYPE STANDARD TABLE, " use STANDARD instead of ANY
<gs_struc> TYPE ANY.
*& Report Z_RTTI_CREATE_COMPLEX_ITAB
*& NOTE: revised version of ZUS_SDN_RTTI_CREATE_STRUCTURES
*& Thread: Dynamic Programming - RTTC - Appending lines
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="980407"></a>
REPORT z_rtti_create_complex_itab.
TYPE-POOLS: abap.
DATA:
celltab TYPE lvc_t_styl. " becomes field of complex itab
DATA:
gd_tabnam TYPE string,
gd_tabfield TYPE string,
go_table TYPE REF TO cl_salv_table,
go_sdescr TYPE REF TO cl_abap_structdescr,
go_sdescr_new TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_data TYPE REF TO data,
gdo_handle TYPE REF TO data,
gs_component TYPE abap_compdescr,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
<gt_itab> TYPE STANDARD TABLE,
<gs_struc> TYPE ANY.
PARAMETER:
p_tabnam TYPE tabname DEFAULT 'KNB1'.
START-OF-SELECTION.
" Describe structure
go_sdescr ?= cl_abap_structdescr=>describe_by_name( p_tabnam ).
gd_tabnam = go_sdescr->get_relative_name( ).
" Simulate dynamic addition of columns
LOOP AT go_sdescr->components INTO gs_component.
" Build fieldname
CONCATENATE gd_tabnam gs_component-name INTO gd_tabfield
SEPARATED BY '-'.
CLEAR: gs_comp.
gs_comp-type ?= cl_abap_datadescr=>describe_by_name( gd_tabfield ).
gs_comp-name = gs_component-name.
APPEND gs_comp TO gt_components.
ENDLOOP.
" Create instances of dynamic structure and dynamic internal table
go_sdescr_new = cl_abap_structdescr=>create( gt_components ).
go_tdescr = cl_abap_tabledescr=>create( go_sdescr_new ).
" Create data refence followed by table creation
CREATE DATA gdo_handle TYPE HANDLE go_sdescr_new.
ASSIGN gdo_handle->* TO <gs_struc>.
CREATE DATA gdo_handle TYPE HANDLE go_tdescr. " !!!
ASSIGN gdo_handle->* TO <gt_itab>.
APPEND INITIAL LINE TO <gt_itab> ASSIGNING <gs_struc>.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = <gt_itab>.
go_table->display( ).
CATCH cx_salv_msg .
ENDTRY.
END-OF-SELECTION.
Regards
Uwe
Maybe you are looking for
-
How to cast a fieldinput value to upper case.
Im not a java programer I guess that this must be a silly thing. Im searching data in R/3 from 2 fields 1 numeric and the other alphanumeric. This alphanumeric fields if I put it in upper case works, if I wirte it in lower case doesnt works. In R/3 w
-
CSV file upload into interal table with unicode system.
Hi everyone. I have a problem. I made a sample program to upload CSV file to server memory;iternal table i mean. if csv file has numeric and english data, it works well. but it's not work when i made a csv file with Korean. my code is below. how can
-
It's an old problem with aging machine, but our school's limping along as best it can! One eMac has a disk stuck in the cd/dvd drive. It's operating, but won't eject. I see no "hole" to use a paperclip on (traditional solution for a Mac), and have so
-
When will ART runtime be avaliable on Z1?
Since it seems the majority of bugs were solved in 14.3.A.0.757 (at least for me), it's time to think in improvements now. I searched the forum I and saw that Sony removed ART runtime from Z1's Kitkat (and other phones' Kitkat). So when will Sony lau
-
Hi Experts. I have a short question. I know that IT0712 is used to tell me the main personnel assignment, but is it used for something else as well? I have two assignment that I think is both main assignments. I just want to know what's the main reas