Skip to Content
0
Former Member
Feb 26, 2009 at 07:41 AM

bsp download

62 Views

hi experts,

i have a download button on clciking on that button the user gets 4 files in the application server.But now the requirement is on cliking on excel the user should be able to download it on local ,my question is shall i get 4 diffrent popus wheni download it on excel ,below is the code :

esixting scenario

CASE event_id.

WHEN 'excel'.

  • Language ****************

IF application->tlang IS NOT INITIAL.

WRITE sy-datum TO date1 YYMMDD.

table = 'lang'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

len = STRLEN( title1 ).

WRITE '.csv' TO title1+len(4).

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'SAP_INTERFACE_NFSPC'

parameter_1 = '0273/out/act'

parameter_2 = title1

IMPORTING

file_name = full_filename.

  • Open the file for editing

OPEN DATASET full_filename FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc = 0.

CLEAR wreturn.

wreturn-type = 'S'.

wreturn-message = 'Successfully created Language File'.

APPEND wreturn TO return.

ELSE.

CLEAR wreturn.

wreturn-type = 'E'.

wreturn-message = 'Failed to create Language File'.

APPEND wreturn TO return.

ENDIF.

LOOP AT application->tlang INTO wlang.

g10c-prod = config.

g10c-lang = wlang-mvgr1.

TRANSFER g10c TO full_filename.

ENDLOOP.

CLOSE DATASET full_filename .

CLEAR g10c.

ENDIF.

  • Metric ******************

IF tmp_metric IS NOT INITIAL.

table = 'metric'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

len = STRLEN( title1 ).

WRITE '.csv' TO title1+len(4).

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'SAP_INTERFACE_NFSPC'

parameter_1 = '0273/out/act'

parameter_2 = title1

IMPORTING

file_name = full_filename.

  • open the file for editing

OPEN DATASET full_filename FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc = 0.

CLEAR wreturn.

wreturn-type = 'S'.

wreturn-message = 'Successfully created Metric File'.

APPEND wreturn TO return.

ELSE.

CLEAR wreturn.

wreturn-type = 'E'.

wreturn-message = 'Failed to create Metric File'.

APPEND wreturn TO return.

ENDIF.

CLEAR wmetric.

LOOP AT tmp_metric INTO wmetric.

g10c-prod = config.

g10c-lang = wmetric-description.

TRANSFER g10c TO full_filename.

ENDLOOP.

CLOSE DATASET full_filename .

CLEAR g10c.

ENDIF.

  • Server Class ******************

IF tmp_tsclass IS NOT INITIAL.

table = 'SrvrCls'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

len = STRLEN( title1 ).

WRITE '.csv' TO title1+len(4).

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'SAP_INTERFACE_NFSPC'

parameter_1 = '0273/out/act'

parameter_2 = title1

IMPORTING

file_name = full_filename.

  • open the file for editing

OPEN DATASET full_filename FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc = 0.

CLEAR wreturn.

wreturn-type = 'S'.

wreturn-message = 'Successfully created Server Class File'.

APPEND wreturn TO return.

ELSE.

CLEAR wreturn.

wreturn-type = 'E'.

wreturn-message = 'Failed to create Server Class File'.

APPEND wreturn TO return.

ENDIF.

CLEAR wsclass.

LOOP AT tmp_tsclass INTO wsclass.

g10c-prod = config.

g10c-lang = wsclass-description.

TRANSFER g10c TO full_filename.

ENDLOOP.

CLOSE DATASET full_filename .

CLEAR g10c.

ENDIF.

  • Type ******************

IF tmp_type IS NOT INITIAL.

table = 'Type'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

len = STRLEN( title1 ).

WRITE '.csv' TO title1+len(4).

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'SAP_INTERFACE_NFSPC'

parameter_1 = '0273/out/act'

parameter_2 = title1

IMPORTING

file_name = full_filename.

  • open the file for editing

OPEN DATASET full_filename FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc = 0.

CLEAR wreturn.

wreturn-type = 'S'.

wreturn-message = 'Successfully created Type File'.

APPEND wreturn TO return.

ELSE.

CLEAR wreturn.

wreturn-type = 'E'.

wreturn-message = 'Failed to create Type File'.

APPEND wreturn TO return.

ENDIF.

CLEAR wtype.

LOOP AT tmp_type INTO wtype.

g10c-prod = config.

g10c-lang = wtype-description.

TRANSFER g10c TO full_filename.

ENDLOOP.

CLOSE DATASET full_filename .

CLEAR g10c.

ENDIF.

  • Term ******************

IF application->tterm IS NOT INITIAL.

table = 'Term'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

len = STRLEN( title1 ).

WRITE '.csv' TO title1+len(4).

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'SAP_INTERFACE_NFSPC'

parameter_1 = '0273/out/act'

parameter_2 = title1

IMPORTING

file_name = full_filename.

  • open the file for editing

OPEN DATASET full_filename FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc = 0.

CLEAR wreturn.

wreturn-type = 'S'.

wreturn-message = 'Successfully created Term File'.

APPEND wreturn TO return.

ELSE.

CLEAR wreturn.

wreturn-type = 'E'.

wreturn-message = 'Failed to create Term File'.

APPEND wreturn TO return.

