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

BDC Session Saves Data Only in Foreground

I have created a bdc program to create an SM35 session of CA02. The wierd thing is that the session will run in background with no errors, but the data is not updated. If I run the session in foreground the data is updated. Have I overlooked something simple?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Dec 03, 2007 at 10:52 AM

    Hi Andrew,

    Try to check if sy-batch is being looked for in the standard program. You can then put a break-point there and debug.

    You can also, when running in foreground, change sy-batch to 'X' from the debugger and see if it works or not.

    Good luck,

    John.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 09:19 PM

    Check the session log. You will have some idea why it is going wrong.

    May be some status messages which says, "Field doesnot exists on the screen XXXX".

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 10:28 PM

    What's the last button you press for each routing when you run it in foreground? Is it save or enter? If it's save, you need to add this to your program.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Pavan Kothapalli

      To see what is going on, I commented out the save at the end to force it to error out. If I run the session in foreground the data is changed. If I run it in display errors only mode, the data is not changed. So it seems not to have anything to do with the save at the end. Perhaps it is now appropriate to post some of the code.

      After the data file is uploaded into the itab and the bdc group has been created, for each routing group I do the following:

        PERFORM dynpro USING:
      * ***   Initial Screen   ***
            'X'   'SAPLCPDI'       '1010',
            ' '   'RC271-PLNNR'    gk_rec-groupnum,
            ' '   'BDC_OKCODE'     '/00',
      * *** Header Overview  ***
            'X'   'SAPLCPDI'       '1200',
            ' '   'BDC_OKCODE'     'MTUE'.	"open material allocation screen
      

      Then for each material allocation the data file says to delete:

        PERFORM dynpro USING:
      * *** Material Allocation ***
            'X'   'SAPLCZDI'         '1010',
            ' '   'RC27X-ENTRY_ACT'  gv_entry,   "gv_entry holds row number to delete
            ' '   'BDC_OKCODE'       'ENT1',       "position button
            'X'   'SAPLCZDI'         '1010',
            ' '   'BDC_CURSOR'       'MAPL-MATNR(01)',  "place cursor on the line to delete
            ' '   'BDC_OKCODE'       'LOE',                      "delete line
            'X'   'SAPLSPO1'         '0100',
            ' '   'BDC_OKCODE'       'YES'.                      "confirm dialog
      

      then at the end of the session:

        PERFORM dynpro USING:
              'X'   'SAPLCZDI'       '1010',
              ' '   'BDC_OKCODE'     'BACK', "leave material allocation screen
              'X'   'SAPLCPDI'       '1200',
              ' '   'BDC_OKCODE'     'BU'.  "save
      

      Then, I insert into the bdc session using tcode ca02. All this given the following subroutine:

      FORM dynpro USING p_dynbegin TYPE any p_name TYPE any p_value TYPE any.
        CLEAR gk_bdc_tab.
      
        IF p_dynbegin = 'X'.
          MOVE:  p_name  TO gk_bdc_tab-program,
                 p_value TO gk_bdc_tab-dynpro,
                 'X'   TO gk_bdc_tab-dynbegin.
        ELSE.
          MOVE:  p_name  TO gk_bdc_tab-fnam,
                 p_value TO gk_bdc_tab-fval.
        ENDIF.
      
        APPEND gk_bdc_tab TO gt_bdc_tab.
      ENDFORM.
      

      It seems that the cursor isn't specifying the line to delete when run in background.

  • Posted on Dec 01, 2007 at 10:54 AM

    Hi Andrew,

    I understand your problem. For BDC session your giving flat file which is in local system ( i.e in presentation server) If the file in presentation server it will run in foreground only to run bdc in background make sure that your file is in application server. Then run the bdc your problem will be solved.

    OPEN DATASET <file name> FOR INPUT IN TEXT MODE ENCODING DEFAULT.

    Read dataset <file name> to itab.

    Close dataset <file name>.

    open dataset is used to open the file on application server. Press F1 on placing the courser on open dataset will get the required information.

    hope it will useful to you.

    <b>reward if useful</b>.

    regards,

    sunil kairam.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      The program uses a local file, which is loaded into an itab. This can't possible be the issues as I have created many other bdc programs using this methodology. Additionally, before this program was working fine with this method before I had to make some changes.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 10:54 AM

    just check what u have done at last in recording , (save or enter ),

    just check it once.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 04:11 AM

    Hi Andrew,

    Using which T-cod ur running in background. AFter running Go to SM37 give the job name as ' * ' (Astrick) and see is ur job status is <b>FINISHED</b> or <b>CANCELLED</b>. This can show is your background process is running succesfull or not. IF cancled check the job log what are the errors.

    regards,

    sunil kairam.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 09:09 PM

    otherwise check its related OSS Notes and apply the same. Its happens some times due to miss of pop up screens in between the flow of the transaction.

    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.