Abap Logic: Field symbol to use in abap for excel
12:57 AM
Most of the time if creating a report with alv. When user need us to make a excel report we would create a whole damn list of field or re-write the field back to the codes (REDUNDANT~!)
This snippet could save your time and energy to code the excel or open dataset part.
DATA : BEGIN OF itab_output OCCURS 0,
sno(10) TYPE c,
pernr LIKE pernr-pernr,
ename LIKE pernr-ename,
werks LIKE p0001-werks,
name1 LIKE t500p-name1,
molga LIKE t001p-molga,
END OF itab_output.
FIELD-SYMBOLS: <field> TYPE ANY,
DATA: alv_fcatlog TYPE slis_t_fieldcat_alv,
fcatlog_hdr LIKE LINE OF alv_fcatlog,
l_line TYPE sy-tfill,
l_field TYPE string,
l_file TYPE rlgrap-filename
l_tab TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
LOOP AT itab_output.
CLEAR l_line.
LOOP AT alv_fcatlog INTO fcatlog_hdr.
CONCATENATE 'ITAB_OUTPUT-' fcatlog_hdr-fieldname
INTO l_field.
ASSIGN (l_field) TO <field>.
IF sy-tabix = 1.
MOVE <field> to l_line.
ELSE.
CONCATENATE l_line <field> INTO l_line SEPARATED BY l_tab.
ENDIF.
ENDLOOP.
TRANSFER l_line TO l_file.
ENDLOOP.
This snippet could save your time and energy to code the excel or open dataset part.
DATA : BEGIN OF itab_output OCCURS 0,
sno(10) TYPE c,
pernr LIKE pernr-pernr,
ename LIKE pernr-ename,
werks LIKE p0001-werks,
name1 LIKE t500p-name1,
molga LIKE t001p-molga,
END OF itab_output.
FIELD-SYMBOLS: <field> TYPE ANY,
DATA: alv_fcatlog TYPE slis_t_fieldcat_alv,
fcatlog_hdr LIKE LINE OF alv_fcatlog,
l_line TYPE sy-tfill,
l_field TYPE string,
l_file TYPE rlgrap-filename
l_tab TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
LOOP AT itab_output.
CLEAR l_line.
LOOP AT alv_fcatlog INTO fcatlog_hdr.
CONCATENATE 'ITAB_OUTPUT-' fcatlog_hdr-fieldname
INTO l_field.
ASSIGN (l_field) TO <field>.
IF sy-tabix = 1.
MOVE <field> to l_line.
ELSE.
CONCATENATE l_line <field> INTO l_line SEPARATED BY l_tab.
ENDIF.
ENDLOOP.
TRANSFER l_line TO l_file.
ENDLOOP.
Table maintenance generator - how to enlarge the input area.
12:09 AM
tcode = SE11
1. Generate the new table maintenance.
2. Double click on the generated screen.
3. At the main attribute tab. Enlarge the width eg 181
4. The click on the layout.
5. From the layout make sure it is showing the element list.
6. Click change.
7. Enlarge too the fields length ie. 181
1. Generate the new table maintenance.
2. Double click on the generated screen.
3. At the main attribute tab. Enlarge the width eg 181
4. The click on the layout.
5. From the layout make sure it is showing the element list.
6. Click change.
7. Enlarge too the fields length ie. 181