Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

I have a problem while changing quantity value in VA01

Former Member
0 Likes
1,187

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

1 ACCEPTED SOLUTION
Read only

former_member632991
Active Contributor
0 Likes
897

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,

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

5 REPLIES 5
Read only

Former Member
0 Likes
897

Use Information Mesage instead of Error. In general error message will stop the processing.

Read only

former_member632991
Active Contributor
0 Likes
898

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

Read only

0 Likes
897

Hi,

Thanks for the reply. It solved the problem ....

Read only

0 Likes
897

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.

Read only

rmazzali
Active Contributor
0 Likes
897

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