*&---------------------------------------------------------------------*
*& Report ZPURPRG1 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZPURPRG1.
TABLES: EKPO,
EKET.
DATA:BEGIN OF ZPUR_TAB,
EBELN1 LIKE EKKO-EBELN,
EBELP1 LIKE EKPO-EBELP,
EINDT1 LIKE EKET-EINDT,
MENGE1 LIKE EKET-MENGE,
AMOUNT1 LIKE EKPO-NETWR,
MATNR1 LIKE EKPO-MEINS,
TXZ1 LIKE EKPO-TXZ01,
IDNLF1 LIKE EKPO-IDNLF,
MEINS1 LIKE EKPO-MEINS,
NETPR1 LIKE EKPO-NETPR,
END OF ZPUR_TAB.
data: EBELN2 LIKE EKKO-EBELN,
EBELP2 LIKE EKPO-EBELP,
amount1 like ekpo-netwr,
Curr1 LIKE SY-WAERS,
Langu LIKE SY-LANGU,
words1 LIKE SPELL.
FORM SUB1 TABLES INTTAB STRUCTURE itcsy
OUTTAB STRUCTURE itcsy.
read table inttab index 1.
amount1 = inttab-value.
read table inttab index 2.
curr1 = inttab-value.
read table inttab index 3.
langu = inttab-value.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = amount1
CURRENCY = curr1
FILLER = ' '
LANGUAGE = langu
IMPORTING
IN_WORDS = words1
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
* WRITE WORDS1.
if sy-subrc = 0.
read table outtab index 1.
move words1-WORD to outtab-value.
shift outtab-value left deleting leading space.
modify outtab index sy-tabix.
read table outtab index 2.
move words1-decword to outtab-value.
shift outtab-value left deleting leading space.
modify outtab index sy-tabix.
read table outtab index 3.
move words1-dig02 to outtab-value.
shift outtab-value left deleting leading space.
modify outtab index sy-tabix.
else.
read table outtab with key name = 'WORDS2'.
move 'invalid data' to outtab-value.
shift outtab-value left deleting leading space.
modify outtab index sy-tabix.
endif.
endform.
FORM SUB2 TABLES INTTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
READ TABLE INTTAB INDEX 1.
EBELN2 = INTTAB-VALUE.
READ TABLE INTTAB INDEX 2.
EBELP2 = INTTAB-VALUE.
* SELECT EKET-EBELN,EKET-EBELP,EKET-EINDT,EKET-MENGE,EKET-MENGE *
*EKPO-NETPR AS AMOUNT,EKPO-MATNR,EKPO-TXZ01,EKPO-IDNLF,EKPO-MEINS,
*EKPO-NETPR FROM EKET INNER JOIN EKPO ON EKPO-EBELN = EKET-EBELN AND
*EKET-EBELP = EKPO-EBELP WHERE EKET-EBELN = EBELN2
ENDFORM.