2008 May 03 4:57 AM
hi,
i had made a Function Module which will reterive the production order,but when i use it in the program it gives runtime error.Plzz help me how to solve this problem.
1st i am pasting the code which i had written:-
FUNCTION ZFIND_PRDORD.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(QP_CHARG) LIKE CHVW-CHARG OPTIONAL
*" VALUE(P_AUFNR) LIKE CHVW-AUFNR OPTIONAL
*" EXPORTING
*" VALUE(P_RETVAL) LIKE CHVW-AUFNR
*"----
DATA : BEGIN OF T_CHVW OCCURS 0,
XZUGA LIKE CHVW-XZUGA,
WERKS LIKE CHVW-WERKS,
MATNR LIKE CHVW-MATNR,
CHARG LIKE CHVW-CHARG,
AUFNR LIKE CHVW-AUFNR,
EBELN LIKE CHVW-EBELN,
MBLNR LIKE CHVW-MBLNR,
ZEILE LIKE CHVW-ZEILE,
BUDAT LIKE CHVW-BUDAT,
SHKZG LIKE CHVW-SHKZG,
BWART LIKE CHVW-BWART,
MENGE LIKE CHVW-MENGE,
MEINS LIKE CHVW-MEINS,
KZBEW LIKE CHVW-KZBEW,
END OF T_CHVW.
SELECT XZUGA WERKS MATNR CHARG AUFNR EBELN
MBLNR ZEILE BUDAT SHKZG BWART MENGE MEINS KZBEW
FROM CHVW INTO TABLE T_CHVW
WHERE CHARG EQ QP_CHARG
and XZUGA = ' '
AND BWART = '101'
and aufnr eq p_aufnr
AND KZBEW = 'F' .
P_RETVAL = T_CHVW-AUFNR.
ENDFUNCTION.
Now i am displaying the program for testing this FM which gives the runtime error:-
TABLES : CHVW.
SELECT-OPTIONS : P_CHARG FOR CHVW-CHARG,
P_AUFNR FOR CHVW-AUFNR .
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = P_AUFNR.
WRITE : / 'SDSQDA' .
Plzz help me out as how to solve this problem as i have to use it in
the main program.
regards,
ric.s
2008 May 03 6:13 AM
HI SANTOSH,
I had removed the SELECT-OPTION from the program and i am filling the batch no.
only and when i execute the program it gives the output blank.
DATA: P_AUFNR LIKE CHVW-AUFNR.
SO PLZZ TELL WHY IT IS GIVING OUTPUT BLANK?
hi,
i had made a Function Module which will reterive the production order,but when i use it in the program it gives runtime error.Plzz help me how to solve this problem.
1st i am pasting the code which i had written:-
FUNCTION ZFIND_PRDORD.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(QP_CHARG) LIKE CHVW-CHARG OPTIONAL
*" VALUE(P_AUFNR) LIKE CHVW-AUFNR OPTIONAL
*" EXPORTING
*" VALUE(P_RETVAL) LIKE CHVW-AUFNR
*"----
DATA : BEGIN OF T_CHVW OCCURS 0,
XZUGA LIKE CHVW-XZUGA,
WERKS LIKE CHVW-WERKS,
MATNR LIKE CHVW-MATNR,
CHARG LIKE CHVW-CHARG,
AUFNR LIKE CHVW-AUFNR,
EBELN LIKE CHVW-EBELN,
MBLNR LIKE CHVW-MBLNR,
ZEILE LIKE CHVW-ZEILE,
BUDAT LIKE CHVW-BUDAT,
SHKZG LIKE CHVW-SHKZG,
BWART LIKE CHVW-BWART,
MENGE LIKE CHVW-MENGE,
MEINS LIKE CHVW-MEINS,
KZBEW LIKE CHVW-KZBEW,
END OF T_CHVW.
SELECT XZUGA WERKS MATNR CHARG AUFNR EBELN
MBLNR ZEILE BUDAT SHKZG BWART MENGE MEINS KZBEW
FROM CHVW INTO TABLE T_CHVW
WHERE CHARG EQ QP_CHARG
and XZUGA = ' '
AND BWART = '101'
and aufnr eq p_aufnr
AND KZBEW = 'F' .
P_RETVAL = T_CHVW-AUFNR.
ENDFUNCTION.
Now i am displaying the program for testing this FM which gives the runtime error:-
TABLES : CHVW.
SELECT-OPTIONS : P_CHARG FOR CHVW-CHARG,
P_AUFNR FOR CHVW-AUFNR .
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = P_AUFNR.
WRITE : / 'SDSQDA' .
Plzz help me out as how to solve this problem as i have to use it in
the main program.
regards,
ric.s
2008 May 03 5:05 AM
Hi Ric,
1. In SE37 first execute your Function module and check with some test data's. If it is retrieve the correct data means its working fine.
2. Then try to anylyse the Runtime error. Using TRansaction ST22 you can analyse the runtime error.
3. otherwise just copy and paste the error description here.
Thanks.
2008 May 03 5:07 AM
hi,
The problem could be ... The parameters given to the FM has to be a parameter than a select-options as select-options is a table ...
Parameters : P_CHARG like CHVW-CHARG,
P_AUFNR like CHVW-AUFNR .
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = P_AUFNR.
WRITE : / 'SDSQDA' .
Regards,
Santosh
2008 May 03 5:44 AM
HI SANTOSH,
I had changed according what u said and it is not giving runtime error .
but it is not giving the value as if i send the value of batch and the prd orderr. plz tell me how do it get the output.
i had written the code of program like this:-
TABLES : CHVW.
Parameters : P_CHARG like CHVW-CHARG,
P_AUFNR like CHVW-AUFNR.
DATA: PRD LIKE CHVW-AUFNR.
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = PRD.
WRITE : / PRD .
PLZ HELPMEOUT HOW TO DO THIS.
2008 May 03 5:50 AM
hi,
Two more changes has to be made ...
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_aufnr
IMPORTING
OUTPUT = p_aufnr.
SELECT XZUGA WERKS MATNR CHARG AUFNR EBELN
MBLNR ZEILE BUDAT SHKZG BWART MENGE MEINS KZBEW
FROM CHVW INTO TABLE T_CHVW
WHERE CHARG EQ QP_CHARG
and XZUGA = ' '
AND BWART = '101'
and aufnr eq p_aufnr
AND KZBEW = 'F' .
if sy-subrc = 0.
read table T_CHVW index 1.
if sy-subrc = 0.
P_RETVAL = T_CHVW-AUFNR.
endif.
endif.
Regards,
Santosh
2008 May 03 5:59 AM
HI SANTOSH,
Thanks for your help.i am rewarding u for ur help .can u suggest me i have to make FM for Batches also. now should i make it in the similar way ?
moreover ,can ii have ur email-id so that in future i can have help from you.
2008 May 03 6:13 AM
HI SANTOSH,
I had removed the SELECT-OPTION from the program and i am filling the batch no.
only and when i execute the program it gives the output blank.
DATA: P_AUFNR LIKE CHVW-AUFNR.
SO PLZZ TELL WHY IT IS GIVING OUTPUT BLANK?
2008 May 03 6:29 AM
2008 May 03 6:32 AM
hi santosh,
here 's d code:-
TABLES : CHVW.
PARAMETERS : P_CHARG LIKE CHVW-CHARG.
DATA: PRD LIKE CHVW-AUFNR.
DATA: P_AUFNR LIKE CHVW-AUFNR.
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = PRD.
WRITE : / PRD .
when on screen i fill the batch no. noly it does not give the produciotn order no.
why it is not giving the putput?
2008 May 03 6:42 AM
hi,
It is because there are no records found in the table with blank aufnr and with the conditions given in the where condition of your select statement ... if you are looking for all the aufnr's in that case do this way ....
if not p_aufnr is initial.
SELECT XZUGA WERKS MATNR CHARG AUFNR EBELN
MBLNR ZEILE BUDAT SHKZG BWART MENGE MEINS KZBEW
FROM CHVW INTO TABLE T_CHVW
WHERE CHARG EQ QP_CHARG
and XZUGA = ' '
AND BWART = '101'
and aufnr eq p_aufnr
AND KZBEW = 'F' .
if sy-subrc = 0.
endif.
else.
SELECT XZUGA WERKS MATNR CHARG AUFNR EBELN
MBLNR ZEILE BUDAT SHKZG BWART MENGE MEINS KZBEW
FROM CHVW INTO TABLE T_CHVW
WHERE CHARG EQ QP_CHARG
and XZUGA = ' '
AND BWART = '101'
AND KZBEW = 'F' .
if sy-subrc = 0.
endif.
endif.
if not T_CHVW[] is initial.
read table T_CHVW index 1.
if sy-subrc = 0.
P_RETVAL = T_CHVW-AUFNR.
endif.
endif.
Regards,
Santosh
2008 May 03 7:36 AM
hi santosh,
thanks for your help now it is working fine i was having hint the explanation u gave but i am not dat confident.
any ways it is working fine i will reward you full 10 points for that.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |