11-24-2014 4:38 PM
Hi Experts,
I have requirement like I need to create xls file based on the ALV output.Based on the requirement I have designed the xls file based final table.
there is issue when we created the file, in the xls file some of the values has native sign after amount like 3500.10- due to which we can't calculating the totals. so I am trying to change the format as like -3500.10, but I am not allowing to change the format.
Could you please regarding the same.
Thanks&Regards
Krishna
11-25-2014 7:55 AM
11-25-2014 9:54 AM
Hello Krishna,
Try using the function module "CLOI_PUT_SIGN_IN_FRONT" for the amount field before passing it on to the ALV display.
Regards,
Thanga
11-25-2014 9:56 AM
Hello Krishna,
Other option might be you can try with EDIT MASK.
Regards,
Thanga
11-25-2014 10:41 AM
Hi Ramakrishna,
Make sure to have the report output internal table (T_OUTTAB) field in character format and use the FM CLOI_PUT_SIGN_IN_FRONT to put the sign in front.
REPORT ZDEMO_REPORT.
type-POOLs: slis.
TYPES: BEGIN OF ty_ekpo,
ebeln type ebeln,
netwr type BWERT,
END OF ty_ekpo.
TYPES: BEGIN OF ty_ekpo1,
ebeln type ebeln,
netwr type char13,
END OF ty_ekpo1.
DATA: lt_ekpo type STANDARD TABLE OF ty_ekpo,
l_wa_ekpo type ty_ekpo,
lt_ekpo_f type STANDARD TABLE OF ty_ekpo1,
l_wa_ekpo_f type ty_ekpo1,
lt_field type SLIS_T_FIELDCAT_ALV.
DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,
gw_fieldcat TYPE slis_fieldcat_alv.
SELECT ebeln netwr from ekpo into TABLE lt_ekpo UP TO 10 ROWS WHERE netwr > 10 .
gw_fieldcat-col_pos = 1.
gw_fieldcat-fieldname = 'EBELN'.
gw_fieldcat-tabname = 'lt_ekpo'.
gw_fieldcat-seltext_m = 'Purchase Order' . "Material
gw_fieldcat-outputlen = 15.
gw_fieldcat-no_zero = 'X'.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
gw_fieldcat-col_pos = 2.
gw_fieldcat-fieldname = 'NETWR'.
gw_fieldcat-tabname = 'lt_ekpo'.
gw_fieldcat-seltext_m = 'Net Value' . "Material Desc
gw_fieldcat-outputlen = 40.
APPEND gw_fieldcat TO gt_fieldcat.
CLEAR gw_fieldcat.
LOOP AT lt_ekpo INTO l_wa_ekpo.
l_wa_ekpo_f-ebeln = l_wa_ekpo-ebeln.
l_wa_ekpo-netwr = -1 * l_wa_ekpo-netwr.
l_wa_ekpo_f-netwr = l_wa_ekpo-netwr.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = l_wa_ekpo_f-netwr .
APPEND l_wa_ekpo_f to lt_ekpo_f.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = gt_fieldcat
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = lt_ekpo_f
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
11-25-2014 10:50 AM