Go on link..

link us with ...

Friday, December 31, 2010

ARE3_TEXT

*&---------------------------------------------------------------------*

*& Report ZARE3_TEXT *

*& *

*&---------------------------------------------------------------------*

*& *

*& *

*&---------------------------------------------------------------------*

REPORT ZARE3_TEXT MESSAGE-ID SY-MSGID .

TABLES : STXH,

MVKE,

LIKP,

MARA,

J_1IEXCDTL,

J_1IEXChdr,

J_1IMOCUST,

J_1IMOCOMP.

DATA : BEGIN OF result.

INCLUDE STRUCTURE itcpp.

DATA : END OF result.

DATA : BEGIN OF options.

INCLUDE STRUCTURE itcpo.

DATA : END OF options.

*&--------------------------------------------------------------------*

*& Form ARE3_FETCH

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE3_FETCH TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : LW_RDOC1 TYPE J_1IEXCDTL-RDOC1,

LW_DOCNO TYPE J_1IEXCDTL-DOCNO,

LW_TEMP1(18) TYPE C,

LW_TEMP2(18) TYPE C,

LW_MEINS1 TYPE MSEG-ERFME,

LW_NTGEW TYPE MSEG-ERFMG,

LW_NTGEW1 TYPE J_1IEXCDTL-NTGEW,

LW_RPL(19) TYPE C,

LW_RPL1(19) TYPE C,

LW_MATNR TYPE MSEG-MATNR,

LW_MENGE TYPE MSEG-MENGE,

LW_MTGEW TYPE MSEG-ERFMG,

LW_TDNAME TYPE TDNAME,

LW_TDOBJECT TYPE TDOBJECT,

LW_MEINS TYPE MARA-MEINS,

LW_NAME TYPE THEAD-TDNAME,

LW_I TYPE I,

LW_J TYPE I,

LW_BSQTY TYPE MSEG-MENGE,

LW_TRUCKNO(255) TYPE C,

lw_line1 TYPE tline-tdline,

lw_text1(255) type c,

lw_text2(255) type c,

LW_GRWT TYPE TLINE-TDLINE,

LW_TRWT TYPE TLINE-TDLINE,

LW_ERFME TYPE MSEG-ERFME,

LW_ERFMG TYPE MSEG-ERFMG,

LW_BTGEW TYPE LIKP-BTGEW,

LW_MVGR3 TYPE MVKE-MVGR3,

LW_EXBED TYPE J_1IEXCDTL-EXBED,

LW_ECS TYPE J_1IEXCDTL-ECS,

LW_TOT1 TYPE J_1IEXCDTL-ECS,

LW_TOT(18) TYPE C,

LW_TEMP3(18) TYPE C,

LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_BUKRS TYPE J_1IEXCHDR-BUKRS,

LW_ECC1 TYPE J_1IMOCOMP-J_1IEXCD,

LW_TDID TYPE TDID.

*ADDED BY NILAMKUMAR ON 09.09.06

DATA: LW_ADDLVAL TYPE J_1IEXCHDR-ADDLVAL.

DATA: LW_ADDLDATA4 TYPE J_1IEXCDTL-ADDLDATA4.

DATA :

BEGIN OF st_line OCCURS 0,

tdformat LIKE tline-tdformat,

tdline LIKE tline-tdline,

END OF st_line.

DATA :

BEGIN OF st_line1 OCCURS 0,

tdformat LIKE tline-tdformat,

tdline LIKE tline-tdline,

END OF st_line1.

DATA :

BEGIN OF st_line2 OCCURS 0,

tdformat LIKE tline-tdformat,

tdline LIKE tline-tdline,

END OF st_line2.

READ TABLE IN_PAR WITH KEY 'RDOC1' .

CHECK SY-SUBRC = 0.

LW_RDOC1 = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'DOCNO' .

CHECK SY-SUBRC = 0.

LW_DOCNO = IN_PAR-VALUE.

SELECT SINGLE * FROM STXH WHERE TDNAME = LW_RDOC1

AND TDOBJECT = 'VBBK'

AND TDID = 'Z027'.

IF SY-SUBRC = 0.

LW_TDNAME = STXH-TDNAME.

LW_TDOBJECT = STXH-TDOBJECT.

LW_TDID = STXH-TDID.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'TDNAME'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TDNAME.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'TDOBJECT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TDOBJECT.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'TDID'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TDID.

MODIFY OUT_PAR INDEX SY-TABIX .

LW_NAME = LW_RDOC1.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z001'

language = 'E'

name = LW_NAME

object = 'VBBK'

TABLES

lines = st_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT ST_LINE.

* READ TABLE st_line INDEX 1.

* lw_line1 = st_line-tdline.

CONCATENATE LW_LINE1 st_line-tdline

INTO LW_LINE1 SEPARATED BY SPACE.

ENDLOOP.

READ TABLE OUT_PAR WITH KEY 'W_TRUCKNO'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_LINE1.

MODIFY OUT_PAR INDEX SY-TABIX .

************************************************************************

READ TABLE IN_PAR WITH KEY 'NTGEW' .

CHECK SY-SUBRC = 0.

LW_RPL = IN_PAR-VALUE.

REPLACE ALL OCCURRENCES OF ',' IN LW_RPL WITH ' '.

LW_NTGEW = LW_RPL.

READ TABLE IN_PAR WITH KEY 'MATNR' .

CHECK SY-SUBRC = 0.

LW_MATNR = IN_PAR-VALUE.

LW_I = STRLEN( LW_MATNR ).

LW_J = 18 - LW_I.

DO LW_J TIMES.

CONCATENATE '0' LW_MATNR INTO LW_MATNR.

ENDDO.

SELECT SINGLE * FROM MARA WHERE MATNR = LW_MATNR.

IF SY-SUBRC = 0.

LW_MEINS = MARA-MEINS.

ENDIF.

READ TABLE IN_PAR WITH KEY 'MENGE' .

CHECK SY-SUBRC = 0.

LW_RPL1 = IN_PAR-VALUE.

REPLACE ALL OCCURRENCES OF ',' IN LW_RPL1 WITH ' '.

LW_MENGE = LW_RPL1.

READ TABLE IN_PAR WITH KEY 'MEINS' .

CHECK SY-SUBRC = 0.

LW_MEINS1 = IN_PAR-VALUE.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_MEINS

ERFMG = LW_NTGEW

MATNR = LW_MATNR

MEINS = LW_MEINS

* MENGE = LW_MENGE

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_MTGEW

* O_MEINS =

* O_MENGE =

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = 'MT'

* ERFMG = LW_NTGEW

MATNR = LW_MATNR

MEINS = LW_MEINS

MENGE = LW_MENGE

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_MTGEW

* O_MEINS =

* O_MENGE =

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LW_TEMP1 = LW_MTGEW.

CONDENSE LW_TEMP1.

READ TABLE OUT_PAR WITH KEY 'J_1IEXCDTL-MTGEW'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEMP1.

MODIFY OUT_PAR INDEX SY-TABIX .

MODIFY OUT_PAR INDEX SY-TABIX .

***********************************************************************

SELECT SINGLE * FROM MVKE WHERE MATNR = LW_MATNR.

IF SY-SUBRC = 0.

LW_MVGR3 = MVKE-MVGR3.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'W_MVGR3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_MVGR3.

MODIFY OUT_PAR INDEX SY-TABIX .

*********IF THE MATERIAL IS BULK

IF MVKE-MVGR3 = 'BLK' AND MVKE-MVGR5 <> 'FAL'.

