hey! I'm moving this blog to another platform.
It will continue on https://jumpifzero.github.io/
Thanks
Friday, July 8, 2016
Tuesday, May 3, 2016
SAP call SQ01 query and get results
This is way too hard for something so simple so I'm posting it here.
data: lr_data type ref to data,
lt_seltable type TABLE OF rsparams,
ls_seltable type rsparams.
ls_seltable-LOW = '20160427'.
ls_seltable-SIGN = 'I'.
ls_seltable-OPTION = 'EQ'.
ls_seltable-SELNAME = 'SP$00001'.
ls_seltable-kind = 'S'.
append ls_seltable to lt_seltable.
CALL FUNCTION 'RSAQ_QUERY_CALL'
EXPORTING
WORKSPACE = 'G'
QUERY = 'name_of_query'
USERGROUP = 'name_of_group_in_sq01'
* VARIANT = ' '
* DBACC = 0
SKIP_SELSCREEN = 'X'
DATA_TO_MEMORY = 'X'
* FREE_SELECTIONS =
IMPORTING
REF_TO_LDATA = lr_data
* LISTTEXT =
* LIST_ID =
* PROGRAM =
* USED_VARIANT =
TABLES
SELECTION_TABLE = lt_seltable
* LISTDESC =
* FPAIRS =
EXCEPTIONS
NO_USERGROUP = 1
NO_QUERY = 2
QUERY_LOCKED = 3
GENERATION_CANCELLED = 4
NO_SELECTION = 5
NO_VARIANT = 6
JUST_VIA_VARIANT = 7
NO_SUBMIT_AUTH = 8
NO_DATA_SELECTED = 9
DATA_TO_MEMORY_NOT_POSSIBLE = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
data: lr_data type ref to data,
lt_seltable type TABLE OF rsparams,
ls_seltable type rsparams.
ls_seltable-LOW = '20160427'.
ls_seltable-SIGN = 'I'.
ls_seltable-OPTION = 'EQ'.
ls_seltable-SELNAME = 'SP$00001'.
ls_seltable-kind = 'S'.
append ls_seltable to lt_seltable.
CALL FUNCTION 'RSAQ_QUERY_CALL'
EXPORTING
WORKSPACE = 'G'
QUERY = 'name_of_query'
USERGROUP = 'name_of_group_in_sq01'
* VARIANT = ' '
* DBACC = 0
SKIP_SELSCREEN = 'X'
DATA_TO_MEMORY = 'X'
* FREE_SELECTIONS =
IMPORTING
REF_TO_LDATA = lr_data
* LISTTEXT =
* LIST_ID =
* PROGRAM =
* USED_VARIANT =
TABLES
SELECTION_TABLE = lt_seltable
* LISTDESC =
* FPAIRS =
EXCEPTIONS
NO_USERGROUP = 1
NO_QUERY = 2
QUERY_LOCKED = 3
GENERATION_CANCELLED = 4
NO_SELECTION = 5
NO_VARIANT = 6
JUST_VIA_VARIANT = 7
NO_SUBMIT_AUTH = 8
NO_DATA_SELECTED = 9
DATA_TO_MEMORY_NOT_POSSIBLE = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Subscribe to:
Posts (Atom)