2007 Apr 17 6:23 AM
Hi,
I am written my conditions in User exit save_document_prepare
and in that I have given custom error message. After the error I have to correct the
quantity value and then save it.
But when I am trying to change after error mesasage it gives an Abort message
"Item xxxx doesnot exist."
Here is my code pls help me regarding this
DATA : FLAG(2),
FCODE LIKE SY-UCOMM,
FCODE = SY-UCOMM.
IF FLAG <> 'X'.
IF SY-TCODE = 'VA01'.
IF SY-UCOMM = 'SICH' OR SY-UCOMM = 'OPT1'.
DATA: BEGIN OF T_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
VGBEL LIKE VBAK-VGBEL,
AUART LIKE VBAK-AUART,
NETWR LIKE VBAK-NETWR,
END OF T_VBAK.
DATA : BEGIN OF T_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
ZMENG LIKE VBAP-ZMENG,
KWMENG LIKE VBAP-KWMENG,
END OF T_VBAP.
DATA : BEGIN OF I_VBUK OCCURS 0,
VBELN TYPE VBUK-VBELN,
RFGSK TYPE VBUK-RFGSK,
END OF I_VBUK.
DATA : T_VBAK_RE LIKE T_VBAK OCCURS 0 WITH HEADER LINE,
WA_VBAK TYPE VBAK.
DATA : I_NETWR1 TYPE VBAK-NETWR,
I_NETWR2 TYPE VBAK-NETWR,
I_NETWR3 TYPE VBAK-NETWR.
DATA : L_VBELN TYPE VBAK-VBELN.
SELECT VBELN VGBEL AUART NETWR
FROM VBAK
INTO TABLE T_VBAK.
IF NOT T_VBAK[] IS INITIAL.
SELECT VBELN RFGSK
FROM VBUK
INTO TABLE I_VBUK
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
ENDIF.
SORT T_VBAK BY VBELN DESCENDING.
IF NOT T_VBAK[] IS INITIAL.
SELECT VBELN POSNR ZMENG KWMENG
FROM VBAP
INTO TABLE T_VBAP
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
ENDIF.
LOOP AT T_VBAK where VGBEL = XVBAK-VGBEL.
IF T_VBAK-AUART = 'TA'.
I_NETWR2 = T_VBAK-NETWR + I_NETWR2.
ENDIF.
ENDLOOP.
LOOP AT T_VBAK WHERE VBELN = XVBAK-VGBEL.
IF T_VBAK-AUART = 'TISC'.
I_NETWR1 = T_VBAK-NETWR.
ENDIF.
ENDLOOP.
I_NETWR3 = I_NETWR1 - I_NETWR2.
WA_VBAK = XVBAK.
READ TABLE T_VBAP WITH KEY VBELN = VBAK-VBELN.
IF SY-SUBRC = 0.
LOOP AT XVBAP.
READ TABLE XVBAP WITH KEY VBELN = SPACE.
IF SY-SUBRC = 0.
MOVE T_VBAK-VBELN TO XVBAP-VBELN.
MODIFY XVBAP.
ENDIF.
ENDLOOP.
IF FLAG <> 'X'.
IF WA_VBAK-AUART <> 'RE'.
IF WA_VBAK-NETWR > I_NETWR3.
MESSAGE E000(ZMS1) WITH I_NETWR3.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Thanks in Advance
Ravi
2007 Apr 17 11:15 AM
Hi,
This error comes when we use the work area taht is already defined in the program and that u have not created in this exit.
i think in this exit, u have created ur own internal table and workarea for all tables except XVBAP.
just create WA like
<b>data : xvbap type xvbap.</b>
LOOP AT XVBAP.
READ TABLE XVBAP WITH KEY VBELN = SPACE.
IF SY-SUBRC = 0.
MOVE T_VBAK-VBELN TO XVBAP-VBELN.
MODIFY XVBAP.
ENDIF.
ENDLOOP.
IF FLAG <> 'X'.
i had faced the same problem and it got solved in this way.
Hope it helps.
Regards,
Sonika
Hi,
This error comes when we use the work area taht is already defined in the program and that u have not created in this exit.
i think in this exit, u have created ur own internal table and workarea for all tables except XVBAP.
just create WA like
<b>data : xvbap type xvbap.</b>
LOOP AT XVBAP.
READ TABLE XVBAP WITH KEY VBELN = SPACE.
IF SY-SUBRC = 0.
MOVE T_VBAK-VBELN TO XVBAP-VBELN.
MODIFY XVBAP.
ENDIF.
ENDLOOP.
IF FLAG <> 'X'.
i had faced the same problem and it got solved in this way.
Hope it helps.
Regards,
Sonika
2007 Apr 17 10:54 AM
Use Information Mesage instead of Error. In general error message will stop the processing.
2007 Apr 17 11:15 AM
Hi,
This error comes when we use the work area taht is already defined in the program and that u have not created in this exit.
i think in this exit, u have created ur own internal table and workarea for all tables except XVBAP.
just create WA like
<b>data : xvbap type xvbap.</b>
LOOP AT XVBAP.
READ TABLE XVBAP WITH KEY VBELN = SPACE.
IF SY-SUBRC = 0.
MOVE T_VBAK-VBELN TO XVBAP-VBELN.
MODIFY XVBAP.
ENDIF.
ENDLOOP.
IF FLAG <> 'X'.
i had faced the same problem and it got solved in this way.
Hope it helps.
Regards,
Sonika
2007 Apr 17 12:18 PM
2007 Apr 17 12:43 PM
While excuting your User exit ERROR message will trigerring so that program execution will stop instead of Error message u will you Information
Please rewards If help this
Best Regards,
Satya.
2007 Apr 17 11:16 AM
check that your exit is compliant with SAP guidelines to exit development.
you can find them in SAP note 0381348 Using user exit, customer exit, VOFM in SD.
Also do not use Error message as stated in the previous post.
pls. reward if helpful
Roberto
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |