Table type with include structure
Hi All,
How to declare a table type with include structure
i am declaraing it in the following way its giving epc check of obselete statement,
could any one tell me how to declare a table type and internal table for the following code.
DATA:BEGIN OF TY_OUTPUT OCCURS 0.
DATA:PS_PSP_PNR TYPE EKKN-PS_PSP_PNR.
INCLUDE STRUCTURE ST_ZCDTT0005.
DATA:END OF TY_OUTPUT.
Thanks in advance.
Hi
TYPES: BEGIN OF TY_OUTPUT,
PS_PSP_PNR TYPE EKKN-PS_PSP_PNR.
INCLUDE STRUCTURE ST_ZCDTT0005.
TYPES: END OF TY_OUTPUT.
TYPES: TY_T_OUTPUT TYPE TABLE OF TY_OUTPUT.
Max
Similar Messages
-
Assigning data from one Table type to another structure
Hi every one,
I have a table type X sent from one function module to another Proxy generated method which has the parameter defined as a structure.
I have declared a variable Y as a LINE TYPE OF X.
Then I have this statement which fills up the data.
READ TABLE X INTO Y INDEX 1.
The data is transferred from X to Y.
Now i need to send this to the proxy generated Function module which has a structure Z.
Now when i say MOVE-CORRESPONDING Y to a variable of type Z, it says it cannot be converted.
The structure in proxy generated FM has different data type but the same domain as that of standard one.
Everywhere it is prefixed with YY.
And also has one additional Controller tab inserted,
Can you guys tell me how to move the data from this table type to the structure.
- VenkatHi,
Declare a variable of line type Z.
Move corresponding values from variable X to this variable.
Append this variable to the table Z.
Try this.
Regards,
R.Nagarajan. -
Problem with primary/secondary keys in table with included structures
Dear ABAPers,
we have a structure which is supposed to be included in the definition of several tables.
The problem is the following:
depending on the application table that includes this structure, 3 or 4 fields of that structure may
or may not be necessary to enhance the table key. As far as I know included structures can only
completely be marked as keys. Therefore I suggested to split up the structure into two parts,
one part with the possible candidates that may become key fields, and the rest, and of course
a structure that unites both of these substructures. So when it comes to reusing this structure
the developer would have the choice to select the structure with all of the fields in case no field
is needed as additional key, or the developer would have to implement both of the substructures
separately with the option to mark the key-part of it as key in his table.
But unfortunetaly this suggestion of mine was refused as being too complicated and I am supposed
to define all the fields in one flat structure and to "enhance" the primary keys (that always will exist)
by secondary keys.
Does anybody know how that is supposed to work without defining double indexes?
I cannot activate a table without having primary keys defined and any unique secondary index would
allways include all of the primary keys.
Thanks in advance for you help
(I'm sorry that you cannot be granted reward points for just reading the extensive problem description)
regards
AndreasDear Rob,
since your answer was helpful and since it was the only one I will grant you full points on that.
Thanks again for your input. In case other developers should look this thread up being confronted
with the same kind of problem, here is how we solved it:
We added an artificial primary key (a number of type NUMC 8) to the table which is supposed to
include the structure. This key alone takes care of the uniqueness of eacht entry.
All the others fields that we want to have available for a fast direct access, including the ones
from the included structure, are put together in a secondary index.
best regards
Andreas -
Explicit Search Helps Short-Dump in Editable ALV with included structure
I have an editable ALV grid defined as follows:
TYPES: BEGIN OF gs_outtab200.
TYPES: row_indx(4) TYPE n.
TYPES: multipurp TYPE c.
INCLUDE structure zxrfwc_test.
TYPES: end of gs_outtab200.
DATA:
gt_outtab200 TYPE TABLE OF gs_outtab200,
wa_outtab200 TYPE gs_outtab200.
The included structure zxrfwc_test has a component (field) which is defined with a data element that has an explicit search helps associated with it.
I know that this search help is working properly because it works fine in the program's selection screen.
But when I invoke the search help from within a column of the ALV itself, I get a short dump with a "GETWA_NOT_ASSIGNED" error.
I have done plenty of editable ALVs with search helps defined on the data elements and never encountered this problem.
Am I hitting this problem because the zxrfwc_test structure is defined within the
gs_outtab200 structure ??
If not, what is causing this problem. (Please note that I have set ls_fcat-F4AVAILABL = 'X' in the fieldcat routine - this doesn't seem to help at all.)
Please advise!!!!
I'm really stuck on this one because it's always worked before when I'm not dealing with a dictionary structure that's included within a larger ALV structure.
Thanks.Hi,
How you are creating your field catalog?
Try to create a field catalog in the following way giving reference to your structure. is it possible for you create a DDIC structure as same as
TYPES: BEGIN OF gs_outtab200.
TYPES: row_indx(4) TYPE n.
TYPES: multipurp TYPE c.
INCLUDE structure zxrfwc_test.
TYPES: end of gs_outtab200.
* Form f_generate_fieldcatalog *
* Form generate the field catalog table *
form f_generate_fieldcatalog.
* Private variable
data : v_structure like dd02l-tabname. " Table Name
v_structure = c_yatt_alv. " Structure Name
* Build the fieldcat according to DDIC structure YATT_ALV:
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = v_structure
i_client_never_display = c_x
changing
ct_fieldcat = i_fieldcat[].
endform. " F_generate_fieldcatalog
a® -
Table type with reference type - how to sort?
I have an internal table lt_refs of the type ZXX_TT_REFS.
The table type ZXX_TT_REFS is a table of references ("ref. type") to the class ZCL_C.
The class C has an attribute attr1.
Now I would like to sort that table. Is there an easy (built-in) way to do this?
DATA lt_refs TYPE ZXX_TT_REFS.
DATA lr_ref TYPE REF TO ZCL_C.
LOOP AT lt_refs INTO lr_ref.
"Sort based on lr_ref->attr1. ?
ENDLOOP.
"or can I
SORT lt_refs BY attr1.
"directly?Danial, please see the following. In the case where you want to sort your reference by an attribute within the object, you can do something like this.
report zrich_0001.
* CLASS lcl_tab DEFINITION
class lcl_app definition.
public section.
data: attri type i.
methods: constructor importing im_attri type i.
endclass.
* CLASS lcl_tab IMPLEMENTATION
class lcl_app implementation.
method constructor.
attri = im_attri.
endmethod.
endclass.
data: a_app type ref to lcl_app.
data: a_app_list type table of ref to lcl_app.
start-of-selection.
create object a_app exporting im_attri = 3 .
append a_app to a_app_list.
create object a_app exporting im_attri = 2 .
append a_app to a_app_list.
create object a_app exporting im_attri = 1 .
append a_app to a_app_list.
sort a_app_list by <b>table_line->attri</b> ascending .
check sy-subrc = 0.
Here is the documentation.
<i>
<b>
Access to Attributes with References in Internal Tables</b>
If the line type of internal tables includes reference variables as components comp, the attributes attr of the object to which the reference in a line points can be used as key values for reading, sorting and changing table rows. This is possible in the following statements:
,,LOOP AT itab ... WHERE comp->attr ...
,,READ TABLE itab ... WITH [TABLE] KEY comp->attr = ...
<b>,,SORT itab BY comp->attr ...</b>
,,DELETE itab WHERE comp->attr ...
,,MODIFY itab ... TRANSPORTING ... WHERE comp->attr ...
<b>If a table contains unstructured lines with the type of a reference variable, the attributes of the object to which a line points can be addressed using TABLE_LINE->attr.</b>
</i>
Regards,
RIch Heilman -
Creating abap program to develop and activate a global table type and global structure.
Hi friends,
I want to create and activate a global structure and global table type by coding in ABAP editor only. so can I do that anyhow.
Please help me.
Thanks in advance.Thanks guys for your fruitful replies, as most of you asked the main purpose of my question, the answer is as follows:
in fact my purpose to do so is to create a function module that can fetch data dynamically from different database tables based on the codings in different abap program.
for example: in one abap program i am coding as follows:
tables: kna1.
types: begin of itab,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of itab.
data: it_tab type standard table of itab,
wa_tab type itab.
similarly in other program i am coding as follows:
tables: vbrp.
types: begin of itab,
posnr type vbrp-posnr,
matnr type vbrp-matnr,
arktx type vbrp-arktx,
end of itab.
data: it_tab type standard table of itab,
wa_tab type itab.
so now for both programs i want to call the same function module and fetch data as required in relative programs as mentioned above. in that case how to create that function module? -
How can I add table fields with existing structure ?
I like to add PSTLZ field to stucture KOMGG.Is it possible to add table field with the existind structure.If yes how can I do this?kindly help me on this.
hi
go to se11
in change mode select the button append
create new append which starts from Zpstlz in this komgg structure and add data element and domain to this field and activate with request number
then in field catalogue this field should be visible ,here ends your append
now it is ready to use in condition tables.
reward if helps !!!!! -
How to use nested table types with XDK
Im using Oracles XDK (xml development kit) to create xml-documents from data in database.4
Problem: I need to use nested tables but when trying to create nested table types I get error: A Table type may not contain a nested table type or VARRAY.
Hope I make myself clear! Are there any solutions or workarounds to this problem?
Help appreciated, thanks!Jesper,
I asked similar question last year (search for Tapsell, you will see my posting). Under 8.1.7 the "nesting" seems restricted to one level down. Thus you cannot create a type using another object that itself includes a nested table. Under Oracle 9, against which most current examples seem based, this limitation is removed making things easier. Under 8.1.7 the workaround I have used is to use the CAST syntax. This is not as neat, but it works. -
Calling a Table type with a specified value.
Hi Everyone,
Please do have a look at this and help me understand.
Inside a procedure I found a table type
TYPE r_rates IS RECORD(
low_rate growth_rates.low_growth%TYPE DEFAULT 0
,mid_rate growth_rates.mid_growth%TYPE DEFAULT 0
,high_rate growth_rates.high_growth%TYPE DEFAULT 0
,real_rate growth_rates.real_growth%TYPE DEFAULT 0);But some where I found this table type has been called like
r_rates(5)What's the meaning of this? Please explain me.
Regards,
BS2012Hi Jeneesh,
Please see the exact code. Please do have a look at the second line from the execution block.
lr_member_record := lpt_group_data(ln_ind).member_table(pv_mbr_name);
What does it mean lpt_group_data(ln_ind) ?
lpt_group_data t_group_table;
TYPE t_group_table IS TABLE OF pck_grp_types.r_group_record INDEX BY PLS_INTEGER;
TYPE r_group_record IS RECORD(
group_data st_group_string
,initial_data st_group_string
,member_table t_member_table
,full_reset BOOLEAN);
FUNCTION tonumber(pv_owner IN sd_groups.owner%TYPE
,pv_grp_name IN sd_groups.groupname%TYPE
,pv_mbr_name IN sd_groups.varname%TYPE) RETURN NUMBER IS
ln_ind PLS_INTEGER;
lr_member_record pck_grp_types.r_member_record;
lv_val VARCHAR2(40);
lv_last VARCHAR2(1);
ln_sign PLS_INTEGER := 1;
BEGIN
ln_ind := f_get_grp_index(pv_owner, pv_grp_name);
lr_member_record := lpt_group_data(ln_ind).member_table(pv_mbr_name);
lv_val := SUBSTR(lpt_group_data(ln_ind).group_data, lr_member_record.start_pos, lr_member_record.entry_length - 1);
lv_last := SUBSTR(lpt_group_data(ln_ind).group_data, lr_member_record.start_pos + lr_member_record.entry_length - 1, 1);
IF lv_last IN ('p','q','r','s','t','u','v','w','x','y','}','J','K','L','M','N','O','P','Q','R')
THEN
lv_val := lv_val || translate(lv_last,'pqrstuvwxy}JKLMNOPQR','01234567890123456789');
IF (lr_member_record.entry_type = pck_grp_types.GCV_SIGNED_NUMERIC)
THEN
ln_sign := -1;
END IF;
ELSE
lv_val := lv_val || translate(lv_last,'{ABCDEFGHI','0123456789');
END IF;
RETURN(stp.tonumber(lv_val) * ln_sign / lr_member_record.scale);
END tonumber; -
How to activate the transparent table along with append structure
Hi,
I add the new fields in existing append structure on tale VBAP.
Initially i provide them the data type as Char with length 20.
Similarly i added the fields in user exit on scree 8459 to add fields on screen.
Until this eveything was working fine.
Then my functional consultant ask me to delete one field from structure and change the length of other data types to 40 characters.
I done this changes but when i go to activate that append structure its giving me error that certan structures in which it is been used are not adjusted and activated.
The table is not adjusted through SE14 - Database Utlity.
Its showing me that Runtime Object and Transparent table are different and not consistent.
Can i delete the runtime object?
The domains which i ave changed are also not geing activated.
Suggest me the node of problem and solution also.
What should be the problem.
What should i do to solve the problem.
Suggest me the solution if any.Give a trail that instead of activating all together, activate low-level objects (domains, data elements etc)first and then high levels (structures, tables) individually. With this approach you could find the errors easily and can resolve quickly.
Regards,
Prasanth -
Hi frnds,
I need a tabletype that should have the datatype as char of length 1025Hello,
U can use any one of this dataelement
ALWWWREQ CHAR 001024 Mon. arch.: Contains selection string in "Name=Value" format
AQL_LDATA CHAR 001024 SAP Query (L): Data line for download to memory
CGSPL2 CHAR 001024 Character 1024
CHAR1024 CHAR 001024 Character 1024
J_5H0_1024 CHAR 001024 XM: Char1024
J_5NA1024 CHAR 001024 AM: CHAR1024
LINE1024 CHAR 001024 Character 1024
LSTRUC CHAR 001024 Dynamic structure
MSQSQLMSG CHAR 001024 MS SQL server - sql error message
MSQSQLOUT CHAR 001024 MS SQL server - sql command ouptpur
RFCCHA1024 CHAR 001024 Character field of length 1024
SDB_C1024 CHAR 001024 SAP DB: C(1024)
SELSTRING_WAO CHAR 001024 Selection String (Web Add-On)
SLPARAM CHAR 001024 Substitution procedure: Parameters for RFC REPORT interface
SPORCH1024 CHAR 001024 Character field with length 1024
TEXT1024 CHAR 001024 Upper/lower case length 1024
Regards,
Vasanth -
Structure or Table Type ??
Hi Epxerts,
Can someone give me an idea of passing multiple records in the parameter it_prxkna1 which of type structure as in code below :
I am working on this to pass it to XI.
Note : it_prxkna1 contains a 3 more nested structures and not an internal table.
Should it_prxkna1 be a table type or structure to hold multiple records?
TRY.
Assign row
it_prxkna1-MT_KNA1-record-row = wa_zcaap. --> one record of a customer
loop at t_zcaap into wa_zcaap.
CALL METHOD kna1_prxy->execute_asynchronous
EXPORTING
output = it_prxkna1.
COMMIT WORK.
endloop.
CATCH cx_ai_system_fault .
DATA fault TYPE REF TO cx_ai_system_fault .
CREATE OBJECT fault.
WRITE :/ fault->errortext.
ENDTRY.
Please suggest.
Thanks
Dany
Edited by: Dan on Apr 11, 2008 9:42 AMYou can append even if it is structure.
check the code below,
REPORT ZTEMPB_TEST7.
types: begin of st1,
s1 type c,
s2 type c,
end of st1.
types: st2 type st1 occurs 1.
data: begin of itab,
f1 type c,
f2 type st2,
end of itab.
data: wa_f2 type st1.
wa_f2-s1 = '1'.
wa_f2-s2 = '2'.
append wa_f2 to itab-f2.
Here ST1 is the structure with 2 fields.
ST2 is table type with the structure ST1.
f2 is the structure in the structure jtab with table type ST2.
But ST2 must be internal table.
Regards,
Bhanu
Edited by: Bhanu P on Apr 11, 2008 4:23 PM -
Include structure in TYPES declaration
Hello All:
Many forum posts have discussed similar topics, but I couldn't exactly find one answering my requirement. Apologies if I have missed out reading some.
Instead of creating a type as below (as suggested in few forum posts)
TYPES begin of types ty_itab
include type BISEG
xxxx type xxx
xxxx type xxx
End of types ty_itab
I need to create the type with include structure after the additonal fields.
TYPES begin of types ty_itab
<fld1> type <ty1>
<fld2> type <ty2>
include type <struc>
End of types ty_itab
Can someone give the right syntax?
Please help,
Fred.Hello Fred
If you are using the extended syntax you should not encounter any problems:
TYPES: begin of types ty_itab.
TYPES: <fld1> type <ty1>.
TYPES: <fld2> type <ty2>.
include type <struc>.
TYPES: End of types ty_itab
Regards
Uwe -
Create dynamic internal table with dynamic structure
I have an internal table itab1 that have 12 amount fields from period1 thru period12. I need to create a dynamic table with dynamic structure for the period column if the total amount of each column is > 0. Any idea on how to do that?
For example if my itab1 has 20 rows and the sum of period1 = 35, sum of period2 = 0, sum of period3 = 5, sum of period4 =0, sum of period5 = 2 then I need to create a dynamic structure for the field column that have the total > 0, i.e structure struct1 have field period1, period3 and period5 only. Then I will need to load the data to itab2 from itab1. Can someone help.
Thanks. I am on 4.7 and will upgrade to ERP 6.0 soon.go throgh this....
REPORT yusmm_text1 NO STANDARD PAGE HEADING
LINE-SIZE 199.
T A B L E S
TABLES: MARA,
MAKT,
THEAD.
GLOBAL TYPE-POOLS
TYPE-POOLS : SLIS.
GLOBAL TYPES
TYPES : BEGIN OF TP_FINAL,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
SPRAS TYPE MAKT-SPRAS,
LTXT(2000) TYPE C ,
SRNO TYPE N ,
END OF TP_FINAL.
TYPES : BEGIN OF TP_T002,
SPRAS TYPE T002-SPRAS,
LAISO TYPE T002-LAISO,
SRNO TYPE N ,
END OF TP_T002.
TYPES : BEGIN OF TP_MARA_MAKT,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF TP_MARA_MAKT.
Types: BEGIN OF tp_matnr,
matnr TYPE mara-matnr,
END OF tp_matnr.
GLOBAL ELEMENTARY VARIABLES
DATA : gv_date TYPE sy-datum.
DATA : gv_repid TYPE sy-repid.
DATA : g_var1(10) TYPE C.
DATA : gv_index TYPE sy-tabix.
DATA: gv_strg TYPE string,
gv_strg1(2000) TYPE C.
DATA : gv_lang TYPE sy-langu.
DATA : g_v(3) TYPE N .
DATA : gv_lines(3) TYPE N .
DATA : gv_var(3) TYPE N .
DATA : gv_var1(3) TYPE N.
DATA: gv_str TYPE STRING.
DATA: gv_str1 TYPE STRING.
DATA : gv_li TYPE I,
gv_lit TYPE I,
gv_lin TYPE I.
DATA: g_var11(3) TYPE N,
gv_li1(3) TYPE N,
g_var2(3) TYPE N.
DATA : gv_i1 TYPE I.
DATA : gv_i TYPE I.
DATA: gl_lenght TYPE I.
GLOBAL STRUCTURES
DATA: T_NEWTABLE TYPE REF TO DATA,
T_NEWLINE TYPE REF TO DATA,
T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
T_FLDCAT TYPE LVC_T_FCAT,
WA_IT_FLDCAT TYPE LVC_S_FCAT,
WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV,
WA_COLNO(2) TYPE N,
WA_FLNAME(5) TYPE C,
L_LT TYPE SLIS_LAYOUT_ALV.
GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA : IG_MARA_MAKT TYPE STANDARD TABLE OF TP_MARA_MAKT,
WG_MARA_MAKT TYPE TP_MARA_MAKT.
DATA : IG_T002 TYPE STANDARD TABLE OF TP_T002,
WG_T002 TYPE TP_T002.
DATA : IG_FINAL TYPE STANDARD TABLE OF TP_FINAL,
WG_FINAL TYPE TP_FINAL.
data : IG_MATNR TYPE STANDARD TABLE OF TP_MATNR WITH HEADER LINE,
WG_MATNR TYPE TP_MATNR.
DATA:BEGIN OF IG_THEAD OCCURS 0.
INCLUDE STRUCTURE THEAD .
DATA: END OF IG_THEAD.
DATA:BEGIN OF IG_TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE .
DATA:END OF IG_TLINE.
FIELD-SYMBOLS
FIELD-SYMBOLS: <T_DYNTABLE> TYPE STANDARD TABLE,"Dynamic internal
"tablename
<FS_DYNTABLE>, "Field symbol to create work area
<FS_FLDVAL> TYPE ANY. " Field symbol to assign values
COMPULSORY
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
------- Create Dyn Table From FC
DATA: LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA,
LI_FIELD_CAT TYPE LVC_T_FCAT,
LWA_FIELD_CAT TYPE LVC_S_FCAT.
PARAMETERS & SELECT-OPTIONS
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_SPRAS FOR MAKT-SPRAS NO INTERVALS DEFAULT 'EN'
OBLIGATORY ,
S_MATNR FOR MARA-MATNR,
S_MTART FOR MARA-MTART.
PARAMETERS: GP_SIZE TYPE I DEFAULT '200'.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION
INITIALIZATION.
gv_repid = sy-repid.
gv_date = sy-datum.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM DATA_FETCH.
PERFORM READ_DATA_TO_FINAL.
SORT ig_final BY matnr spras.
gv_lin = gv_li.
gv_li = gv_li - 2.
LOOP AT ig_final INTO wg_final.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Material Number'.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Authorization Group'.
g_VAR11 = wg_final-srno + 2.
gv_li1 = gv_li1 + 2.
MOVE : g_var11 TO gv_i1.
ASSIGN COMPONENT g_var11 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'MatDesc'.
g_var2 = g_var11 + gv_lines.
ASSIGN COMPONENT g_var2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'BasicData'.
APPEND <LWA_LINE_WA1> TO <FS_22>.
EXIT.
ENDLOOP.
LOOP AT ig_final INTO wg_final.
AT NEW matnr.
gv_index = sy-tabix.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-matnr.
ENDAT.
AT NEW MATNR.
GV_INDEX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-matnr.
ENDAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-begru.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-begru.
gv_var = wg_final-srno + 2.
gv_li = gv_li + 2.
MOVE : gv_var TO gv_i.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-maktx.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-maktx.
gv_var1 = gv_var + gv_lines .
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-ltxt.
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-ltxt.
AT END OF matnr.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
AT END OF matnr.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
PERFORM display..
*& Form data_fetch
text
--> p1 text
<-- p2 text
FORM DATA_FETCH .
SELECT matnr
from mara up to gp_size rows
appending corresponding fields of table ig_matnr
where matnr in s_matnr
and mtart in s_mtart.
loop at ig_matnr.
SELECT MARA~MATNR
MARA~BEGRU
MARA~MTART
MAKT~SPRAS
MAKT~MAKTX FROM MARA INNER JOIN MAKT
ON MARAMATNR = MAKTMATNR
appending corresponding fields of TABLE ig_mara_makt UP TO GP_SIZE
ROWS
WHERE makt~spras IN s_spras
AND mara~matnr IN s_matnr
AND mara~mtart IN s_mtart
AND mara~matnr EQ ig_matnr-matnr.
endloop.
IF sy-subrc = 0.
SORT ig_mara_makt.
ENDIF.
ENDFORM. " data_fetch
*& Form read_data_to_final
text
--> p1 text
<-- p2 text
FORM READ_DATA_TO_FINAL .
LOOP AT ig_mara_makt INTO wg_mara_makt .
wg_final-MATNR = wg_mara_makt-MATNR.
wg_final-BEGRU = wg_mara_makt-BEGRU.
wg_final-MTART = wg_mara_makt-MTART.
wg_final-SPRAS = wg_mara_makt-SPRAS.
wg_final-MAKTX = wg_mara_makt-MAKTX.
READ TABLE ig_t002 INTO wg_t002 WITH KEY spras = wg_final-spras.
IF sy-subrc = 0.
wg_final-srno = wg_t002-srno.
ENDIF.
CLEAR ig_thead[].
ig_thead-TDOBJECT = 'MATERIAL'.
ig_thead-TDNAME = wg_final-matnr.
ig_thead-TDID = 'GRUN'.
ig_thead-TDSPRAS = wg_final-spras.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = IG_THEAD
I_READONLY = 'X'
IMPORTING
E_HEADER = IG_THEAD
TABLES
T_LINES = IG_TLINE[]
EXCEPTIONS
NOTFOUND = 1.
IF sy-subrc EQ 0.
LOOP AT ig_tline.
gv_strg = ig_tline-tdline.
IF gv_strg1 <> ' '.
CONCATENATE gv_strg1 ';' gv_strg INTO gv_strg1.
ELSE.
gv_strg1 = gv_strg.
ENDIF.
ENDLOOP.
wg_final-ltxt = gv_strg1.
APPEND wg_final TO ig_final.
CLEAR wg_final.
gv_strg1 = ' '.
ELSE.
APPEND wg_final TO ig_final.
ENDIF.
ENDLOOP.
ENDFORM. " read_data_to_final
" read_data_to_final
*& Form layout
text
--> p1 text
<-- p2 text
FORM LAYOUT .
CLEAR L_LT.
L_LT-ZEBRA = 'X'.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = 'MATERIAL DETAILS'.
ENDFORM. " layout
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
SELECT SPRAS
LAISO FROM t002 INTO CORRESPONDING FIELDS OF TABLE ig_t002
WHERE spras IN s_spras.
DESCRIBE TABLE ig_t002 LINES gv_lines.
LOOP AT ig_t002 INTO wg_t002.
g_v = g_v + 1.
Wg_t002-srno = g_v.
MODIFY ig_t002 FROM wg_t002 TRANSPORTING SRNO.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'MD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'BD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
MOVE 'MATNR' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Material No'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 1.
MOVE 'BEGRU' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Authorization Group'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 2.
DESCRIBE TABLE T_FLDCAT LINES gv_li.
ASSIGN LT_DATA TO <FS_DATA>.
Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
LOOP AT T_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-SELTEXT.
WA_IT_FLDCAT1-REF_TABNAME = 'MARC'.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
ENDFORM. " fieldcat
*& Form show
text
--> p1 text
<-- p2 text
FORM Display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <FS_2>
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDFORM. " display
FORM PF_STATUS_SET USING RS_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' .
ENDFORM. "PF_STATUS_SET
*& Form Name: user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM USER_COMMAND USING IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Data download to excel'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IMPORTING
ANSWER =
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Material-Text.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
IMPORTING
FILELENGTH = GL_LENGHT
TABLES
DATA_TAB = <FS_22>
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF GL_LENGHT NE 0.
MESSAGE S398(00) WITH 'DATA downloaded to EXCEL'.
ENDIF.
ENDCASE.
ENDFORM. "user_command
Thanks -
Include structure and extra fields in the same Internal Table
Hi developers,
im trying to declare an internal table with include structure and extra fields,
something like this:
data: BEGIN OF it_loans occurs 0,
include structure zthrca006,
status(10),
pernr like pa0001-pernr,
sname like pa0001-pernr,
tipomov(20),
monto like zthrca006-monto,
data: END of it_loans.
zthrca006 is huge so i dont want to type everithing.What is the issue?
data: BEGIN OF it_loans occurs 0.
include structure zthrca006.
data : status(10),
data : pernr like pa0001-pernr.
data : sname like pa0001-pernr.
data : tipomov(20).
data : monto like zthrca006-monto,.
data: END of it_loans.
Regards,
Ravi
Note - Please mark all the helpful answers
Maybe you are looking for
-
Tax percentage and gross amount
We have a requirement (South Africa) where we have the gross amount (final selling price) and tax percentage. The net amount and tax amount has to be back calculated from the gross amount. For example: Gross price = 100 ZAR Tax % = 15% Therefore,
-
I share PDF files through a secure web application and sporadically encounter this error message when attempting to open/download the shared PDF: I'm the owner of the original files and can open those with no problem. It's only when I save the file
-
Hi Gurus, I have been asked to take an interview for the post of ORACLE DBA. This job profile is to support RAC databases. I will be questioning DBA's on the following. INSTALL AND CONFIGURE RAC TAF BACKUP AND RECOVERY OF RAC database. But my main qu
-
Service Call - Removing activites not allowed
Hi When i am updating the Service Call follwing error is showing..... Removing Activities is not allowed in Service Call. Any suggestion?? Regards Mohit Gupta
-
KT4V won't recognize CDroms??
I had my system running perfeclty with a KT3Ultra, until one day the cdrom and burner started acting erratically. A few weeks later they completely died and I could no longer access either drive in windows; the drives were also not recognized upon P