Field symbols im samrt forms
HI gurus in smart forms in global definitions there is a tab called field symbols wat for it is used and how to use it can any body explain me with an aexample
hi rajesh,
http://searchsap.techtarget.com/tip/0,289483,sid21_gci790038,00.html
hope this will help u
Regards,
sindhu.
Similar Messages
-
How to change the Field Symbol, so Adobe Forms takes it as a Table?
Hi guys,
I created an Field Symbol, in a Interface which I use for Adobe Forms. The type of the Field Symbol is STANDARD TABLE, and this field symbol I fill with data from another program.
But the problem is that in adobe forms, this Field Symbol is taken as TEXT FIELD and not as Table... and this shows me a Dump because it can't convert Internal Table to type C (the dump is like that).
What I need, is how to change the Field Symbol, so Adobe Forms takes it as a Table?
I looked at Adobe Form, and found this:
The Type Category of the Field Symbol is DICTIONARY TYPE and I think I need to change it to Internal Table as shown in the right picture.
Does someone have any idea?Hello Taly,
To what i understand your requirement, you need to pass data from Field symbol to internal table in Adobe form.
You have done it correct partially. I have replicated your scenario and steps are below -
1) Create a Z structure
2) Create Z Table Type
3) Create Adobe Interface with Table & Field Symbol. Also do coding as shown to assign the internal table populated in driver program to filed symbol.
4) Design Form as -
5) Code driver as -
*& Report ZR_AF_FS_1
REPORT zr_af_fs_1.
DATA: fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
it_kna1 TYPE ztt_fs_1.
* Sets the output parameters and opens the spool job
CALL FUNCTION 'FP_JOB_OPEN' "& Form Processing: Call Form
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* <error handling>
ENDIF.
*&---- Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' "& Form Processing Generation
EXPORTING
i_name = 'ZAF_FS_1'
IMPORTING
e_funcname = fm_name.
IF sy-subrc <> 0.
* <error handling>
ENDIF.
*-- Fetch the Data and store it in the Internal Table
SELECT kunnr name1 name2 adrnr FROM kna1 INTO TABLE it_kna1 UP TO 15 ROWS.
* Language and country setting (here US as an example)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
*&--- Call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
it_data = it_kna1
* IMPORTING
* /1BCDWB/FORMOUTPUT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
IF sy-subrc <> 0.
* <error handling>
ENDIF.
*&---- Close the spool job
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* <error handling>
ENDIF.
6) Output -
BR. -
Assigning field symbol to a form parameter
Hello there.
I got this huge string that concatenates several columns from a structure and I have to distribute these data into fields of a generic work area in a FORM.
The thing is that I can't find the right way to pass this work area and when I try to assign my field symbol a dump occurs.
Could anyone give me a tip?
<b>Here is what I'm doing:</b>
Form Nameform <how to pass?> p_workarea
loop at it_tab
CONCATENATE 'p_table-' it_tab-fieldname INTO campo.
ASSIGN (campo) TO <fs>.
endloop.
When I debug it, the program sees p_workarea, but when I try to see a specific field like p_workarea-kunnr, it's like it doesn't exists.Thanks Matt,
But how do I append the values within this internal table ??
When I am using the following code:
ls_wa-fld3 = 'A'.
ls_wa-t_in-fld1 = 'B'.
ls_wa-t_in-fld2 = 'C'.
ls_wa-t_in-fld1 = 'D'.
ls_wa-t_in-fld2 = 'E'.
append ls_wa to lt_tab.
Its giving an error that:
The data object "LS_WA" does not have a component called "T_IN-FLD1".
I wanted the values to be appended in the following way in lt_tab:
fld3 fld1 fld2
A B C
D E
Please help. -
Problem in accessing field symbols passed as parameters to subroutine
Hi,
I have different internal tables/structures,i am populating those tables dynamically using field symbols. If i put that logic in perform, i am getting error while accessing the field symbol insdie the form.
For ex: My code looks like below.
tab1 is my int table, fs1 is my work area,
declared <fs1> as
data: <fs1> type fs1. <fs1> is my structure type.
perform populate tables tab1
using <fs1>
fs1.
form populate tables p_tab
using p_fs
p_wa.
assign p_wa to p_fs.
endform.
i am getting the error in the assign stmt
logic without form...endform is
assign fs1 to <fs1>
logic was working fine wihtout perform.
Regards,
sowjanyaHi Sowjanya,
Try this one, Hope it will solve your issue
REPORT ztest_fs_create.
DATA: gt_final TYPE STANDARD TABLE OF pernr_d,
wa_final TYPE pernr_d.
NODES pernr.
TABLES pa0001.
FIELD-SYMBOLS: <tab> TYPE pernr-pernr.
GET pernr.
ASSIGN pernr-pernr TO <tab>.
PERFORM get_pernr USING <tab>.
END-OF-SELECTION.
LOOP AT gt_final INTO wa_final.
WRITE:/1 wa_final.
ENDLOOP.
*& Form gt_pernr
text
-->P_TAB text
FORM get_pernr USING p_tab TYPE any.
APPEND p_tab TO gt_final.
ENDFORM. "gt_pernr
Cheers
Pavan -
Hello experts,
I am getting a problem while working with field symbols. I have some data field symbol in the form of structure. The field symbols have the type 'TABLE' so the data fills in runtime, so the structure also changes runtime. We need to get some fields out form them in the work area.
How can I do that? Is there any code you can give me so that I can use that.
Please help.
Thanks,
GaneshHello,
Use the Assign statement.
Try like this.
LOOP AT <FS_1> ASSIGNING <FS_2>.
ASSIGN COMPONENT 'POSIDFROM'
OF STRUCTURE <FS_2> TO <FS_5>.
LV_POSID = <FS_5>.
endloop.
Cheers,
Vasanth -
Hi,
I have a doubt regarding the field symbol assignment.
In my program, I have logic as below.
<b> W_1STCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP1'.
W_2NDCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP2'.
ASSIGN (W_1STCNTFLD) TO <FS1>.
ASSIGN (W_2NDCNTFLD) TO <FS2>.</b>
While debugging, when I see the values of the Field Symbols <b><FS1></b> and <b><FS2></b> after assignment, they are <b>0, 0</b>. Why is it like that..?
In general, what does a Field Symbol hold..? the value of the variable being assigned or the Memory location of that variable..?
When I remove the paranthesis while assigning like below,
<b>ASSIGN W_1STCNTFLD TO <FS1>.</b>
it is storing the value of the variable(<b>E_INV_AGING_STRU-PDISCCNTP1</b>) to <b><FS1></b> instead of '0'.
And what is the difference between <b>ASSIGN (W_1STCNTFLD) TO <FS1></b> and <b>ASSIGN W_1STCNTFLD TO <FS1></b>..? I mean, when we put paranthesis to the variable and when we remove the paranthesis.
Please clarify my doubts. Thanks in advance.
Thanks & Regards,
Paddu.when you use the paranthesis,(W_1STCNTFLD) actually equals to ('E_INV_AGING_STRU-PDISCCNTP1'),and the 'E_INV_AGING_STRU-PDISCCNTP1' must be the label of a data object,it can't be a string!
please refer to the following document(coming from sap abap keywords document):
Alternative 2
... [TABLE FIELD] (name)
Alternative 3
... oref->(attr_name)
Alternative 4
... {class|(class_name)}=>{attr|(attr_name)}
Effect
There are three dynamic variants for mem_area, where the storage area is not specified directly, but as the content of character/type data objects enclosed within parentheses.
In the first variant (name), the label in name is built exacltly like the direct specification. When the statement is executed, the content of name must be the label of a data object that can contain offset/length specifications, strucuture component selectors, and component selectors for the assignment of attributes in classes or objects (since Release 6.10). The content of name must be specified in uppercase letters.
The optional addition TABLE FIELD before (name) is only possible outside of classes. This addition limits the search area - where the data object specified in (name) is searched for (see below) - to the interface work areas for the current program group declared using TABLES. If TABLE FIELD is specified, casting_spec and range_spec cannot be specified explicitly.
If the label in name is a field symbol or a form parameter with an unstructured type, components can be addressed, as of Release 6.10, through structure component selectors. The components must exist when the statement is executed.
The second variant oref->(attr_name) is a special case of the first variant for the assignment of an instance attribute to a field symbol - where the object reference variable oref is specified statically. The label of the attribute is specified dynamically in the character-type field attr_name and must not be specified in uppercase letters.
The third variant {class|(class_name)}=>{name|(attr_name)} is a special case of the first variant for the assignment of a static attribute to a field symbol where the class name class and the name of the attribute name can be specified both directly and dynamically in character-type fields class_name or attr_name. The contents of attr_name and class_name do not have to be in uppercase letters. If the class name is specified dynamically and the attribute is specified directly, no offset/length specifications can be made for the attribute.
If a data object is specified dynamically, this is searched for in accordance with the following hierarchy.
Within the local data objects of the current procedure
Within the attributes, visible in a method, of the actual class, where , in instance methods, the self reference me-> is set explicitly before the label
Within the global data of the current program
Within the interface work areas of the main program of the current program group declared with TABLES
Within the attributes of the object to which oref refers, if the label has the expression oref-> (as of Release 6.10)
Note
Only for internal use can the label in name also have the form (PROG)DOBJ, whereby PROG is the name of an ABAP program and DOBJ is the name of a global data object of this program. If the program PROG is loaded during execution of the statement ASSIGN in the same internal mode as the current program is loaded, the data object (PROG)DOBJ in this program is searched for and the field symbol points to this data object after successful assignment.
Example
Dynamic access to an attribute of an object (Dynamic Access) through a field symbol.
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS m1 IMPORTING oref TYPE REF TO object
attr TYPE string.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
FIELD-SYMBOLS <attr> TYPE ANY.
ASSIGN oref->(attr) TO <attr>.
WRITE <attr> ...
ENDMETHOD.
ENDCLASS. -
How to use the separate symbol in the text field in the adobe form.
Hi,experts,
I dont know how to use the separate symbol to make a paragraph separate into several lines correctly in the text field in the adobe form.
Action:
1. config the ADS successfully.
2. create the adobe form with a mult-line textfield(binding the 'remark' context in the interface of the form) using sfp.
3. create a WDA for invoke the form and transfer the 'remark' context data.
I use the following codes to display the paragraph in the PDF document:
CONCATENATE
'1、aaaaaaaaaaa;'
'2、bbbbbbbbb '
'3、ccccccccccc'
'4、ddddddddd'
INTO remark .
lo_nd_z_hr_php_payslip->set_attribute(
EXPORTING
name = `REMARK`
value = remark ).
But I found all the content aren't paragraph separate correctly in the text field in the adobe form when I run the WDA.
Could you please give me some hints to make the paragraph separate correctly in PDF document? Thanks a lot in advance!
My email is : [email protected]
Best regards,
Tao
Edited by: wang tao on Apr 8, 2008 1:58 AMHi,
If it is just a one word value then you could use this in the exist event;
this.rawValue
= util.printx(">?<*",this.rawValue);
This changes the first character (represented by the ?) to uppercase (represented by the >) and all trailing characters (represented by the *) to lowercase (represented by the <).
If you wanted something more general ... if they could also enter a middle name then you could call a function like;
function toTitleCase(textValue)
return textValue.toLowerCase().replace(/\b[a-z]/g, function replacer(match) { return match.toUpperCase(); });
This uses a regex to change all lowercase letters following a word boundary to uppercase.
Bruce -
Hi,
I am using dynamic table concepts.I am using field symbols.I need to maintain two tables of similar structure.
when i append data it will enter into both tables.when i unassign first table and reassign it ,i am getting back that data again into first table ..how to slve this problem.i need to start first table as fresh table and second table contain copy of the first table.Hi,
maybe you should clarify your problem a bit more by pasting some code and try to explain it a bit more in detail.
Roy -
Modify DB by single field using Field Symbol
Hi,
please help me ,actually i have not use the field symbol in any object. i have one requirement ,i have to modify the DB by field STATUS using Field symbol ,
I am sending u my code so please help me how can i modify DB using field symbol..
gw_msg3_status1 = k_status1 .
LOOP AT gi_msg3 INTO gs_msg3.
gs_msg3-status = gw_msg3_status1 .
gs_msg3-issue = lw_issuno.
MODIFY gi_msg3 FROM gs_msg3 TRANSPORTING status.
MODIFY gi_msg3 INDEX sy-tabix FROM gs_msg3 TRANSPORTING issue status.
ENDLOOP.
Thanks & Regards,
Meenakshiperform dboperation_table using 'SET' 'BIRTHDT' '=' <fs>.
perform dboperation_table using 'WHERE' 'PARTNER' '=' <fs>
perform dboperation_update using 'BUT000'.
form dboperation_table
using p_type
p_var1
p_var2
p_var3.
data: t_l type cmst_str_data.
data: d_cx_root type ref to cx_root,
d_text type string.
try.
clear t_l.
if p_var3 is not initial.
t_l = p_var3.
condense t_l.
concatenate '''' t_l '''' into t_l.
endif.
concatenate p_var1 p_var2 t_l into t_l
separated by space.
case p_type.
when 'SET'. append t_l to g_s_t.
when 'WHERE'. append t_l to g_w_t.
endcase.
catch cx_root into d_cx_root.
d_text = d_cx_root->get_text( ).
message a398(00) with d_text.
endtry.
endform. "DBOPERATION_table
form dboperation_update
using p_tabname type zdboperation-tabname.
data: tabname type bus_table.
data: d_cx_root type ref to cx_root,
d_text type string.
try.
tabname-tabname = p_tabname.
call function 'ZDBOPERATION_UPDATE'
in update task
exporting
tabname = tabname
tables
where_table = g_w_t
set_table = g_s_t.
catch cx_root into d_cx_root.
d_text = d_cx_root->get_text( ).
message a398(00) with d_text.
endtry.
endform. "DBOPERATION_update
Hope it will help you.
Regards,
Madan. -
Field symbol has not yet been assigned. ???
Dear Experts ,
W hen i tried to execute my program this error appears :
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 32821).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
and Here is my CODE :
*& Report ZPO
Report ZPO1.
type-pools slis.
PARAMETERS : PO_Doc like EKBE-EBELN DEFAULT '4800000007'.
PARAMETERS : Plant TYPE WERKS DEFAULT '1000'.
PARAMETERS : PO_ORG TYPE EKORG DEFAULT ''.
data TtlS type mara-wesch .
data TtlH type mara-wesch .
data Ttl type mara-wesch .
data ZEKBE type TABLE OF EKBE.
data ZEKBER type EKBE.
data ZEKPO type TABLE OF EKPO.
data ZEKPOR type EKPO.
data ZEKKOR TYPE EKKO.
data ZNAME1F type LFA1-LIFNR.
data ZWGBEZF TYPE T023T-WGBEZ.
data i type n.
data counter type n.
types : begin of SBAGDS,
Serial Type n, "Purchase Order
EBELN like EKKO-EBELN, "Purchase Order
MATNR like EKPO-MATNR, "Material
TXZ01 like EKPO-TXZ01, "Short Text
MATKL like EKPO-MATKL, "Material Group
WGBEZ like T023T-WGBEZ, "Material Group Desc"
SUBMI like EKKO-SUBMI, "GPM
CHARG like EKBE-CHARG, "Batch
LIFNR like EKKO-LIFNR, "Vendor
NAME1 like LFA1-NAME1, "Vendor Name
RECV like mara-wesch, "Received Quantity
REVR like mara-wesch, "Reversed Quantity
DELV like mara-wesch, "Delivered Quantity
end of SBAGDS .
DATA : BAGDS TYPE SBAGDS OCCURS 0 WITH HEADER LINE.
data Struc like BAGDS.
data: gr_table like BAGDS OCCURS 0 WITH HEADER LINE.
data: gt_fieldcat type slis_t_fieldcat_alv, gt_outtab type SBAGDS occurs 0 with header line.
INITIALIZATION.
i = 0.
counter = 0 .
perform field_cat_init using gt_fieldcat[].
FORM field_cat_init using rt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv,
pos type i value 1.
clear LS_FIELDCAT.
*Column 1
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'Serial'.
ls_fieldcat-SELTEXT_L = 'Serial'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 2
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'EBELN'.
ls_fieldcat-SELTEXT_L = 'Purchase Order'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 3
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-SELTEXT_L = 'Material'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 4
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'TXZ01'.
ls_fieldcat-SELTEXT_L = 'Short Text'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 5
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATKL'.
ls_fieldcat-SELTEXT_L = 'Material Group'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 6
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WGBEZ'.
ls_fieldcat-SELTEXT_L = 'Material Group Desc'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 7
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SUBMI'.
ls_fieldcat-SELTEXT_L = 'GPM'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 8
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CHARG'.
ls_fieldcat-SELTEXT_L = 'Batch'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 9
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-SELTEXT_L = 'Vendor'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 10
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-SELTEXT_L = 'Vendor Name'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 11
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'RECV'.
ls_fieldcat-SELTEXT_L = 'Received Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 12
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'REVR'.
ls_fieldcat-SELTEXT_L = 'Reversed Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 13
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DELV'.
ls_fieldcat-SELTEXT_L = 'Delivered Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
endform.
START-OF-SELECTION.
select SINGLE * from EKKO into ZEKKOR where EBELN = PO_DOC.
select SINGLE * from EKPO into ZEKPOR where EBELN = PO_DOC.
select SINGLE NAME1 from LFA1 into ZNAME1F where LIFNR = ZEKKOR-LIFNR.
* ' Buliding Structure
Struc-EBELN = ZEKPOR-EBELN.
Struc-SUBMI = ZEKKOR-SUBMI.
Struc-LIFNR = ZEKKOR-LIFNR.
Struc-Name1 = ZNAME1F.
select * from EKPO into TABLE ZEKPO where EBELN = PO_Doc and WERKS = plant.
LOOP at ZEKPO into ZEKPOR.
select SINGLE WGBEZ from T023T into ZWGBEZF WHERE MATKL = ZEKPOR-MATKL .
counter = counter + 1.
* ' Buliding Structure
Struc-Serial = counter.
Struc-MATNR = ZEKPOR-MATNR.
Struc-TXZ01 = ZEKPOR-TXZ01.
Struc-MATKL = ZEKPOR-MATKL.
Struc-WGBEZ = ZWGBEZF.
* Calcualting Debit transactions from PO History
select * from EKBE into table ZEKBE where EBELN = PO_Doc and MATNR = ZEKPOR-MATNR and EBELP = ZEKPOR-EBELP and BWART NOT LIKE '' and SHKZG = 'S'.
LOOP AT ZEKBE INTO ZEKBER.
TtlS = TtlS + ZEKBER-MENGE.
ENDLOOP.
* ' Buliding Structure
Struc-CHARG = ZEKBER-CHARG.
Struc-RECV = TtlS.
Ttl = TtlS.
clear TtlS.
* Calcualting Credit transactions from PO History
select * from EKBE into table ZEKBE where EBELN = PO_Doc and MATNR = ZEKPOR-MATNR and EBELP = ZEKPOR-EBELP and BWART NOT LIKE '' and SHKZG = 'H'.
LOOP AT ZEKBE INTO ZEKBER.
TtlH = TtlH + ZEKBER-MENGE.
ENDLOOP.
* ' Buliding Structure
Struc-REVR = TtlH.
* Calculating Total Delivered
Ttl = Ttl - TtlH.
clear TtlH.
* ' Buliding Structure
Struc-DELV = Ttl.
clear Ttl.
* Writtng ITAB
APPEND Struc to BAGDS.
ENDLOOP.
* Reading ITAB
* WRITE : / , 'ITAB Begin : ' .
* loop at BAGDS into Struc.
* counter = counter + 1.
* write : /,'Serial : ',counter.
* write : / ,'PO : ',Struc-EBELN.
* write : / ,'Vendor : ',Struc-LIFNR.
* write : / ,'Vendor Name : ',Struc-NAME1.
* write : / ,'Material : ',Struc-MATNR.
* write : /,'Short Text: ',Struc-TXZ01.
* write : / ,'Model : ',Struc-MATKL.
* write : / ,'Model Desc : ',Struc-WGBEZ.
* write : /,'GPM : ',Struc-SUBMI.
* write : /,'Lot : ',Struc-CHARG.
* write : /,'Received : ',Struc-RECV.
* write : /,'Reversed : ',Struc-REVR.
* write : /,'Delivered : ',Struc-DELV,/,/,/.
* ENDLOOP.
* Call ALV Grid Viewer
*BREAK-POINT.
gr_Table[] = BAGDS[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SBAGDS'
IT_FIELDCAT = gt_fieldcat[]
TABLES
T_OUTTAB = gr_Table.
Please Advise
Edited by: Sap Sap on Jul 27, 2009 12:18 PM
Edited by: Sap Sap on Jul 27, 2009 12:22 PM
Edited by: Sap Sap on Jul 27, 2009 12:22 PMHi,
The problem seems to be in your ALV grid display.
The reason must be your field catalog.
Just check your fieldcatalog.
The value in the fieldname field of the fieldcatalog should be same as the fieldname in your internal table and should be in capital letters.
Probably you must have mistyped some field.
Kinldy check.
Regards,
Ankur Parab -
Field symbol with top of page in reuse_alv_list
When using the top_of_page in REUSE_ALV_LIST_DISPLAY
I had in the old programm reference to values in the outtab for the header in the new programm I use dynamic tables and I wonder how to add those values in a header.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = h_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_structure_name = 'ZDOORBEL_ALV'
* IT_EVENTS = TEVENTS
is_layout = slayout
it_fieldcat = it_fieldcat[]
it_sort = tsort[]
i_save = a_save
is_variant = variant
TABLES
t_outtab = <ta_output>
in my top_of_page I try to read the current row of <ta_output> but I have no clue on how to do it. I gives the error that there is no workarea assigned to <ta_output>
anybody knows how to read the current line of <ta_output> in top_of_page ?
kind regards
arthur de smidtI have
* fieldsymbols voor dynamische ALV tabel
FIELD-SYMBOLS: <ta_output> TYPE table ,
<ta_color> TYPE table,
<l_line> TYPE ANY,
<wa_output> type any,
<wa> TYPE ANY,
<l_field> TYPE ANY,
<fs> TYPE ty_pernrs.
FORM top_of_page.
CREATE DATA new_line LIKE LINE OF <ta_output>.
ASSIGN new_line->* TO <wa_output>.
read table <ta_output> assigning <wa_output> index sy-tabix.
if ra_pernr = 'X'.
if <wa_output>-week = space or <wa_output>-pernr = '00000000'.
but still it says that the
The data object "<WA_OUTPUT>" has no structure and therefore no
component called "WEEK" . .
Edited by: A. de Smidt on Jun 26, 2008 11:07 AM -
How to use different field symbols to append data in a loop
Hi experts!
I have to loop over a itab and I want to save different into one table.
See my code below:
DATA: l_hours TYPE i,
grfk_ok_code TYPE sy-ucomm,
grfk_values TYPE TABLE OF GPRVAL WITH HEADER LINE,
grfk_coltxt TYPE TABLE OF GPRTXT WITH HEADER LINE,
wa_ztab TYPE zqm_chq_prueflos,
l_index TYPE n,
l_field TYPE string,
l_line_check TYPE string
FIELD-SYMBOLS:
<fs_0102> TYPE ANY,
<fs_0304> TYPE ANY,
<fs_0506> TYPE ANY,
<fs_grenze> TYPE ANY
REFRESH: grfk_values.
CLEAR: l_hours.
LOOP AT ztab INTO wa_ztab.
AT NEW qase_serialnr.
CLEAR: l_line_check.
IF wa_ztab-qase_serialnr CS '-01'
OR wa_ztab-qase_serialnr CS '-02'.
grfk_values-rowtxt = 'gelötet'.
l_line_check = '0102'.
ELSEIF wa_ztab-qase_serialnr CS '-03'
OR wa_ztab-qase_serialnr CS '-04'.
grfk_values-rowtxt = 'geglüht'.
l_line_check = '0304'.
ELSEIF wa_ztab-qase_serialnr CS '-05'
OR wa_ztab-qase_serialnr CS '-06'.
grfk_values-rowtxt = 'unbehandelt'.
l_line_check = '0506'.
ELSE.
grfk_values-rowtxt = 'serialnr_wrong'.
ENDIF.
ENDAT.
***---------------------------------------------------->
AT NEW qapp_usern1.
* X-axis: values are:0,50,100,...,400
grfk_coltxt-coltxt = wa_ztab-qapp_usern1.
SHIFT grfk_coltxt-coltxt LEFT DELETING LEADING '0'.
APPEND grfk_coltxt.
UNASSIGN <fs_grenze>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_grenze>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_grenze> = 10.
APPEND grfk_values.
ENDAT.
IF l_line_check = '0102'.
UNASSIGN <fs_0102>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0102>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0102> = wa_ztab-cf_dgp.
ELSEIF l_line_check = '0304'.
UNASSIGN <fs_0304>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0304>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0304> = wa_ztab-cf_dgp.
ELSEIF l_line_check = '0506'.
UNASSIGN <fs_0506>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0506>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0506> = wa_ztab-cf_dgp.
ENDIF.
ENDLOOP.
My goal should be to fill the graphic with 4 Lines:
1 is boarderline.
2-3 are the lines with the looped values in "ztab"
Do I have to use references to write the values in into different rows of internal table "grfk_values"????
With this code I want to fill the itab which I need for the GFW_PRES_SHOW function.
The table I have to commit has the following structure:
-rowtxt
-val1
-val2
-val31
EDIT:
My current output are 2 lines the first has value 0 for each point and the second shows the correct values... The boarder which always should have value 10 is completly not shown.hopen this will help
report zrich_0001 .
data: begin of itab1 occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab1.
data: begin of itab2 occurs 0,
flda(10) type c,
fldb(10) type c,
fldc(10) type c,
end of itab2.
field-symbols: <fs_table> type table,
<fs_wa>,
<fs>.
data: mod_field(10) type c.
itab1-fld1 = '1'. itab1-fld2 = '2'. itab1-fld3 = '3'. append itab1.
itab1-fld1 = '4'. itab1-fld2 = '5'. itab1-fld3 = '6'. append itab1.
itab2-flda = 'A'. itab2-fldb = 'B'. itab2-fldc = 'C'. append itab2.
itab2-flda = 'D'. itab2-fldb = 'E'. itab2-fldc = 'F'. append itab2.
assign itab1[] to <fs_table>.
assign itab1 to <fs_wa>.
mod_field = 'FLD2'.
perform modify_table.
perform write_table.
assign itab2[] to <fs_table>.
assign itab2 to <fs_wa>.
mod_field = 'FLDC'.
perform modify_table.
perform write_table.
FORM modify_table *
form modify_table.
loop at <fs_table> into <fs_wa>.
assign component mod_field of structure <fs_wa> to <fs>.
<fs> = 'Modified'.
modify <fs_table> from <fs_wa>.
endloop.
endform.
FORM write_table *
form write_table.
loop at <fs_table> into <fs_wa>.
do.
assign component sy-index of structure <fs_wa> to <fs>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <fs>.
else.
write: <fs>.
endif.
enddo.
endloop.
endform.
regards
navjot
reward points if helpfull -
Assigning a value to a field-symbol (workarea of type any)
Dear forumers,
I'm having a bit of difficulty in assigning a value to a field-symbol (it should be treated as a workarea of type any), but I'm given a syntax error instead:-
The data object "<LFS_WORKAREA>" has no structure and therefore no component called "LFMON".
What could have gone wrong and how may I resolve this (I must have missed something out)? I will still need <LFS_WORKAREA> to be defined as TYPE ANY.
Please help. I'd appreciate any inputs at all. Thanks.
*& Form FORMAT_POST_PERIOD
* Subroutine to format the posting period data
* --> PI_MBEW Material valuation data (internal table)
FORM format_post_period CHANGING pi_mbew TYPE ANY TABLE.
" Create local field symbols
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
" Create local variables
DATA: lv_index TYPE sy-tabix.
DATA: lv_lfmon TYPE ckmlcr-poper.
" Format posting periods
LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
lv_index = sy-tabix.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
MOVE lv_lfmon TO <lfs_workarea>-lfmon. " the syntax error occurs here :(
MODIFY pi_mbew FROM <lfs_workarea>
INDEX lv_index
TRANSPORTING lfmon.
CLEAR: <lfs_workarea>,
<lfs_lfmon>
lv_lfmon,
lv_index.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIODMost of us aren't in it for the points in any case...
For your solution you've redundant code:
*& Form FORMAT_POST_PERIOD
* Subroutine to format the posting period data
* --> PI_MBEW Material valuation data (internal table)
FORM format_post_period CHANGING pi_mbew TYPE ANY TABLE.
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
DATA: lv_lfmon TYPE ckmlcr-poper.
* DATA: lo_workarea TYPE REF TO data. "<--Not needed, because the LOOP AT ASSIGNING below does the work
* CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
* ASSIGN lo_workarea->* TO <lfs_workarea>.
LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
<lfs_lfmon> = lv_lfmon.
CLEAR lv_lfmon.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIOD
Here's a couple of more efficient solutions, using LOOP AT INTO.
FORM format_post_period CHANGING pi_mbew TYPE INDEX TABLE. " <-- Table type a little more specific
"<--now you can use index operations
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
DATA: lv_lfmon TYPE ckmlcr-poper,
lv_index TYPE sytabix.
DATA: lo_workarea TYPE REF TO data.
CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
ASSIGN lo_workarea->* TO <lfs_workarea>.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
LOOP AT pi_mbew INTO <lfs_workarea>.
lv_index = sy-tabix.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
<lfs_lfmon> = lv_lfmon.
MODIFY pi_mbew FROM <lfs_workarea>
INDEX lv_index. " <--INDEX TABLE, so this is permitted.
CLEAR lv_lfmon.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIOD -
Getting a runtime error in block alv that field symbol has been assigned
hi to all experts ,
im getting a runtime error that field symbol has not been assigned in functionmodule reuse_alv_block_list_display
i tried a lot to rectify the error ,im unable to do it thats i have posted here
*& Report ZHAI_ALV_BLOCK_LIST
REPORT ZHAI_ALV_BLOCK_LIST.
type-pools:slis.
tables:mara.
DATA:BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MBRSH LIKE MARA-MBRSH,
MATKL LIKE MARA-MATKL,
END OF IT_MARA.
data: begin of IT_DESC OCCURS 0,
MATNR like MAKT-MATNR,
MAKTX like MAKT-MAKTX,
end of IT_DESC.
data: begin of IT_MARD occurs 0,
MATNR like mard-matnr,
WERKS like mard-werks,
LGORT like mard-lgort,
LABST like mard-labst,
end of IT_MARD.
data: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV ,
WA_FCAT LIKE LINE OF IT_FCAT,
IT_FCAT1 type slis_t_fieldcat_alv,
WA_FCAT1 LIKE LINE OF IT_FCAT1,
IT_FCAT2 TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT2 LIKE LINE OF IT_FCAT2,
wa_layout type SLIS_LAYOUT_ALV,
it_event type SLIS_T_EVENT,
wa_event like line of it_event,
wa_layout like line of it_layout,
V_REPID LIKE SY-REPID.
select-options:so_matnr for mara-matnr.
start-of-selection.
perform f_select_data.
DEFINE ADD_CATALOGUE1.
WA_FCAT-COL_POS = &1.
WA_FCAT-fieldname = &2.
WA_fcat-tabname = &3.
wa_fcat-emphasize = &4.
wa_fcat-ref_tabname = &5.
APPEND WA_FCAT TO IT_FCAT.
END-OF-DEFINITION.
DEFINE ADD_CATALOGUE2.
WA_FCAT1-COL_POS = &1.
WA_FCAT1-fieldname = &2.
WA_fcat1-tabname = &3.
wa_fcat1-emphasize = &4.
wa_fcat1-ref_tabname = &5.
APPEND WA_FCAT1 TO IT_FCAT1.
END-OF-DEFINITION.
DEFINE ADD_CATALOGUE3.
WA_FCAT2-COL_POS = &1.
WA_FCAT2-fieldname = &2.
WA_fcat2-tabname = &3.
wa_fcat2-emphasize = &4.
wa_fcat2-ref_tabname = &5.
APPEND WA_FCAT2 TO IT_FCAT2.
END-OF-DEFINITION.
perform f_build_fcat.
*perform f_build_fcat1.
perform f_build_fcat2.
PERFORM F_BUILD_LAYOUT.
PERFORM F_BUILD_EVENTS.
PERFORM F_BLOC_DISPLAY.
*& Form f_select_data
FORM f_select_data .
select matnr
mbrsh
matkl
from mara into table it_mara where matnr
in so_matnr.
if it_mara[] is not initial.
select matnr
maktx
from makt
into table it_desc
for all entries in it_mara
where matnr eq it_mara-matnr.
endif.
if it_desc[] is not initial.
select matnr
werks
lgort
labst
from mard
into table it_mard
for all entries in it_desc
where matnr eq it_desc-matnr.
endif.
ENDFORM. " f_select_data
*& Form f_build_fcat
FORM f_build_fcat .
ADD_CATALOGUE2:
'1' 'MATNR' 'IT_MARA' 'C500' 'MARA',
'2' 'MBRSH' 'IT_MARA' 'C600' 'MARA',
'3' 'MATKL' 'IT_MARA' 'C300' 'MARA'.
ENDFORM. " f_build_fcat
**& Form f_build_fcat1
FORM f_build_fcat1 .
ADD_CATALOGUE1:
'1' 'MATNR' 'IT_DESC' 'C500' 'MAKT',
'2' 'MAKTX' 'IT_DESC' 'C600' 'MAKT'.
ENDFORM. " f_build_fcat1
*& Form f_build_fcat2
FORM f_build_fcat2.
ADD_CATALOGUE3:
'1' 'MATNR' 'IT_MARD' 'C500' 'MARD',
'2' 'WERKS' 'IT_MARD' 'C600' 'MARD',
'3' 'LGORT' 'IT_MARD' 'C200' 'MARD',
'4' 'LABST' 'IT_MARD' 'C300' 'MARD'.
ENDFORM. " f_build_fcat2
*& Form F_BLOC_DISPLAY
text
--> p1 text
<-- p2 text
FORM F_BLOC_DISPLAY .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fcat
I_TABNAME = 'IT_MARA'
IT_EVENTS = it_event
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fcat1
I_TABNAME = 'IT_DESC'
IT_EVENTS = IT_EVENT
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_DESC
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = wa_LAYOUT
IT_FIELDCAT = IT_FCAT2
I_TABNAME = 'IT_MARD'
IT_EVENTS = IT_EVENT
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARD
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_BLOC_DISPLAY
*& Form F_BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM F_BUILD_LAYOUT .
wa_layout-edit = 'X'.
wa_layout-window_titlebar = 'MOHAMMED ABDUL HAI'.
wa_layout-zebra = 'X'.
ENDFORM. " F_BUILD_LAYOUT
*& Form F_BUILD_EVENTS
text
--> p1 text
<-- p2 text
FORM F_BUILD_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENT
EXCEPTIONS
LIST_TYPE_WRONG = 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.
SORT IT_EVENT BY NAME.
READ TABLE it_event INTO wa_event WITH KEY NAME = 'TOP_OF_PAGE' bINARY
SEArch.
if sy-subrc eq 0.
wa_event-form = 'F_TOP_OF_PAGE'.
ENDIF.
MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX TRANSPORTING FORM.
READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND' BINARY SEARCH.
WA_EVENT-FORM = 'F_USER_COMMAND'.
MODIFY IT_EVENT FROM wa_event INDEX SY-TABIX TRANSPORTING FORM.
ENDFORM. " F_BUILD_EVENTSHi,
When does this runtime error occur? When displaying output (calling FM) or.....
I copied your coding and made a few minor changes and It's working fine for my now:
REPORT ZHAI_ALV_BLOCK_LIST.
TYPE-POOLS:slis.
TABLES:mara.
DATA:BEGIN OF it_mara OCCURS 0,
matnr LIKE mara-matnr,
mbrsh LIKE mara-mbrsh,
matkl LIKE mara-matkl,
END OF it_mara.
DATA: BEGIN OF it_desc OCCURS 0,
matnr LIKE makt-matnr,
maktx LIKE makt-maktx,
END OF it_desc.
DATA: BEGIN OF it_mard OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
END OF it_mard.
DATA: it_fcat TYPE slis_t_fieldcat_alv ,
wa_fcat LIKE LINE OF it_fcat,
it_fcat1 TYPE slis_t_fieldcat_alv,
wa_fcat1 LIKE LINE OF it_fcat1,
it_fcat2 TYPE slis_t_fieldcat_alv,
wa_fcat2 LIKE LINE OF it_fcat2,
wa_layout TYPE slis_layout_alv,
it_event TYPE slis_t_event,
wa_event LIKE LINE OF it_event,
* wa_layout like line of it_layout,
v_repid LIKE sy-repid.
SELECT-OPTIONS:so_matnr FOR mara-matnr.
START-OF-SELECTION.
PERFORM f_select_data.
DEFINE add_catalogue1.
wa_fcat-col_pos = &1.
wa_fcat-fieldname = &2.
wa_fcat-tabname = &3.
wa_fcat-emphasize = &4.
wa_fcat-ref_tabname = &5.
append wa_fcat to it_fcat.
END-OF-DEFINITION.
DEFINE add_catalogue2.
wa_fcat1-col_pos = &1.
wa_fcat1-fieldname = &2.
wa_fcat1-tabname = &3.
wa_fcat1-emphasize = &4.
wa_fcat1-ref_tabname = &5.
append wa_fcat1 to it_fcat1.
END-OF-DEFINITION.
DEFINE add_catalogue3.
wa_fcat2-col_pos = &1.
wa_fcat2-fieldname = &2.
wa_fcat2-tabname = &3.
wa_fcat2-emphasize = &4.
wa_fcat2-ref_tabname = &5.
append wa_fcat2 to it_fcat2.
END-OF-DEFINITION.
PERFORM f_build_fcat.
PERFORM f_build_fcat1.
PERFORM f_build_fcat2.
PERFORM f_build_layout.
PERFORM f_build_events.
PERFORM f_bloc_display.
*& Form f_select_data
FORM f_select_data .
SELECT matnr
mbrsh
matkl
FROM mara INTO TABLE it_mara WHERE matnr
IN so_matnr.
IF it_mara[] IS NOT INITIAL.
SELECT matnr
maktx
FROM makt
INTO TABLE it_desc
FOR ALL ENTRIES IN it_mara
WHERE matnr EQ it_mara-matnr.
ENDIF.
IF it_desc[] IS NOT INITIAL.
SELECT matnr
werks
lgort
labst
FROM mard
INTO TABLE it_mard
FOR ALL ENTRIES IN it_desc
WHERE matnr EQ it_desc-matnr.
ENDIF.
ENDFORM. " f_select_data
*& Form f_build_fcat
FORM f_build_fcat .
add_catalogue2:
'1' 'MATNR' 'IT_MARA' 'C500' 'MARA',
'2' 'MBRSH' 'IT_MARA' 'C600' 'MARA',
'3' 'MATKL' 'IT_MARA' 'C300' 'MARA'.
ENDFORM. " f_build_fcat
**& Form f_build_fcat1
FORM f_build_fcat1 .
add_catalogue1:
'1' 'MATNR' 'IT_DESC' 'C500' 'MAKT',
'2' 'MAKTX' 'IT_DESC' 'C600' 'MAKT'.
ENDFORM. " f_build_fcat1
*& Form f_build_fcat2
FORM f_build_fcat2.
add_catalogue3:
'1' 'MATNR' 'IT_MARD' 'C500' 'MARD',
'2' 'WERKS' 'IT_MARD' 'C600' 'MARD',
'3' 'LGORT' 'IT_MARD' 'C200' 'MARD',
'4' 'LABST' 'IT_MARD' 'C300' 'MARD'.
ENDFORM. " f_build_fcat2
*& Form F_BLOC_DISPLAY
* text
FORM f_bloc_display .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fcat1
i_tabname = 'IT_MARA'
it_events = it_event
*IT_SORT =
*I_TEXT =
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fcat1
i_tabname = 'IT_DESC'
it_events = it_event
*IT_SORT =
*I_TEXT =
TABLES
t_outtab = it_desc
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fcat2
i_tabname = 'IT_MARD'
it_events = it_event
*IT_SORT =
*I_TEXT = ' '
TABLES
t_outtab = it_mard
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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 FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_BLOC_DISPLAY
*& Form F_BUILD_LAYOUT
FORM f_build_layout .
wa_layout-edit = 'X'.
wa_layout-window_titlebar = 'MOHAMMED ABDUL HAI'.
wa_layout-zebra = 'X'.
ENDFORM. " F_BUILD_LAYOUT
*& Form F_BUILD_EVENTS
FORM f_build_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
SORT it_event BY name.
READ TABLE it_event INTO wa_event WITH KEY name = 'TOP_OF_PAGE' BINARY
SEARCH.
IF sy-subrc EQ 0.
wa_event-form = 'F_TOP_OF_PAGE'.
ENDIF.
MODIFY it_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
READ TABLE it_event INTO wa_event WITH KEY name = 'USER_COMMAND' BINARY
SEARCH.
wa_event-form = 'F_USER_COMMAND'.
MODIFY it_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
ENDFORM. " F_BUILD_EVENTS -
Dynnamic Field Symbol returning short dump ASSIGN_TYPE_CONFLICT
Hi everyone,
I have a RFC FM and make a dynamic access via SYMBOL FIELD, declared as ANY TABLE. The problem is that sometimes I can get a structure instead of a table and then the error occurs. How do I handle this error if the check IS ASSIGN not work? How do I capture and return an error message?
I tryed this:
FIELD-SYMBOLS: <fs_tabela> TYPE ANY TABLE.
TRY.
ASSIGN (st_b2b_text-tabname) TO <fs_tabela>. <<<<----
DUMP HERE!
CATCH cx_root INTO v_erro.
v_text = v_erro->get_text( ).
MOVE v_text TO st_return-message.
APPEND st_return TO t_return.
PERFORM f_return_error_pi USING event.
ENDTRY.
IF <fs_tabela> IS ASSIGNED.
CONCATENATE 'S' st_b2b_text-tabname INTO vl_wkarea.
CONDENSE vl_wkarea NO-GAPS.
ASSIGN (vl_wkarea) TO <fs_wkarea>.
IF <fs_wkarea> IS ASSIGNED.
LOOP AT <fs_tabela> ASSIGNING <fs_wkarea>.
ASSIGN COMPONENT c_posnr
OF STRUCTURE <fs_wkarea> TO <fs_posnr>.
Does anyone have any tips?
Tnks,
Marco Antonio
from BrazilI solved with this test that I did:
TABLES: vbak.
TYPES: BEGIN OF ty_ctrlimo,
equnr TYPE equnr,
anln1 TYPE anln1,
anln2 TYPE anln2,
aufnr TYPE aufnr,
bukrs TYPE bukrs,
zanln1_andam TYPE anln1,
zanln2_andam TYPE anln2,
END OF ty_ctrlimo.
DATA: estrutura TYPE ty_ctrlimo,
tabela TYPE STANDARD TABLE OF ty_ctrlimo
INITIAL SIZE 0 WITH HEADER LINE,
tabela2 TYPE TABLE OF ty_ctrlimo,
variavel TYPE char30.
DATA: is_tabela.
Evento: START-OF-SELECTION ***
START-OF-SELECTION.
BREAK-POINT.
PERFORM f_check_is_tabela USING 'TABELA' CHANGING is_tabela.
WRITE: / '1 ', 'TABELA =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'TABELA2' CHANGING is_tabela.
WRITE: / '2 ', 'TABELA2 =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'ESTRUTURA' CHANGING is_tabela.
WRITE: / '3 ', 'ESTRUTURA =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'VARIAVEL' CHANGING is_tabela.
WRITE: / '4 ', 'VARIAVEL =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'VBAK' CHANGING is_tabela.
WRITE: / '5 ', 'VBAK =', is_tabela.
SKIP 1.
*& Form F_CHECK_IS_TABELA
FORM f_check_is_tabela USING value(p_nome_tabela_estrutura)
CHANGING p_is_tabela.
FIELD-SYMBOLS <check> TYPE ANY.
DATA: lcls_strdscr TYPE REF TO cl_abap_structdescr,
lcls_typdscr TYPE REF TO cl_abap_typedescr.
CLEAR: p_is_tabela.
ASSIGN (p_nome_tabela_estrutura) TO <check>.
lcls_typdscr ?= cl_abap_structdescr=>describe_by_data( <check> ).
IF lcls_typdscr->type_kind = cl_abap_structdescr=>typekind_table.
p_is_tabela = cl_abap_structdescr=>true.
ENDIF.
WRITE: / 'tipo data: ', lcls_typdscr->type_kind.
ENDFORM. " F_CHECK_IS_TABELA
Maybe you are looking for
-
Dynamic %HINT ORACLE in select query
Hi Experts, I am trying to implement given below code with dynamic % hint oracle SELECT vbeln posnr uepos FROM vbap INTO TABLE i_vbap FOR ALL ENTRIES IN i_vbak WHERE vbeln EQ i_vbak-vbeln %_hints oracle '
-
Return Code - Query for Multiple Rows as XML
Hi, I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this: { call MyStoredProc(?) } This works great, the stored procedure always returns a recor
-
Error when login to bi publisher desktop 11g
Hi expert, I have a problem with BI Publisher Destktop when I login. I fill username , password and Report server , click Login button then I got the error : error : "Error while trying to access to Report Server Location : Object reference not set t
-
Redirecting from a JSP to an XML file
I have an issue that I urgently need to sort out. I'm running a web application which uses EJB's for the back-end and JSP's for the front-end. I have a class that generates an xml file on the system containing client information. I create a String Ob
-
Agent on SLES 10 stops responding
We are running NSM Agent version 2.5.2.1 on a SLES 10 server. Moving student accounts (in the thousdands), the agent stops responding. After unloading and re-loading the agent, it will run for a few minutes, then stop again. Any ideas on how to corre