on 09-21-2010 5:01 AM
Hi Experts,
I am doing sap scripts where the program is riprov00 for Notification Overview. When I execute this report i am getting error MPORT FROM MEMORY error: program canceled whn i click on text it is saying
You have probably called up the program directly. However, it can only be called up through print control in the maintenance notification or or maintenance order.
How to run this program please help me I am new to scripts.
If you debug through the print program to where it's giving the error message, you can see that it's expecting an IMPORT from the calling transaction to verify that it was called from SAP - In my case IQS2.
Strangely, you can spoof this, using another EXPORT to MEMORY ID.
Essentially, the SAP Standard throws out loads of stuff to memory IDs then reads it back in. Not sure why it should work in such a way, rather than, say, an interface on a function module or paramaters on a report, or a method, but hey.
Be aware in my code I'm using a Notification Papers default of Z002, so you might need to change that to suit your config.
data: ID_IPRT_STRUCT(16) VALUE 'ID_IPRT_STRUCT'.
data: l_tq80 type tq80.
data: IVIQMEL type viqmel,
IVIQMFE type TAB_WQMFE,
IVIQMMA type tab_wqmma,
IVIQMSM type tab_wqmsm,
IVIQMUR type tab_wqmur,
IQKAT type TABLE OF qkat,
w_iqkat type qkat,
IHPAD_TAB TYPE TABLE OF IHPAD,
RIWO1 type riwo1,
RIWO020 TYPE TABLE OF RIWO020,
RIWO00 type RIWO00,
rqm00 type rqm00.
data T_QPK1CDTAB type TABLE OF QPK1CD.
data w_QPK1CDTAB type QPK1CD.
data T_CODEGRPTAB type TABLE OF QPK1CODEGRP.
data device type ITCPP-TDDEVICE.
data: iworkpaper TYPE WWORKPAPER.
data: Wworkpaper TYPE WWORKPAPER.
CALL FUNCTION 'READ_NOTIFICATION'
EXPORTING
QMNUM = i_QMNUM
IMPORTING
IVIQMEL = iVIQMEL
TABLES
IVIQMFE = IVIQMFE
IVIQMMA = IVIQMMA
IVIQMSM = IVIQMSM
IVIQMUR = IVIQMUR
TRIWO020TAB = RIWO020
EXCEPTIONS
INVALID_NUMBER = 1
OTHERS = 2.
"Get IQKAT.
select single * from tq80 into l_tq80 where qmart = iviqmel-qmart.
CALL FUNCTION 'QPK1_GP_CODE_ARRAY_SELECTION'
EXPORTING
I_KATALOGART = l_TQ80-MFKAT
I_CODE = '*'
I_SPRACHE = SY-LANGU
I_NO_AUTHORITY_CHECK = 'X' "YX
TABLES
T_QPK1CDTAB = T_QPK1CDTAB
T_CODEGRPTAB = T_CODEGRPTAB
EXCEPTIONS
NO_MATCH_IN_RANGE = 1
NO_AUTHORIZATION = 2
NO_SELECTION_SPECIFIED = 3
OBJECT_LOCKED = 4
LOCK_ERROR = 5
OBJECT_MISSING = 6
OTHERS = 7.
LOOP AT T_QPK1CDTAB into w_QPK1CDTAB.
MOVE-CORRESPONDING w_QPK1CDTAB TO w_IQKAT.
MOVE w_QPK1CDTAB-VERSION TO w_IQKAT-VERSIONCD.
MOVE w_QPK1CDTAB-GUELTIGAB TO w_IQKAT-GUELTIGCD.
APPEND w_IQKAT to iqkat.
ENDLOOP.
iworkpaper-PM_APPL = 'N'.
iworkpaper-WORKPAPER = 'Z002'.
iworkpaper-TDDEST = 'LOCL'.
iworkpaper-TDCOPIES = '1'.
iworkpaper-TDNEWID = 'X'.
iworkpaper-TDRECEIVER = sy-uname.
iworkpaper-SELECTED = 'X'.
iworkpaper-PRINT_LANG = 'E'.
WWORKPAPER = IWORKPAPER.
DEVICE = 'PRINTER'.
EXPORT IWORKPAPER from iworkpaper TO MEMORY ID 'ID_IPRT_PAPERS'.
EXPORT device from device TO MEMORY ID 'ID_IPRT_PAPERS'.
CALL FUNCTION 'PM_GET_PARTNER_INFO'
EXPORTING
OBJECT_NUMBER = IVIQMEL-OBJNR "partner for object
TABLES
IHPAD_TAB_EXP = IHPAD_TAB. "table of partners with texts
MOVE-CORRESPONDING Iviqmel TO riwo1.
*-> Texte nachlesen
CALL FUNCTION 'IWO1_GET_OBJECT_DATA'
EXPORTING
i_riwo1 = riwo1
IMPORTING
e_riwo1 = riwo1
EXCEPTIONS
OTHERS = 1.
RQM00-txtqm = 'Mech Eng DYN'.
RQM00-KZ_PLOS_IN = 'X'.
RQM00-XCHPF = 'X'.
RQM00-sernp = 'X'.
exPORT IVIQMEL = IVIQMEL " ... Notification
IVIQMFE = IVIQMFE " ... positions
IVIQMMA = IVIQMMA " ... codes
IVIQMSM = IVIQMSM " ... codes
IVIQMUR = IVIQMUR " ... codes
IQKAT = IQKAT " ... Catalogue
IHPAD_TAB = IHPAD_TAB " ... partner table
RIWO1 = RIWO1 " ... Texts from Objects
RIWO00 = RIWO00 " ... Dialog structure with status info
to MEMORY ID ID_IPRT_STRUCT.
EXPORT RQM00 from rqm00 TO MEMORY ID 'ID_IPRT_RQM00'.
data: sy_uname type sy-uname.
data: sy_datum type sy-datum.
data: print_language type langu.
DATA: T390 type T390.
sy_uname = sy-uname.
sy_datum = sy-datum.
print_language = sy-langu.
select single * into t390 from t390 where WORKPAPER = 'Z002'.
export sy_uname from sy_uname to MEMORY ID 'ID_IPRT_OPTIONS'.
export sy_datum from sy_datum to MEMORY ID 'ID_IPRT_OPTIONS'.
export print_language from print_language to MEMORY ID 'ID_IPRT_OPTIONS'.
export DEVICE from DEVICE to MEMORY ID 'ID_IPRT_OPTIONS'.
EXPORT WWORKPAPER FROM WWORKPAPER TO MEMORY ID 'ID_IPRT_OPTIONS'.
EXPORT T390 FROM T390 TO MEMORY ID 'ID_IPRT_OPTIONS'.
submit ZHPE_RIPROV00_web and return.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
Yup. for a standard program you can call it from that transaction code and execute. try it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
To use a sap script you have to call it from a abap program(create it se38) makig use of fuction modules like start_form, open_form,write_form, close_form and end_form, where you will pass your sap script program as parameter and execute it. this is how you will execute SAP script. you can test and have your priview of your script, by going to utilities and select priview.
Regards
Vinodh A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.