cancel
Showing results for 
Search instead for 
Did you mean: 

zvbeln should generate automnatic number

former_member664907
Discoverer
0 Kudos
99

hello

i have a problem regarding auto generate of temp sales order number.

when i debug this program it shows some number in zvbeln but when i execute the program it automatically saved the program but the temp no. is not saved in ztable.

the program is as under :-



SET PF-STATUS 'SAVE'.
*CASE SY-UCOMM.


* END
* CASE SY-UCOMM.
* WHEN 'SAVE'.
*break-point.
*WHEN 'SAVE'.
IF SY-UCOMM = 'SAVE'.


.
SELECT MAX( ZVBELN ) FROM ZLIPS INTO P_VBELN WHERE VBELN = WA_ZLIPS-ZVBELN.

WA_ZLIPS-ZVBELN = P_VBELN + 1 .



*BREAK-POINT.

move wa_zlips-vbeln to wa_final-vbeln.
move wa_zlips-posnr to wa_final-posnr.
move wa_zlips-MATNR to wa_final-MATNR.
MOVE WA_zlips-ZIEME TO WA_final-ZIEME.
MOVE WA_zlips-UMZIZ TO WA_final-UMZIZ.
MOVE WA_zlips-MEINS TO WA_final-MEINS.
MOVE WA_zlips-UMZIN TO WA_final-UMZIN.
MOVE WA_zlips-WERKS TO WA_final-WERKS.
MOVE WA_zlips-ERDAT TO WA_final-ERDAT.
MOVE WA_zlips-MAKTX TO WA_final-MAKTX.

append wa_zlips to it_zLIPS.
* APPEND WA_ZLIPS TO IT_FINAL.

modify zlips from table it_final.

if sy-subrc = 0.
MESSAGE : 'NEW TEMPORARY ORDER NO.' TYPE 'I'.
endif.

ENDIF.

MESSAGE : 'DATA HAS BEEN SUCCESSFULLY SAVED' TYPE 'S'.

*WHEN 'BACK'.
IF SY-UCOMM = 'BACK'.
LEAVE PROGRAM.
ENDIF.
* WHEN 'EXIT'.
IF SY-UCOMM = 'EXIT'.
* LEAVE TO SCREEN 0.
LEAVE PROGRAM.
ENDIF.
* WHEN 'CANCEL'.
IF SY-UCOMM = 'CANCEL'.
LEAVE PROGRAM.
* LEAVE PROGRAM.
ENDIF.

VeselinaPeykova
Active Contributor
0 Kudos

Are you by any chance a colleague of the user asking this question: temporary sales order should be generated automatically when click on save button.

The code in the question looks very similar to what you posted and from the looks of it OP has not finalized the development yet.

To be fair, this code does not make much sense to me, why don't you debug it?

By the way, the concept does not look good to me, I hope that this is just an exercise or test and not the final design.

Accepted Solutions (0)

Answers (1)

Answers (1)

dev_parbutteea
Active Contributor

1. You are moving all data to WA_FINAL

2. You are appending WA_ZLIPS to IT_ZLIPS but modifying your table from IT_FINAL !!

Guess where is the issue ??

append wa_zlips to it_zLIPS.
* APPEND WA_ZLIPS TO IT_FINAL.
modify zlips from table it_final.