Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BDC Recording Issue in Background

Former Member
0 Kudos

Gurus,

I did BDC recording of cost center report S_ALR_87013633 (cost center Actual/variance report). The reason for this recording is to be able to schedule it as a background job to run every month in which it will generate emails and send it to employees in reference to their cost center number.

I created a Z table with the cost centers and email address.

In this program, I changed the hard coded parameters with the field from the Z table which I call into an internal table. So I looped through this internal table and changed the hardcorded parameters (from the recording) to the fields of the internal table.

When I ran this program in foreground, it worked well, going through all the screens and sending the emails out.

When I schedule it to run in background, nothing happens. I tried it from the program it self using CALL TRANSACTION with background mode and even used the SESSION mode but nothing happens. I got this message.

CALL_TRANSACTION S_ALR_87013633 Return code = 1,001  RECORD:          0

S No batch input data for screen SAPLGRWOS 0100

I know there are some recording needs to be adjusted in other to run them in background. I've searched a lot of forums but couldn't get any answers.

Please help.

Basil.

Attached is a copy of the program.

8 REPLIES 8

ShyamPindiproli
Active Participant
0 Kudos

Hello Basil,

Use the options screen mode and update mode so as to collect the errors in an internal table I_BDCMESSAGE

This will help you analyze the reason using the error return codes.

CALL TRANSACTION 'S_ALR_87013633' USING I_BDCDATA

  MODE P_MODE         " Select from the Selection Screen (A,N,E options)

  UPDATE 'S'

  MESSAGES INTO I_BDCMESSAGE.

DATA MESSAGE TYPE MESSAGE.

LOOP AT I_BDCMESSAGE.

  CALL FUNCTION 'WRITE_MESSAGE'

       EXPORTING

            MSGID = I_BDCMESSAGE-MSGID

            MSGNO = I_BDCMESSAGE-MSGNR

            MSGTY = I_BDCMESSAGE-MSGTYP

            MSGV1 = I_BDCMESSAGE-MSGV1

            MSGV2 = I_BDCMESSAGE-MSGV2

            MSGV3 = I_BDCMESSAGE-MSGV3

            MSGV4 = I_BDCMESSAGE-MSGV4

       IMPORTING

            MESSG = MESSAGE.

  WRITE: / MESSAGE-MSGTX.

ENDLOOP.

Regards,

Shyam

0 Kudos

Thanks for your answer. I'm a bit confuse. Did you see my program I attached? Do I include your code to this or do I create a new program and include your code and my code?

\

Thanks

0 Kudos

Step 1. Goto SHDB and record the transaction again with the Simulate Background Option Checked.

Step 2. Replace the above piece of code with the CALL Transaction Call in your code and all error messages will be logged in the internal table I_BDCMESSAGE.

I beleive this should work.

Regards,

Shyam

former_member282968
Contributor
0 Kudos

Dear Basil,

The screen sequence may change while running in the background.So record the screen sequence in SHDB and process the recording using processing mode " Back ground processing".If it runs correctly cross check your BDC recording code.

If it says " No batch input data for screen SAPLGRWOS 0100" , at this screen one of the input field value in your screen sequence misses out while running in back ground processing.

With regards,

former_member213851
Active Contributor
0 Kudos

Hi Basil,

May be in the Background mode, one extra screen is coming which is not present in your recording and hence throwing the error 'No batch input data for screen SAPLGRWOS 0100'

I mean your recording is not suitable for Background mode although it works perfectly for Foreground mode. May be you can check if such unwanted screen is coming in Background mode.

or as said by Naveen, the screen sequence might have altered in Background mode , so record again using Background Simulation mode and then check.

Best Regards,

Sachin.

raymond_giuseppi
Active Contributor
0 Kudos

Looking at S_ALR_87013633 transaction, this is a Report Writer report (START_REPORT with type RW and report 1STD) You could call this report with the report-report interface.

Look at following FM :

- RSTI_APPL_STACK_POP (define sender/receiver)

- RSTI_APPL_STACK_INITIALIZE (initialize)