LW_TEXT1 = 'FILLED IN BULK'.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ELSEIF MVKE-MVGR3 = 'BLK' AND MVKE-MVGR5 = 'FAL'.

LW_TEXT1 = 'FILLED IN BULK IN SS TANK'.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

************************************************************************

************************************************************************

*********IF THE MATERIAL IS IN DRUM

IF MVKE-MVGR3 = 'DRM'.

LW_ERFME = MVKE-MVGR3.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_MEINS1

ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

* MENGE = 0

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

* O_ERFMG =

* O_MEINS =

O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_ERFME

* ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

MENGE = LW_BSQTY

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_ERFMG

* O_MEINS =

* O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LW_TEMP2 = LW_ERFMG.

CONDENSE LW_TEMP2.

CONCATENATE 'FILLED IN ' LW_TEMP2 'DRUMS'

INTO LW_TEXT1 SEPARATED BY SPACE.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

************************************************************************

************************************************************************

*********IF THE MATERIAL IS IN CASES

IF MVKE-MVGR3 = 'CS'.

LW_ERFME = MVKE-MVGR3.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_MEINS1

ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

* MENGE = 0

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

* O_ERFMG =

* O_MEINS =

O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_ERFME

* ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

MENGE = LW_BSQTY

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_ERFMG

* O_MEINS =

* O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LW_TEMP2 = LW_ERFMG.

CONDENSE LW_TEMP2.

CONCATENATE 'FILLED IN ' LW_TEMP2 'CASES'

INTO LW_TEXT1 SEPARATED BY SPACE.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

************************************************************************

************************************************************************

*********IF THE MATERIAL IS IN CASES

IF MVKE-MVGR3 = 'BGS'.

LW_ERFME = MVKE-MVGR3.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_MEINS1

ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

* MENGE = 0

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

* O_ERFMG =

* O_MEINS =

O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_ERFME

* ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

MENGE = LW_BSQTY

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_ERFMG

* O_MEINS =

* O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LW_TEMP2 = LW_ERFMG.

CONDENSE LW_TEMP2.

CONCATENATE 'FILLED IN ' LW_TEMP2 'BAGS'

INTO LW_TEXT1 SEPARATED BY SPACE.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

************************************************************************

************************************************************************

*********IF THE MATERIAL IS IN CARBUOYS

IF MVKE-MVGR3 = 'CBY'.

LW_ERFME = MVKE-MVGR3.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_MEINS1

ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

* MENGE = 0

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

* O_ERFMG =

* O_MEINS =

O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = LW_ERFME

* ERFMG = LW_MENGE

MATNR = LW_MATNR

MEINS = LW_MEINS

MENGE = LW_BSQTY

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = LW_ERFMG

* O_MEINS =

* O_MENGE = LW_BSQTY

* O_UMREN =

* O_UMREZ =

* EXCEPTIONS

* CONVERSION_NOT_FOUND = 1

* DIFFERENT_DIMENSION = 2

* DIVISION_BY_ZERO = 3

* OVERFLOW = 4

* T006D_ENTRY_MISSING = 5

* T006_ENTRY_MISSING = 6

* OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LW_TEMP2 = LW_ERFMG.

CONDENSE LW_TEMP2.

CONCATENATE 'FILLED IN ' LW_TEMP2 'CARBUOYS'

INTO LW_TEXT1 SEPARATED BY SPACE.

READ TABLE OUT_PAR WITH KEY 'W_DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEXT1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

************************************************************************

************************************************************************

*****FOR GETTING GROSS WEIGHT & TARE WEIGHT

****FOR GROSS WEIGHT

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z040'

language = 'E'

name = LW_NAME

object = 'VBBK'

TABLES

lines = st_line1

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT ST_LINE1.

CONCATENATE LW_GRWT st_line1-tdline

INTO LW_GRWT SEPARATED BY SPACE.

ENDLOOP.

READ TABLE OUT_PAR WITH KEY 'W_GRWT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_GRWT.

MODIFY OUT_PAR INDEX SY-TABIX .

****FOR TARE WEIGHT

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z041'

language = 'E'

name = LW_NAME

object = 'VBBK'

TABLES

lines = st_line2

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT ST_LINE2.

CONCATENATE LW_TRWT st_line2-tdline

INTO LW_TRWT SEPARATED BY SPACE.

ENDLOOP.

READ TABLE OUT_PAR WITH KEY 'W_TRWT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TRWT.

MODIFY OUT_PAR INDEX SY-TABIX .

************************************************************************

************************************************************************

****FOR GETTING THE NET VALUE

SELECT SINGLE * FROM LIKP WHERE VBELN = LW_RDOC1.

IF SY-SUBRC = 0.

LW_BTGEW = LIKP-ntgew.

ENDIF.

LW_TEMP3 = LW_BTGEW.

CONDENSE LW_TEMP3.

READ TABLE OUT_PAR WITH KEY 'W_TEMP3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TEMP3.

MODIFY OUT_PAR INDEX SY-TABIX .

************************************************************************

************************************************************************

******FOR GETTING THE TOTAL OF THE EXCISE & ECESS VALUE

*break-point.

SELECT SINGLE * FROM J_1IEXCHDR WHERE DOCNO = LW_DOCNO

AND TRNTYP = 'ARE3'.

IF SY-SUBRC = 0.

LW_EXBED = J_1IEXCHDR-EXBED.

LW_ECS = J_1IEXCHDR-ECS.

* ADDITION BY NILAMKUMAR ON 09.09.06

* LW_ADDLVAL = J_1IEXCHDR-ADDLVAL.

ENDIF.

LW_TOT1 = LW_EXBED + LW_ECS.

LW_TOT = LW_TOT1.

CONDENSE LW_TOT.

READ TABLE OUT_PAR WITH KEY 'W_TOT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_TOT.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. "ARE3_FETCH

************************************************************************

********FOR ECC NUMBER

FORM ARE3_FETCH1 TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_BUKRS TYPE J_1IEXCHDR-BUKRS,

LW_KUNWE TYPE J_1IEXCHDR-KUNWE,

LW_CUSTECC1 TYPE J_1IMOCUST-J_1IEXCD,

LW_I TYPE I,

LW_J TYPE I,

LW_ECC1 TYPE J_1IMOCOMP-J_1IEXCD.

READ TABLE IN_PAR WITH KEY 'WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'BUKRS' .

CHECK SY-SUBRC = 0.

LW_BUKRS = IN_PAR-VALUE.

SELECT SINGLE * FROM J_1IMOCOMP WHERE WERKS = LW_WERKS

AND BUKRS = LW_BUKRS.

IF SY-SUBRC = 0.

LW_ECC1 = J_1IMOCOMP-J_1IEXCD.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'ECC1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_ECC1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE IN_PAR WITH KEY 'KUNWE' .

CHECK SY-SUBRC = 0.

LW_KUNWE = IN_PAR-VALUE.

LW_I = STRLEN( LW_KUNWE ).

LW_J = 10 - LW_I.

DO LW_J TIMES.

CONCATENATE '0' LW_KUNWE INTO LW_KUNWE.

ENDDO.

SELECT SINGLE * FROM J_1IMOCUST WHERE KUNNR = LW_KUNWE.

IF SY-SUBRC = 0.

* LW_CUSTECC1 = J_1IMOCOMP-J_1IEXCD. "commented by chetan

LW_CUSTECC1 = J_1IMOCUST-J_1IEXRN.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'CENTECC1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_CUSTECC1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. "ARE3_FETCH1

*

*ENDFORM. " QUAN_CONVERT

FORM ARE3_ADR_NEW TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_BUKRS TYPE J_1IEXCHDR-BUKRS,

