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: 

JOB SUBMIT

Former Member
0 Kudos
447

Hi,

Im starting to create jobs in SAP ABAP...

I saw this method

SUBMIT zz_00_scheduled_report

WITH SELECTION-TABLE it_seltab VIA

JOB lv_jobname NUMBER lv_jobnumber AND RETURN .

the selection-table it_seltab

Do I have access to it in my report zz_00_scheduled_report ?

If yes how ?

Thanks !

1 ACCEPTED SOLUTION

Former Member
0 Kudos
208

Excerpts from SAP Documentation:

-


If you specify WITH SELECTION-TABLE rspar addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:

SELNAME (length 8),

KIND (length 1),

SIGN (length 1),

OPTION (length 2),

LOW (length 45),

HIGH (length 45).

To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:

SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals

KIND must contain the type of selection screen component (P for parameters, S for selection criteria)

SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.

If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.

The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.

-


I hope it is clear now.If you still have questions, let us know.

Regards,

Shyam

7 REPLIES 7

Former Member
0 Kudos
209

Excerpts from SAP Documentation:

-


If you specify WITH SELECTION-TABLE rspar addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:

SELNAME (length 8),

KIND (length 1),

SIGN (length 1),

OPTION (length 2),

LOW (length 45),

HIGH (length 45).

To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:

SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals

KIND must contain the type of selection screen component (P for parameters, S for selection criteria)

SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.

If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.

The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.

-


I hope it is clear now.If you still have questions, let us know.

Regards,

Shyam

Former Member
0 Kudos
208

I want to supply a custom internal table to my report with my own fields

My report will not have selection screen

the report will only contains --> calls function module using some parameters of the internal table that I provided in the with selection-table and other things but none interaction with the user ...

0 Kudos
208

For that you have 2 options:

1) Directly pass the table as import parameter to the funciton module

2) Use ABAP memory (EXPORT itab to MEMORY ID id)

Regards,

Shyam

0 Kudos
208

Seems that you didn't understand well what I want to do.

I have to create jobs (monthly, weekly) from my abap program when the user fill in some fields in the web dynpro and push the schedule button.

I have to remember those fields cause I need them in my abap report that will be called when the job runs.

I have to pass those parameters into the job and then have access to them in my report ...

I need parameters , variants ??? I have issues, problems on how to do that

Thanks !

0 Kudos
208

How to pass parameters to my job, I want to have access to them in my report after

Is it possible ?

Thanks

0 Kudos
208

This is one method if its called in background. In background export/import will not work

check this sample


REPORT  yksdbg1.

TABLES:indx.

TYPES:BEGIN OF ty_data,
      matnr TYPE mara-matnr,
      mtart TYPE mara-mtart,
      END OF ty_data.

DATA:it_data TYPE TABLE OF ty_data.

DATA: indxkey TYPE indx-srtfd VALUE 'ITDATA'.

DATA: jobname LIKE tbtcjob-jobname VALUE 'TRANSFER DATA'.

DATA: jobcount LIKE tbtcjob-jobcount,
      host LIKE msxxlist-host.
DATA: BEGIN OF starttime.
        INCLUDE STRUCTURE tbtcstrt.
DATA: END OF starttime.

DATA: starttimeimmediate LIKE btch0000-char1 VALUE 'X'.


START-OF-SELECTION.

  SELECT matnr mtart INTO TABLE it_data FROM mara UP TO 100 ROWS.
  CHECK it_data[] IS NOT INITIAL.
  indx-aedat = sy-datum.
  indx-usera = sy-uname.

  EXPORT it_data TO DATABASE indx(st) ID indxkey. "Also you can pass single values/internal tables

* Job open
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      delanfrep        = ' '
      jobgroup         = ' '
      jobname          = jobname
      sdlstrtdt        = sy-datum
      sdlstrttm        = sy-uzeit
    IMPORTING
      jobcount         = jobcount
    EXCEPTIONS
      cant_create_job  = 01
      invalid_job_data = 02
      jobname_missing  = 03.


  SUBMIT yksdbg2 AND RETURN
                 USER sy-uname
                 VIA JOB jobname
                 NUMBER jobcount.


  starttime-sdlstrtdt = sy-datum + 1.
  starttime-sdlstrttm = '220000'.
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
      jobcount             = jobcount
      jobname              = jobname
      strtimmed            = starttimeimmediate
    EXCEPTIONS
      cant_start_immediate = 01
      invalid_startdate    = 02
      jobname_missing      = 03
      job_close_failed     = 04
      job_nosteps          = 05
      job_notex            = 06
      lock_failed          = 07
      OTHERS               = 99.


REPORT  yksdbg2.

TABLES:indx.
type-pools:slis.

DATA: indxkey TYPE indx-srtfd VALUE 'ITDATA'.

TYPES:BEGIN OF ty_data,
      matnr TYPE mara-matnr,
      mtart TYPE mara-mtart,
      END OF ty_data.

DATA:it_data TYPE TABLE OF ty_data.
DATA:it_fcat TYPE slis_t_fieldcat_alv.
DATA:wa_cat LIKE LINE OF it_fcat.

START-OF-SELECTION.


  indx-aedat = sy-datum.
  indx-usera = sy-uname.

  IMPORT it_data FROM DATABASE indx(st) ID indxkey.

  wa_cat-fieldname = 'MATNR'.
  wa_cat-seltext_m = 'Part No'.
  append wa_cat to it_fcat.
  wa_cat-fieldname = 'MTART'.
  wa_cat-seltext_m = 'MAT type'.
  APPEND wa_cat TO it_fcat.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM             = sy-repid
     IT_FIELDCAT                    = IT_FCAT[]
    tables
      T_OUTTAB                       = IT_DATA[]
   exceptions
     PROGRAM_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.

Former Member
0 Kudos
208

Solved this with rsparams

Thanks !