- RSTI_SELECTION_EXPORT (pass parameters/selections)

- RSTI_COMMUNICATION_HANDLER (execute)

Read help.sap.com documentation, FM documentation and in scn wiki ABAP Report-Report-Interface.

Regards,

Raymond

Former Member
0 Kudos

Guys, thanks for your replies.

When I try to record the report using "background simulation", it will not output the result. It got stuck with a message "Report Group 1STD".

So does this mean the report cannot be run in background?

So what will be a good way to run this report every month and send the result to the sales rep as an email with attachement?

I'm trying to read about what Raymond suggested, I don't really understand using the FMs:

RSTI_APPL_STACK_POP (define sender/receiver)

- RSTI_APPL_STACK_INITIALIZE (initialize)

- RSTI_SELECTION_EXPORT (pass parameters/selections)

- RSTI_COMMUNICATION_HANDLER (execute).

I will be glad if you can shed a bit more light on that please.

Thanks.

0 Kudos

Small sample to help you, but try to read online help of the FM and perform some where-used on your system.

* Sender/Receiver

  clear gs_sender. " This report is sender

  gs_sender-rtool = 'RT'.

  gs_sender-rappl = space.

  gs_sender-rsubc = space.

  gs_sender-ronam = sy-repid.

* Receiver (from S_ALR_87013019 transaction definition)

  clear gs_receiver. " Define receiver; RONAM syntax depends on RTOOL/RAPPL

  gs_receiver-rtool = 'RW'.

  gs_receiver-ronam = '6OBU'.

* Selection-screen fields list

  refresh gt_fields.

  clear gt_fields.

  gt_fields-field    = 'KOKRS'.

  gt_fields-rollname = 'KOKRS'.

  gt_fields-domname  = 'CACCD'.

  gt_fields-memoryid = 'CAC'.

  append gt_fields.

  clear gt_fields.

  gt_fields-field    = 'AUFNR'.

  gt_fields-rollname = 'AUFNE'.  " Data element

  gt_fields-domname  = 'AUFNR'.   " Domain

  gt_fields-memoryid = 'ANR'.     " Set/get-parameter

  append gt_fields.

* selection-screen values

  refresh gt_sel.

  clear gt_sel.

  gt_sel-field  = 'KOKRS'.

  gt_sel-sign   = 'I'.                  " (I)nclude or (E)xclude

  gt_sel-option = 'EQ'.                 " EQ/BT/CS ...

  gt_sel-low    = p_kokrs.

  append gt_sel.

  clear gt_sel.

  gt_sel-field  = 'AUFNR'.

  gt_sel-sign   = 'I'.                  " (I)nclude or (E)xclude

  loop at gt_values into gs_values.

    gt_sel-option = 'BT'.                 " EQ/BT/CS ...

    gt_sel-low    = gs_values-from.

    gt_sel-high   = gs_values-to.

    gt_sel-hclass = '0103'.

    gt_sel-hienm = gv_setid.

    gt_sel-leaf = 'X'.

    gt_sel-basic = 'X'.

    append gt_sel.

  endloop.

* call report via report-report-interface

  call function 'RSTI_APPL_STACK_POP'

    importing

      i_rec                      = gs_sender

    exceptions

      appl_stack_not_initialized = 1.

  if sy-subrc <> 0.

    call function 'RSTI_APPL_STACK_INITIALIZE'

      exporting

        e_appl = gs_sender-rappl

        e_subc = gs_sender-rsubc

        e_tool = gs_sender-rtool

        e_onam = gs_sender-ronam.

  endif.

  call function 'RSTI_SELECTION_EXPORT'

    tables

      it_sel    = gt_sel

      it_fields = gt_fields.

  call function 'RSTI_COMMUNICATION_HANDLER'

    exporting

      e_rexec                    = 'X'

      e_fccls                    = '9'

      e_rec                      = gs_receiver

    exceptions

      appl_stack_not_initialized = 1

      no_lines                   = 2

      no_line_picked             = 3

      others                     = 4.

Regards,

Raymond