LW_KUNNR TYPE KNA1-KUNNR,

LW_KUNWE TYPE J_1IEXCHDR-KUNWE,

LW_ADRNR TYPE KNA1-ADRNR,

LW_NAME1 TYPE ADRC-NAME1,

LW_STRAS TYPE T001W-STRAS,

LW_ORT01 TYPE T001W-ORT01,

LW_PSTLZ TYPE T001W-PSTLZ,

LW_CUSTECC1 TYPE J_1IMOCUST-J_1IEXCD,

LW_I TYPE I,

LW_J TYPE I,

LW_ECC1 TYPE J_1IMOCOMP-J_1IEXCD.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

SELECT SINGLE KUNWE INTO LW_KUNWE FROM J_1IEXCHDR WHERE WERKS =

LW_WERKS.

IF LW_KUNWE = 'P003'.

SELECT SINGLE NAME1 STRAS ORT01 PSTLZ inTO (LW_NAME1,LW_STRAS,

LW_ORT01,LW_PSTLZ)

FROM T001W WHERE WERKS = 'D031'.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'NAME1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_NAME1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STRAS'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_STRAS.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'ORT01'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_ORT01.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'PSTLZ'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_PSTLZ.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. "ARE3_ADR_NEW

*&--------------------------------------------------------------------*

*& Form ARE3_lgdate

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE3_lgdate TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : LW_RDOC TYPE J_1IEXCDTL-RDOC1,

LW_WADAT_IST TYPE likp-WADAT_IST,

LW_WADAT_IST1(10) TYPE c.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RDOC1' .

CHECK SY-SUBRC = 0.

LW_RDOC = IN_PAR-VALUE.

SELECT SINGLE WADAT_IST INTO LW_WADAT_IST FROM LIKP WHERE VBELN =

LW_RDOC.

write LW_WADAT_IST to LW_WADAT_IST DD/MM/YY.

LW_WADAT_IST1 = LW_WADAT_IST .

condense LW_WADAT_IST1.

READ TABLE OUT_PAR WITH KEY 'GLDAT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_WADAT_IST1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. "ARE3_lgdate

*&--------------------------------------------------------------------*

*& Form ARE3_FOOT

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE3_FOOT TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_KUNWE TYPE J_1IEXCHDR-KUNWE,

LW_CHK TYPE C.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

SELECT SINGLE KUNWE INTO LW_KUNWE FROM J_1IEXCHDR WHERE WERKS =

LW_WERKS.

IF SY-SUBRC = 0.

IF LW_KUNWE = 'P003'.

LW_CHK = 'Y'.

READ TABLE OUT_PAR WITH KEY 'CHK'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_CHK.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

ENDIF.

ENDFORM. "ARE3_FOOT

*&--------------------------------------------------------------------*

*& Form ARE1_ADD

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE1_ADD TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : BEGIN OF ITAB OCCURS 0,

ADD_IDENT LIKE ZVVF_ARE1_ADDR-ADD_IDENT,

ADD_CODE LIKE ZVVF_ARE1_ADDR-ADD_CODE,

END OF ITAB.

DATA : LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_KUNWE TYPE J_1IEXCHDR-KUNWE,

LW_CHK TYPE C,

LW_CAM_HANDLE TYPE J_1IADDRES-CAM_HANDLE,

W_STREET TYPE ADRC-STREET,

W_STR_SUPPL1 TYPE ADRC-STR_SUPPL1,

W_STR_SUPPL2 TYPE ADRC-STR_SUPPL2,

W_CITY1 TYPE ADRC-CITY1,

W_CITY2 TYPE ADRC-CITY2,

W_POST_CODE1 TYPE ADRC-POST_CODE1,

W_ADD_NO TYPE J_1IEXCHDR-EXC_ADDRESS_NO,

W_STREET_1 TYPE ADRC-STREET,

W_STR_SUPPL1_1 TYPE ADRC-STR_SUPPL1,

W_STR_SUPPL2_1 TYPE ADRC-STR_SUPPL2,

W_CITY1_1 TYPE ADRC-CITY1,

W_CITY2_1 TYPE ADRC-CITY2,

W_POST_CODE1_1 TYPE ADRC-POST_CODE1.

DATA : RDOC1 LIKE J_1IEXCDTL-RDOC1,

LW_NAME1 TYPE THEAD-TDNAME,

LW_GRWT6 TYPE TLINE-TDLINE.

DATA: LW_TYP LIKE J_1IEXCHDR-TRNTYP,

LW_YR LIKE J_1IEXCHDR-DOCYR,

LW_BONDYR LIKE J_1IEXCHDR-BONDYR,

LW_DOCNO LIKE J_1IEXCHDR-DOCNO,

LW_POSNR LIKE J_1IEXCDTL-RITEM1.

DATA : WS_TDID LIKE STXH-TDID.

DATA : BEGIN OF st_line6 OCCURS 0,

tdformat LIKE tline-tdformat,

tdline LIKE tline-tdline,

END OF st_line6.

* BREAK-POINT.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RDOC1' .

CHECK SY-SUBRC = 0.

LW_NAME1 = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RITEM1' .

CHECK SY-SUBRC = 0.

LW_POSNR = IN_PAR-VALUE.

*Commented by Upinder Singh 03.01.2006 ... Vijay Salvekar

* select single tdid into ws_tdid from stxh

* where TDOBJECT = 'VBBK' AND TDID = 'Z031' AND TDNAME = LW_NAME1.

* IF WS_TDID = 'Z031'.

*

* CALL FUNCTION 'READ_TEXT'

* EXPORTING

* client = sy-mandt

* id = 'Z031'

* language = 'E'

* name = LW_NAME1

* object = 'VBBK'

* TABLES

* lines = st_line6

* EXCEPTIONS

* id = 1

* language = 2

* name = 3

* not_found = 4

* object = 5

* reference_check = 6

* wrong_access_to_archive = 7

* OTHERS = 8.

*

* ENDIF.

* LOOP AT ST_LINE6.

* CONCATENATE LW_GRWT6 st_line6-tdline INTO LW_GRWT6 SEPARATED BY

* SPACE.

* ENDLOOP.

* READ TABLE OUT_PAR WITH KEY 'TXT'.

* CHECK SY-SUBRC = 0.

* OUT_PAR-VALUE = LW_GRWT6.

* MODIFY OUT_PAR INDEX SY-TABIX .

*

* End of Code

* Code Added to print Ship to Party's Country

* Upinder Singh 03.01.2006

*TABLES: T005.

DATA:W_LAND1 LIKE KNA1-LAND1.

DATA: LW_LAND LIKE T005T-LANDX.

data: w_bondtyp like j_1ibond-bondtyp.

data:lw_name2 TYPE THEAD-TDNAME.

data: w_BONDNO like j_1ibond-bondno.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-TRNTYP' .

CHECK SY-SUBRC = 0.

LW_TYP = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-DOCYR' .

CHECK SY-SUBRC = 0.

LW_YR = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-DOCNO' .

CHECK SY-SUBRC = 0.

LW_DOCNO = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-BONDYR' .

CHECK SY-SUBRC = 0.

LW_BONDYR = IN_PAR-VALUE.

SELECT single bondno INTO w_bondno FROM

j_1iexchdr WHERE docno = lw_docno.

Select single bondtyp from j_1ibond into w_bondtyp where

BONDNO = w_bondno and bondyr = lw_bondyr.

READ TABLE OUT_PAR WITH KEY 'J_1IBOND-BONDTYP'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_BONDTYP.

MODIFY OUT_PAR INDEX SY-TABIX .

* Commented by Upinder on 06.02.2006 .... New Logic for picking Ship

* to Party's Country ... Now we pick it from text id and if the text id

* is blank we pick it from KNVK table

* SELECT SINGLE KUNWE INTO LW_KUNWE FROM J_1IEXCHDR WHERE WERKS =

* LW_WERKS AND TRNTYP = LW_TYP AND DOCYR = LW_YR AND DOCNO = LW_DOCNO.

*

* SELECT SINGLE LAND1 INTO W_LAND1 FROM KNA1 WHERE KUNNR = LW_KUNWE.

*

* SELECT SINGLE LANDX INTO LW_LAND FROM T005T WHERE LAND1 = W_LAND1.

* End of Comment

* New Code Begins

data: w_vgbel like lips-vgbel,

w_vgpos like lips-vgpos.

* Select vgbel vgpos from lips into (w_vgbel,w_vgpos) where

* vbeln = LW_NAME1 and posnr = LW_POSNR.

Select single vbeln from vbrp into lw_name2 where vgbel = lw_name1

and vgpos = lw_posnr.

* select single tdid into ws_tdid from stxh

* where TDOBJECT = 'VBBK' AND TDID = 'Z060' AND TDNAME = LW_NAME1.

* IF WS_TDID = 'Z060'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z060'

language = 'E'

name = LW_NAME2

object = 'VBBK'

TABLES

lines = st_line6

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

*

* ENDIF.

if sy-subrc eq '0'.

LOOP AT ST_LINE6.

MOVE ST_LINE6-TDLINE TO lw_land.

* CONCATENATE LW_GRWT6 st_line6-tdline INTO LW_GRWT6 SEPARATED BY

* SPACE.

ENDLOOP.

elseif sy-subrc eq '4'.

data: w_kunnr like likp-kunnr.

data: w_parnr like vbpa-kunnr.

data: w_adrnr like knvk-adrnp_2.

Select single kunnr into w_kunnr from likp where vbeln = LW_NAME1.

Select single parnr into w_parnr from vbpa where vbeln = LW_NAME1

and parvw eq 'ZN'.

Select single adrnp_2 into w_adrnr from knvk where parnr = w_parnr

and kunnr = w_kunnr.

SELECT SINGLE COUNTRY INTO W_LAND1 FROM ADRC WHERE ADDRNUMBER =

W_ADRNR.

SELECT SINGLE LANDX INTO LW_LAND FROM T005T WHERE LAND1 = W_LAND1

and spras eq 'E'.

endif.

* End of New Code

READ TABLE OUT_PAR WITH KEY 'TXT'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_LAND.

MODIFY OUT_PAR INDEX SY-TABIX .

* End of Code Upinder Singh 03.01.2006

SELECT ADD_IDENT ADD_CODE INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZVVF_ARE1_ADDR WHERE WERKS = LW_WERKS.

* IF LW_KUNWE = 'P003'.

LOOP AT ITAB.

IF ITAB-ADD_IDENT = 'S1'.

SELECT SINGLE CAM_HANDLE INTO LW_CAM_HANDLE FROM J_1IADDRES

WHERE ADDRESS_NO = ITAB-ADD_CODE.

SELECT SINGLE STREET STR_SUPPL1 STR_SUPPL2 CITY1 CITY2

POST_CODE1

INTO

(W_STREET,W_STR_SUPPL1,W_STR_SUPPL2,W_CITY1,

W_CITY2,W_POST_CODE1)

FROM ADRC WHERE ADDRNUMBER = LW_CAM_HANDLE.

READ TABLE OUT_PAR WITH KEY 'STREET'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STREET.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'POST_CODE1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_POST_CODE1.

MODIFY OUT_PAR INDEX SY-TABIX .

ELSEIF ITAB-ADD_IDENT = 'C1'.

SELECT SINGLE CAM_HANDLE INTO LW_CAM_HANDLE FROM J_1IADDRES

WHERE ADDRESS_NO = ITAB-ADD_CODE.

SELECT SINGLE STREET STR_SUPPL1 STR_SUPPL2 CITY1 CITY2

POST_CODE1

INTO

(W_STREET_1,W_STR_SUPPL1_1,W_STR_SUPPL2_1,

W_CITY1_1,W_CITY2_1,W_POST_CODE1_1)

FROM ADRC WHERE ADDRNUMBER = LW_CAM_HANDLE.

READ TABLE OUT_PAR WITH KEY 'STREET_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STREET_1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL1_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL1_1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL2_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL2_1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY1_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY1_1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY2_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY2_1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'POST_CODE1_1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_POST_CODE1_1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

ENDLOOP.

* ENDIF.

ENDFORM. "ARE1_ADD

*&--------------------------------------------------------------------*

*& Form ARE3_BLK

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE3_BLK TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : W_VKORG LIKE LIKP-VKORG,

W_MATNR LIKE J_1IEXCDTL-MATNR,

LW_NTGEW TYPE ITCSY-VALUE,

LW_BRGEW TYPE ITCSY-VALUE,

LW_MEINS LIKE J_1IEXCDTL-MEINS,

W_pkgs TYPE ITCSY-VALUE,

W_GEWEI TYPE ITCSY-VALUE,

W_MVGR3 LIKE MVKE-MVGR3,

W_STEUC LIKE MARC-STAWN.

DATA : RDOC1 LIKE J_1IEXCDTL-RDOC1,

LW_NAME1 TYPE THEAD-TDNAME,

LW_NAME2 TYPE THEAD-TDNAME,

LW_POSNR LIKE J_1IEXCDTL-RITEM1,

LW_MAKTX LIKE J_1IEXCDTL-MAKTX.

DATA: ITAB TYPE STANDARD TABLE OF tline with header line.

DATA : CHAPID LIKE J_1IEXCDTL-CHAPID,

W_J_1ICHT1 LIKE J_1ICHIDTX-J_1ICHT1,

W_BONDNO LIKE J_1IBOND-BONDNO,

W_BONDYR LIKE J_1IBOND-BONDYR,

W_BONDNOEX LIKE J_1IBOND-BONDNOEX.

DATA: W_TOTAL LIKE J_1IEXCDTL-BRGEW.

data: lw_werks like J_1IEXCDTL-WERKS.

DATA: W_OUT LIKE MSEG-MENGE.

DATA: W_OUT1 LIKE MSEG-MENGE.

data: mark_side type tdline.

data: mark_side1 type tdline.

data: mark_side2 type tdline.

data: mark_side3 type tdline.

data: mark_side4 type tdline.

data: mark_side5 type tdline.

data: mark_side6 type tdline.

data: mark_side7 type tdline.

data: mark_side8 type tdline.

data: mark_side9 type tdline.

data: mark_side10 type tdline.

data: mark_side11 type tdline.

data: mark_side12 type tdline.

data: mark_side13 type tdline.

data: mark_top type tdline.

data: mark_top1 type tdline.

data: mark_top2 type tdline.

data: mark_top3 type tdline.

data: mark_top4 type tdline.

data: mark_top5 type tdline.

data: mark_top6 type tdline.

data: mark_top7 type tdline.

data: mark_top8 type tdline.

data: mark_top9 type tdline.

data: mark_top10 type tdline.

data: mark_top11 type tdline.

data: mark_top12 type tdline.

data: mark_top13 type tdline.

data: w_lic like zexp_license-LIC_INDICATOR.

data: w_license like zexp_license-EXP_LINCENSE_NO.

data: w_invoice type tdline.

* data : w_brgew like j_1iexcdtl-brgew.

*BREAK-POINT.

DATA: NAME lIKE THEAD-TDNAME.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RDOC1' .

