2006 May 25 3:50 AM
Hi everyone,
I've been assigned to do a user exit. One of the specs require me to select field IWERK from structure CAUFVD.
My questions are:
1. How do i declare a structure like this in the user exit
2. How do i do a SELECT from a structure?
Hi everyone,
I've been assigned to do a user exit. One of the specs require me to select field IWERK from structure CAUFVD.
My questions are:
1. How do i declare a structure like this in the user exit
2. How do i do a SELECT from a structure?
2006 May 25 4:00 AM
2006 May 25 4:01 AM
Bernard,
You cannot select from a structure, can do only from a table. In this case you might have to look at AUFK, AUFC tables.
Declaration can be something like this
DATA : WA_CAUFVD LIKE CAUFVD.
Regards,
Ravi
Note : Please mark all the helpful answers
2006 May 25 4:58 AM
HI
GOOD
YOU HAVE TO DECLARE LIKE THIS
TYPES: BEGIN OF struct,
number_1 TYPE i,
number_2 TYPE p DECIMALS 2,
END OF struct.
SELECT FROM A STRUCTURE=>
USING THE SELECT STATEMENT YOU CAN SELECT FROM THE STRUCTURE.
https://help.sap.com/saphelp_nw04s/helpdata/en/90/8d7301b1af11d194f600a0c929b3c3/frameset.htm
THANKS
MRUTYUN
2006 May 25 6:33 AM
Hi bernard,
1. As u said u are working on user exit,
2. This structure CAUFVD
will be passed by the user-exit FM.
(It will be an Import parameter in this FM)
3. There is no need to do any select.
4. Just check out your FM
the structure CAUFVD
will be having some name in import parameter,
eg. I_CAUFVD
5. Just do I_CAUFVD-IWERK.
regards,
amit m.
2006 May 25 6:38 AM
Hai
try this example:
=====================================
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SYST'
CHANGING
ct_fieldcat = it_fcat[].
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
MOVE-CORRESPONDING is_fcat TO is_fieldcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP.
Thanks & regards
Sreeni
2006 May 25 7:18 AM
Hi,
1. STRUCTURE WILL NEVER STORE DATA.
2. TABLE STORES DATA. BUT STRUCTURE NEVER STORES DATA.
If this structure is an import parameter of ur exit-FM
then u can directly get this value like this:
variable = CAUFVD-IWERK.
rgds,
latheesh
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |