Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8491

Re: Read file from presentation server in background job.

$
0
0

Hi,

i too got the same problem and got the solution for that.

code:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  PERFORM file_browse.

  PERFORM file_upload. " Files into internal table before start of selection event

AT SELECTION-SCREEN OUTPUT.

  DATA: exclude LIKE rsexfcode OCCURS 0 WITH HEADER LINE,

        ls_submit_info TYPE rssubinfo.

START-OF-SELECTION.

  PERFORM process_data.

FORM file_upload .

  DATA ip_file TYPE string.

  CLEAR ip_file.

  REFRESH it_data.

  ip_file = p_file.

  CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

      filename                = ip_file " Path of the file

      has_field_separator     = 'X'

    TABLES

      data_tab                = it_data

    EXCEPTIONS

      file_open_error         = 1

      file_read_error         = 2

      no_batch                = 3

      gui_refuse_filetransfer = 4

      invalid_type            = 5

      no_authority            = 6

      unknown_error           = 7

      bad_data_format         = 8

      header_not_allowed      = 9

      separator_not_allowed   = 10

      header_too_long         = 11

      unknown_dp_error        = 12

      access_denied           = 13

      dp_out_of_memory        = 14

      disk_full               = 15

      dp_timeout              = 16

      OTHERS                  = 17.

  IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

***Using this concept" Export into another variable

REFRESH: exp_data.

  exp_data = it_data.

*Index key is group of Report & UserId.

  CONCATENATE sy-repid sy-uname  INTO indxkey .

  EXPORT exp_data FROM exp_data

  TO DATABASE mcdx(zb)  FROM wa_indx ID indxkey.

ENDFORM.                    "file_upload

****import into start of selection

FORM process_data .

IF sy-batch EQ 'X'.

    REFRESH it_data.

    CONCATENATE sy-repid sy-uname  INTO indxkey .

    IMPORT exp_data = exp_data  FROM DATABASE mcdx(zb) ID indxkey.

    it_data = exp_data.

  ENDIF.

  IF it_data IS NOT INITIAL.

    LOOP AT it_data INTO wa_data.

      wa_bapi_data-payer_code = ''.

      wa_bapi_data-labr_value = wa_data-labr_value.

      wa_bapi_data-plant = wa_data-plant.

      wa_bapi_data-text = wa_data-text.

      wa_bapi_data-dealer_code = wa_data-dealer_code.

      wa_bapi_data-claim_mnth = wa_data-claim_mnth.

      wa_bapi_data-claim_yr = wa_data-claim_yr.

      wa_bapi_data-dr_cr_indicator = wa_data-dr_cr_indicator.

      APPEND wa_bapi_data TO it_bapi_data.

    ENDLOOP.

  ELSE.

    MESSAGE:'No entry found' TYPE 'E'.

  ENDIF.

ENDFORM.                    "

I think you get the correct answer.

Regards,

Ankita Jain

 


Viewing all articles
Browse latest Browse all 8491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>