CHECK SY-SUBRC = 0.

LW_NAME1 = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RDOC2' .

CHECK SY-SUBRC = 0.

LW_NAME2 = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RITEM1' .

CHECK SY-SUBRC = 0.

LW_POSNR = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-MATNR' .

CHECK SY-SUBRC = 0.

W_MATNR = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-NTGEW' .

CHECK SY-SUBRC = 0.

CONDENSE IN_PAR-VALUE.

LW_NTGEW = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-BRGEW' .

CHECK SY-SUBRC = 0.

CONDENSE IN_PAR-VALUE.

LW_BRGEW = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-GEWEI' .

CHECK SY-SUBRC = 0.

LW_MEINS = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-MAKTX' .

CHECK SY-SUBRC = 0.

LW_MAKTX = IN_PAR-VALUE.

data: l type i.

data: n type i value '31'.

l = strlen( LW_MAKTX ).

do n times.

if LW_MAKTX+n(1) eq space.

* write:/ str(n).

* write:/ str+n.

READ TABLE OUT_PAR WITH KEY 'M1' .

CHECK SY-SUBRC = 0.

* CONDENSE rate1.

OUT_PAR-VALUE = LW_MAKTX(n).

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'M2' .

CHECK SY-SUBRC = 0.

* CONDENSE rate1.

OUT_PAR-VALUE = LW_MAKTX+n.

MODIFY OUT_PAR INDEX SY-TABIX .

exit.

else.

n = n - 1.

endif.

enddo.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

INPUT = W_MATNR

IMPORTING

OUTPUT = W_MATNR.

data: w_vbeln like vbfa-vbeln,

w_posnn like vbfa-posnn.

data: w_bsark like vbkd-bsark.

data: w_vbelv like vbfa-vbelv.

data:rate type p decimals 2.

data:rate1(10) type c.

data:rate2(10) type c.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-BEDRATE' .

CHECK SY-SUBRC = 0.

CONDENSE IN_PAR-VALUE.

RATE = IN_PAR-VALUE.

rate1 = rate.

split rate1 at '.' into rate1 rate2.

if rate2 eq '00'.

READ TABLE OUT_PAR WITH KEY 'RATE' .

CHECK SY-SUBRC = 0.

CONDENSE rate1.

OUT_PAR-VALUE = RATE1.

MODIFY OUT_PAR INDEX SY-TABIX .

else.

concatenate rate1 rate2 into rate1 separated by '.'.

READ TABLE OUT_PAR WITH KEY 'RATE' .

CHECK SY-SUBRC = 0.

CONDENSE rate1.

OUT_PAR-VALUE = RATE1.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

if lw_werks ne 'P003'.

READ TABLE OUT_PAR WITH KEY 'RDOC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = LW_NAME2.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

clear lw_name2.

select SINGLE vkorg INTO W_VKORG FROM LIKP WHERE VBELN = LW_NAME1.

SELECT SINGLE MVGR3 INTO W_MVGR3 FROM MVKE WHERE VKORG = W_VKORG AND

MATNR = W_MATNR.

*W_OUT = LW_NTGEW.

DATA: W TYPE P .

CALL FUNCTION 'MOVE_CHAR_TO_NUM'

EXPORTING

CHR = LW_NTGEW

IMPORTING

NUM = W

EXCEPTIONS

CONVT_NO_NUMBER = 1

CONVT_OVERFLOW = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

W_OUT = W.

Select single vbeln posnn from vbfa into (w_vbeln,w_posnn)

where vbelv eq lw_name1 and posnv eq lw_posnr and vbtyp_n eq 'U'.

Select single vbelv from vbfa into w_vbelv where vbeln eq w_vbeln.

Select single bsark from vbkd into w_bsark where vbeln eq w_vbelv.

if w_bsark ne 'BULK'.

NAME = LW_NAME1.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z003'

LANGUAGE = 'E'

NAME = NAME

OBJECT = 'VBBK'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = ITAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

data: line like tline-tdline.

loop at itab.

move itab-tdline to line.

endloop.

condense line.

*else.

*line = 'BULK'.

endif.

case w_bsark.

when 'BULK'.

READ TABLE OUT_PAR WITH KEY 'CONTAINER1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'BULK BY SHIP'.

MODIFY OUT_PAR INDEX SY-TABIX .

when 'ISO'.

READ TABLE OUT_PAR WITH KEY 'CONTAINER1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'FILLED IN BULK'.

MODIFY OUT_PAR INDEX SY-TABIX .

endcase.

READ TABLE OUT_PAR WITH KEY 'CONTAINER'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = line.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'W_MVGR'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_MVGR3.

MODIFY OUT_PAR INDEX SY-TABIX .

if lw_werks eq 'P001' or lw_werks eq 'P002'.

W_J_1ICHT1 = space.

else.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-CHAPID' .

CHECK SY-SUBRC = 0.

CHAPID = IN_PAR-VALUE.

**commented by Nilamkumar on 08.09.06

*SELECT SINGLE J_1ICHT1 INTO W_J_1ICHT1 FROM J_1ICHIDTX WHERE J_1ICHID

**= CHAPID.

* READ TABLE OUT_PAR WITH KEY 'DESC'.

* CHECK SY-SUBRC = 0.

* OUT_PAR-VALUE = W_J_1ICHT1.

* MODIFY OUT_PAR INDEX SY-TABIX .

endif.

*added by nilamkumar on 08.09.06

if lw_werks eq 'P003'.

SELECT SINGLE STAWN FROM MARC INTO W_STEUC WHERE

MATNR = W_matnr AND WERKS = 'P003'.

* FOR MATERIAL GROUP

* SELECT SINGLE MATKL INTO W_MATKL FROM VBRP

* WHERE matnr = W_matnr AND VBELN = ***.

CONCATENATE 'HS Code' W_STEUC into W_STEUC SEPARATED BY SPACE.

READ TABLE OUT_PAR WITH KEY 'DESC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STEUC.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

*---------------end of addition---------

READ TABLE IN_PAR WITH KEY 'J_1IBOND-BONDNO'.

CHECK SY-SUBRC = 0.

W_BONDNO = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IBOND-BONDYR'.

CHECK SY-SUBRC = 0.

W_BONDYR = IN_PAR-VALUE.

SELECT SINGLE BONDNOEX INTO W_BONDNOEX FROM J_1IBOND WHERE BONDNO =

W_BONDNO AND BONDYR = W_BONDYR.

READ TABLE OUT_PAR WITH KEY 'BONDD'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_BONDNOEX.

MODIFY OUT_PAR INDEX SY-TABIX .

*Select single vbeln posnn from vbfa into (w_vbeln,w_posnn)

*where vbelv eq lw_name1 and posnv eq lw_posnr and vbtyp_n eq 'U'.

name = w_vbeln.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z006'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = itab

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC = 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

loop at itab.

condense itab-tdline.

move itab-tdline to w_lic.

endloop.

condense w_lic.

shift w_lic left deleting leading '0'.

Select single EXP_LINCENSE_NO from zexp_license into w_license

where plant = lw_werks and lic_indicator = w_lic.

READ TABLE OUT_PAR WITH KEY 'LICENSE'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = w_license.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

clear name.

if lw_werks eq 'P001' or lw_werks eq 'P002'.

READ TABLE OUT_PAR WITH KEY 'L1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Plot No.109 & 109B'.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'L2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Sion(East)'.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'L3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Mumbai-400022'.

MODIFY OUT_PAR INDEX SY-TABIX .

else.

READ TABLE OUT_PAR WITH KEY 'L1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Plot No.V-41'.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'L2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'MIDC,Taloja'.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'L3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Tal.Panvel,Dist.Raigad'.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'L4'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = 'Maharashtra-410208'.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

*if lw_werks ne 'P003'.

name = w_vbeln.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z053'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = itab

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC = 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

loop at itab.

if lw_werks ne 'P003'.

move itab-tdline(30) to w_invoice.

else.

move itab-tdline(30) to w_invoice.

READ TABLE OUT_PAR WITH KEY 'RDOC'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_INVOICE.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

endloop.

else.

message 'Invoice Number not maintained' type 'I'.

endif.

*endif.

READ TABLE OUT_PAR WITH KEY 'INVOICE'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = w_invoice.

MODIFY OUT_PAR INDEX SY-TABIX .

concatenate w_vbeln w_posnn into name.

*Select single vbelv from vbfa into w_vbelv where vbeln eq w_vbeln.

*Select single bsark from vbkd into w_bsark where vbeln eq w_vbelv.

if w_bsark eq 'FCL'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z007'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBP'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = itab

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

*IF SY-SUBRC = 4.

** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*

*Message 'Marks - Side not maintainted' type 'I'.

*endif.

IF SY-SUBRC = 0.

read table itab index 1.

if sy-subrc = 0.

move itab-tdline to mark_side.

endif.

read table itab index 2.

if sy-subrc = 0.

move itab-tdline to mark_side1.

endif.

read table itab index 3.

if sy-subrc = 0.

move itab-tdline to mark_side2.

endif.

read table itab index 4.

if sy-subrc = 0.

move itab-tdline to mark_side3.

endif.

read table itab index 5.

if sy-subrc = 0.

move itab-tdline to mark_side4.

endif.

read table itab index 6.

if sy-subrc = 0.

move itab-tdline to mark_side5.

endif.

read table itab index 7.

if sy-subrc = 0.

move itab-tdline to mark_side6.

endif.

read table itab index 8.

if sy-subrc = 0.

move itab-tdline to mark_side7.

endif.

read table itab index 9.

if sy-subrc = 0.

move itab-tdline to mark_side8.

endif.

read table itab index 10.

if sy-subrc = 0.

move itab-tdline to mark_side9.

endif.

read table itab index 11.

if sy-subrc = 0.

move itab-tdline to mark_side10.

endif.

read table itab index 12.

if sy-subrc = 0.

move itab-tdline to mark_side11.

endif.

read table itab index 13.

if sy-subrc = 0.

move itab-tdline to mark_side12.

endif.

read table itab index 14.

if sy-subrc = 0.

move itab-tdline to mark_side13.

endif.

*leave to current transaction.

ENDIF.

clear itab.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0003'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBP'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = itab

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

*IF SY-SUBRC = 4.

** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*

*Message 'Marks - Top not maintainted' type 'I'.

*endif.

IF SY-SUBRC = 0.

read table itab index 1.

if sy-subrc = 0.

move itab-tdline to mark_top.

endif.

read table itab index 2.

if sy-subrc = 0.

move itab-tdline to mark_top1.

endif.

read table itab index 3.

if sy-subrc = 0.

move itab-tdline to mark_top2.

endif.

read table itab index 4.

if sy-subrc = 0.

move itab-tdline to mark_top3.

endif.

read table itab index 5.

if sy-subrc = 0.

move itab-tdline to mark_top4.

endif.

read table itab index 6.

if sy-subrc = 0.

move itab-tdline to mark_top5.

endif.

read table itab index 7.

if sy-subrc = 0.

move itab-tdline to mark_top6.

endif.

read table itab index 8.

if sy-subrc = 0.

move itab-tdline to mark_top7.

endif.

read table itab index 9.

if sy-subrc = 0.

move itab-tdline to mark_top8.

endif.

read table itab index 10.

if sy-subrc = 0.

move itab-tdline to mark_top9.

endif.

read table itab index 11.

if sy-subrc = 0.

move itab-tdline to mark_top10.

endif.

read table itab index 12.

if sy-subrc = 0.

move itab-tdline to mark_top11.

endif.

read table itab index 13.

if sy-subrc = 0.

move itab-tdline to mark_top12.

endif.

read table itab index 14.

if sy-subrc = 0.

move itab-tdline to mark_top13.

endif.

*leave to current transaction.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_TOP1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_TOP2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_TOP3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top3.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP4'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top4.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP5'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top5.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP6'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top6.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP7'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top7.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP8'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top8.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP9'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top9.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP10'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top10.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP11'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top11.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP12'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top12.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_TOP13'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_top13.

MODIFY OUT_PAR INDEX SY-TABIX.

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE3'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side3.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE4'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side4.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE5'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side5.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE6'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side6.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE7'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side7.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE8'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side8.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE9'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side9.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE10'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side10.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE11'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side11.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE12'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side12.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'MARK_SIDE13'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = mark_side13.

MODIFY OUT_PAR INDEX SY-TABIX .

endif.

clear name.

clear itab.

READ TABLE OUT_PAR WITH KEY 'W_BSARK'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_BSARK.

MODIFY OUT_PAR INDEX SY-TABIX .

if lw_werks = 'P003'.

Select single vbeln from vbfa into name where vbelv eq lw_name1

and vbtyp_n eq 'U'.

*name = LW_NAME1.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z053'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

* ARCHIVE_HANDLE = 0

* LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = itab

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC = 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

loop at itab.

move itab-tdline to lw_name2.

endloop.

ELSE.

Message 'Internal Export Invoice Document not maintainted' type 'I'.

leave to current transaction.

ENDIF.

*else.

endif.

if w_mvgr3 ne 'BLK'.

CALL FUNCTION 'MB_UNIT_CONVERSION'

EXPORTING

ERFME = W_MVGR3

ERFMG = 0

MATNR = W_MATNR

MEINS = LW_MEINS

MENGE = W_OUT

* UMREN = 1

* UMREZ = 0

* CHARG =

* WERKS =

* CUOBJ =

IMPORTING

* O_ERFME =

O_ERFMG = W_OUT

* O_MEINS =

* O_MENGE =

* O_UMREN =

* O_UMREZ =

EXCEPTIONS

CONVERSION_NOT_FOUND = 1

DIFFERENT_DIMENSION = 2

DIVISION_BY_ZERO = 3

OVERFLOW = 4

T006D_ENTRY_MISSING = 5

T006_ENTRY_MISSING = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE 'Conversion not found' TYPE 'I'.

EXIT.

ENDIF.

endif.

w_pkgs = w_out.

*w_GEWEI = w_out1.

condense w_pkgs.

* condense w_GEWEI.

READ TABLE OUT_PAR WITH KEY 'NUM_OF_PKGS'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_PKGS.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. "ARE3_BLK

*&--------------------------------------------------------------------*

*& Form ARE3_TOTAL

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

*FORM ARE3_TOTAL TABLES IN_PAR STRUCTURE ITCSY

* OUT_PAR STRUCTURE ITCSY.

*

*DATA: W_EXBED1 LIKE ITCSY-VALUE,

* W_ECS1 LIKE ITCSY-VALUE,

** CHAR40,

** W_DUMMY1 LIKE ITCSY-VALUE.

*W_DUMMY1 TYPE CHAR40.

*

**DATA: W_EXBED TYPE CHAR40,

** W_ECS TYPE CHAR40,

** W_DUMMY TYPE CHAR40.

*

**

**DATA: W_EXBED TYPE P DECIMALS 2,

** W_ECS TYPE N,

** W_DUMMY TYPE N.

*

*

*

*DATA: W_EXBED LIKE j_1iexcdtl-exbed,

* W_ECS LIKE j_1iexcdtl-ecs.

*** CHAR40,

*

*

*READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-EXBED' .

*CHECK SY-SUBRC = 0.

*W_EXBED1 = IN_PAR-VALUE.

**W_EXBED = W_EXBED1.

**CONDENSE W_EXBED.

*CONDENSE W_EXBED1.

*

**CALL FUNCTION 'CONVERSION_EXIT_DEC_3_INPUT'

** EXPORTING

** INPUT = IN_PAR-VALUE

** IMPORTING

** OUTPUT = W_EXBED

** .

**

*

**W_EXBED = IN_PAR-VALUE.

*

**CONDENSE W_EXBED.

*

*READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-ECS' .

*CHECK SY-SUBRC = 0.

*W_ECS1 = IN_PAR-VALUE.

**W_ECS = W_ECS1.

**CONDENSE W_ECS.

*CONDENSE W_ECS1.

*

*

**CALL FUNCTION 'CONVERSION_EXIT_DEC_3_INPUT'

** EXPORTING

** INPUT = IN_PAR-VALUE

** IMPORTING

** OUTPUT = W_ECS

** .

*

*W_DUMMY1 = W_EXBED + W_ECS .

*W_DUMMY1 = W_EXBED1 + W_ECS1 .

*

*READ TABLE OUT_PAR WITH KEY 'W_DUMMY'.

*CHECK SY-SUBRC = 0.

*OUT_PAR-VALUE = W_DUMMY1 .

*MODIFY OUT_PAR INDEX SY-TABIX .

*

*ENDFORM.

*

*&--------------------------------------------------------------------*

*& Form ARE1_ADD1

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->IN_PAR text

* -->OUT_PAR text

*---------------------------------------------------------------------*

FORM ARE1_ADD1 TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : BEGIN OF ITAB OCCURS 0,

ADD_IDENT LIKE ZVVF_ARE1_ADDR-ADD_IDENT,

ADD_CODE LIKE ZVVF_ARE1_ADDR-ADD_CODE,

END OF ITAB.

DATA : LW_WERKS TYPE J_1IEXCHDR-WERKS,

LW_KUNWE TYPE J_1IEXCHDR-KUNWE,

LW_CHK TYPE C,

LW_CAM_HANDLE TYPE J_1IADDRES-CAM_HANDLE,

W_STREET TYPE ADRC-STREET,

W_STR_SUPPL1 TYPE ADRC-STR_SUPPL1,

W_STR_SUPPL2 TYPE ADRC-STR_SUPPL2,

W_CITY1 TYPE ADRC-CITY1,

W_CITY2 TYPE ADRC-CITY2,

W_POST_CODE1 TYPE ADRC-POST_CODE1,

W_ADD_NO TYPE J_1IEXCHDR-EXC_ADDRESS_NO.

DATA : RDOC1 LIKE J_1IEXCDTL-RDOC1,

LW_NAME1 TYPE THEAD-TDNAME,

LW_GRWT6 TYPE TLINE-TDLINE.

DATA : IT_LINES TYPE TABLE OF TLINE WITH HEADER LINE.

DATA: LW_TYP LIKE J_1IEXCHDR-TRNTYP,

LW_YR LIKE J_1IEXCHDR-DOCYR,

LW_DOCNO LIKE J_1IEXCHDR-DOCNO.

DATA : WS_TDID LIKE STXH-TDID.

DATA : BEGIN OF st_line6 OCCURS 0,

tdformat LIKE tline-tdformat,

tdline LIKE tline-tdline,

END OF st_line6.

* BREAK-POINT.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-RDOC1' .

CHECK SY-SUBRC = 0.

LW_NAME1 = IN_PAR-VALUE.

* Code Added to print Ship to Party's Country

* Upinder Singh 03.01.2006

*TABLES: T005.

DATA:W_LAND1 LIKE KNA1-LAND1.

DATA: LW_LAND LIKE T005T-LANDX.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-TRNTYP' .

CHECK SY-SUBRC = 0.

LW_TYP = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-DOCYR' .

CHECK SY-SUBRC = 0.

LW_YR = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCHDR-DOCNO' .

CHECK SY-SUBRC = 0.

LW_DOCNO = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'J_1IEXCDTL-WERKS' .

CHECK SY-SUBRC = 0.

LW_WERKS = IN_PAR-VALUE.

* Code Added Upinder Singh 12.01.2006 to print Container numbers

* of all OBD's

data: w_mar(40) type c.

data: w_marks(120) type c.

data: w_vbelv like vbfa-vbelv.

data: w_bsark like vbkd-bsark.

data: w_con(40) type c.

data: w_container(120) type c.

data: w_pac(40) type c.

data: w_package(120) type c.

data: seal(40) type c.

data: w_seal(120) type c.

data: name like thead-tdname.

Select distinct rdoc1 from J_1IEXCDTL into name where trntyp eq

lw_typ and docyr eq LW_YR and docno eq LW_DOCNO.

Select single vbelv from vbfa into w_vbelv where vbeln eq name.

Select single bsark from vbkd into w_bsark where vbeln eq w_vbelv.

if w_bsark eq 'FCL'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z058'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_lines.

move it_lines-tdline to w_pac.

endloop.

if w_package eq ' '.

w_package = w_pac.

else.

concatenate w_package w_pac into w_package separated by ','.

endif.

elseif w_bsark eq 'ISO'.

w_package = 'FILLED IN BULK'.

else.

w_package = '______'.

endif.

clear it_lines.

if w_bsark ne 'BULK'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z003'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_lines.

move it_lines-tdline to w_con.

endloop.

if w_container eq ' '.

w_container = w_con.

else.

concatenate w_container w_con into w_container separated by ','.

endif.

clear it_lines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z026'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_lines.

move it_lines-tdline to w_mar.

endloop.

if w_marks eq ' '.

w_marks = w_mar.

else.

concatenate w_marks w_mar into w_marks separated by ','.

endif.

clear it_lines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z057'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_lines.

move it_lines-tdline to seal.

endloop.

if w_seal eq ' '.

w_seal = seal.

else.

concatenate w_seal seal into w_seal separated by ','.

endif.

clear it_lines.

else.

w_seal = '____'.

w_marks = '___'.

w_container = 'BULK BY SHIP'.

endif.

EndSelect.

* End of Code Added Upinder Singh 12.01.2006

SELECT SINGLE KUNWE INTO LW_KUNWE FROM J_1IEXCHDR WHERE WERKS =

LW_WERKS AND TRNTYP = LW_TYP AND DOCYR = LW_YR AND DOCNO = LW_DOCNO.

SELECT SINGLE LAND1 INTO W_LAND1 FROM KNA1 WHERE KUNNR = LW_KUNWE.

SELECT SINGLE LANDX INTO LW_LAND FROM T005T WHERE LAND1 = W_LAND1.

* READ TABLE OUT_PAR WITH KEY 'TXT'.

* CHECK SY-SUBRC = 0.

* OUT_PAR-VALUE = LW_LAND.

* MODIFY OUT_PAR INDEX SY-TABIX .

*

* End of Code Upinder Singh 03.01.2006

SELECT ADD_IDENT ADD_CODE INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZVVF_ARE1_ADDR WHERE WERKS = LW_WERKS.

* IF LW_KUNWE = 'P003'.

LOOP AT ITAB.

IF ITAB-ADD_IDENT = 'C1'.

SELECT SINGLE CAM_HANDLE INTO LW_CAM_HANDLE FROM J_1IADDRES

WHERE ADDRESS_NO = ITAB-ADD_CODE.

SELECT SINGLE STREET STR_SUPPL1 STR_SUPPL2 CITY1 CITY2

POST_CODE1

INTO

(W_STREET,W_STR_SUPPL1,W_STR_SUPPL2,W_CITY1,

W_CITY2,W_POST_CODE1)

FROM ADRC WHERE ADDRNUMBER = LW_CAM_HANDLE.

READ TABLE OUT_PAR WITH KEY 'STREET'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STREET.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'STR_SUPPL2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_STR_SUPPL2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY1.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'CITY2'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CITY2.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'POST_CODE1'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_POST_CODE1.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDIF.

ENDLOOP.

DATA: W_CSEAL(20) TYPE C.

clear it_lines.

IF LW_WERKS = 'P001' OR LW_WERKS = 'P003' OR LW_WERKS = 'P002' .

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z028'

LANGUAGE = 'E'

NAME = name

OBJECT = 'VBBK'

ARCHIVE_HANDLE = 0

LOCAL_CAT = ' '

* IMPORTING

* HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_lines.

move it_lines-tdline to w_cseal.

endloop.

ENDIF.

* IF LW_WERKS = 'P003'.

* W_CSEAL = 'C.EX.TR.VI-BEL'.

* ENDIF.

*

* IF LW_WERKS = 'P001' OR LW_WERKS = 'P002' .

* W_CSEAL = 'C.EX.-40'.

* ENDIF.

IF LW_WERKS = 'P004' OR LW_WERKS = 'P011' .

W_CSEAL = '__'.

ENDIF.

READ TABLE OUT_PAR WITH KEY 'W_CSEAL'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CSEAL.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'W_CONTAINER'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_CONTAINER.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'W_MARKS'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_MARKS.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'W_SEAL'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_SEAL.

MODIFY OUT_PAR INDEX SY-TABIX .

READ TABLE OUT_PAR WITH KEY 'W_PACKAGE'.

CHECK SY-SUBRC = 0.

OUT_PAR-VALUE = W_PACKAGE.

MODIFY OUT_PAR INDEX SY-TABIX .

* ENDIF.

ENDFORM. "ARE1_ADD

*&---------------------------------------------------------------------*

*& Form WRITE_FORM

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_0319 text

* -->P_0320 text

* -->P_0321 text

*----------------------------------------------------------------------*

FORM write_form USING element fnction window.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = element

function = fnction

type = 'BODY'

window = window

* IMPORTING

* PENDING_LINES =

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

spool_error = 8

codepage = 9

OTHERS = 10

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " WRITE_FORM

*&---------------------------------------------------------------------*

*& Form start_form

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM start_form USING l_layout l_stpg.

CALL FUNCTION 'START_FORM'

EXPORTING

* ARCHIVE_INDEX =

form = l_layout

* LANGUAGE = ''

startpage = l_stpg

program = sy-repid

* MAIL_APPL_OBJECT =

* IMPORTING

* LANGUAGE =

EXCEPTIONS

form = 1

format = 2

unended = 3

unopened = 4

unused = 5

spool_error = 6

codepage = 7

OTHERS = 8

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " start_form

*&---------------------------------------------------------------------*

*& Form close_form

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM close_form .

CALL FUNCTION 'CLOSE_FORM'

IMPORTING

RESULT = RESULT

* TABLES

* OTFDATA =

exceptions

unopened = 1

OTHERS = 6

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " close_form

*&---------------------------------------------------------------------*

*& Form open_form

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_OPTIONS text

* -->P_LAYOUT text

* <--P_RESULT text

*----------------------------------------------------------------------*

FORM open_form USING p_options

p_layout

CHANGING p_result.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

application = 'TX'

* ARCHIVE_INDEX =

* ARCHIVE_PARAMS =

device = 'PRINTER'

dialog = 'X'

form = p_layout

language = sy-langu

options = options

* MAIL_SENDER =

* MAIL_RECIPIENT =

* MAIL_APPL_OBJECT =

* RAW_DATA_INTERFACE = '*'

IMPORTING

* LANGUAGE =

* NEW_ARCHIVE_PARAMS =

RESULT = RESULT

exceptions

canceled = 1

device = 2

form = 3

options = 4

unclosed = 5

* MAIL_OPTIONS = 6

* ARCHIVE_ERROR = 7

* INVALID_FAX_NUMBER = 8

* MORE_PARAMS_NEEDED_IN_BATCH = 9

spool_error = 10

codepage = 11

OTHERS = 12

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " open_form

*&---------------------------------------------------------------------*

*& Form DIFF

*&---------------------------------------------------------------------*

* text WILL CALCULATE THE DIFF

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM DIFF_1 TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA : W_DOCNO LIKE J_1IEXCHDR-DOCNO.

DATA : W_YEAR(4).

DATA : W_ADDLVAL LIKE J_1IEXCHDR-ADDLVAL.

DATA : BEGIN OF I_EXC OCCURS 0,

EXBED LIKE J_1IEXCDTL-EXBED,

ECS LIKE J_1IEXCDTL-ECS,

END OF I_EXC.

DATA: W_TOT_EXBED LIKE J_1IEXCDTL-EXBED.

DATA: W_TOT_ECS LIKE J_1IEXCDTL-ECS.

DATA: TOTAL LIKE J_1IEXCDTL-EXBED.

DATA : C_TOTAL(15).

DATA : DIFF LIKE J_1IEXCDTL-EXBED.

DATA : C_DIFF(15).

DATA : C_ADDLVAL(15).

LOOP AT IN_PAR.

CASE IN_PAR-NAME.

WHEN 'J_1IEXCHDR-DOCNO'.

W_DOCNO = IN_PAR-VALUE.

WHEN 'J_1IEXCHDR-DOCYR'.

W_YEAR = IN_PAR-VALUE.

ENDCASE.

ENDLOOP.

SELECT SINGLE ADDLVAL FROM J_1IEXCHDR INTO W_ADDLVAL

WHERE TRNTYP = 'ARE1' AND

DOCNO = W_DOCNO AND

DOCYR = W_YEAR.

C_ADDLVAL = W_ADDLVAL.

if W_ADDLVAL IS INITIAL.

Message 'Bond opening balance not maintainted' type 'I'.

*LEAVE TO TRANSACTION SY-TCODE

*AND SKIP FIRST SCREEN .

**message e(0001) " 'Amount Not Maintained'.

endif.

READ TABLE OUT_PAR WITH KEY 'VAL1'.

OUT_PAR-VALUE = C_ADDLVAL.

MODIFY OUT_PAR INDEX SY-TABIX .

SELECT EXBED ECS FROM J_1IEXCDTL INTO CORRESPONDING FIELDS OF TABLE I_EXC

WHERE TRNTYP = 'ARE1' AND

DOCNO = W_DOCNO AND

DOCYR = W_YEAR.

LOOP AT I_EXC.

W_TOT_EXBED = W_TOT_EXBED + I_EXC-EXBED.

W_TOT_ECS = W_TOT_ECS + I_EXC-ECS.

ENDLOOP.

TOTAL = W_TOT_EXBED + W_TOT_ECS.

C_TOTAL = TOTAL.

READ TABLE OUT_PAR WITH KEY 'VAL2'.

OUT_PAR-VALUE = C_TOTAL.

MODIFY OUT_PAR INDEX SY-TABIX .

DIFF = W_ADDLVAL - TOTAL.

C_DIFF = DIFF.

READ TABLE OUT_PAR WITH KEY 'W_DIFF'.

OUT_PAR-VALUE = C_DIFF.

MODIFY OUT_PAR INDEX SY-TABIX .

ENDFORM. " DIFF

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)