Skip to Content
avatar image
Former Member

Using SUBMIT in RFC giving error

Hi Experts

I have created a RFC and in that i am calling another program to get some data using SUBMIT with a bunch of selection value. New if i run it in SAP through SE37 then it works fine, but if somebody calls this RFC from some third party software like .NET then it gives error on SUBMIT statement saying "NOT_SUPPORTED_BY_GUI".

Kindly help me to resolve it.

Thanks in advance

Regards

Ashutosh 

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 30, 2014 at 08:09 PM

    Hi,

    does you SUBMItted program try to do any kind of screen interaction? An RFC call is a background task where no GUI or screen or user is avaliable.

    If the SUBMItted program runs as background job (try using SA38 and F9) then it will also run when submitted by RFC function.

    BTW: What program do you submit, what does the dump tell you about source code where the error occurred?

    Regards

    Clemens

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 29, 2014 at 01:36 PM

    Hello Ashutosh,

       Instead of Submiting the report directly, try to Schedule a Background Job for that report from RFC.

    Sample code:

    CALL FUNCTION 'JOB_OPEN'

         EXPORTING

           DELANFREP        = 'X'

           JOBNAME          = L_NAME

         IMPORTING

           JOBCOUNT         = L_NUMBER

         EXCEPTIONS

           CANT_CREATE_JOB  = 1

           INVALID_JOB_DATA = 2

           JOBNAME_MISSING  = 3

           OTHERS           = 4.

       IF SY-SUBRC <> 0.

    *   Implement suitable error handling here

       ELSE.

    *   Schdule Background job for Report 

         SUBMIT ZXXXX TO SAP-SPOOL

    *                      WITH S_VBELN = R_VBELN

                SPOOL PARAMETERS PRINT_PARAMS WITHOUT SPOOL DYNPRO

                            USER 'SAPBATCH'  "SY-UNAME

                         VIA JOB L_NAME

                          NUMBER L_NUMBER

                             AND RETURN.

         IF SY-SUBRC = 0.

    *     Close Job

           CALL FUNCTION 'JOB_CLOSE'

             EXPORTING

               JOBCOUNT             = L_NUMBER

               JOBNAME              = L_NAME

               STRTIMMED            = 'X'

             EXCEPTIONS

               CANT_START_IMMEDIATE = 1

               INVALID_STARTDATE    = 2

               JOBNAME_MISSING      = 3

               JOB_CLOSE_FAILED     = 4

               JOB_NOSTEPS          = 5

               JOB_NOTEX            = 6

               LOCK_FAILED          = 7

               INVALID_TARGET       = 8

               OTHERS               = 9.

           IF SY-SUBRC <> 0.

    *       Implement suitable error handling here

           ENDIF.

           CONCATENATE 'Background Job with Name' L_NAME 'Scheduled Sucessfully'

                  INTO RETURN-MESSAGE SEPARATED BY SPACE.

           APPEND RETURN.

         ENDIF.

       ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ashutosh,

        It may take some time to complete the Back ground Job. It may causes no data from Memory.. So try to give some time before importing the Data. 

        First Execute it in Foreground in debug mode. Stop after scheduling the Back ground Job for some time and wait untill successful completion of the the Job. then execute remaining and get it from Memory..

        If the memory return values, you can write 'wait untill n sec..' statement before 'Import final..' statement..

        Try to find out the reason for Cancelling the Job & try without selection table in Submit for Testing purpose..

      Regards,

      Raghu

  • Dec 30, 2014 at 12:22 PM

    Hi Ashutosh,

    The background job will work in a separate session, so i doubt whether the data you exported to memory can be used inside the submitted program. Also you will have to add a wait till the background job complete the execution to get the output. imo, here also the import will not work as the batch job runs in a different session).

    Regards,

    Murali

    Add comment
    10|10000 characters needed characters exceeded