Skip to Content
0
Former Member
Jan 06, 2008 at 03:29 AM

PRODUCT-RECEIPT CODE

50 Views

PROGRAM ZSAPMASH1.(TOP INCULDE).

tables : ZRECEIPT,ZSTOCKTAB.

TYPES: BEGIN OF ZSTOCKTAB_PROTAB,

PRONO TYPE ZPRONO,

PROTYP TYPE ZPROTYP,

ZDAYS TYPE INT2,

END OF ZSTOCKTAB_PROTAB.

data : ok_code type sy-ucomm,

WA_ZRECEIPT_INS TYPE ZRECEIPT,

WA_ZSTOCKTAB_PROTAB TYPE ZSTOCKTAB_PROTAB,

WA_ZSTOCKTAB_INS TYPE ZSTOCKTAB,

WA_ZSTOCKTAB TYPE ZSTOCKTAB.

&----


*& Include ZI01 *

&----


&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

WHEN 'INS'.

IF sy-datum+4(2) = '01'.

WA_ZRECEIPT_INS-ZMONTH = 'JAN'.

ENDIF.

WA_ZRECEIPT_INS-RECNO = ZRECEIPT-RECNO.

WA_ZRECEIPT_INS-PRONO = ZRECEIPT-PRONO.

WA_ZRECEIPT_INS-RECDAT = SY-DATUM.

WA_ZRECEIPT_INS-DEALNO = ZRECEIPT-DEALNO.

WA_ZRECEIPT_INS-PROPRI = ZRECEIPT-PROPRI .

WA_ZRECEIPT_INS-QUANTITY = ZRECEIPT-QUANTITY.

WA_ZRECEIPT_INS-VALUE = ZRECEIPT-QUANTITY * ZRECEIPT-PROPRI.

  • WA_ZRECEIPT_INS-ZMONTH = ZRECEIPT-ZMONTH.

INSERT INTO ZRECEIPT VALUES WA_ZRECEIPT_INS .

SELECT SINGLE * FROM ZSTOCKTAB

INTO wa_zstocktab

WHERE PRONO = ZRECEIPT-PRONO

AND RECDAT = ZRECEIPT-RECDAT.

IF SY-SUBRC IS initial.

UPDATE ZSTOCKTAB

SET QUANTITY = QUANTITY + ZRECEIPT-QUANTITY

WHERE PRONO = ZRECEIPT-PRONO

AND RECDAT = ZRECEIPT-RECDAT.

ELSE.

SELECT SINGLE PRONO PROTYP

ZDAYS

FROM ZPROTAB

INTO WA_ZSTOCKTAB_PROTAB

WHERE PRONO = ZRECEIPT-PRONO.

WA_ZSTOCKTAB_INS-PRONO = ZRECEIPT-PRONO.

WA_ZSTOCKTAB_INS-RECDAT = SY-DATUM.

WA_ZSTOCKTAB_INS-PRONO = ZRECEIPT-PRONO.

WA_ZSTOCKTAB_INS-QUANTITY = ZRECEIPT-QUANTITY.

WA_ZSTOCKTAB_INS-PROTYP = WA_ZSTOCKTAB_PROTAB-PROTYP.

WA_ZSTOCKTAB_INS-EXPDAT = SY-DATUM +

WA_ZSTOCKTAB_PROTAB-ZDAYS.

INSERT INTO ZSTOCKTAB VALUES WA_ZSTOCKTAB_INS.

ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'CLOSE'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT