Thursday, October 18, 2007

Sample ABAP Program for Submitting report with selection table

REPORT submit_with_selection_table.
TABLES QMSM.
* Work area for internal table IQMSM
DATA: BEGIN OF WQMSM,
QMNUM LIKE QMSM-QMNUM,
MNGRP LIKE QMSM-MNGRP,
MNCOD LIKE QMSM-MNCOD,
ZZSTAT LIKE QMSM-ZZSTAT,
END OF WQMSM.

* WORK Area for internal table iseltab.
DATA: WSELTAB LIKE RSPARAMS.
*----------------------------------------------------------------------*
* Internal tables
*----------------------------------------------------------------------*
* selection table to pass to RIQMEL30
DATA: ISELTAB LIKE TABLE OF WSELTAB.
* Table of notification numbers selected - will be passed to riqmel30
DATA: IQMSM LIKE TABLE OF WQMSM.
*----------------------------------------------------------------------*
START-OF-SELECTION.
*----------------------------------------------------------------------*
REFRESH IQMSM.
SELECT QMNUM MNGRP MNCOD ZZSTAT
FROM QMSM INTO CORRESPONDING FIELDS OF TABLE IQMSM
WHERE MNGRP = 'ACTION'
AND MNCOD = 'CALL'
and ( zzqmart = 'ZE' or zzqmart = 'ZI' )
AND ZZSTAT = ' '.

* create selection table entries for field QMART

WSELTAB-SELNAME = 'QMART'.
WSELTAB-KIND = 'S'.
WSELTAB-SIGN = 'I'.
WSELTAB-OPTION = 'EQ'.
WSELTAB-LOW = 'ZE'.
APPEND WSELTAB TO ISELTAB.
WSELTAB-LOW = 'ZI'.
APPEND WSELTAB TO ISELTAB.

* Create selection table entries for QMNUM

CLEAR WSELTAB.
WSELTAB-SELNAME = 'QMNUM'.
WSELTAB-KIND = 'S'.
WSELTAB-SIGN = 'I'.
WSELTAB-OPTION = 'EQ'.
LOOP AT IQMSM INTO WQMSM.
WSELTAB-LOW = WQMSM-QMNUM.
APPEND WSELTAB TO ISELTAB.
ENDLOOP
*
* SUBMIT program with parameters passed in table ISELTAB
* Other parameters passed explicitly

SUBMIT RIQMEL30 WITH SELECTION-TABLE ISELTAB
WITH MNGRP = 'ACTION'
WITH MNCOD = 'CALL'
WITH DATUV = '00000000'
WITH DATUB = '99991231'
WITH STAI1 = 'TSRL'.

1 comment:

punyavathisiva said...

Excellent blog we got here on sap abap online training in hyderabad, usa, uk, canada.


sap abap online coures in hyderabad

sap abap online coures in usa