Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Format issue in excle when we downlaod alv output into xls

Former Member
0 Kudos
93

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

5 REPLIES 5

Former Member
0 Kudos
64

Hi ,

Change data type for amount with type c.

Thanks,

Rajesh G.

thanga_prakash
Active Contributor
0 Kudos
64

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

thanga_prakash
Active Contributor
0 Kudos
64

Hello Krishna,

Other option might be you can try with EDIT MASK.

Regards,

Thanga

karthikeyan_p3
Contributor
0 Kudos
64

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.

Former Member
0 Kudos
64

This message was moderated.