Skip to Content
author's profile photo Former Member
Former Member

Submit RSBDCSUB and the calling program is run in Backgroung mode

Hi,

I have a bdc program . I use call transaction for that and with the failed records I create the session . I am collecting error messages from call transaction into t_error . This session I am trying to process using RSBDCSUB.

Following is the syntax used :

SUBMIT RSBDCSUB WITH MAPPE = 'ZOTCIGT001'
WITH VON = SY-DATUM
WITH Z_VERARB = 'X'
exporting list to memory
AND RETURN .

After the session is processed I am trying display the contents of table t_error .

Loopa at t_error.
write : t_error-mstyp, t_error-msgspra ....
endloop

<b>The program is run in background mode . After that if I go to Sm37 I cannot see the spool ????</b>

When ran in foreground the spool can be seen .

How do I view my spool ??

Please help me with this .

Regards,

Varun .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 30, 2006 at 11:27 PM

    >>>exporting list to memory..

    that is why there is no spool..

    Revise your sumit statement to include to SAP-SPOOL..

    Press F1 on SUBMIT & you will get to know the correct syntax..

    ~Suresh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2006 at 11:28 PM

    Hi Varun,

    You can use

    <b>

    SUBMIT rep ... TO SAP-SPOOL. 
    

    </b>

    * Without archiving 
    DATA: PARAMS LIKE PRI_PARAMS, 
          DAYS(1)  TYPE N VALUE 2, 
          COUNT(3) TYPE N VALUE 1, 
          VALID    TYPE C. 
    
    CALL FUNCTION 'GET_PRINT_PARAMETERS' 
      EXPORTING DESTINATION           = 'LT50' 
                COPIES                = COUNT 
                LIST_NAME             = 'TEST' 
                LIST_TEXT             = 'SUBMIT ... TO SAP-SPOOL' 
                IMMEDIATELY           = 'X' 
                RELEASE               = 'X' 
                NEW_LIST_ID           = 'X' 
                EXPIRATION            = DAYS 
                LINE_SIZE             = 79 
                LINE_COUNT            = 23 
                LAYOUT                = 'X_PAPER' 
                SAP_COVER_PAGE        = 'X' 
                COVER_PAGE            = 'X' 
                RECEIVER              = 'SAP*' 
                DEPARTMENT            = 'System' 
                NO_DIALOG             = ' ' 
      IMPORTING OUT_PARAMETERS        = PARAMS 
                VALID                 = VALID. 
    
    IF VALID <> SPACE. 
      SUBMIT RSTEST00 TO SAP-SPOOL 
        SPOOL PARAMETERS PARAMS 
        WITHOUT SPOOL DYNPRO. 
    ENDIF. 
    
    
    

    Cheers

    VJ

    Message was edited by: Vijayendra Rao

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      I guess you guys are not clear with my requirement please refer to this code ad tell me what to do :

      START-OF-SELECTION.
      
        CLEAR:w_error,w_u_done,w_c_done,w_invalid,
              w_unchange,w_record,w_check,w_powder.
      
        CLEAR:t_file,t_data,t_create,t_update,t_knmt,t_knvv,t_mara.
        REFRESH:t_file,t_data,t_create,t_update,t_knmt,t_knvv,t_mara.
      
        sy-subrc = 0.
        IF p_local = 'X'.
          PERFORM upload_local_file.
        ELSE.
          PERFORM read_dataset.
        ENDIF.
      
        LOOP AT t_file.
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
               EXPORTING
                    input        = t_file-matnr
               IMPORTING
                    output       = t_file-matnr
               EXCEPTIONS
                    length_error = 1
                    OTHERS       = 2.
          IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
      
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
               EXPORTING
                    input        = t_file-bismt
               IMPORTING
                    output       = t_file-bismt
               EXCEPTIONS
                    length_error = 1
                    OTHERS       = 2.
          IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
      
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
               EXPORTING
                    input  = t_file-kunnr
               IMPORTING
                    output = t_file-kunnr.
          MODIFY t_file.
        ENDLOOP.
      
        SELECT * FROM knmt INTO CORRESPONDING FIELDS OF TABLE t_knmt
         FOR ALL ENTRIES IN t_file
          WHERE kunnr = t_file-kunnr.
      
        SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE t_knvv
         FOR ALL ENTRIES IN t_file
          WHERE kunnr = t_file-kunnr.
      
        SELECT * FROM mara INTO CORRESPONDING FIELDS OF TABLE t_mara
         FOR ALL ENTRIES IN t_file
          WHERE matnr = t_file-matnr.
      
        SELECT kunnr xcpdk FROM kna1 INTO TABLE t_kna1
         FOR ALL ENTRIES IN t_file
          WHERE kunnr = t_file-kunnr.
      
        PERFORM separate_entries.
      
        PERFORM update_cmir.
      
        PERFORM create_cmir.
      
      
      
        IF w_record = 'X'.
          CALL FUNCTION 'BDC_CLOSE_GROUP'.
        ENDIF.
      
      *  submit RSBDCBTC with QUEUE-ID EQ w_qid and return .
      *CALL FUNCTION 'JOB_OPEN'
      *  EXPORTING
      **   DELANFREP              = ' '
      **   JOBGROUP               = ' '
      *    jobname                = 'ZJOB1'
      **   SDLSTRTDT              = NO_DATE
      **   SDLSTRTTM              = NO_TIME
      **   JOBCLASS               =
      ** IMPORTING
      **   JOBCOUNT               =
      ** CHANGING
      **   RET                    =
      ** EXCEPTIONS
      **   CANT_CREATE_JOB        = 1
      **   INVALID_JOB_DATA       = 2
      **   JOBNAME_MISSING        = 3
      **   OTHERS                 = 4
      *          .
      *IF sy-subrc <> 0.
      ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      *ENDIF.
      *
      SUBMIT RSBDCSUB WITH MAPPE = 'ZOTCIGT001'
      WITH VON = SY-DATUM
      WITH Z_VERARB = 'X'
      exporting list to memory
      AND RETURN .
      *call function 'JOB_CLOSE' .
      
      
        IF NOT t_error[] IS INITIAL.
          PERFORM write_error_file.
        ENDIF.
      
      
      
      ************************************************************************
      *  E N D - O F - S E L E C T I O N                                     *
      ************************************************************************
      
      END-OF-SELECTION.
      */end message /*
        PERFORM end_message.                  "closing message
      
        IF p_out = 'X' AND sy-batch = 'X'.
          PERFORM down_list_for_background.
        ENDIF.
      
        IF p_out = 'X'.
          PERFORM spool_automation.
        ENDIF.
      
      ************************************************************************
      *  T O P - O F - P A G E                                               *
      ************************************************************************
      TOP-OF-PAGE.
      
        CALL FUNCTION 'Z_ZS01_REPORT_HEADER'
             EXPORTING
                  ip_confidential = ' '
                  ip_pagewidth    = 132
             EXCEPTIONS
                  width_overflow  = 1
                  width_underflow = 2
                  OTHERS          = 3.
        IF sy-subrc <> 0.
          MESSAGE ID 'ZPTP' TYPE 'E' NUMBER 000.
        ENDIF.
      
      
      
      
      
      *&---------------------------------------------------------------------*
      *&      Form  get_local_file
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM get_local_file.
      
        CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
               EXPORTING
                 program_name        = w_repid
                 dynpro_number       = syst-dynnr
      *   FIELD_NAME          = ' '
      *   STATIC              = ' '
      *   MASK                = ' '
                CHANGING
                  file_name           = p_l_path
               EXCEPTIONS
                 mask_too_long       = 1
                 OTHERS              = 2
                        .
        IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      
      ENDFORM.                    " get_local_file
      *&---------------------------------------------------------------------*
      *&      Form  set_file
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM set_file.
      
        LOOP AT SCREEN.
          IF p_local = 'X'.
            IF screen-name CP '*P_U_PATH*'.
              screen-invisible = '0'.
              screen-active = '0'.
            ENDIF.
          ELSE.
            IF screen-name CP '*P_L_PATH*'.
              screen-invisible = '0'.
              screen-active = '0'.
            ENDIF.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      
      ENDFORM.                    " set_file
      *&---------------------------------------------------------------------*
      *&      Form  upload_local_file
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM upload_local_file.
      
        DATA:w_filename TYPE string.
      
        CLEAR w_filename.
        w_filename = p_l_path.
      
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                      = w_filename
            filetype                      = 'ASC'
         has_field_separator           = 'X'
      *   HEADER_LENGTH                 = 0
      *   READ_BY_LINE                  = 'X'
         dat_mode                      = 'X'
      * IMPORTING
      *   FILELENGTH                    =
      *   HEADER                        =
          TABLES
            data_tab                      = t_file
         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.
          WRITE: 'Error in downloading file'.
        ENDIF.
      
      ENDFORM.                    " upload_local_file
      *&---------------------------------------------------------------------*
      *&      Form  read_dataset
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM read_dataset.
      
      *  CALL FUNCTION 'FILE_GET_NAME'
      *          EXPORTING
      *     CLIENT                        = SY-MANDT
      *     LOGICAL_FILENAME              = P_U_PATH
      *     OPERATING_SYSTEM              = SY-OPSYS
      **   PARAMETER_1                   = ' '
      **   PARAMETER_2                   = ' '
      **   PARAMETER_3                   = ' '
      **   USE_PRESENTATION_SERVER       = ' '
      **   WITH_FILE_EXTENSION           = ' '
      **   USE_BUFFER                    = ' '
      **   ELEMINATE_BLANKS              = 'X'
      *         IMPORTING
      **   EMERGENCY_FLAG                =
      **   FILE_FORMAT                   =
      *           FILE_NAME                     = w_file
      *         EXCEPTIONS
      *           FILE_NOT_FOUND                = 1
      *           OTHERS                        = 2
      *                  .
      *  IF SY-SUBRC <> 0.
      *    MESSAGE E130 WITH p_u_path.
      *  ENDIF.
      
      *  IF sy-subrc EQ 0.
        w_file = p_u_path.
        OPEN DATASET w_file FOR INPUT IN TEXT MODE.
        IF sy-subrc EQ 0.
          DO.
            READ DATASET w_file INTO t_data.
            IF sy-subrc EQ 0.
              SPLIT t_data AT c_tab INTO t_file-kunnr t_file-name1
               t_file-matnr t_file-maktx t_file-prctr t_file-bismt
                t_file-btext t_file-werks.
      
              APPEND t_file.
              CLEAR: t_file,t_data.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ELSE.
          MESSAGE e905.
        ENDIF.
        CLOSE DATASET w_file.
      *  ENDIF.
      
      ENDFORM.                    " read_dataset
      *&---------------------------------------------------------------------*
      *&      Form  separate_entries
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM separate_entries.
      
        LOOP AT t_file.
          CLEAR: w_powder,t_create,t_update.
      
      * Validate the Material exists in MARA
          READ TABLE t_mara WITH KEY matnr = t_file-matnr.
          IF sy-subrc NE 0.
            MOVE-CORRESPONDING t_file TO t_error.
            t_error-text = text-002.
            APPEND t_error.
            w_invalid = w_invalid + 1.
            CONTINUE.
          ENDIF.
      
          READ TABLE t_kna1 WITH KEY kunnr = t_file-kunnr.
          IF sy-subrc EQ 0.
            IF t_kna1-xcpdk = 'X'.
              MOVE-CORRESPONDING t_file TO t_error.
              t_error-text = text-003.
              APPEND t_error.
              w_invalid = w_invalid + 1.
              CONTINUE.
            ENDIF.
          ELSE.
            MOVE-CORRESPONDING t_file TO t_error.
            t_error-text = text-005.
            APPEND t_error.
            w_invalid = w_invalid + 1.
            CONTINUE.
          ENDIF.
      
      
      
      * Depending on Profit Center determine whether the record is
      * a AFC's or A&S or Powder Coatings.
          READ TABLE t_ztval WITH KEY typecode2 = 'PRCTR'
                                         value2 = t_file-prctr.
      
          IF sy-subrc EQ 0.
            IF t_ztval-value = c_powder.
              w_powder = 'X'.
              t_create-untto = '10'.
              t_create-uebto = '10'.
            ENDIF.
      
            IF t_ztval-value = c_as.
              t_create-untto = '20'.
              t_create-uebto = '20'.
              IF t_mara-tragr = '0001'.
                t_create-untto = '0'.
                t_create-uebto = '0'.
              ENDIF.
            ENDIF.
      
            IF t_ztval-value = c_afc.
              t_create-untto = '20'.
              t_create-uebto = '20'.
              IF t_mara-tragr = '0001'.
                t_create-untto = '0'.
                t_create-uebto = '0'.
              ENDIF.
            ENDIF.
          ENDIF.
      
      * Customers to be excluded.
          READ TABLE t_ztval_2 WITH KEY value = t_file-kunnr.
          IF sy-subrc EQ 0.
            IF t_ztval_2-value2 = c_powder.
              MOVE-CORRESPONDING t_file TO t_error.
              t_error-text = text-004.
              APPEND t_error.
              w_invalid = w_invalid + 1.
              CONTINUE.
            ENDIF.
            IF t_ztval_2-value2 = c_afc.
              MOVE-CORRESPONDING t_file TO t_error.
              t_error-text = text-008.
              APPEND t_error.
              w_invalid = w_invalid + 1.
              CONTINUE.
            ENDIF.
            IF t_ztval_2-value2 = c_as.
              MOVE-CORRESPONDING t_file TO t_error.
              t_error-text = text-009.
              APPEND t_error.
              w_invalid = w_invalid + 1.
              CONTINUE.
            ENDIF.
          ENDIF.
      
      * Check if customer tolerance needs to be 0 Powder Coatings.
          IF w_powder = 'X'.
            READ TABLE t_ztval_1 WITH KEY value = t_file-kunnr.
            IF sy-subrc EQ 0.
              CLEAR: t_create-uebto,t_create-untto.
      *        MOVE-CORRESPONDING t_file TO t_error.
      *        t_error-text = text-004.
      *        APPEND t_error.
      *        w_invalid = w_invalid + 1.
      *        CONTINUE.
            ENDIF.
          ENDIF.
      
          READ TABLE t_knmt WITH KEY kunnr = t_file-kunnr
                                     matnr = t_file-matnr.
      *     IF sy-subrc EQ 0.
      
          IF sy-subrc EQ 0.
            LOOP AT t_knmt WHERE kunnr = t_file-kunnr AND
                           matnr = t_file-matnr.
              IF t_knmt-werks IS INITIAL OR
                 t_knmt-werks NE t_file-werks.
      
      * Logic to check the plant from 9000 Series
                IF t_knmt-werks+0(1) = '9'.
                  MOVE-CORRESPONDING t_file TO t_error.
                  t_error-text = text-007.
                  APPEND t_error.
                  w_invalid = w_invalid + 1.
                  CONTINUE.
                ENDIF.
      * Logic to check the plant from 9000 Series
      
                t_update-kunnr = t_file-kunnr.
                t_update-matnr = t_file-matnr.
                t_update-werks = t_file-werks.
                t_update-vkorg = t_knmt-vkorg.
                t_update-vtweg = t_knmt-vtweg.
                t_update-prctr = t_file-prctr.
                t_update-werks1 = t_knmt-werks.
                APPEND t_update.
              ELSE.
                MOVE-CORRESPONDING t_file TO t_done.
                t_done-vkorg = t_knmt-vkorg.
                t_done-vtweg = t_knmt-vtweg.
                t_done-flag = 'X'.
                APPEND t_done.
                CLEAR t_done.
                w_unchange = w_unchange + 1.
              ENDIF.
      
              IF t_mara-tragr = '0002'.
                w_material = t_mara-prdha+10(8).
                IF w_material IS INITIAL.
                  CONTINUE.
                ENDIF.
                CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
                     EXPORTING
                          input        = w_material
                     IMPORTING
                          output       = w_material
                     EXCEPTIONS
                          length_error = 1
                          OTHERS       = 2.
                IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                ENDIF.
      
      * Logic to change the Father material
                READ TABLE t_knmt WITH KEY kunnr = t_file-kunnr
                                          matnr = w_material
                                          vkorg = t_knmt-vkorg
                                          vtweg = t_knmt-vtweg.
                IF sy-subrc EQ 0.
      
                  LOOP AT t_knmt WHERE kunnr = t_file-kunnr AND
                                       matnr = w_material AND
                                       vkorg = t_knmt-vkorg AND
                                       vtweg = t_knmt-vtweg.
                    IF t_knmt-werks EQ t_file-werks.
                      MOVE-CORRESPONDING t_file TO t_done.
                      t_done-vkorg = t_knmt-vkorg.
                      t_done-vtweg = t_knmt-vtweg.
                      t_done-matnr = w_material.
                      t_done-flag = 'X'.
                      APPEND t_done.
                      CLEAR t_done.
                      w_unchange = w_unchange + 1.
                      CONTINUE.
                    ELSE.
                      IF t_knmt-werks+0(1) = '9'.
                        MOVE-CORRESPONDING t_file TO t_error.
                        t_error-matnr = w_material.
                        t_error-text = text-007.
                        APPEND t_error.
                        w_invalid = w_invalid + 1.
                        CONTINUE.
                      ENDIF.
                      t_update-kunnr = t_file-kunnr.
                      t_update-vkorg = t_knmt-vkorg.
                      t_update-vtweg = t_knmt-vtweg.
                      t_update-matnr = w_material.
                      t_update-werks = t_file-werks.
                      t_update-prctr = t_file-prctr.
                      t_update-werks1 = t_knmt-werks.
                      t_update-untto = t_create-untto.
                      t_update-uebto = t_create-uebto.
                      APPEND t_update.
                      CLEAR t_update.
                      CONTINUE.
                    ENDIF.
                  ENDLOOP.
                ELSE.
                  LOOP AT t_knvv WHERE kunnr = t_file-kunnr.
                    t_create-kunnr = t_file-kunnr.
                    t_create-matnr = w_material.
                    t_create-werks = t_file-werks.
                    t_create-vkorg = t_knvv-vkorg.
                    t_create-vtweg = t_knvv-vtweg.
                    t_create-prctr = t_file-prctr.
      *            t_create-bismt = t_file-bismt.
      *            t_create-btext = t_file-btext.
                    APPEND t_create.
                    CLEAR t_create.
                  ENDLOOP.
                ENDIF.
      * Logic to change the Father material.
              ENDIF.
            ENDLOOP.
          ELSE.
            LOOP AT t_knvv WHERE kunnr = t_file-kunnr.
              IF w_powder = 'X'.
                READ TABLE t_ztval_1 WITH KEY value2 = t_knvv-vkorg.
                IF sy-subrc NE 0.
                  CONTINUE.
                ENDIF.
              ENDIF.
              t_create-kunnr = t_file-kunnr.
              t_create-matnr = t_file-matnr.
              t_create-werks = t_file-werks.
              t_create-vkorg = t_knvv-vkorg.
              t_create-vtweg = t_knvv-vtweg.
              t_create-prctr = t_file-prctr.
              t_create-bismt = t_file-bismt.
              t_create-btext = t_file-btext.
              APPEND t_create.
      
              IF t_mara-tragr = '0002'.
                w_material = t_mara-prdha+10(8).
                IF w_material IS INITIAL.
                  CONTINUE.
                ENDIF.
                CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
                     EXPORTING
                          input        = w_material
                     IMPORTING
                          output       = w_material
                     EXCEPTIONS
                          length_error = 1
                          OTHERS       = 2.
                IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                ENDIF.
      
      * Logic to check if the parent material rec exists
                READ TABLE t_knmt WITH KEY kunnr = t_file-kunnr
                                          matnr = w_material
                                          vkorg = t_knmt-vkorg
                                          vtweg = t_knmt-vtweg.
                IF sy-subrc EQ 0.
                  LOOP AT t_knmt WHERE kunnr = t_file-kunnr AND
                           matnr = w_material AND
                            vkorg = t_knmt-vkorg AND
                            vtweg = t_knmt-vtweg.
                    IF t_knmt-werks EQ t_file-werks.
                      MOVE-CORRESPONDING t_file TO t_done.
                      t_done-vkorg = t_knmt-vkorg.
                      t_done-vtweg = t_knmt-vtweg.
                      t_done-matnr = w_material.
                      t_done-flag = 'X'.
                      APPEND t_done.
                      CLEAR t_done.
                      w_unchange = w_unchange + 1.
                      CONTINUE.
                    ELSE.
                      IF t_knmt-werks+0(1) = '9'.
                        MOVE-CORRESPONDING t_file TO t_error.
                        t_error-matnr = w_material.
                        t_error-text = text-007.
                        APPEND t_error.
                        w_invalid = w_invalid + 1.
                        CONTINUE.
                      ENDIF.
                      t_update-matnr = w_material.
                      t_update-kunnr = t_file-kunnr.
                      t_update-vkorg = t_knmt-vkorg.
                      t_update-vtweg = t_knmt-vtweg.
                      t_update-werks = t_file-werks.
                      t_update-prctr = t_file-prctr.
                      t_update-uebto = t_create-uebto.
                      t_update-untto = t_create-untto.
                      t_update-werks1 = t_knmt-werks.
                      APPEND t_update.
                      CONTINUE.
                    ENDIF.
                  ENDLOOP.
                ELSE.
                  CLEAR: t_create-bismt,t_create-btext.
                  t_create-matnr = w_material.
                  APPEND t_create.
                ENDIF.
              ENDIF.
      *        CLEAR t_create.
            ENDLOOP.
          ENDIF.
      
        ENDLOOP.
      
        SORT t_create BY kunnr matnr vkorg vtweg werks.
        SORT t_update BY kunnr matnr vkorg vtweg werks.
      
        DELETE ADJACENT DUPLICATES FROM t_create COMPARING kunnr matnr vkorg
        vtweg werks.
      
        DELETE ADJACENT DUPLICATES FROM t_update COMPARING kunnr matnr vkorg
        vtweg werks.
      ENDFORM.                    " separate_entries
      *&---------------------------------------------------------------------*
      *&      Form  update_cmir
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM update_cmir.
      
        LOOP AT t_update.
      
      *    SET PARAMETER ID 'KUN' FIELD char1.
      *    SET PARAMETER ID 'VKO' FIELD char1.
      *    SET PARAMETER ID 'VTW' FIELD char1.
      *    SET PARAMETER ID 'MAT' FIELD char1.
      
          CLEAR:bdcdata,messtab.
          REFRESH:bdcdata,messtab.
      
          PERFORM bdc_dynpro      USING 'RV10A001' '1000'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KUNNR'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'KUNNR'
                                        t_update-kunnr.
          PERFORM bdc_field       USING 'VKORG'
                                        t_update-vkorg.
          PERFORM bdc_field       USING 'VTWEG'
                                        t_update-vtweg.
          PERFORM bdc_field       USING 'MATNR_R-LOW'
                                        t_update-matnr.
          PERFORM bdc_dynpro      USING 'RV10A001' '1000'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KUNNR'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ONLI'.
          PERFORM bdc_field       USING 'KUNNR'
                                        t_update-kunnr.
          PERFORM bdc_field       USING 'VKORG'
                                        t_update-vkorg.
          PERFORM bdc_field       USING 'VTWEG'
                                        t_update-vtweg.
          PERFORM bdc_field       USING 'MATNR_R-LOW'
                                        t_update-matnr.
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-MATNR(01)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SELE'.
          PERFORM bdc_field       USING 'MV10A-SELKZ(01)'
                                        'X'.
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0300'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-UEBTO'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SICH'.
          PERFORM bdc_field       USING 'MV10A-WERKS'
                                        t_update-werks.
      
          READ TABLE t_ztval WITH KEY typecode2 = 'PRCTR'
                                      value2 = t_update-prctr.
          IF sy-subrc EQ 0.
            IF t_ztval-value = 'POWDER_COATINGS'.
              CLEAR:w_untto,w_uebto.
              t_update-untto = '10'.
              t_update-uebto = '10'.
      
              READ TABLE t_ztval_1 WITH KEY value = t_update-kunnr.
              IF sy-subrc EQ 0.
                CLEAR: t_update-untto,t_update-uebto.
              ENDIF.
              WRITE t_update-untto TO w_untto.
              WRITE t_update-uebto TO w_uebto.
              SHIFT w_untto LEFT DELETING LEADING space.
              SHIFT w_uebto LEFT DELETING LEADING space.
      
              PERFORM bdc_field       USING 'MV10A-UNTTO'
                                            w_untto.
              PERFORM bdc_field       USING 'MV10A-UEBTO'
                                            w_uebto.
            ENDIF.
          ENDIF.
      
          SET PARAMETER ID 'KUN' FIELD char1.
          SET PARAMETER ID 'VKO' FIELD char1.
          SET PARAMETER ID 'VTW' FIELD char1.
          SET PARAMETER ID 'MAT' FIELD char1.
      
          CALL TRANSACTION 'VD52' USING bdcdata
                           MODE   p_mode
                           UPDATE 'S'
                           MESSAGES INTO messtab.
      *    READ TABLE messtab WITH KEY msgtyp = 'E'.
      *    IF sy-subrc EQ 0.
          IF sy-subrc NE 0.
      *        READ TABLE messtab WITH KEY msgtyp = 'E'.
            READ TABLE messtab INDEX 1 .
      
            w_error = w_error + 1.
            PERFORM keep_session USING 'VD52'.
            w_record = 'X'.
      * Check and Add*
            CALL FUNCTION 'MESSAGE_TEXT_BUILD'
                 EXPORTING
                      msgid               = messtab-msgid
                      msgnr               = messtab-msgnr
                      msgv1               = messtab-msgv1
                      msgv2               = messtab-msgv2
                      msgv3               = messtab-msgv3
                      msgv4               = messtab-msgv4
                 IMPORTING
                      message_text_output = w_message.
            t_error-flag = 'X'.
            MOVE-CORRESPONDING t_update TO t_error.
            t_error-text = w_message.
            APPEND t_error.
            CLEAR t_error.
      * Check and add*
          ELSE.
            MOVE-CORRESPONDING t_update TO t_done.
            t_done-flag = 'U'.
            APPEND t_done.
            CLEAR t_done.
            w_u_done = w_u_done + 1.
          ENDIF.
        ENDLOOP.
      
      ENDFORM.                    " update_cmir
      *&---------------------------------------------------------------------*
      *&      Form  bdc_dynpro
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *      -->P_1407   text
      *      -->P_1408   text
      *----------------------------------------------------------------------*
      FORM bdc_dynpro USING program dynpro.
        CLEAR bdcdata.
        bdcdata-program  = program.
        bdcdata-dynpro   = dynpro.
        bdcdata-dynbegin = 'X'.
        APPEND bdcdata.
      
      ENDFORM.                    " bdc_dynpro
      *&---------------------------------------------------------------------*
      *&      Form  bdc_field
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *      -->P_1432   text
      *      -->P_T_UPDATE_VTWEG  text
      *----------------------------------------------------------------------*
      FORM bdc_field USING fnam fval.
        IF fval <> ''.
          CLEAR bdcdata.
          bdcdata-fnam = fnam.
          bdcdata-fval = fval.
          APPEND bdcdata.
        ENDIF.
      
      ENDFORM.                    " bdc_field
      *&---------------------------------------------------------------------*
      *&      Form  keep_session
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *      -->P_1550   text
      *----------------------------------------------------------------------*
      FORM keep_session USING    v_code TYPE sy-tcode.
      
        IF w_check = ''.
          CALL FUNCTION 'BDC_OPEN_GROUP'
               EXPORTING
                    group               = c_group
                    keep                = 'X'
                    user                = sy-uname
               IMPORTING
                     qid                = w_qid
               EXCEPTIONS
                    client_invalid      = 1
                    destination_invalid = 2
                    group_invalid       = 3
                    group_is_locked     = 4
                    holddate_invalid    = 5
                    internal_error      = 6
                    queue_error         = 7
                    running             = 8
                    system_lock_error   = 9
                    user_invalid        = 10
                    OTHERS              = 11.
          IF sy-subrc <> 0.
            WRITE: / 'BDC Open Group Failed',c_group.
          ENDIF.
        ENDIF.
      
        w_check = 'X'.
        CALL FUNCTION 'BDC_INSERT'
             EXPORTING
                  tcode            = v_code
             TABLES
                  dynprotab        = bdcdata
             EXCEPTIONS
                  internal_error   = 1
                  not_open         = 2
                  queue_error      = 3
                  tcode_invalid    = 4
                  printing_invalid = 5
                  posting_invalid  = 6
                  OTHERS           = 7.
      
        IF sy-subrc <> 0.
          WRITE: / 'BDC Insert Failed'.
        ENDIF.
      
        w_record = 'X'.
      
      ENDFORM.                    " keep_session
      *&---------------------------------------------------------------------*
      *&      Form  create_cmir
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM create_cmir.
      
        LOOP AT t_create.
          CLEAR:bdcdata,messtab,w_untto,w_uebto.
          REFRESH:bdcdata,messtab.
      
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0100'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-VKORG'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'MV10A-KUNNR'
                                        t_create-kunnr.
          PERFORM bdc_field       USING 'MV10A-VKORG'
                                        t_create-vkorg.
          PERFORM bdc_field       USING 'MV10A-VTWEG'
                                        t_create-vtweg.
      
      
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-MATNR(01)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'MV10A-MATNR(01)'
                                        t_create-matnr.
      
      
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-MATNR(01)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SELE'.
          PERFORM bdc_field       USING 'MV10A-SELKZ(01)'
                                        'X'.
      
      
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0300'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MV10A-UEBTO'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SICH'.
      
          WRITE t_create-untto TO w_untto.
          WRITE t_create-uebto TO w_uebto.
          SHIFT w_untto LEFT DELETING LEADING space.
          SHIFT w_uebto LEFT DELETING LEADING space.
      *    perform bdc_field       using 'MV10A-KDMAT'
      *                                  t_create-bismt.
      *    perform bdc_field       using 'MV10A-POSTX'
      *                                  t_create-btext.
          PERFORM bdc_field       USING 'MV10A-WERKS'
                                        t_create-werks.
          PERFORM bdc_field       USING 'MV10A-UNTTO'
                                        w_untto.
          PERFORM bdc_field       USING 'MV10A-UEBTO'
                                        w_uebto.
          PERFORM bdc_field       USING 'MV10A-LPRIO'
                                        '00'.
      
          SET PARAMETER ID 'KUN' FIELD char1.
          SET PARAMETER ID 'VKO' FIELD char1.
          SET PARAMETER ID 'VTW' FIELD char1.
          SET PARAMETER ID 'MAT' FIELD char1.
      
          CALL TRANSACTION 'VD51' USING bdcdata
                           MODE   p_mode
                           UPDATE 'S'
                           MESSAGES INTO messtab.
      *    READ TABLE messtab INDEX 1.
      *    READ TABLE messtab WITH KEY msgtyp = 'E'.
      
      *    IF sy-subrc EQ 0.
          IF sy-subrc NE 0.
      *        READ TABLE messtab WITH KEY msgtyp = 'E'.
            READ TABLE messtab INDEX 1.
      
            w_error = w_error + 1.
            PERFORM keep_session USING 'VD51'.
            w_record = 'X'.
      
      * Check and Add*
            CALL FUNCTION 'MESSAGE_TEXT_BUILD'
                 EXPORTING
                      msgid               = messtab-msgid
                      msgnr               = messtab-msgnr
                      msgv1               = messtab-msgv1
                      msgv2               = messtab-msgv2
                      msgv3               = messtab-msgv3
                      msgv4               = messtab-msgv4
                 IMPORTING
                      message_text_output = w_message.
            t_error-flag = 'X'.
            MOVE-CORRESPONDING t_create TO t_error.
            t_error-text = w_message.
            APPEND t_error.
            CLEAR t_error.
      * Check and add*
          ELSE.
            MOVE-CORRESPONDING t_create TO t_done.
            t_done-flag = 'C'.
            APPEND t_done.
            CLEAR t_done.
            w_c_done = w_c_done + 1.
          ENDIF.
      
        ENDLOOP.
      
      ENDFORM.                    " create_cmir
      *&---------------------------------------------------------------------*
      *&      Form  end_message
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM end_message.
      
        WRITE:   / 'Records Successfully Updated:',w_u_done,
                 / 'Records Successfully Created:',w_c_done,
                 / 'Records Unchanged:',w_unchange,
                 / 'Records Failed Validation:',w_invalid.
      
      *  SORT: t_error,t_done.
      *  DELETE ADJACENT DUPLICATES from t_error.
      *  DELETE ADJACENT DUPLICATES from t_done.
      
        IF NOT w_error IS INITIAL.
          WRITE:/ 'The following BDC Session was created:','ZOTCIGT001.',
                / 'Records Written to BDC Session:',w_error.
        ENDIF.
      
        IF NOT t_error[] IS INITIAL.
          READ TABLE t_error WITH KEY flag = ''.
          IF sy-subrc EQ 0.
            SKIP 2.
            WRITE:/ 'The following records failed validation'.
      *      WRITE: / 'Customer',11(18)'Material',30(15) 'Profit Center',
      *                 46(5)'Plant',52(40) 'Error Text'.
      
            WRITE : /  'Customer' , 11(25)'Name' , 38(18)'Material' ,
      58(40)'Description' , 100(15)'Profit Center' , 117(5)'Plant' ,
      125(40)'Error text' .
            LOOP AT t_error WHERE flag = ''.
      *       WRITE: / t_error-kunnr,11(18) t_error-matnr,30(15) t_error-prctr
      *,
      *                     46(5) t_error-werks,52(40) t_error-text.
      *----
              SELECT SINGLE name1 INTO t_error-name1 FROM kna1 WHERE kunnr =
              t_error-kunnr .
      
      *select single maktx into t_error-maktx from kna1 where matnr =
      *t_error-matnr .
      *----
            WRITE : / t_error-kunnr,11(25) t_error-name1,38(18) t_error-matnr,
                                   58(40) t_error-maktx,100(15) t_error-prctr,
                                   117(5) t_error-werks,125(40) t_error-text .
      
            ENDLOOP.
          ENDIF.
        ENDIF.
      
        READ TABLE t_done WITH KEY flag = 'X'.
        IF sy-subrc EQ 0.
          SKIP 2.
          WRITE:/ 'The following records were not changed:'.
      *    WRITE: / 'Customer',11(18)'Material',30(15) 'Profit Center',
      *               46(5)'Plant',52(10)'Sales Org',63(12)'Dist Channel'..
      WRITE: / 'Customer',11(25)'Name' ,38(18)'Material', 58(40)'Description',
                      100(15)'Profit Center',117(5)'Plant',125(10)'Sales Org',
                                              136(12)'Dist Channel'.
      
          LOOP AT t_done WHERE flag = 'X'.
      *      WRITE: / t_done-kunnr,11(18) t_done-matnr,30(15) t_done-prctr,
      *             46(5) t_done-werks,52(10) t_done-vkorg,63(12) t_done-vtweg
      *----
            SELECT SINGLE name1 INTO t_done-name1 FROM kna1 WHERE kunnr =
            t_done-kunnr .
      *----
      
            WRITE: / t_done-kunnr,11(25) t_done-name1,38(18) t_done-matnr,
                     58(40) t_done-maktx,100(15) t_done-prctr,
                117(5) t_done-werks, 125(4) t_done-vkorg, 136(2) t_done-vtweg.
      
      
          ENDLOOP.
        ENDIF.
      
        READ TABLE t_done WITH KEY flag = 'U'.
        IF sy-subrc EQ 0.
          SKIP 2.
          WRITE:/ 'The following records were updated:'.
      *    WRITE: / 'Customer',11(18)'Material',30(15) 'Profit Center',
      *               46(5)'Plant',52(10)'Sales Org',63(12)'Dist Channel',
      *               76(16)'Overridden Plant'.
        WRITE: / 'Customer',11(25)'Name',38(18)'Material',58(40)'Description',
                      100(15)'Profit Center',117(5)'Plant',125(10)'Sales Org',
                              136(12)'Dist Channel',150(16)'Overridden Plant'.
      
          LOOP AT t_done WHERE flag = 'U'.
      *      WRITE: / t_done-kunnr,11(18) t_done-matnr,30(15) t_done-prctr,
      *             46(5) t_done-werks,52(10) t_done-vkorg,63(12) t_done-vtweg
      *,
      *             76(16) t_done-werks1.
      
      *----
            SELECT SINGLE name1 INTO t_done-name1 FROM kna1 WHERE kunnr =
            t_done-kunnr .
      *----
      
            WRITE: / t_done-kunnr,11(25) t_done-name1,38(18) t_done-matnr,
                 58(40) t_done-maktx,100(15) t_done-prctr,117(5) t_done-werks,
                     125(10) t_done-vkorg,136(12) t_done-vtweg,
                     150(16) t_done-werks1.
      
      
          ENDLOOP.
        ENDIF.
      
        READ TABLE t_done WITH KEY flag = 'C'.
        IF sy-subrc EQ 0.
          SKIP 2.
          WRITE:/ 'The following records were created:'.
      *    WRITE: / 'Customer',11(18)'Material',30(15) 'Profit Center',
      *               46(5)'Plant',52(10)'Sales Org',63(12)'Dist Channel'.
      WRITE: / 'Customer',11(25)'Name' ,38(18)'Material', 58(40)'Description',
                      100(15)'Profit Center',117(5)'Plant',125(10)'Sales Org',
                                      136(12)'Dist Channel'.
      
          LOOP AT t_done WHERE flag = 'C'.
      *      WRITE: / t_done-kunnr,11(18) t_done-matnr,30(15) t_done-prctr,
      *             46(5) t_done-werks,52(10) t_done-vkorg,63(12) t_done-vtweg
      *.
      
      *----
            SELECT SINGLE name1 INTO t_done-name1 FROM kna1 WHERE kunnr =
            t_done-kunnr .
      *----
      
            WRITE: / t_done-kunnr,11(25) t_done-name1,38(18) t_done-matnr,
                     58(40) t_done-maktx,100(15) t_done-prctr,
                117(5) t_done-werks, 125(4) t_done-vkorg, 136(2) t_done-vtweg.
      
          ENDLOOP.
        ENDIF.
      
        SKIP 2.
        IF NOT w_error IS INITIAL.
          WRITE:/ 'The following records have failed in CALL TRANSACTION'.
      
      *    WRITE: / 'Customer',11(18)'Material',30(15) 'Profit Center',
      *                 46(5)'Plant',52(40) 'Error Text'.
        WRITE: / 'Customer',11(25)'Name',38(18)'Material',58(40)'Description',
                   100(15) 'Profit Center',117(5)'Plant',125(40) 'Error Text'.
      
          LOOP AT t_error WHERE flag = 'X'.
      *      WRITE: / t_error-kunnr,11(18) t_error-matnr,30(15) t_error-prctr,
      *                   46(5) t_error-werks,52(256) t_error-text.
      
      *----
            SELECT SINGLE name1 INTO t_error-name1 FROM kna1 WHERE kunnr =
            t_error-kunnr .
      *----
      
            WRITE: / t_error-kunnr,11(25) t_error-name1,38(18) t_error-matnr,
              58(40) t_error-maktx,100(15) t_error-prctr,
              117(5) t_error-werks,125(256) t_error-text.
      
          ENDLOOP.
        ENDIF.
      ENDFORM.                    " end_message
      *&---------------------------------------------------------------------*
      *&      Form  write_error_file
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM write_error_file.
      
        CLEAR:t_data.
        REFRESH t_data.
      
        CHECK NOT p_e_path IS INITIAL.
      
        LOOP AT t_error.
          CONCATENATE t_error-kunnr t_error-name1 t_error-matnr t_error-maktx
         t_error-prctr t_error-bismt t_error-btext t_error-werks t_error-text
         INTO t_data SEPARATED BY '|'.
      
          APPEND t_data.
          CLEAR t_data.
      
        ENDLOOP.
      
      *  CALL FUNCTION 'FILE_GET_NAME'
      *            EXPORTING
      *       CLIENT                        = SY-MANDT
      *       LOGICAL_FILENAME              = P_E_PATH
      *       OPERATING_SYSTEM              = SY-OPSYS
      **   PARAMETER_1                   = ' '
      **   PARAMETER_2                   = ' '
      **   PARAMETER_3                   = ' '
      **   USE_PRESENTATION_SERVER       = ' '
      **   WITH_FILE_EXTENSION           = ' '
      **   USE_BUFFER                    = ' '
      **   ELEMINATE_BLANKS              = 'X'
      *           IMPORTING
      **   EMERGENCY_FLAG                =
      **   FILE_FORMAT                   =
      *             FILE_NAME                     = w_file1
      *           EXCEPTIONS
      *             FILE_NOT_FOUND                = 1
      *             OTHERS                        = 2
      *                    .
      *  IF SY-SUBRC <> 0.
      *    MESSAGE S130 WITH p_e_path.
      *  ENDIF.
      
      *  IF sy-subrc EQ 0.
        w_file1 = p_e_path.
        OPEN DATASET w_file1 FOR OUTPUT IN TEXT MODE.
        IF sy-subrc EQ 0.
          LOOP AT t_data.
            TRANSFER t_data TO w_file1.
            CLEAR t_data.
          ENDLOOP.
        ELSE.
          MESSAGE s905.
        ENDIF.
        CLOSE DATASET w_file1.
      *  ENDIF.
      
        WRITE: 'Error File written to:',w_file1.
        SKIP 2.
      
      
      ENDFORM.                    " write_error_file
      *&---------------------------------------------------------------------*
      *&      Form  spool_automation
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM spool_automation.
      
        DATA : w_zotc_agentemail TYPE zotc_agentemail,
               mailname TYPE sood1-objnam,
               mailtitel TYPE sood1-objdes,
               l_tcode TYPE tcode,
               l_svariant TYPE variant.
      
        IF t_abaplist[] IS INITIAL.
          FREE t_abaplist.
          CALL FUNCTION 'SAVE_LIST'
               EXPORTING
                    list_index         = '0'
               TABLES
                    listobject         = t_abaplist
               EXCEPTIONS
                    list_index_invalid = 1
                    OTHERS             = 2.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
      
        SELECT SINGLE tcode FROM tstc INTO l_tcode WHERE pgmna = sy-repid.
      
        l_svariant = sy-slset.
      
        SELECT * FROM zotc_agentemail
        INTO TABLE t_zotc_agentemail
        WHERE tcode    = l_tcode
          AND svariant = l_svariant.
      
        CHECK NOT t_zotc_agentemail[] IS INITIAL.
      
        CLEAR w_zotc_agentemail.
        LOOP AT t_zotc_agentemail INTO w_zotc_agentemail.
      
          CALL FUNCTION 'Z_ZV70_EMAIL_FAX_ABAP_LIST'
               EXPORTING
                    distribution_info = w_zotc_agentemail
                    title             = sy-title
               TABLES
                    t_abaplist        = t_abaplist
                    t_lines           = t_faxlines.
          CLEAR w_zotc_agentemail.
        ENDLOOP.
      
        CLEAR:t_abaplist,t_faxlines,t_zotc_agentemail.
        REFRESH:t_abaplist,t_faxlines,t_zotc_agentemail.
      
      
      
      ENDFORM.                    " spool_automation
      *&---------------------------------------------------------------------*
      *&      Form  down_list_for_background
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM down_list_for_background.
      
        TABLES: tbtcp.
      
        DATA: l_start_line TYPE i,
                l_end_line   TYPE i.
      
        l_start_line = 1.
        l_end_line   = l_start_line + 999999.
      
        SELECT listident sdldate sdltime UP TO 1 ROWS
         FROM   tbtcp
         INTO  (tbtcp-listident,
                tbtcp-sdldate,
                tbtcp-sdltime)
         WHERE  progname EQ sy-repid
           AND  variant  EQ sy-slset
         ORDER BY sdldate DESCENDING sdltime DESCENDING.
        ENDSELECT.
      
        IF NOT tbtcp-listident IS INITIAL.
          SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
                          WITH rqident = tbtcp-listident
                          WITH first   = l_start_line
                          WITH last    = l_end_line.
      
          FREE t_abaplist.
          CALL FUNCTION 'LIST_FROM_MEMORY'
               TABLES
                    listobject = t_abaplist
               EXCEPTIONS
                    not_found  = 1
                    OTHERS     = 2.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
      
      
      ENDFORM.                    " down_list_for_background
      *&---------------------------------------------------------------------*
      *&      Form  get_phy_file
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *  -->  p1        text
      *  <--  p2        text
      *----------------------------------------------------------------------*
      FORM get_phy_file.
      
        DATA:   c_path(30) VALUE '/interfaces/',
                c_dir(30),
                c_slash(1)        TYPE c VALUE '/'.
      
        CONCATENATE c_slash sy-sysid c_path INTO c_dir.
      
        CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
             EXPORTING
                  directory        = c_dir
                  filemask         = '*.*'
             IMPORTING
                  serverfile       = p_u_path
             EXCEPTIONS
                  canceled_by_user = 1
                  OTHERS           = 2.
        IF sy-subrc NE 0.
          MESSAGE e000(zotc) WITH 'Error while opening File'
                                    space space space.
        ENDIF.
      
      
      ENDFORM.                    " get_phy_file
      

      Regards,

      Varun .

  • Posted on Aug 31, 2006 at 12:55 AM

    Hi Varun,

    Yes, clear with the requirement.

    You do not want the spool output of the RSBDCSUB but you want the spool output of the error messages.

    DATA: PARAMS LIKE PRI_PARAMS,

    ARPARAMS LIKE ARC_PARAMS,

    DAYS(1) TYPE N VALUE 2,

    COUNT(3) TYPE N VALUE 1,

    VALID TYPE C.

    CALL FUNCTION 'GET_PRINT_PARAMETERS'

    EXPORTING DESTINATION = 'LT50'

    COPIES = COUNT

    LIST_NAME = 'TEST'

    LIST_TEXT = 'Test NEW-PAGE PRINT ON'

    IMMEDIATELY = ' '

    RELEASE = 'X'

    NEW_LIST_ID = 'X'

    EXPIRATION = DAYS

    LINE_SIZE = 79

    LINE_COUNT = 23

    LAYOUT = 'X_PAPER'

    SAP_COVER_PAGE = 'X'

    RECEIVER = 'SAP*'

    DEPARTMENT = 'System'

    SAP_OBJECT = 'RS'

    AR_OBJECT = 'TEST'

    ARCHIVE_ID = 'XX'

    ARCHIVE_INFO = 'III'

    ARCHIVE_TEXT = 'Description'

    NO_DIALOG = ' '

    IMPORTING OUT_PARAMETERS = PARAMS

    VALID = VALID.

    IF VALID <> SPACE.

    <b> <b>NEW-PAGE PRINT ON PARAMETERS PARAMS

    KEEP IN SPOOL 'X' " (Keep list after

    printing?)</b>

    NO DIALOG.</b>

    loop at it_error.

    WRITE / 'First line'.

    write :/ it_error-message.

    endloop.

    ENDIF.

    Best regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi ,

      Thank you all for your valuable time and useful replies .

      No code changes are necessary but while defining the job in sm36 I unchecked the output immediately and delete after output and the problem is solved .

      Regards,

      varun .

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.