‎2009 Mar 05 10:46 AM
Hi,
the task seems to be almost unsolvable (for me at least).
There is a table which provides us the data.
This table is the basis for further action. It is a customer table.
It consists of many fields like
HEADER_ID
MEASURE_LEG_ID
SIZE_ID
SIZE_NAME (column names of the output table)
MEASURE_LEG (rows(lines)of the output table)
DELFLAG
ISREFSIZE
STATUS
ORIGSIGN
SEASON
VENDOR
....
..
Due to this table must be created an new output table which looks as follows:
Create as many columns as the number of values in the field SIZE_NAME.
The lines(rows) should look as follows:
-
XXL--XLL-M--S
MEASURE_LEG5--
MEASURE_LEG3--
MEASURE_LEG2--
MEASURE_LEG6--
MEASURE_LEG9--
SIZE_NAME: XXL,XL,L,M,S
ROWS(lines) MEASURE_LEG12, MEASURE_LEG3 etc are the rows(lines).
Finally this output must be generated in a new table with the information
from the first table.
I need only the LOOP on how to create the look as output internal table
and not the whole technology with ALV.
I hope from the whole heart someone can help me in this matter.
Regards
sas erdem
‎2009 Mar 05 1:33 PM
I have the following problem.
Do you know a logic how to fill or populate now the sizes
to the appropriate Legs (regarding to the base table field VALUES)
HEADER_ID
MEASURE_LEG_ID
SIZE_ID
SIZE_NAME (column names of the output table)
MEASURE_LEG (rows(lines)of the output table)
VALUES
DELFLAG
ISREFSIZE
STATUS
ORIGSIGN
SEASON
VENDOR
Thanks in advance
Regards
sas
Edited by: erdem sas on Mar 5, 2009 6:01 PM
‎2009 Mar 05 11:00 AM
Could you more explain ur requirement. i think its feasible using dynamic fieldcat
‎2009 Mar 05 11:13 AM
HI Erdem,
Use this logic :
for the custom internal table zcustomsize
select size_name measure_leg
from zcustomsize
into corresponding fields of table itab.
Now fill the fiedcat depending on the entries in the custom table for SIZE_NAME
form fieldcat.
loop at itab.
wa_fcat-fieldname = ITAB-size_name.
wa_fact-tabname = itab_display.
endloop.
endform.
Now when populating the table, fill in the entries by looping at itab and pass entry into itab_display which will be the final internal table which will be passed to the reuse_alv_grid_display FM.
Pls explain the requirement to be more clear to help u out.
‎2009 Mar 05 11:31 AM
it is quite simple. Various MEASURE_LEG5 should be displayed
to different SIZES(SIZE_NAME)
In the basis table are many information given.
The goal is a meaningful representation of those information
as below shown.
It is hard to me to pair this information
to have finally this look.
-
XXL--XLL-M--S
MEASURE_LEG5--
MEASURE_LEG3--
MEASURE_LEG2--
MEASURE_LEG6--
MEASURE_LEG9--
‎2009 Mar 05 11:41 AM
Hi,
please check this code. It is working and you just need to populate the final table built as per your requirements:
TYPE-POOLS:slis.
*DATA DECLARATION
FIELD-SYMBOLS: <dyntable> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
FIELD-SYMBOLS: <fs_1>.
DATA: i_fieldlist TYPE lvc_t_fcat,
wa_fieldlist TYPE lvc_s_fcat,
i_data TYPE REF TO data.
TYPES:BEGIN OF typ,
size_name(20) TYPE c , "(column names of the output table)
measure_leg(20) TYPE c, "(rows(lines)of the output table)
END OF typ.
DATA:i_tab TYPE STANDARD TABLE OF typ,
wa_tab TYPE typ.
wa_tab-size_name = 'XL'.
wa_tab-measure_leg = 'MEASURE_LEG5'.
APPEND wa_tab TO i_tab.
wa_tab-size_name = 'XXL'.
wa_tab-measure_leg = 'MEASURE_LEG6'.
APPEND wa_tab TO i_tab.
*field name to store MEASURE_LEG5..
wa_fieldlist-fieldname = 'MEASURE_LEG_TYPE'.
wa_fieldlist-intlen = '30'.
APPEND wa_fieldlist TO i_fieldlist.
LOOP AT i_tab INTO wa_tab.
wa_fieldlist-fieldname = wa_tab-size_name.
APPEND wa_fieldlist TO i_fieldlist.
CLEAR wa_tab.
ENDLOOP.
ASSIGN i_data TO <fs_data>.
*CREATING INTERNAL TABLE TO DISPLAY ALV DATA
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fieldlist
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i023(zxxxfi) WITH 'Error while creating table'.
STOP.
ENDIF.
ASSIGN <fs_data>->* TO <fs_1>.
ASSIGN <fs_1> TO <dyntable>.
FIELD-SYMBOLS:<dyn_wa>,
<dyn_field>.
DATA:dy_line TYPE REF TO data.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyntable>. " creating a line type of the table just created above
ASSIGN dy_line->* TO <dyn_wa>. " creating the work area with reference to the line type
LOOP AT i_tab INTO wa_tab.
ASSIGN COMPONENT 1
OF STRUCTURE <dyn_wa> TO <dyn_field>.
IF sy-subrc = 0.
<dyn_field> = wa_tab-measure_leg. " filling value for this field
APPEND <dyn_wa> TO <dyntable>.
ENDIF.
ENDLOOP.
data:i_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
lv_title type lvc_title VALUE 'test title'.
loop at i_fieldlist into wa_fieldlist.
move-corresponding wa_fieldlist to wa_fieldcat.
wa_fieldcat-seltext_s = wa_fieldcat-fieldname.
wa_fieldcat-seltext_l = wa_fieldcat-fieldname.
wa_fieldcat-seltext_m = wa_fieldcat-fieldname.
append wa_fieldcat to i_fieldcat.
endloop.
data:wa_layout type slis_layout_alv.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_grid_title = lv_title
it_fieldcat = i_fieldcat
i_default = ' '
is_layout = wa_layout
i_save = 'A'
tables
t_outtab = <dyntable>
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.
stop.
endif.
Regards.
‎2009 Mar 05 11:53 AM
‎2009 Mar 05 1:33 PM
I have the following problem.
Do you know a logic how to fill or populate now the sizes
to the appropriate Legs (regarding to the base table field VALUES)
HEADER_ID
MEASURE_LEG_ID
SIZE_ID
SIZE_NAME (column names of the output table)
MEASURE_LEG (rows(lines)of the output table)
VALUES
DELFLAG
ISREFSIZE
STATUS
ORIGSIGN
SEASON
VENDOR
Thanks in advance
Regards
sas
Edited by: erdem sas on Mar 5, 2009 6:01 PM
‎2009 Mar 06 4:10 AM
Hi,
please give an scenario of data in the input table and expected output. This will help to better understand your requirement.
‎2009 Mar 06 11:02 AM
Hello Parbutteea,
here are some values.
Regards
sas
1)
HEADER_ID MEASURE_LEG_ID SIZE_ID SIZE_NAME MEASURE_LEG VALUES DELFLAG ISREFSIZE STATUS ORIGSIGN SEASON VENDOR
000000001 000000007 XXL 55 E S Lewis
HEADER_ID MEASURE_LEG_ID SIZE_ID SIZE_NAME MEASURE_LEG VALUES DELFLAG ISREFSIZE STATUS ORIGSIGN SEASON VENDOR
000000001 000000003 waistband A S Lewis2)
HEADER_ID MEASURE_LEG_ID SIZE_ID SIZE_NAME MEASURE_LEG VALUES DELFLAG ISREFSIZE STATUS ORIGSIGN SEASON VENDOR
000000010 000000011 XL 52 E S Lewis
HEADER_ID MEASURE_LEG_ID SIZE_ID SIZE_NAME MEASURE_LEG VALUES DELFLAG ISREFSIZE STATUS ORIGSIGN SEASON VENDOR
000000010 000000034 hip size A S LewisEdited by: erdem sas on Mar 7, 2009 8:41 AM