Skip to Content

BDC program in Foreground and Background

Hi,

I have a requirement from client to write a BDC program which can upload the data in TABLES in foreground and background. There will be a flag for FOREGROUND on the screen, if user clicks the FOREGROUND FLAG then data should be uploaded in foreground and if flag is blank than should be in background. What statements should I used to accomplish this logic in a BDC program.

Thanks.

minisap

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 04:27 PM

    Hello,

    Check this sample.

    SELECTION-SCREEN BEGIN OF BLOCK BLCK1 WITH FRAME TITLE TEXT-002.
    PARAMETERS: FILENAME LIKE EPSF-EPSDIRNAM
                DEFAULT '\\FS000P01\D48\ANSKA\SAP_R3_ANSKA_FILES.TXT'.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN ULINE.
    PARAMETERS: AP RADIOBUTTON GROUP GRP1,
                PC RADIOBUTTON GROUP GRP1.
    SELECTION-SCREEN END OF BLOCK BLCK1.
    
    START-OF-SELECTION.
      IF NOT AP IS INITIAL.
        
        PERFORM UPLOAD_APPLICATION_SERVER TABLES IT_FILE
                                          USING  FILENAME
                                        CHANGING RC.
      ENDIF.
      IF NOT PC IS INITIAL.
        PERFORM UPLOAD_WORKSTATION TABLES IT_FILE
                                   USING  FILENAME
                                 CHANGING RC.
      ENDIF.
    
    FORM UPLOAD_APPLICATION_SERVER TABLES   P_ITAB_DATA STRUCTURE IT_FILE
                                   USING    P_FILENAME
                                   CHANGING P_RC.
      CHECK P_RC IS INITIAL.
      OPEN DATASET P_FILENAME FOR INPUT IN TEXT MODE.
      IF SY-SUBRC = 0.
        DO.
          READ DATASET P_FILENAME INTO P_ITAB_DATA.
          IF SY-SUBRC <> 0.
            EXIT.
          ENDIF.
          APPEND P_ITAB_DATA.
        ENDDO.
        CLOSE DATASET P_FILENAME.
        P_RC = 0.
      ELSE.
        P_RC = 4.
      ENDIF.
    
    
    ENDFORM.                    " upload_application_server
    
    FORM UPLOAD_WORKSTATION TABLES   P_ITAB_DATA STRUCTURE IT_FILE
                            USING    P_FILENAME
                            CHANGING P_RC.
    
      DATA: FILENAME LIKE  RLGRAP-FILENAME.
    
      FILENAME = P_FILENAME.
      CLEAR P_RC.
    
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
    *   CODEPAGE                      = ' '
          FILENAME                      = FILENAME
          FILETYPE                      = 'ASC'
    *   HEADLEN                       = ' '
    *   LINE_EXIT                     = ' '
    *   TRUNCLEN                      = ' '
    *   USER_FORM                     = ' '
    *   USER_PROG                     = ' '
    *   DAT_D_FORMAT                  = ' '
    * IMPORTING
    *   FILELENGTH                    =
        TABLES
          DATA_TAB                      = P_ITAB_DATA
        EXCEPTIONS
          CONVERSION_ERROR              = 1
          FILE_OPEN_ERROR               = 2
          FILE_READ_ERROR               = 3
          INVALID_TYPE                  = 4
          NO_BATCH                      = 5
          UNKNOWN_ERROR                 = 6
          INVALID_TABLE_WIDTH           = 7
          GUI_REFUSE_FILETRANSFER       = 8
          CUSTOMER_ERROR                = 9
          OTHERS                        = 10
                .
      IF SY-SUBRC <> 0.
        P_RC = SY-SUBRC.
      ENDIF.
    
    
    ENDFORM.                    " upload_workstation
    
    

    Hope this will solve ur issue.

    Cheers,

    Vasanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:22 PM

    For foreground, you can use CALL TRANSACTION and for background, you can use the session method.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

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.