ENDIF.

CLEAR wterm.

LOOP AT application->tterm INTO wterm.

g10c-prod = config.

g10c-lang = wterm-description.

TRANSFER g10c TO full_filename.

ENDLOOP.

CLOSE DATASET full_filename .

CLEAR g10c.

cretes 4 diffrent files in the application server , i have implemented this :

IF application->tlang IS NOT INITIAL.

WRITE sy-datum TO date1 YYMMDD.

table = 'lang'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

LOOP AT application->tlang INTO wlang.

g10c-prod = config.

g10c-lang = wlang-mvgr1.

concatenate

output

g10c-prod tab

g10c-lang

CL_ABAP_CHAR_UTILITIES=>CR_LF

INTO output SEPARATED BY space.

clear g10c.

endloop.

app_type = 'APPLICATION/MSEXCEL;charset=utf-16le'.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = output

mimetype = 'APPLICATION/MSEXCEL;charset=utf-16le'

IMPORTING

buffer = l_xstring.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

l_xstring

INTO l_xstring IN BYTE MODE.

CALL METHOD cl_bsp_utility=>download

EXPORTING

object_s = l_xstring

content_type = app_type

content_disposition = 'attachment;filename=title1.xls'

response = mresponse

navigation = navigation.

endif.

  • Metric ******************

IF tmp_metric IS NOT INITIAL.

table = 'metric'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

CLEAR wmetric.

LOOP AT tmp_metric INTO wmetric.

g10c-prod = config.

g10c-lang = wmetric-description.

concatenate

output

g10c-prod tab

g10c-lang

CL_ABAP_CHAR_UTILITIES=>CR_LF

INTO output SEPARATED BY space.

clear g10c.

endloop.

app_type = 'APPLICATION/MSEXCEL;charset=utf-16le'.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = output

mimetype = 'APPLICATION/MSEXCEL;charset=utf-16le'

IMPORTING

buffer = l_xstring.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

l_xstring

INTO l_xstring IN BYTE MODE.

CALL METHOD cl_bsp_utility=>download

EXPORTING

object_s = l_xstring

content_type = app_type

content_disposition = 'attachment;filename=title1.xls'

response = mresponse

navigation = navigation.

endif.

  • Server Class ******************

IF tmp_tsclass IS NOT INITIAL.

*

table = 'SrvrCls'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

CLEAR wsclass.

LOOP AT tmp_tsclass INTO wsclass.

g10c-prod = config.

g10c-lang = wsclass-description.

concatenate

output

g10c-prod tab

g10c-lang

CL_ABAP_CHAR_UTILITIES=>CR_LF

INTO output SEPARATED BY space.

clear g10c.

ENDLOOP.

app_type = 'APPLICATION/MSEXCEL;charset=utf-16le'.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = output

mimetype = 'APPLICATION/MSEXCEL;charset=utf-16le'

IMPORTING

buffer = l_xstring.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

l_xstring

INTO l_xstring IN BYTE MODE.

CALL METHOD cl_bsp_utility=>download

EXPORTING

object_s = l_xstring

content_type = app_type

content_disposition = 'attachment;filename=title1.xls'

response = mresponse

navigation = navigation.

endif.

  • Type ******************

IF tmp_type IS NOT INITIAL.

table = 'Type'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

*

LOOP AT tmp_type INTO wtype.

g10c-prod = config.

g10c-lang = wtype-description.

concatenate

output

g10c-prod tab

g10c-lang

CL_ABAP_CHAR_UTILITIES=>CR_LF

INTO output SEPARATED BY space.

clear g10c.

ENDLOOP.

app_type = 'APPLICATION/MSEXCEL;charset=utf-16le'.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = output

mimetype = 'APPLICATION/MSEXCEL;charset=utf-16le'

IMPORTING

buffer = l_xstring.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

l_xstring

INTO l_xstring IN BYTE MODE.

CALL METHOD cl_bsp_utility=>download

EXPORTING

object_s = l_xstring

content_type = app_type

content_disposition = 'attachment;filename=title1.xls'

response = mresponse

navigation = navigation.

ENDIF.

  • Term ******************

IF application->tterm IS NOT INITIAL.

table = 'Term'.

CONCATENATE table

sy-uname+0(4)

date1+2(4)

sy-uzeit+0(4)

INTO title1.

CLEAR wterm.

LOOP AT application->tterm INTO wterm.

g10c-prod = config.

g10c-lang = wterm-description.

concatenate

output

g10c-prod tab

g10c-lang

CL_ABAP_CHAR_UTILITIES=>CR_LF

INTO output SEPARATED BY space.

clear g10c.

ENDLOOP.

app_type = 'APPLICATION/MSEXCEL;charset=utf-16le'.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = output

mimetype = 'APPLICATION/MSEXCEL;charset=utf-16le'

IMPORTING

buffer = l_xstring.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

l_xstring

INTO l_xstring IN BYTE MODE.

CALL METHOD cl_bsp_utility=>download

EXPORTING

object_s = l_xstring

content_type = app_type

content_disposition = 'attachment;filename=title1.xls'

response = mresponse

navigation = navigation.

ENDIF.

but i am getting only 1 pop ups.am not getting four pops i want 2 get 4 pop ups