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
Go on link..
link us with ...
Friday, December 31, 2010
findining USEREXIT for particular TCODE
*& Report ZEXIT_FIND *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZEF .
tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.
select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
atevent used in report
***** SYSTEM DEFINED REPORT VARIABLES ********
System field Information
SY-LSIND
Index of the list created during the current event (basic list = 0)
SY-LISTI
Index of the list level from which the event was triggered
SY-LILLI
Absolute number of the line from which the event was triggered
SY-LISEL
Contents of the line from which the event was triggered
SY-CUROW
Position of the line in the window from which the event was triggered
(counting starts with 1)
SY-CUCOL
Position of the column in the window from which the event was triggered
(counting starts with 2)
SY-CPAGE
Page number of the first displayed page of the list from which the
event was triggered
SY-STARO
Number of the first line of the first page displayed of the list from
which the event was triggered (counting starts with 1). This line may
contain the page header.
SY-STACO
Number of the first column displayed in the list from which the event
was triggered (counting starts with 1)
SY-UCOMM
Function code that triggered the event
SY-PFKEY
Status of the list currently being
*START-OF-SELECTION.
* WRITE 'CLICK HERE!' HOTSPOT COLOR 5 INVERSE ON.
WRITE : / .
WRITE : ' TEST HERE '.
*
*AT LINE-SELECTION.
* WRITE 'CLICK TO GET NEXT LIST !' HOTSPOT COLOR 5 INVERSE ON.
* WRITE : / 'LIST INDEX ', SY-LSIND.
*
****** EXAMPLE FOR SY-LSIND & SY-UCOMM *********
*START-OF-SELECTION.
* SET PF-STATUS 'TEST'.
*
* WRITE: 'STANDARD LIST, SY-LSIND =', SY-LSIND.
*
*AT LINE-SELECTION.
*
* WRITE: 'LINE-SELECTION, SY-LSIND =', SY-LSIND.
*
*AT USER-COMMAND.
*
* CASE SY-UCOMM.
* WHEN 'TEST'.
* WRITE: 'TESTED, SY-LSIND =', SY-LSIND.
* WHEN 'OTHER'.
* WRITE : / ' OTHERS TESTED ', SY-LSIND.
* ENDCASE.
*
*
*************** AT FIRST AND AT LAST AS HEADER & FOOTER *******
*TABLES: ZCOUNTRY.
*DATA ITAB LIKE ZCOUNTRY OCCURS 25 WITH HEADER LINE.
*SELECT * FROM ZCOUNTRY INTO TABLE ITAB.
*LOOP AT ITAB.
*AT FIRST.
*WRITE : / 'CNT CODE ', 10 'CNT POS', 25 'CNT NAME '.
*ULINE.
*ENDAT.
*
*WRITE : / ITAB-CNTCODE , 10 ITAB-CNTPOS, 25 ITAB-CNTNAME.
*AT LAST.
*WRITE : / , 10 '-------', 25 '--------'.
*ENDAT.
*ENDLOOP.
*FREE ITAB.
*DATA: BEGIN OF ITAB OCCURS 0,
* NUM TYPE I, NAME(20),
* SAL TYPE P DECIMALS 2,
* END OF ITAB.
*
* ITAB-NUM = 10.
* ITAB-NAME = 'RAJU'.
* ITAB-SAL = '455.55'.
* APPEND ITAB.
*
* ITAB-NUM = 20.
* ITAB-NAME = 'KIRAN'.
* ITAB-SAL = '232.45'.
* APPEND ITAB.
*
* ITAB-NUM = 30.
* ITAB-NAME = 'SWAMY'.
* ITAB-SAL = '67.89'.
* APPEND ITAB.
*
* ITAB-NUM = 40.
* ITAB-NAME = 'BHARATH'.
* ITAB-SAL = '567.89'.
* APPEND ITAB.
*
* ITAB-NUM = 50.
* ITAB-NAME = 'KALAYAN'.
* ITAB-SAL = '647.29'.
*
* APPEND ITAB.
*
* ITAB-NUM = 60.
* ITAB-NAME = 'SRAVAYA'.
* ITAB-SAL = '267.59'.
*
* APPEND ITAB.
*
* LOOP AT ITAB.
*
* AT FIRST.
* WRITE ' *** STATRT OF INFORMATION *** '.
* ULINE.
* SKIP 2.
* WRITE : ' NUMBER ', 20 'NAME ', 45 'SAL'.
* SKIP 2.
* ENDAT.
*
* WRITE : / ITAB-NUM, 20 ITAB-NAME, 45 ITAB-SAL.
* ULINE.
* AT LAST.
* SUM.
* WRITE : /30 'TOTAL SALARY ',ITAB-SAL.
*
* SKIP 2.
* WRITE : / ' END OF INFORMATION '.
* ULINE.
* ENDAT.
*
* ENDLOOP.
*
************ AT NEW AND AT END EVENTS *************
*DATA: BEGIN OF LINE,
* CARRID TYPE SBOOK-CARRID,
* CONNID TYPE SBOOK-CONNID,
* FLDATE TYPE SBOOK-FLDATE,
* CUSTTYPE TYPE SBOOK-CUSTTYPE,
* CLASS TYPE SBOOK-CLASS,
* BOOKID TYPE SBOOK-BOOKID,
* END OF LINE.
*
* DATA ITAB LIKE LINE OCCURS 0 WITH HEADER LINE.
*SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
* FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
*
*LOOP AT ITAB. "INTO LINE.
*
* AT FIRST.
* WRITE / 'TRAVEL BOOKING INFROMATION '.
* ULINE.
* ENDAT.
*
* AT NEW CARRID.
* WRITE: / 'Carrid:', ITAB-CARRID.
* ENDAT.
*
* AT NEW CONNID.
* WRITE: / 'Connid:', ITAB-CONNID.
* ENDAT.
*
* AT NEW FLDATE.
* WRITE: / 'Fldate:', ITAB-FLDATE.
* ENDAT.
*
* AT NEW CUSTTYPE.
* WRITE: / 'Custtype:', ITAB-CUSTTYPE.
* ENDAT.
*
* WRITE: / ITAB-BOOKID, ITAB-CLASS.
*
* AT END OF CLASS.
* ULINE.
* ENDAT.
*
*ENDLOOP.
*
*
ADDING TWO STRUCTURES
* BEGIN OF S1,
* NUM TYPE I VALUE 12,
* AMT TYPE P DECIMALS 2 VALUE '13.45',
* END OF S1.
*
*DATA:
* BEGIN OF S2,
* NUM TYPE I VALUE 10,
* AMT TYPE P DECIMALS 2 VALUE '34.56',
* NAME(20) TYPE C VALUE 'ESWAR',
* END OF S2.
*
* ADD-CORRESPONDING S1 TO S2.
*
* WRITE : / S2-NUM, S2-AMT, S2-NAME.
*
* ADDING SEQUENTIALFIELDS ...*********************
*DATA:
* BEGIN OF S3,
* A TYPE I VALUE 1,
* B TYPE I VALUE 2,
* C TYPE I VALUE 3,
* D TYPE I VALUE 4,
* E TYPE I VALUE 5,
* END OF S3,
*
* GTOT TYPE P VALUE 5 ,
* TTOT TYPE P VALUE 5.
* ADD S3-A THEN S3-B UNTIL S3-E GIVING GTOT.
* ADD S3-A THEN S3-B UNTIL S3-E TO TTOT.
*
* WRITE: / 'TOTAL GIVING = ', GTOT.
*
* WRITE: / 'TOTAL TO = ', TTOT .
*
*FIELD-SYMBOLS .... *******************************
*PARAMETERS: NAME(20) TYPE C,
* NUM(5) TYPE N.
*
* FIELD-SYMBOLS
*
* ASSIGN NUM TO
* WRITE
* ASSIGN NAME TO
* WRITE
*
* FIELDS-SYMBOLS FOR STRUCTURES ...****************************
*DATA:
*
* BEGIN OF TNAME,
* FIRSTNAME(20) TYPE C VALUE 'KIRAN',
* MIDDLENAME(20) TYPE C VALUE 'KUMAR',
* LASTNAME(20) TYPE C VALUE 'RAMI',
* END OF TNAME.
*
**DATA MYNAME TYPE TNAME.
**
**MYNAME-FIRSTNAME = 'RAMI'.
**MYNAME-MIDDLENAME = 'VENKAT'.
**MYNAME-LASTNAME = 'ESWAR'.
**
**WRITE : / MYNAME-FIRSTNAME, MYNAME-MIDDLENAME, MYNAME-LASTNAME.
*
*
*FIELD-SYMBOLS
*
*ASSIGN COMPONENT SY-INDEX OF STRUCTURE TNAME TO
*
*WRITE: /
DATA: BEGIN OF LINE,
COL1 TYPE I VALUE '11',
COL2 TYPE I VALUE '22',
COL3 TYPE I VALUE '33',
END OF LINE.
DATA COMP(5) VALUE 'COL3'.
FIELD-SYMBOLS:
ASSIGN LINE TO
ASSIGN COMP TO
DO 3 TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE
WRITE
ENDDO.
ASSIGN COMPONENT
WRITE /
ABAP QUERY
1. DEFINE THE USER GROUP (SQ03) - GO TO 'ENVIRONMENT' -QUERY AREA
SELECT (GLOBAL-CROSS CLIENT)
2. GIVE THE NAME - CREATE -SAVE -BACK
3. DEFINE THE FUNCATIONAL AREAS (SQ02) - GIVE THE NAME OF FUN. AREA
4. CREATE - GIVE DESCRIPTION - GIVE THE 'LDB' NAME OR ANY DATA BASE TABLE
5. ENTER - CLICK ON FUNCAL GROUPS - CREATE - GIVE 3 NAMES FOR 3 TABLE OF LDB
6. SELECT THE FIRST FUNCTIONAL GROUP - THEN - GO TO THE FIRST TABLE OF LDB
7. EXPAND THE TABLE COLUMNS AND MAKE THE SELECTION OF COULMNS FOR THAT
FUNCTIONAL GROUP - SAVE.
8. THEN - REPEAT THE SAME OPERATION FOR THE REMAINING TWO FUNC. GROUP
9. SAVE - BACK -IT'LL ASK FOR 'GENERATION' - CLICK - YES - BACK
10. GO TO USERGROUP - CLICK ON 'ASSIGN USER GROUP' - TYPE 'SAPUSER' AND
CLICK ON CHANGE AUTHORIZATION - SAVE - BACK.
11. GO TO FUNCTIONAL AREA - CLICK ON 'ASSIGN FUNC. AREA' - SELECT YOUR USER GROUP
AND SELECT YOUR FUNCATIONAL AREA - SAVE - BACK
12. GO TO QUERY - CREATE - GIVE THE TITLE - SELECT - BASIC LIST - FROM 'DATA FIELDS'
EXPLAND THE TABLE(S) - THEN SELECT - COLUMNS FROM EACH TABLE
13. TAKE THE HEADER AND FOOTER FOR ADDING HEADER AND FOOTER TO THE LIST
14. EXECUTE.
ABAP Technical Interview Questions
ABAP Technical Interview Questions:
1. What is the typical structure of an ABAP program?
2. What are field symbols and field groups.? Have you used "component idx of structure" clause with field groups?
3. What should be the approach for writing a BDC program?
4. What is a batch input session?
5. What is the alternative to batch input session?
6. A situation: An ABAP program creates a batch input session. We need to submit the program and the batch session in background. How to do it?
7. What is the difference between a pool table and a transparent table and how they are stored at the database level?
8. What are the problems in processing batch input sessions? How is batch input process different from processing on line?
9. What do you define in the domain and data element?
10. What are the different types of data dictionary objects?
11. How many types of tables exist and what are they in data dictionary?
12. What is the step-by-step process to create a table in data dictionary?
13. Can a transparent table exist in data dictionary but not in the database physically?
14. What are the domains and data elements?
15. Can you create a table with fields not referring to data elements?
16. What is the advantage of structures? How do you use them in the ABAP programs?
17. What does an extract statement do in the ABAP program?
18. What is a collect statement? How is it different from append?
19. What is open sql vs native sql?
20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
21. What is the meaning of ABAP editor integrated with ABAP data dictionary?
22. What are the events in ABAP language?
23. What is an interactive report? What is the obvious diff of such report compared with classical type reports?
24. What is a drill down report?
25. How do you write a function module in SAP? Describe.
26. What are the exceptions in function module?
27. What is a function group?
28. How are the date abd time field values stored in SAP?
29. What are the fields in a BDC_Tab Table?
30. Name a few data dictionary objects?
31. What happens when a table is activated in DD?
32. What is a check table and what is a value table?
33. What are match codes? Describe?
34. What transactions do you use for data analysis?
35. What is table maintenance generator?
36. What are ranges? What are number ranges?
37. What are select options and what is the diff from parameters?
38. How do you validate the selection criteria of a report? And how do you display initial values in a selection screen?
39. What are selection texts?
40. What is CTS and what do you know about it?
41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?
42. What is the client concept in SAP? What is the meaning of client independent?
43. Are programs client dependent?
44. Name a few system global variables you can use in ABAP programs?
45. What are internal tables? How do you get the number of lines in an internal table? How to use a specific number occurs statement?
46. How do you take care of performance issues in your ABAP programs?
47. What are datasets?
48. How to find the return code of a stmt in ABAP programs?
49. What are interface/conversion programs in SAP?
50. Have you used SAP supplied programs to load master data?
1. What are the techniques involved in using SAP supplied programs? Do you prefer to write your own programs to load master data? Why?
2. What are logical databases? What are the advantages/disadvantages of logical databases?
3. What specific statements do you using when writing a drill down report?
4. What are different tools to report data in SAP? What all have you used?
5. What are the advantages and disadvantages of ABAP query tool?
6. What are the functional areas? User groups? How does ABAP query work in relation to these?
7. Is a logical database a requirement/must to write an ABAP query?
8. What is the structure of a BDC sessions.
9. What are Change header/detail tables? Have you used them?
10. What do you do when the system crashes in the middle of a BDC batch session?
11. What do you do with errors in BDC batch sessions?
12. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
13. Is it possible to run host command from SAP environment? How do you run?
14. What kind of financial periods exist in SAP? What is the relevant table for that?
15. Does SAP handle multiple currencies? Multiple languages?
16. What is a currency factoring technique?
17. How do you document ABAP programs? Do you use program documentation menu option?
18. What is SAPscript and layout set?
19. What are the ABAP commands that link to a layout set?
20. What is output determination?
SDL0FIR0_GL_S
*& Report ZVVF_SDL0FIR0_GL_S *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZVVF_SDL0FIR0_GL_S LINE-SIZE 230
NO STANDARD PAGE HEADING.
TABLES : T001, BSEG, BKPF , SKB1 , KNA1, LFA1, SKAT, PAYR,SKA1,GLT0.
PARAMETERS : BUKRS LIKE T001-BUKRS MEMORY ID BUK.
SELECTION-SCREEN BEGIN OF BLOCK GEN WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : BELNR FOR BKPF-BELNR,
HKONT FOR SKB1-SAKNR MATCHCODE OBJECT SAKO OBLIGATORY,
BLART FOR BKPF-BLART,
BUDAT FOR BKPF-BUDAT OBLIGATORY.
SELECTION-SCREEN END OF BLOCK GEN .
SELECTION-SCREEN BEGIN OF BLOCK OUT WITH FRAME TITLE TEXT-003.
PARAMETERS : LIST RADIOBUTTON GROUP OUT,
XXL RADIOBUTTON GROUP OUT.
SELECTION-SCREEN END OF BLOCK OUT .
*$*$ Data Decleration
DATA : BEGIN OF IT_BELNR OCCURS 1000 ,
BELNR LIKE BKPF-BELNR,
END OF IT_BELNR.
DATA IGLT0 LIKE GLT0 OCCURS 10 WITH HEADER LINE.
DATA : BEGIN OF IT_DATA OCCURS 1000 ,
BUDAT LIKE BKPF-BUDAT,
BELNR LIKE BSEG-BELNR,
BLDAT LIKE BKPF-BLDAT,
CHECT LIKE PAYR-CHECT,
LIFNR LIKE BSEG-LIFNR,
NAME1 LIKE KNA1-NAME1,
SGTXT LIKE BSEG-SGTXT,
DR LIKE BSEG-WRBTR,
CR LIKE BSEG-WRBTR,
SALDO LIKE RF42B-SALDO,
END OF IT_DATA.
DATA : CHAR10(10),
CHAR10A(10),
IBSEG LIKE BSEG OCCURS 1000 WITH HEADER LINE,
CHAR30(30),
FIRST_DATE LIKE BUDAT,
GJAHR LIKE BKPF-GJAHR,
DATE(10),
POSTPERIOD LIKE T009B-POPER,
LAST_PERIOD_LDATE LIKE SY-DATUM,
LAST_PERIOD LIKE POSTPERIOD,
FIRST_PERIOD LIKE LAST_PERIOD,
BEGIN OF SUMM,
HSL01 like GLT0-HSL01,
HSL02 like GLT0-HSL02,
HSL03 like GLT0-HSL03,
HSL04 like GLT0-HSL04,
HSL05 like GLT0-HSL05,
HSL06 like GLT0-HSL06,
HSL07 like GLT0-HSL07,
HSL08 like GLT0-HSL08,
HSL09 like GLT0-HSL09,
HSL10 like GLT0-HSL10,
HSL11 like GLT0-HSL11,
HSL12 like GLT0-HSL12,
HSLVT like GLT0-HSLVT,
END OF SUMM,
DUMMY_FIYEAR LIKE BSEG-GJAHR,
FLG_FIRST.
DATA : PERIOD_CL_VALUE LIKE RF42B-SALDO,
PERIOD_CL_DEBIT LIKE RF42B-UMNNS,
PERIOD_CL_CREDIT LIKE RF42B-UMNNH,
PERIOD_CL_BALANCE LIKE RF42B-SALDO,
ACCT_BAL_CR LIKE GLT0-HSLVT,
ACCT_BAL_DR LIKE GLT0-HSLVT,
CURRENT_CR LIKE RF42B-SALDO,
CURRENT_DR LIKE RF42B-SALDO,
CURRENT_BALANCE LIKE RF42B-SALDO.
FIELD-SYMBOLS
INCLUDE ZVVF_TSDL0BSIO_S.
*INCLUDE ZVVF_SDL0BSIO_S.
DEFINE SORT_IT_DATA.
IF &1 = 'D'.
SORT IT_DATA BY &2 DESCENDING..
ELSE.
SORT IT_DATA BY &2.
ENDIF.
END-OF-DEFINITION.
*$*$ At selection-screen *$*$
AT SELECTION-SCREEN ON BUKRS.
PERFORM CHECK_BUKRS .
AT SELECTION-SCREEN ON BUDAT.
PERFORM CHECK_GJAHR .
*$*$ Start-of-selection
START-OF-SELECTION.
SET PF-STATUS 'GL00'.
PERFORM FIND_OPEN_BALANCE.
IF FLG_FIRST = 'X'.
LAST_PERIOD_LDATE = BUDAT-LOW.
LAST_PERIOD_LDATE+5(2) = '01'.
ELSE.
LAST_PERIOD_LDATE = LAST_PERIOD_LDATE + 1.
ENDIF.
PERFORM GET_DATA.
PERFORM GET_CUR_GLBAL.
SORT IT_DATA BY BUDAT BELNR.
LOOP AT IT_DATA.
CURRENT_BALANCE = CURRENT_BALANCE - IT_DATA-CR + IT_DATA-DR.
IT_DATA-SALDO = CURRENT_BALANCE.
MODIFY IT_DATA.
ENDLOOP.
WRITE IT_DATA-SALDO TO SY-TVAR2 CURRENCY 'INR' .
IF IT_DATA[] IS INITIAL .
MESSAGE 'No data selected. Please Check your Input' TYPE 'E'.
ENDIF.
*$*$ End-of-selection.
END-OF-SELECTION.
IF LIST = SPACE.
PERFORM TO_XXL.
ELSE.
NEW-PAGE LINE-COUNT 58.
PERFORM WRITE_LIST.
ENDIF.
*$*$ At user-command.
AT USER-COMMAND.
PERFORM HANDLE_USER_COMMAND.
*$*$ At line-selection
AT LINE-SELECTION.
PERFORM LINE_SELECTION.
*$*$ Top-of-page.
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM WRITE_HEADING.
TOP-OF-PAGE.
PERFORM WRITE_HEADING.
*&---------------------------------------------------------------------*
*& Form CHECK_GJAHR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHECK_GJAHR .
DATA TMP_GJAHR LIKE GJAHR.
IF BUDAT-HIGH IS INITIAL . BUDAT-HIGH = BUDAT-LOW. ENDIF.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = BUDAT-LOW
I_BUKRS = BUKRS
I_PERIV = T001-PERIV
IMPORTING
E_POPER = POSTPERIOD
E_GJAHR = GJAHR
EXCEPTIONS
FISCAL_YEAR = 1
PERIOD = 2
PERIOD_VERSION = 3
POSTING_PERIOD = 4
SPECIAL_PERIOD = 5
VERSION = 6
POSTING_DATE = 7
OTHERS = 8.
CHECK NOT BUDAT-HIGH IS INITIAL.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = BUDAT-HIGH
I_BUKRS = BUKRS
I_PERIV = T001-PERIV
IMPORTING
E_GJAHR = TMP_GJAHR
EXCEPTIONS
FISCAL_YEAR = 1
PERIOD = 2
PERIOD_VERSION = 3
POSTING_PERIOD = 4
SPECIAL_PERIOD = 5
VERSION = 6
POSTING_DATE = 7
OTHERS = 8.
IF TMP_GJAHR NE GJAHR .
MESSAGE 'Something missing' type 'I'.
ENDIF.
ENDFORM. " CHECK_GJAHR
*&---------------------------------------------------------------------*
*& Form WRITE_AC_TEXT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM WRITE_AC_TEXT.
CASE BSEG-KOART.
WHEN 'S' OR 'M'.
SELECT SINGLE TXT20 FROM SKAT INTO IT_DATA-NAME1
WHERE SPRAS = SY-LANGU
AND KTOPL = T001-KTOPL
AND SAKNR = BSEG-HKONT.
IT_DATA-LIFNR = BSEG-HKONT.
WHEN 'D'.
SELECT SINGLE NAME1 FROM KNA1 INTO IT_DATA-NAME1
WHERE KUNNR = BSEG-KUNNR.
IT_DATA-LIFNR = BSEG-KUNNR.
WHEN 'K'.
SELECT SINGLE NAME1 FROM LFA1 INTO IT_DATA-NAME1
WHERE LIFNR = BSEG-LIFNR.
IT_DATA-LIFNR = BSEG-LIFNR.
ENDCASE.
ENDFORM. " WRITE_AC_TEXT
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHECK_BUKRS.
SELECT SINGLE * FROM T001
WHERE BUKRS = BUKRS.
* IF SY-SUBRC NE 0.
* MESSAGE 'E050' type 'I'.
* ENDIF.
*AUTHORITY-CHECK OBJECT 'Z_SDL_REPS'
* ID 'TCD' FIELD SY-TCODE
* ID 'BUKRS' FIELD BUKRS
* ID 'VKORG' FIELD '*'
* ID 'WERKS' FIELD '*'.
* IF SY-SUBRC NE 0
* .MESSAGE 'E039' type 'I'.
* ENDIF.
ENDFORM. " CHECK_BUKRS
*&---------------------------------------------------------------------*
*& Form WRITE_CEQUE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM WRITE_CEQUE_DATA.
SELECT SINGLE * FROM PAYR
WHERE ZBUKR = BUKRS
AND VBLNR = IT_BELNR
AND GJAHR = GJAHR.
IF SY-SUBRC = 0.
IT_DATA-CHECT = PAYR-CHECT.
ELSE.
CLEAR IT_DATA-CHECT.
ENDIF.
ENDFORM. " WRITE_CEQUE_DATA
*&---------------------------------------------------------------------*
*& Form TO_XXL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM TO_XXL.
COLL_HEADER '1' 'Post. date'.
COLL_HEADER '2' 'Docu. No'.
ROW_HEADER '1' '1' 'Docu. Date'.
ROW_HEADER '1' '2' 'Cheque No'.
ROW_HEADER '1' '3' 'Offset A/C'.
ROW_HEADER '1' '4' 'A/C Desc'.
ROW_HEADER '1' '5' 'Text'.
ROW_HEADER '1' '6' 'Debit(Rs)'.
ROW_HEADER '1' '7' 'Credit(Rs)'.
ROW_HEADER '1' '8' 'Balance(Rs)'.
COL_ATR '1' ' ' 'DAT' 'DFT' ' ' .
COL_ATR '2' ' ' 'STR' 'DFT' ' ' .
COL_ATR '3' ' ' 'DAT' 'NOP' ' ' .
COL_ATR '4' ' ' 'STR' 'DFT' ' ' .
COL_ATR '5' ' ' 'STR' 'DFT' ' ' .
COL_ATR '6' ' ' 'STR' 'DFT' ' ' .
COL_ATR '7' ' ' 'STR' 'DFT' ' ' .
COL_ATR '8' ' ' 'NUM' 'ADD' ' ' .
COL_ATR '9' ' ' 'NUM' 'ADD' ' ' .
COL_ATR '10' ' ' 'NUM' 'ADD' ' ' .
P_HEADER 'H' 'L' '1' T001-BUTXT.
P_HEADER 'H' 'C' '1' TEXT-002.
* write sy-uzeit format '__:__:__' to char10 .
* write sy-datum to char10a dd/mm/yyyy
CONCATENATE 'Time' SY-UZEIT 'Date' SY-DATUM INTO CHAR30
SEPARATED BY SPACE.
P_HEADER 'H' 'R' '1' CHAR30.
P_HEADER 'H' 'L' '2' T001-ORT01.
SELECT SINGLE * FROM SKAT
WHERE SPRAS = SY-LANGU
AND KTOPL = T001-KTOPL
AND SAKNR = HKONT-LOW.
P_HEADER 'H' 'C' '2' SKAT-TXT50.
CONCATENATE SY-CPROG '/' SY-UNAME INTO CHAR30 SEPARATED BY SPACE.
P_HEADER 'H' 'R' '2' CHAR30.
CONCATENATE 'Open. Bal :' SY-TVAR1 INTO CHAR30 SEPARATED BY SPACE.
CONDENSE CHAR30.
P_HEADER 'H' 'L' '3' CHAR30.
IF BUDAT-HIGH IS INITIAL.
CONCATENATE 'On' BUDAT-LOW INTO CHAR30 SEPARATED BY SPACE.
ELSE.
CONCATENATE 'From' BUDAT-LOW 'To' BUDAT-HIGH
INTO CHAR30 SEPARATED BY SPACE.
ENDIF.
P_HEADER 'H' 'C' '3' CHAR30.
CONCATENATE 'Clos. Bal :' SY-TVAR2 INTO CHAR30 SEPARATED BY SPACE.
CONDENSE CHAR30.
P_HEADER 'H' 'R' '3' CHAR30.
* call_xxl '1' 'A/C Summery' it_data.
CALL_XXL_FULL '2' 'A/C Summery' IT_DATA '8' '1'.
ENDFORM. " TO_XXL
*&---------------------------------------------------------------------*
*& Form WRITE_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM WRITE_LIST.
DATA INT TYPE I.
LOOP AT IT_DATA.
NEW-LINE.
FORMAT COLOR 2.
INT = SY-TABIX MOD 2.
IF INT IS INITIAL.
FORMAT INTENSIFIED OFF.
ELSE.
FORMAT INTENSIFIED ON.
ENDIF.
WRITE : AT 1 '|', IT_DATA-BUDAT,
AT 13 '|', IT_DATA-BELNR HOTSPOT ON,
AT 25 '|', IT_DATA-BLDAT,
AT 37 '|', IT_DATA-CHECT,
AT 51 '|', IT_DATA-LIFNR,
AT 63 '|', IT_DATA-NAME1,
AT 99 '|', IT_DATA-SGTXT,
AT 151 '|', IT_DATA-DR,
AT 170 '|', IT_DATA-CR.
IF IT_DATA-SALDO < 0.
WRITE : AT 188 '|', IT_DATA-SALDO COLOR 6.
ELSE.
WRITE : AT 188 '|', IT_DATA-SALDO COLOR 5.
ENDIF.
WRITE : AT 214 '|'.
AT LAST.
ULINE.
SUM.
FORMAT COLOR OFF.
NEW-LINE.
WRITE : AT 151 '|', IT_DATA-DR COLOR 5,
AT 170 '|', IT_DATA-CR COLOR 6,
AT 188 '|'.
NEW-LINE.
ULINE AT 151(38).
ENDAT.
ENDLOOP.
CLEAR IT_DATA.
ENDFORM. " WRITE_LIST
*&---------------------------------------------------------------------*
*& Form HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM HANDLE_USER_COMMAND.
FIELD-SYMBOLS
SY-LSIND = 0.
CASE SY-UCOMM.
WHEN 'PICK' OR 'DET' . "Choose
DATA N10(10) TYPE N.
N10 = SY-LISEL+14(10).
SELECT SINGLE * FROM BKPF
WHERE BUKRS = BUKRS
AND BELNR = N10
AND GJAHR = GJAHR.
CHECK SY-SUBRC = 0.
SET PARAMETER ID 'BLN' FIELD N10.
SET PARAMETER ID 'GJR' FIELD GJAHR.
SET PARAMETER ID 'BUK' FIELD BUKRS.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
WHEN 'S+'. "Next Field
SCROLL LIST RIGHT BY 20 PLACES.
WHEN 'S++'.
SCROLL LIST RIGHT.
WHEN 'S-'. "Previous Field
SCROLL LIST LEFT BY 20 PLACES.
WHEN 'S--'. "First Field
SCROLL LIST LEFT .
WHEN 'UP'. "Up
GET CURSOR FIELD CHAR30.
CHECK CHAR30 CS 'IT_DATA-'.
SHIFT CHAR30 UP TO '-'. SHIFT CHAR30 .
ASSIGN CHAR30 TO
SORT_IT_DATA ' ' (
PERFORM WRITE_LIST.
WHEN 'DOWN'. "Down
GET CURSOR FIELD CHAR30.
CHECK CHAR30 CS 'IT_DATA-'.
SHIFT CHAR30 UP TO '-'. SHIFT CHAR30 .
ASSIGN CHAR30 TO
SORT_IT_DATA 'D' (
PERFORM WRITE_LIST.
WHEN 'SEL'.
MODIFY CURRENT LINE LINE FORMAT COLOR = 4.
ENDCASE.
ENDFORM. " HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
*& Form WRITE_HEADING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM WRITE_HEADING.
* format color 3.
SELECT SINGLE * FROM SKAT
WHERE SPRAS = SY-LANGU
AND KTOPL = T001-KTOPL
AND SAKNR = HKONT-LOW.
FORMAT COLOR 3. FORMAT INTENSIFIED OFF.
DATA CHAR150(150).
DATA DATE1(10).
DATA DATE1A(1).
WRITE SY-DATUM TO DATE DD/MM/YYYY.
CONCATENATE 'Time' SY-UZEIT 'Date' DATE INTO CHAR30
SEPARATED BY SPACE.
WRITE : T001-BUTXT LEFT-JUSTIFIED .
SY-INDEX = SY-LINSZ - 60.
WRITE AT 30+(SY-INDEX) : TEXT-002 CENTERED .
SY-INDEX = SY-LINSZ - 30.
WRITE AT SY-INDEX+(30) CHAR30 RIGHT-JUSTIFIED.
WRITE BUDAT-LOW TO DATE DD/MM/YYYY .
NEW-LINE.
FORMAT INTENSIFIED OFF.
SY-INDEX = SY-LINSZ - 60.
WRITE AT 30+(SY-INDEX) : SKAT-TXT50 CENTERED .
WRITE AT 180+(50) : ''.
NEW-LINE.
IF BUDAT-HIGH IS INITIAL.
CONCATENATE 'On' DATE INTO CHAR30 SEPARATED BY SPACE.
ELSE.
WRITE BUDAT-HIGH TO DATE1 DD/MM/YYYY.
CONCATENATE 'From' DATE 'To' DATE1
INTO CHAR30 SEPARATED BY SPACE.
ENDIF.
WRITE : T001-ORT01 .
SY-INDEX = SY-LINSZ - 60.
WRITE AT 30+(SY-INDEX) : CHAR30 CENTERED .
SY-INDEX = SY-LINSZ - 30.
CONCATENATE SY-CPROG SY-UNAME INTO CHAR30 SEPARATED BY SPACE.
WRITE AT SY-INDEX+(30) CHAR30 RIGHT-JUSTIFIED .
NEW-LINE.
DATA BAL_CA_FD LIKE ACCT_BAL_DR.
BAL_CA_FD = ACCT_BAL_CR + ACCT_BAL_DR.
NEW-LINE. SKIP.
FORMAT : COLOR 4, INTENSIFIED ON.
WRITE : 'Opening balance as on', BUDAT-LOW,
SY-TVAR1 .
NEW-LINE.
FORMAT COLOR 4.
WRITE : 'Closing balance as on', BUDAT-HIGH,
SY-TVAR2 .
* write : 'Current Period',
* at 15 period_cl_credit , '(Cr)',
* at 42 period_cl_debit , '(Dr)',
* at 70 period_cl_balance , '(Net)'.
* new-line.
* write : 'On' , budat-low dd/mm/yy,
* at 15 current_cr , '(Cr)',
* at 42 current_dr , '(Dr)',
* at 70 current_balance , '(Net)'.
FORMAT COLOR 1.
ULINE.
SKIP 1.
ULINE.
WRITE : AT 1 '|', 'Post. date',
AT 13 '|', 'Docu. No',
AT 25 '|', 'Docu. Date',
AT 37 '|', 'Cheque No',
AT 51 '|', 'Offset A/C',
AT 63 '|', 'A/C Desc',
AT 99 '|', 'Text',
AT 151 '|', 'Debit(Rs)',
AT 170 '|', 'Credit(Rs)',
AT 188 '|', 'Balance',
AT 214 '|'.
ULINE.
ENDFORM. " WRITE_HEADING
*&---------------------------------------------------------------------*
*& Form FIND_OPEN_BALANCE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FIND_OPEN_BALANCE.
* Check whether Input G/L Account is a Cash account
select single * from SKA1 where KTOPL = T001-KTOPL
AND SAKNR = HKONT-LOW.
if POSTPERIOD = 001.
LAST_PERIOD = 1.
FLG_FIRST = 'X'.
else.
LAST_PERIOD = POSTPERIOD - 1.
endif.
* Determine the Date of the Last Day for the Last Period
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
I_GJAHR = GJAHR
I_PERIV = T001-PERIV
I_POPER = LAST_PERIOD
IMPORTING
E_DATE = LAST_PERIOD_LDATE
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4.
case SY-SUBRC.
when 1.
MESSAGE 'Invalid Date Input' type 'I'.
when 2.
MESSAGE 'Fiscal Year variant V3 not in table T009' type 'I'.
when 3.
MESSAGE 'Fiscal Year variant V3 not in table T009B' type 'I'.
when 4.
MESSAGE 'Error while converting Input Date to Fiscal Period' type 'I'.
endcase.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = BUDAT-LOW
I_PERIV = T001-PERIV
IMPORTING
E_BUPER = first_PERIOD
E_GJAHR = GJAHR
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4.
FIRST_DATE = BUDAT-LOW.
FIRST_DATE+6(02) = '01'.
first_PERIOD = first_PERIOD - 1.
select * from GLT0 into table IGLT0
WHERE BUKRS = BUKRS AND RACCT IN HKONT AND RYEAR = GJAHR.
if SY-SUBRC <> 0.
MESSAGE 'No record found' type 'I'.
endif.
PERFORM GET_LAST_PERIOD_CL_VALUE USING LAST_PERIOD 'S'.
PERIOD_CL_DEBIT = PERIOD_CL_VALUE.
CLEAR PERIOD_CL_VALUE.
PERFORM GET_LAST_PERIOD_CL_VALUE USING LAST_PERIOD 'H'.
PERIOD_CL_CREDIT = PERIOD_CL_VALUE.
PERIOD_CL_BALANCE = PERIOD_CL_BALANCE +
PERIOD_CL_DEBIT + PERIOD_CL_CREDIT +
ACCT_BAL_CR + ACCT_BAL_DR.
ENDFORM. " FIND_OPEN_BALANCE
*&---------------------------------------------------------------------*
*& Form GET_LAST_PERIOD_CL_VALUE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LAST_PERIOD text *
* -->P_1383 text *
*----------------------------------------------------------------------*
FORM GET_LAST_PERIOD_CL_VALUE USING LAST_PERIOD P_DRCRIND.
if P_DRCRIND = 'H'.
LOOP AT IGLT0 WHERE DRCRK = 'H'.
MOVE-CORRESPONDING IGLT0 TO SUMM.
ACCT_BAL_CR = ACCT_BAL_CR + IGLT0-HSLVT.
clear IGLT0.
do firST_PERIOD times.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE SUMM TO
if SY-SUBRC <> 0.
EXIT.
endif.
PERIOD_CL_VALUE =
enddo.
ENDLOOP.
CLEAR SUMM.
elseif P_DRCRIND = 'S'.
LOOP AT IGLT0 WHERE DRCRK = 'S'.
move-corresponding IGLT0 to SUMM.
ACCT_BAL_DR = ACCT_BAL_DR + IGLT0-HSLVT."Account Balance Debit Fd
clear IGLT0.
do firST_PERIOD times.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE SUMM TO
if SY-SUBRC <> 0.
EXIT.
endif.
PERIOD_CL_VALUE =
enddo.
ENDLOOP.
clear SUMM.
endif.
ENDFORM. " GET_LAST_PERIOD_CL_VALUE
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_DATA.
SELECT * FROM BSEG APPENDING
CORRESPONDING FIELDS OF TABLE IT_BELNR
WHERE BUKRS = BUKRS
AND GJAHR = GJAHR
AND HKONT IN HKONT
ORDER BY PRIMARY KEY.
SORT IT_BELNR.
DELETE ADJACENT DUPLICATES FROM IT_BELNR.
LOOP AT IT_BELNR.
CLEAR IT_DATA.
SELECT SINGLE * FROM BKPF
WHERE BUKRS = BUKRS
AND BELNR = IT_BELNR
AND GJAHR = GJAHR
AND BLART IN BLART.
CHECK SY-SUBRC = 0.
CHECK BKPF-BUDAT BETWEEN LAST_PERIOD_LDATE AND BUDAT-HIGH.
IF BKPF-BUDAT >= LAST_PERIOD_LDATE
AND BKPF-BUDAT < BUDAT-LOW.
SELECT * FROM BSEG
APPENDING CORRESPONDING FIELDS OF TABLE IBSEG
WHERE BUKRS = BUKRS
AND BELNR = IT_BELNR
AND GJAHR = GJAHR
AND HKONT IN HKONT.
ELSE.
SELECT * FROM BSEG
WHERE BUKRS = BUKRS
AND BELNR = IT_BELNR
AND GJAHR = GJAHR
AND HKONT NOT IN HKONT.
CLEAR IT_DATA.
MOVE-CORRESPONDING BKPF TO IT_DATA.
MOVE-CORRESPONDING BSEG TO IT_DATA.
IF BSEG-SHKZG = 'S'.
IT_DATA-CR = BSEG-DMBTR.
ELSE.
IT_DATA-DR = BSEG-DMBTR.
ENDIF.
PERFORM WRITE_AC_TEXT.
PERFORM WRITE_CEQUE_DATA.
APPEND IT_DATA.
ENDSELECT.
ENDIF.
ENDLOOP.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form GET_CUR_GLBAL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_CUR_GLBAL.
CURRENT_CR = PERIOD_CL_CREDIT.
CURRENT_DR = PERIOD_CL_DEBIT.
CURRENT_BALANCE = PERIOD_CL_BALANCE.
LOOP AT IBSEG.
IF IBSEG-SHKZG = 'H'.
CURRENT_CR = CURRENT_CR + IBSEG-DMBTR.
CURRENT_BALANCE = CURRENT_BALANCE - IBSEG-DMBTR.
ELSE.
CURRENT_DR = CURRENT_DR + IBSEG-DMBTR.
CURRENT_BALANCE = CURRENT_BALANCE + IBSEG-DMBTR.
ENDIF.
ENDLOOP.
WRITE CURRENT_BALANCE TO SY-TVAR1. "*-*-*--=====///////////////////
ENDFORM. " GET_CUR_GLBAL
*&---------------------------------------------------------------------*
*& Form LINE_SELECTION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM LINE_SELECTION.
DATA N10(10) TYPE N.
N10 = SY-LISEL+14(10).
SELECT SINGLE * FROM BKPF
WHERE BUKRS = BUKRS
AND BELNR = N10
AND GJAHR = GJAHR.
CHECK SY-SUBRC = 0.
SET PARAMETER ID 'BLN' FIELD SY-LISEL+14(10).
SET PARAMETER ID 'GJR' FIELD GJAHR.
SET PARAMETER ID 'BUK' FIELD BUKRS.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDFORM. " LINE_SELECTION
PURChase BOOK
*& Report ZVVF_FR017_PURCBOOK *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZVVF_FR017_PURCBOOK_06042005 .
*Tables
TABLES : bkpf, bseg, mara, t007a, t007s, makt, lfa1,
konv, ekko, ekpo, lfb1.
TYPE-POOLS SLIS.
*Parameters : p_werks like bseg-werks. "Plant/Depot
*
**---------------------------------------------------------------------*
* Constants Begin with C_
**---------------------------------------------------------------------*
CONSTANTS: st_formname_top_of_page TYPE slis_formname
VALUE 'TOP_OF_PAGE-ALV'.
DATA : BEGIN OF itab OCCURS 0,
werks LIKE bseg-werks,
NAME2 LIKE T001W-NAME1,
belnr LIKE bkpf-belnr,
buzei LIKE bseg-buzei,
bldat LIKE bkpf-bldat,
budat like bkpf-budat,
lifnr LIKE bseg-lifnr,
name1 LIKE lfa1-name1,
ort01 LIKE lfa1-ort01,
xblnr LIKE bkpf-xblnr,
bktxt LIKE bkpf-bktxt,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
maktx LIKE makt-maktx,
mwskz LIKE bseg-mwskz,
text1 LIKE t007s-text1,
landl LIKE bseg-landl,
waers LIKE bkpf-waers,
ekorg LIKE ekko-ekorg,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
matkl LIKE ekpo-matkl,
meins LIKE ekpo-matkl,
menge LIKE ekpo-menge,
netwr LIKE ekpo-netwr,
mtart LIKE ekpo-mtart,
txjcd LIKE ekpo-txjcd,
emlif LIKE ekpo-emlif,
other_costs LIKE bseg-dmbtr,
totpr LIKE bseg-dmbtr,
dmbtr LIKE bseg-dmbtr,
FBILL LIKE bseg-dmbtr,
FBASE_AMT LIKE bseg-dmbtr,
FSALES_TAX LIKE bseg-dmbtr,
FEXC_ASS LIKE bseg-dmbtr,
FEXC LIKE bseg-dmbtr,
akont like lfb1-akont,
OTHER LIKE BSEG-DMBTR,
ecess1 like bseg-dmbtr,
date(10) type c,
date1(10) type c,
vendor(10) type c,
AKONT1(5) TYPE C,
matnr1(18) type c,
bill_amt LIKE BSEG-DMBTR,
meins1 like bseg-meins,
knumv like ekko-knumv,
basic like konv-KAWRT,
INSURANCE like konv-kbetr,
FREIGHT like konv-kbetr,
ASV like konv-kbetr,
BCD like konv-kbetr,
CVD like konv-kbetr,
ESSCVD like konv-kbetr,
ESSBCD like konv-kbetr,
SCD like konv-kbetr,
basic_u like konv-KAWRT,
INSURANCE_u like konv-kbetr,
FREIGHT_u like konv-kbetr,
ASV_u like konv-kbetr,
BCD_u like konv-kbetr,
CVD_u like konv-kbetr,
VAT LIKE KONV-KBETR,
ZWCT LIKE KONV-KBETR,
JIP2 LIKE KONV-KBETR,
ZSUR LIKE KONV-KBETR,
ZTOT LIKE KONV-KBETR,
ESSCVD_u like konv-kbetr,
ESSBCD_u like konv-kbetr,
SCD_u like konv-kbetr,
OTHER1_u LIKE bseg-dmbtr,
WKURS LIKE EKKO-WKURS,
OTHER1 LIKE bseg-dmbtr,
status(15) type c,
SERV_TAX LIKE konv-kbetr,
ECESS_TAX LIKE konv-kbetr,
TDS LIKE konv-kbetr,
W_CHK(1) TYPE C,
W_CHK1(1) TYPE C,
BSART LIKE EKKO-BSART,
aedat like ekko-aedat,
TYPE(5) TYPE C,
KTOSL LIKE BSEG-KTOSL,
END OF itab.
*
DATA : BEGIN OF ibkpf OCCURS 0,
bukrs LIKE bkpf-bukrs,
gjahr LIKE bkpf-gjahr,
belnr LIKE bkpf-belnr,
bldat LIKE bkpf-bldat,
budat like bkpf-budat,
xblnr LIKE bkpf-xblnr,
bktxt LIKE bkpf-bktxt,
waers LIKE bkpf-waers,
STGRD LIKE BKPF-STGRD,
END OF ibkpf.
*
DATA : W_LINES TYPE I.
DATA : BEGIN OF ibseg OCCURS 0,
werks LIKE bseg-werks,
buzei LIKE bseg-buzei,
lifnr LIKE bseg-lifnr,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
mwskz LIKE bseg-mwskz,
landl LIKE bseg-landl,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
menge LIKE bseg-menge,
other_costs LIKE bseg-dmbtr,
totpr LIKE bseg-dmbtr,
dmbtr LIKE bseg-dmbtr,
meins like bseg-meins,
belnr like bseg-belnr,
gjahr like bseg-gjahr,
wrbtr like bseg-wrbtr,
shkzg like bseg-shkzg,
erfmg like bseg-erfmg,
bldat LIKE bkpf-bldat,
budat like bkpf-budat,
xblnr LIKE bkpf-xblnr,
bktxt LIKE bkpf-bktxt,
waers LIKE bkpf-waers,
status(15) type c,
END OF ibseg.
DATA : BEGIN OF ibseg1 OCCURS 0,
werks LIKE bseg-werks,
buzei LIKE bseg-buzei,
lifnr LIKE bseg-lifnr,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
mwskz LIKE bseg-mwskz,
landl LIKE bseg-landl,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
menge LIKE bseg-menge,
other_costs LIKE bseg-dmbtr,
totpr LIKE bseg-dmbtr,
dmbtr LIKE bseg-dmbtr,
meins like bseg-meins,
belnr like bseg-belnr,
gjahr like bseg-gjahr,
wrbtr like bseg-wrbtr,
shkzg like bseg-shkzg,
erfmg like bseg-erfmg,
bldat LIKE bkpf-bldat,
budat like bkpf-budat,
xblnr LIKE bkpf-xblnr,
bktxt LIKE bkpf-bktxt,
waers LIKE bkpf-waers,
KTOSL LIKE BSEG-KTOSL,
status(15) type c,
TDS LIKE konv-kbetr,
W_CHK(1) TYPE C,
W_CHK1(1) TYPE C,
END OF ibseg1.
DATA : BEGIN OF ibseg2 OCCURS 0,
werks LIKE bseg-werks,
buzei LIKE bseg-buzei,
lifnr LIKE bseg-lifnr,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
mwskz LIKE bseg-mwskz,
landl LIKE bseg-landl,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
menge LIKE bseg-menge,
other_costs LIKE bseg-dmbtr,
totpr LIKE bseg-dmbtr,
dmbtr LIKE bseg-dmbtr,
meins like bseg-meins,
belnr like bseg-belnr,
gjahr like bseg-gjahr,
wrbtr like bseg-wrbtr,
shkzg like bseg-shkzg,
erfmg like bseg-erfmg,
bldat LIKE bkpf-bldat,
budat like bkpf-budat,
xblnr LIKE bkpf-xblnr,
bktxt LIKE bkpf-bktxt,
waers LIKE bkpf-waers,
status(15) type c,
KTOSL LIKE BSEG-KTOSL,
END OF ibseg2.
*
DATA : BEGIN OF inm_bseg OCCURS 0,
belnr LIKE bseg-belnr,
lifnr LIKE bseg-lifnr,
END OF inm_bseg.
*
DATA : BEGIN OF im_other_costs OCCURS 0,
shkzg LIKE bseg-shkzg,
dmbtr LIKE bseg-dmbtr,
END OF im_other_costs.
*
DATA : BEGIN OF im_bseg OCCURS 0,
werks LIKE bseg-werks,
buzei LIKE bseg-buzei,
lifnr LIKE bseg-lifnr,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
mwskz LIKE bseg-mwskz,
landl LIKE bseg-landl,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
menge LIKE bseg-menge,
erfmg LIKE bseg-erfmg,
dmbtr LIKE bseg-dmbtr,
shkzg LIKE bseg-shkzg,
meins like bseg-meins,
END OF im_bseg.
*
DATA : BEGIN OF im_bseg1 OCCURS 0,
werks LIKE bseg-werks,
buzei LIKE bseg-buzei,
lifnr LIKE bseg-lifnr,
matnr LIKE bseg-matnr,
bukrs LIKE bseg-bukrs,
mwskz LIKE bseg-mwskz,
landl LIKE bseg-landl,
ebeln LIKE bseg-ebeln,
ebelp LIKE bseg-ebelp,
menge LIKE bseg-menge,
erfmg LIKE bseg-erfmg,
dmbtr LIKE bseg-dmbtr,
shkzg LIKE bseg-shkzg,
END OF im_bseg1.
*
TYPES: BEGIN OF TY_KONV,
KNUMV LIKE KONV-KNUMV,
KBETR LIKE KONV-KBETR,
KSCHL LIKE KONV-KSCHL,
KWERT like VBRL-NETWR,
KAWRT LIKE KONV-KAWRT,
END OF TY_KONV.
DATA : IT_EKKO TYPE STANDARD TABLE OF EKKO WITH HEADER LINE.
DATA : IT_EKPO TYPE STANDARD TABLE OF EKPO WITH HEADER LINE.
DATA : IT_KONV TYPE STANDARD TABLE OF KONV WITH HEADER LINE.
DATA : W_BAMT LIKE KONV-KWERT.
DATA : BEGIN OF komk OCCURS 0.
INCLUDE STRUCTURE komk.
DATA : END OF komk.
*
DATA : BEGIN OF komp OCCURS 0.
INCLUDE STRUCTURE komp.
DATA : END OF komp.
*
*DATA BEGIN OF tkomv OCCURS 0.
* INCLUDE STRUCTURE komv.
*DATA END OF tkomv.
*
DATA excise_ass_amt LIKE komv-kwert.
DATA excise_amt LIKE komv-kwert.
DATA sales_tax_amt LIKE komv-kwert.
DATA : W_VAT LIKE komv-kwert.
DATA st_base_amt LIKE komv-kwert.
DATA netwr(13).
DATA menge(10).
DATA base_amt(13).
DATA tax_amt(13).
DATA ass_amt(13).
DATA excise(13).
DATA ecess(13).
data basic(13).
DATA SERV_TAX(13).
DATA ECESS_TAX(13).
DATA : W_ZWCT LIKE KONV-KBETR.
DATA bill_amt LIKE komv-kwert.
DATA : bill_amt1 LIKE BSEG-DMBTR.
DATA : W_WKURS LIKE EKKO-WKURS.
DATA flag(1) TYPE c VALUE 'N'.
DATA : final_bill_amt LIKE komv-kwert,
final_menge LIKE bseg-menge,
final_base_amt LIKE komv-kwert,
final_sales_tax LIKE komv-kwert,
final_excise_ass LIKE komv-kwert,
final_excise LIKE komv-kwert.
DATA: tot_bill_amt LIKE komv-kwert,
tot_menge LIKE bseg-menge,
tot_base_amt LIKE komv-kwert,
tot_sales_tax LIKE komv-kwert,
tot_excise_ass LIKE komv-kwert,
tot_excise LIKE komv-kwert,
tot_ecess LIKE komv-kwert.
DATA : char_bill_amt(13),
char_excise_ass(13),
char_excise(13),
char_base_amt(13),
char_sales_tax(13).
.
data : name1(30), lfa_name1(30).
* s_repid LIKE sy-repid,
* s_save(1) TYPE c.
*
data: date(10) type c.
*types: begin of slis_specialcol_alv,
* fieldname type slis_fieldname,
* color type slis_color,
* nokeycol(1) type c,
* end of slis_specialcol_alv.
DATA: IT_slis_t_specialcol_alv type slis_specialcol_alv.
DATA : IT_CAL_TAX LIKE TAXCOM OCCURS 0 WITH HEADER LINE.
DATA : WA_KONV TYPE table of TAXCOM with header line.
DATA : tkomv LIKE KOMV OCCURS 0 WITH HEADER LINE.
DATA : W_JIP2 LIKE KONV-KBETR.
DATA : W_ZSUR LIKE KONV-KBETR.
DATA : W_ZTOT LIKE KONV-KBETR.
DATA: it_st_list_top_of_page TYPE slis_t_listheader,
it_st_fieldcat TYPE slis_t_fieldcat_alv,
it_st_events TYPE slis_t_event,
st_layout TYPE slis_layout_alv,
s_status TYPE slis_formname VALUE 'STANDARD_ST01',
s_user_command TYPE slis_formname VALUE 'USER_COMMAND-ALV',
s_repid LIKE sy-repid,
s_save(1) TYPE c,
s_variant LIKE disvariant,
code LIKE disvariant-handle.
*DATA: G_VARIANT LIKE DISVARIANT.
SELECT-OPTIONS : s_werks FOR bseg-werks , "Plant/Depot
s_lifnr FOR bseg-lifnr , "Vendor
s_bukrs for bkpf-bukrs OBLIGATORY,
s_blart FOR bkpf-blart OBLIGATORY, "Doc type
s_matnr FOR bseg-matnr , "Material
* s_emlif FOR ekpo-emlif, "Receiving vendor.
s_date FOR sy-datum OBLIGATORY , "Doc posting Date
s_gjahr FOR bseg-gjahr . "Fiscal Year
*
*SELECTION-SCREEN: SKIP, BEGIN OF LINE, COMMENT (15) TEXT-001.
* parameters: p_all radiobutton group del default 'X'.
*
* selection-screen comment 25(9) for field p_all.
*
* parameters: p_sumtax radiobutton group del.
*
* selection-screen comment 45(12) for field p_sumtax.
*
* parameters: p_sumven radiobutton group del.
*
* selection-screen comment 65(14) for field p_sumven.
*
*
*selection-screen end of line.
INITIALIZATION.
s_repid = sy-repid.
s_save = 'A'.
PERFORM eventtab_build USING it_st_events[].
PERFORM variant_init.
START-OF-SELECTION.
*Extracting basic data.
PERFORM extract_data.
END-OF-SELECTION.
PERFORM data_validation.
PERFORM comment_build USING it_st_list_top_of_page[].
PERFORM FIELDCAT USING it_st_fieldcat[].
PERFORM layout_build USING st_layout.
PERFORM reuse_alv_list_display.
*---------------------------------------------------------------------*
* FORM extract_data_new *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM extract_data.
SELECT * FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE ibkpf
WHERE bukrs in s_bukrs AND
budat IN s_date AND
blart IN s_blart AND
gjahr IN s_gjahr.
select * from bseg
into corresponding fields of table ibseg
for all entries in ibkpf
where bukrs = ibkpf-bukrs and
belnr = ibkpf-belnr and
gjahr = ibkpf-gjahr and
buzei = 001 and
lifnr in s_lifnr .
select * from bseg
into corresponding fields of table ibseg1
for all entries in ibseg
where bukrs = ibseg-bukrs and
belnr = ibseg-belnr and
gjahr = ibseg-gjahr and
buzei = 002 and
werks in s_werks.
select * from bseg
into corresponding fields of table ibseg2
for all entries in ibseg
where bukrs = ibseg-bukrs and
belnr = ibseg-belnr and
gjahr = ibseg-gjahr and
KOART NE 'K'.
sort ibseg by belnr.
sort ibseg1 by belnr.
loop at ibseg1.
READ TABLE IBKPF WITH KEY BELNR = IBSEG1-BELNR.
MOVE IBKPF-xblnr TO IBSEG1-xblnr.
MOVE IBKPF-BKTXT TO IBSEG1-bktxt.
MOVE IBKPF-WAERS TO IBSEG1-waers.
IF IBKPF-STGRD NE SPACE.
IBSEG1-STATUS = 'REVERSAL'.
ENDIF.
MOVE IBKPF-BUDAT TO IBSEG1-BUDAT.
MOVE IBKPF-BLDAT TO IBSEG1-BLDAT.
read table ibseg with key belnr = ibseg1-belnr.
move ibseg-lifnr to ibseg1-LIFNR.
move ibseg-wrbtr to ibseg1-wrbtr.
modify ibseg1.
endloop.
SORT IBSEG2 BY BELNR.
LOOP AT ibseg1.
CLEAR IBSEG1-MENGE.
LOOP AT IBSEG2 WHERE BELNR = IBSEG1-BELNR.
IF ibseg2-shkzg = 'H'.
ibseg1-totpr = ibseg1-totpr - ibseg2-DMBTR.
ELSEIF ibseg2-shkzg = 'S'.
ibseg1-totpr = ibseg1-totpr + ibseg2-DMBTR.
ENDIF.
IF IBSEG2-KTOSL EQ 'WIT'.
IBSEG1-TDS = IBSEG2-DMBTR.
ENDIF.
IF IBSEG2-KTOSL EQ 'WRX'.
IBSEG1-W_CHK = 'Y'.
ENDIF.
IF IBSEG2-KTOSL EQ 'FR1'.
IBSEG1-W_CHK1 = 'Y'.
ENDIF.
IF IBSEG2-KTOSL = 'WRX'.
IBSEG1-MENGE = IBSEG1-MENGE + IBSEG2-MENGE.
* ELSE.
* IBSEG1-MENGE = IBSEG1-MENGE.
ENDIF.
MODIFY IBSEG1.
ENDLOOP.
ENDLOOP.
SELECT * INTO TABLE IT_EKKO FROM EKKO
FOR ALL
ENTRIES IN IBSEG1
WHERE EBELN = IBSEG1-EBELN.
SELECT * INTO TABLE IT_EKPO FROM EKPO
FOR ALL
ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
SELECT * INTO TABLE IT_KONV FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV.
LOOP AT ibseg1.
SELECT SINGLE * FROM ekko WHERE ebeln EQ ibseg1-ebeln.
CHECK sy-subrc EQ 0.
SELECT * FROM ekpo WHERE ebeln EQ ibseg1-ebeln AND
matnr = ibseg1-matnr AND ebelp EQ ibseg1-ebelp.
ENDSELECT.
READ TABLE IT_EKKO WITH KEY EBELN = IBSEG1-EBELN.
W_WKURS = IT_EKKO-WKURS.
PERFORM update_itab.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DATA_VALIDATION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM data_validation. CLEAR : itab. SORT itab BY werks matnr belnr. LOOP AT itab. CHECK itab-matnr IN s_matnr. * CHECK itab-emlif IN s_emlif. AT NEW werks. flag = 'Y'. ENDAT. IF flag = 'Y'. * SKIP. flag = 'N'. ENDIF. *To check if the material belong to 'ROH' type. * perform check_matnr. * check mara-mtart eq 'ROH'. *To check if input tax and to get taxcode desc. PERFORM tax_code_data. CHECK t007a-mwart EQ 'V'. *To get vendor address PERFORM get_vendor_data. PERFORM get_material_data. PERFORM modify_itab. PERFORM excise_data_calc. AT END OF werks. * PERFORM write_totals. NEW-PAGE WITH-HEADING. ENDAT. ENDLOOP. ENDFORM. " DATA_VALIDATION *&---------------------------------------------------------------------* *& Form CHECK_MATNR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM check_matnr. SELECT SINGLE * FROM mara WHERE matnr EQ itab-matnr. CHECK sy-subrc EQ 0. ENDFORM. " CHECK_MATNR *&---------------------------------------------------------------------* *& Form GET_VENDOR_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM get_vendor_data. SELECT SINGLE * FROM lfa1 WHERE lifnr = itab-lifnr. CHECK sy-subrc EQ 0. MOVE lfa1-name1 TO itab-name1. MOVE lfa1-ort01 TO itab-ort01. select single * from lfb1 where lifnr = itab-lifnr. CHECK sy-subrc EQ 0. shift lfb1-akont left deleting leading '0'. MOVE lfb1-akont TO itab-akont1. ENDFORM. " GET_VENDOR_DATA *&---------------------------------------------------------------------* *& Form GET_MATERIAL_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM get_material_data. SELECT SINGLE * FROM makt WHERE matnr = itab-matnr AND spras = 'EN'. CHECK sy-subrc EQ 0. MOVE makt-maktx TO itab-maktx. * shift itab-matnr left deleting leading '0'. ENDFORM. " GET_MATERIAL_DATA *&---------------------------------------------------------------------* *& Form TAX_CODE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM tax_code_data. SELECT SINGLE * FROM t007a WHERE mwskz EQ itab-mwskz. CHECK sy-subrc EQ 0. CHECK t007a-mwart EQ 'V'. SELECT SINGLE * FROM t007s WHERE spras = 'EN' AND kalsm = 'TAXINJ' AND mwskz = itab-mwskz. CHECK sy-subrc EQ 0. MOVE t007s-text1 TO itab-text1. ENDFORM. " TAX_CODE_DATA *&---------------------------------------------------------------------* *& Form EXCISE_DATA_CALC *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM excise_data_calc. *Fill fields of KOMK with data. PERFORM populate_komk. *Fill fields of KOMP with data. PERFORM populate_komp. *Call function PRICING to get TAX & Excise values PERFORM get_tax_data. *Writing the output PERFORM write_details. ENDFORM. " EXCISE_DATA_CALC *&---------------------------------------------------------------------* *& Form POPULATE_KOMK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM populate_komk. refresh it_cal_tax. clear it_cal_tax. MOVE itab-bukrs TO IT_CAL_TAX-bukrs. "bseg move itab-waers to it_cal_tax-waers. MOVE itab-ebelp TO it_cal_tax-kposn. MOVE itab-lifnr TO IT_CAL_TAX-lifnr. "bseg MOVE itab-ekorg TO IT_CAL_TAX-ekorg. "ekko MOVE itab-mwskz TO IT_CAL_TAX-mwskz. "bseg MOVE itab-matnr TO IT_CAL_TAX-matnr. MOVE itab-werks TO IT_CAL_TAX-werks. MOVE itab-matkl TO IT_CAL_TAX-matkl. MOVE itab-meins TO IT_CAL_TAX-meins. move itab-menge to it_cal_tax-mglme. MOVE itab-mtart TO it_cal_tax-mtart. MOVE itab-landl TO IT_CAL_TAX-land1. "bseg MOVE itab-netwr TO it_cal_tax-wrbtr. move 'H' to it_cal_tax-shkzg. move itab-aedat to it_cal_tax-budat. move itab-aedat to it_cal_tax-bldat. MOVE itab-waers TO IT_CAL_TAX-hwaer. "bkpf it_cal_tax-XMWST = 'X'. move itab-ebeln to it_cal_tax-ebeln. move itab-ebelp to it_cal_tax-ebelp. append it_cal_tax. ENDFORM. " POPULATE_KOMK *&---------------------------------------------------------------------* *& Form POPULATE_KOMP *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM populate_komp. ENDFORM. " POPULATE_KOMP *&---------------------------------------------------------------------* *& Form MODIFY_ITAB *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM modify_itab. MODIFY itab INDEX sy-tabix. ENDFORM. " MODIFY_ITAB *----------------* FORM update_itab. *----------------* select single knumv into itab-knumv from ekko where ebeln eq ibseg1-ebeln. READ TABLE IT_EKKO WITH KEY EBELN = IBSEG1-EBELN. move it_ekko-aedat to itab-aedat . READ TABLE IT_EKPO WITH KEY EBELN = IT_EKKO-EBELN Ebelp = ibseg1-ebelp. MOVE IT_EKKO-BSART TO ITAB-BSART. MOVE IBSEG1-KTOSL TO ITAB-KTOSL. MOVE iBSEG1-belnr TO itab-belnr. MOVE iBSEG1-bldat TO itab-bldat. MOVE iBSEG1-budat TO itab-budat. MOVE IBSEG1-TOTPR TO ITAB-BILL_AMT. IF IT_EKKO-BSART EQ 'ZI'. LOOP AT IT_KONV WHERE KNUMV = ITAB-KNUMV. IF ITAB-KTOSL NE 'FR1'. if IT_KONV-kschl = 'ZP00' or IT_konv-kschl = 'ZP01'. * itab-basic = ( IT_KONV-kWERT * W_WKURS ). * itab-basic_u = IT_KONV-kWERT. ITAB-BASIC = ( IT_KONV-KBETR * IBSEG1-MENGE ) * W_WKURS. itab-basic_u = ( IT_KONV-KBETR * IBSEG1-MENGE ). endif. IF ( IT_KONV-KSCHL = 'ZINS' ). itab-insurance = ( IT_KONV-KWERT * w_wkurs ). itab-insurance_u = IT_KONV-KWERT. ENDIF. IF ( IT_KONV-KSCHL = 'ZFA1' ) OR ( IT_KONV-KSCHL = 'ZFB1' ) OR ( IT_KONV-KSCHL = 'ZFC1' ). ITab-freight = ( IT_KONV-kWERT * W_WKURS ). ITab-freight_u = it_konv-kwert. ENDIF. if itab-ktosl EQ 'FR3'. IF ( IT_KONV-KSCHL = 'ZASV' ). ITAB-ASV = ( IT_KONV-kWERT * W_WKURS ). ITab-ASV_u = IT_KONV-kWERT. ENDIF. IF ( IT_KONV-KSCHL = 'JCDB' ). ITAB-BCD = ( IT_KONV-kWERT * W_WKURS ). ITab-bcd_u = IT_KONV-kWERT. ENDIF. IF ( IT_KONV-KSCHL = 'JCV1' ). ITAB-CVD = ( IT_KONV-kWERT * W_WKURS ). ITab-cvd_u = IT_KONV-kWERT. ENDIF. IF ( IT_KONV-KSCHL = 'JECV' ). ITAB-ESSCVD = ( IT_KONV-kWERT * W_WKURS ). ITab-ESSCVD_u = IT_KONV-kWERT. ENDIF. IF ( IT_KONV-KSCHL = 'JEDB' ). ITAB-ESSBCD = ( IT_KONV-kWERT * W_WKURS ). ITAB-ESSBCD_u = IT_KONV-kWERT. ENDIF. IF ( IT_KONV-KSCHL = 'JCDS' ). ITAB-SCD = ( IT_KONV-kWERT * W_WKURS ). ITAB-SCD_u = IT_KONV-kWERT. ENDIF. endif. *IF ( IT_KONV-KSCHL = 'ZICR' ) OR ( IT_KONV-KSCHL = 'ZSTD' ) OR ( *IT_KONV-KSCHL = 'ZADM' ) OR ( IT_KONV-KSCHL = 'ZDOR' ) OR *( IT_KONV-KSCHL = 'ZBAR' ) OR ( IT_KONV-KSCHL = 'ZBKR' ) OR ( *IT_KONV-KSCHL = 'ZOCM' ) OR ( IT_KONV-KSCHL = 'ZTRN' ) OR *( IT_KONV-KSCHL = 'ZBPT' ) OR ( IT_KONV-KSCHL = 'ZCLR' ) OR ( *IT_KONV-KSCHL = 'ZBEC' ) OR ( IT_KONV-KSCHL = 'ZDEM' ) OR *( IT_KONV-KSCHL = 'ZHAN' ) OR ( IT_KONV-KSCHL = 'ZBRC' ) OR ( *IT_KONV-KSCHL = 'ZMIS' ) OR ( IT_KONV-KSCHL = 'ZLCC' ) OR *( IT_KONV-KSCHL = 'ZCRN' ) OR ( IT_KONV-KSCHL = 'ZFLC' ) OR ( *IT_KONV-KSCHL = 'ZTHC' ) OR ( IT_KONV-KSCHL = 'ZDOC' ) OR * ( IT_KONV-KSCHL = 'ZDTN' ). * * ITAB-OTHER1 = ITAB-OTHER1 + ( IT_KONV-kWERT * W_WKURS ). * ITAB-OTHER1_u = ITAB-OTHER1_u + IT_KONV-kWERT. * ENDIF. ENDIF. ENDLOOP. IF ITAB-KTOSL = 'FR3' . ITAB-OTHER1 = ( ITAB-BILL_AMT ) - ( ITAB-BCD + ITAB-CVD + ITAB-ESSBCD + ITAB-ESSCVD + ITAB-SCD ). ENDIF. IF ITAB-KTOSL NE 'FR3'. "= 'WRX' OR ITAB-KTOSL = 'UPF' OR ITAB-KTOSL = 'FR1'. ITAB-OTHER1 = ITAB-BILL_AMT - ITAB-BASIC. ENDIF. * IF ITAB-KTOSL = 'FR1'. * ITAB-OTHER1 = ITAB-BILL_AMT . * ENDIF. ENDIF. concatenate itab-bldat+6(2) '-' itab-bldat+4(2) '-' itab-bldat(4) into itab-date. concatenate itab-budat+6(2) '-' itab-budat+4(2) '-' itab-budat(4) into itab-date1. * shift ekko-lifnr left deleting leading '0'. move itab-date1 to itab-date1. move itab-date to itab-date. MOVE IBSEG1-LIFNR TO itab-lifnr. MOVE IBSEG1-LIFNR TO itab-VENDOR. shift itab-VENDOR left deleting leading '0'. * MOVE ekko-lifnr TO itab-vendor. MOVE iBSEG1-xblnr TO itab-xblnr. MOVE iBSEG1-bktxt TO itab-bktxt. MOVE IBSEG1-bukrs TO itab-bukrs. MOVE IBSEG1-ebeln TO itab-ebeln. MOVE IBSEG1-ebelp TO itab-ebelp. MOVE IBSEG1-werks TO itab-werks. select single name1 into ITAB-NAME2 from t001w where werks = ITAB-WERKS. * MOVE ekpo-matnr TO itab-matnr. MOVE IBSEG1-matnr TO itab-matnr. MOVE IT_ekpo-matnr TO itab-matnr1. shift itab-matnr1 left deleting leading '0'. MOVE ibseg1-menge TO itab-menge. IF ITAB-BSART NE 'ZI'. ITAB-TYPE = 'DOM'. itab-netwr = ibseg1-menge * IT_ekpo-netpr / IT_ekpo-peinh * IT_ekpo-bpumz / IT_ekpo-bpumn. ELSE. ITAB-TYPE = 'IMP'. ENDIF. MOVE IT_ekpo-mwskz TO itab-mwskz. MOVE IT_ekko-lands TO itab-landl. MOVE IT_ekko-ekorg TO itab-ekorg. MOVE iBSEG1-waers TO itab-waers. MOVE IT_ekpo-matkl TO itab-matkl. MOVE IT_ekpo-meins TO itab-meins. MOVE IT_ekpo-mtart TO itab-mtart. MOVE IT_ekpo-txjcd TO itab-txjcd. MOVE IT_ekpo-emlif TO itab-emlif. MOVE ibseg1-lifnr TO itab-lifnr. * MOVE ibseg1-totpr TO itab-totpr. MOVE ibseg1-other_costs TO itab-other_costs. MOVE ibseg1-dmbtr TO itab-dmbtr. move ibseg1-meins to itab-meins1. MOVE ibseg1-W_CHK to itab-W_CHK. MOVE ibseg1-W_CHK1 to itab-W_CHK1. move ibseg1-status to itab-status. MOVE IBSEG1-TDS TO ITAB-TDS. APPEND itab. CLEAR itab. ENDFORM. " UPDATE_ITAB *----------------* *&---------------------------------------------------------------------* *& Form GET_TAX_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM get_tax_data. refresh wa_konv. clear wa_konv. refresh tkomv. clear tkomv. READ TABLE IT_CAL_TAX INTO WA_KONV INDEX 1. append wa_konv. IF ITAB-W_CHK = 'Y' AND ITAB-W_CHK1 = 'Y'. if itab-mwskz ne 'V0'. if it_cal_tax-mwskz ne space. CLEAR IT_CAL_TAX. CALL FUNCTION 'CALCULATE_TAX_ITEM' EXPORTING I_TAXCOM = WA_KONV TABLES T_XKOMV = tkomv. IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
endif.
ELSEIF ITAB-W_CHK = 'Y'.
if itab-mwskz ne 'V0'.
if it_cal_tax-mwskz ne space.
CLEAR IT_CAL_TAX.
CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
I_TAXCOM = WA_KONV
TABLES
T_XKOMV = tkomv.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
endif.
ENDIF.
CHECK sy-subrc EQ 0.
ENDFORM. " GET_TAX_DATA
*&---------------------------------------------------------------------*
*& Form WRITE_DETAILS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM write_details. DATA : v_interim LIKE bseg-dmbtr. DATA INT TYPE I. IF ITAB-BSART NE 'ZI'. LOOP AT tkomv WHERE KPOSN = ITAB-EBELP. NEW-LINE. FORMAT COLOR COL_NORMAL. INT = SY-TABIX MOD 2. IF INT IS INITIAL. FORMAT INTENSIFIED OFF. ELSE. FORMAT INTENSIFIED ON. ENDIF. IF tkomv-kschl EQ 'BASB'. excise_ass_amt = tkomv-kwert. ENDIF. IF tkomv-kschl EQ 'JMO1'. excise_amt = excise_amt + tkomv-kwert. ENDIF. IF tkomv-kschl EQ 'JMO2'. excise_amt = excise_amt + tkomv-kwert. ENDIF. IF tkomv-kschl EQ 'JIP1' or tkomv-kschl EQ 'ZRST'. sales_tax_amt = sales_tax_amt + tkomv-kwert. ENDIF. * IF tkomv-kschl EQ 'JIP2'. * sales_tax_amt = sales_tax_amt + tkomv-kwert. * ENDIF. IF tkomv-kschl EQ 'JEC1'. Ecess = sales_tax_amt + tkomv-kwert. ENDIF. if tkomv-kschl eq 'JSRT'. SERV_TAX = SERV_TAX + tkomv-kwert. ENDIF. if tkomv-kschl eq 'JEC3'. ECESS_TAX = ECESS_TAX + tkomv-kwert. ENDIF. if tkomv-kschl EQ 'JIP6' or tkomv-kschl EQ 'JIP8'. W_VAT = W_VAT + tkomv-kwert. ENDIF. if tkomv-kschl EQ 'ZWCT'. W_ZWCT = W_ZWCT + tkomv-kwert. ENDIF. if tkomv-kschl EQ 'JIP2'. W_JIP2 = W_JIP2 + tkomv-kwert. ENDIF. if tkomv-kschl EQ 'ZSUR'. W_ZSUR = W_ZSUR + tkomv-kwert. ENDIF. if tkomv-kschl EQ 'ZTOT'. W_ZTOT = W_ZTOT + tkomv-kwert. ENDIF. ENDLOOP. ENDIF. st_base_amt = excise_ass_amt + excise_amt. bill_amt = excise_ass_amt + excise_amt + sales_tax_amt + ecess. * v_interim = ( itab-totpr + itab-other_costs ) . MOVE : v_interim TO netwr, "Total of the transaction itab-menge TO menge, st_base_amt TO base_amt, sales_tax_amt TO tax_amt, excise_ass_amt TO ass_amt, excise_amt TO excise, ecess to ecess. CONDENSE : itab-matnr, netwr, menge, base_amt, tax_amt, ass_amt, excise NO-GAPS. * v_interim = itab-totpr - itab-dmbtr. clear lfa_name1. select single name1 from lfa1 into (lfa_name1 ) where lifnr = itab-emlif. * tot_bill_amt = tot_bill_amt + ( itab-totpr + itab-other_costs ). tot_menge = tot_menge + itab-menge. tot_base_amt = tot_base_amt + st_base_amt. tot_sales_tax = tot_sales_tax + sales_tax_amt. tot_excise_ass = tot_excise_ass + excise_ass_amt. tot_excise = tot_excise + excise_amt. tot_ecess = tot_ecess + ecess. *-------- * final_bill_amt = final_bill_amt + ( itab-totpr + itab-other_costs ). final_menge = final_menge + itab-menge. final_base_amt = final_base_amt + st_base_amt + tot_ecess. final_sales_tax = final_sales_tax + sales_tax_amt. final_excise_ass = final_excise_ass + excise_ass_amt. final_excise = final_excise + excise_amt. * MOVE FINAL_BILL_AMT TO ITAB-FBILL. * MOVE FINAL_MENGE TO ITAB-MENGE. MOVE FINAL_BASE_AMT TO ITAB-FBASE_AMT. MOVE FINAL_SALES_TAX TO ITAB-FSALES_TAX. MOVE FINAL_EXCISE_ASS TO ITAB-FEXC_ASS. MOVE FINAL_EXCISE TO ITAB-FEXC. move v_interim to itab-other. MOVE SERV_TAX TO ITAB-SERV_TAX. MOVE ECESS_TAX TO ITAB-ECESS_TAX. MOVE W_VAT TO ITAB-VAT. move W_ZWCT to itab-zwct. move W_JIP2 to itab-JIP2. move W_ZSUR to itab-zsur. move w_ZTOT to itab-ztot. * bill_amt1 = FINAL_BASE_AMT + FINAL_SALES_TAX + v_interim. * MOVE BILL_AMT1 TO ITAB-BILL_AMT. * MOVE IBSEG1-TOTPR TO ITAB-BILL_AMT. move tot_ecess to itab-ecess1. IF ITAB-BSART NE 'ZI'. W_BAMT = ABS( ITAB-BILL_AMT ). ITAB-OTHER = ( W_BAMT + ITAB-TDS ) - ( ITAB-NETWR + ITAB-FEXC + ITAB-ECESS1 + ITAB-FSALES_TAX + ITAB-SERV_TAX + ITAB-ECESS_TAX + ITAB-VAT + ITAB-JIP2 + ITAB-ZWCT + ITAB-ZSUR + ITAB-ZTOT ). ENDIF. MODIFY ITAB TRANSPORTING FBILL MENGE FBASE_AMT FSALES_TAX FEXC_ASS FEXC BILL_AMT OTHER ecess1 SERV_TAX ECESS_TAX VAT JIP2 ZWCT ZSUR ZTOT. CLEAR ECESS. CLEAR BILL_AMT1. CLEAR FINAL_BILL_AMT. CLEAR FINAL_MENGE. CLEAR FINAL_BASE_AMT. CLEAR FINAL_SALES_TAX. CLEAR FINAL_EXCISE_ASS. CLEAR FINAL_EXCISE. CLEAR V_INTERIM. clear tot_ecess. CLEAR W_VAT. CLEAR SERV_TAX. CLEAR ECESS_TAX. CLEAR W_BAMT. CLEAR W_ZWCT. CLEAR W_JIP2. CLEAR W_ZSUR. CLEAR W_ZTOT. CLEAR : itab, tkomv, st_base_amt, sales_tax_amt, excise_ass_amt, excise_amt. CLEAR : base_amt, tax_amt, ass_amt, excise, netwr, menge. REFRESH KOMK. CLEAR KOMK. REFRESH KOMP. CLEAR KOMP. REFRESH TKOMV. CLEAR TKOMV. ENDFORM. " WRITE_DETAILS *&---------------------------------------------------------------------* *& Form COMMENT_BUILD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM comment_build USING p_it_st_list_top_of_page TYPE slis_t_listheader. DATA: ls_line TYPE slis_listheader. DATA: mix_date(130) type c, mix(130) type c, mix_ekorg(40) type c, mixekorg(40) type c, mix_werks(40) type c, mixwerks(40) type c, mix_ebeln(40) type c, mixebeln(40) type c, mix_aedat(40) type c, mixaedat(40) type c, mix_ekgrp(40) type c, mixekgrp(40) type c, mixbsart(40) type c, mix_bsart(40) type c, mixmatkl(40) type c, mix_matkl(40) type c, mixmatnr(40) type c, mix_matnr(40) type c, temp(40) type c. data : w_date_t(10) type c, w_date_f(10) type c, w_tdate(100) type c. REFRESH p_it_st_list_top_of_page. CLEAR ls_line. ls_line-typ = 'H'. ls_line-info = 'Details of Purchase Day Book'. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Company Code concatenate s_bukrs-low ' - ' s_bukrs-high into mix_ekorg SEPARATED BY SPACE. concatenate 'Company Code :' ' ' mix_ekorg into mixekorg SEPARATED BY SPACE . ls_line-typ = 'S'. ls_line-info = mixekorg. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Vendor concatenate s_lifnr-low ' - ' s_lifnr-high into mix_date SEPARATED BY SPACE. concatenate 'Vendor :' ' ' mix_date into mix SEPARATED BY SPACE. ls_line-typ = 'S'. ls_line-info = mix. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Plant concatenate s_werks-low ' - ' s_werks-high into mix_werks SEPARATED BY SPACE. concatenate 'Plant :' ' ' mix_werks into mixwerks SEPARATED BY SPACE . ls_line-typ = 'S'. ls_line-info = mixwerks. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Material concatenate s_matnr-low ' - ' s_matnr-high into mix_matnr SEPARATED BY SPACE. concatenate 'Material :' ' ' mix_matkl into mixmatnr SEPARATED BY SPACE. ls_line-typ = 'S'. ls_line-info = mixmatnr. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Document No. concatenate s_blart-low ' - ' s_blart-high into mix_ebeln SEPARATED BY SPACE. concatenate 'Doc. Type :' ' ' mix_ebeln into mixebeln SEPARATED BY SPACE . ls_line-typ = 'S'. ls_line-info = mixebeln. APPEND ls_line TO p_it_st_list_top_of_page. if s_date-low ne SPACE and s_date-low gt 0. concatenate S_date-LOW+6(2) '-' S_date-LOW+4(2) '-' S_DATe-LOW(4) into w_date_f. concatenate S_DATe-high+6(2) '-' S_DATe-high+4(2) '-' S_DATe-high(4) into w_date_t. concatenate 'Doc Date :' ' ' w_date_f '-' w_date_t into w_tdate SEPARATED BY SPACE. ls_line-typ = 'S'. ls_line-info = w_tdate. APPEND ls_line TO p_it_st_list_top_of_page. endif. clear mix_date. clear mix. endform. *&--------------------------------------------------------------------* *& Form TOP_OF_PAGE-ALV *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM top_of_page-alv. * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_st_list_top_of_page. ENDFORM. "TOP_OF_PAGE-ALV *FORM specialcol_alv USING p_slis_t_specialcol_alv TYPE *slis_t_specialcol_alv. * CLEAR IT_slis_t_specialcol_alv. * IT_slis_t_specialcol_alv-fieldname = 'BASIC'. * IT_slis_t_specialcol_alv-color = 1. * IT_slis_t_specialcol_alv-nokeycol = '1'. * APPEND IT_slis_t_specialcol_alv TO P_slis_specialcol_alv. *ENDFORM. FORM fieldcat USING p_it_st_fieldcat TYPE slis_t_fieldcat_alv. DATA: ls_fieldcat TYPE slis_fieldcat_alv. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'WERKS'. ls_fieldcat-rollname = 'WERKS'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'Plant Code'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'NAME2'. * ls_fieldcat-rollname = 'NAME1' ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Plant Name'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'STATUS'. * ls_fieldcat-rollname = 'BELNR'. ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Reversal'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TYPE'. * ls_fieldcat-rollname = 'BELNR'. ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Purch Doc Type'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BELNR'. ls_fieldcat-rollname = 'BELNR'. ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Doc No'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BUDAT'. ls_fieldcat-rollname = 'BUDAT'. ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Doc Date.'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'AKONT1'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'Party G/L Recon'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'VENDOR'. ls_fieldcat-outputlen = 6. ls_fieldcat-seltext_m = 'Party Code'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'NAME1'. ls_fieldcat-outputlen = 15. ls_fieldcat-seltext_m = 'Party Name'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'EBELN'. ls_fieldcat-outputlen = 15. ls_fieldcat-seltext_m = 'PO'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'XBLNR'. ls_fieldcat-outputlen = 15. ls_fieldcat-seltext_m = 'Bill No'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BLDAT'. ls_fieldcat-outputlen = 10. ls_fieldcat-seltext_m = 'Bill Date'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MATNR1'. ls_fieldcat-outputlen = 6. ls_fieldcat-seltext_m = 'Item Code'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MAKTX'. ls_fieldcat-outputlen = 15. ls_fieldcat-seltext_m = 'Item Desc'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * ls_fieldcat-EMPHASIZE = ''. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MENGE'. ls_fieldcat-rollname = 'MENGE'. ls_fieldcat-seltext_m = 'Quantity'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-outputlen = 10. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MEINS1'. * ls_fieldcat-rollname = 'MENGE'. ls_fieldcat-seltext_m = 'Unit'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-outputlen = 3. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MWSKZ'. ls_fieldcat-outputlen = 2. ls_fieldcat-seltext_m = 'Tax Code'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-datatype = 'CHAR'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TEXT1'. ls_fieldcat-outputlen = 15. ls_fieldcat-seltext_m = 'Sales Tax Desc'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'NETWR'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'Dom Basic Value'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'FEXC'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'Excise Duty'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ECESS1'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'Ecess Excise'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'FBASE_AMT'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'Sales Tax Base Amt'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'FSALES_TAX'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'CST'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'JIP2'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'LST'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ZSUR'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'SURC'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ZTOT'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'TOT'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ZWCT'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'WCT'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'VAT'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'VAT'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'SERV_TAX'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'Service Tax'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ECESS_TAX'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'Ecess Service Tax'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TDS'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'TDS (incl Sur & Ecess)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'OTHER'. ls_fieldcat-outputlen = 5. ls_fieldcat-seltext_m = 'Dom-Other'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. *CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'FBILL'. * ls_fieldcat-outputlen = 15. * ls_fieldcat-seltext_m = 'Dom Non Modvat AMT'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BILL_AMT'. ls_fieldcat-outputlen = 16. ls_fieldcat-seltext_m = 'Total Bill Amt'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'EMLIF'. * ls_fieldcat-outputlen = 10. * ls_fieldcat-seltext_m = 'Receiving Vendor'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BASIC'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Imp-Basic Price(INR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BASIC_U'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Imp-Basic Price(FOR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'INSURANCE'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Insurance(INR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'INSURANCE_U'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Insurance(FOR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'FREIGHT'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Freight(INR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'FREIGHT_U'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Freight(FOR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ASV'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Imp-AV(INR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ASV_U'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Imp-AV(FOR)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'BCD'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Basic Custom Duty(BCD)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'BCD_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-BSD (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'CVD'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Counterveiling Duty(CVD)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'CVD_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-CVD (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ESSBCD'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'ECess BCD'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'ESSBCD_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-CESS ON BCD (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ESSCVD'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'ECess CVD'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'ESSCVD_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-CESS ON CVD (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'SCD'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Special Customs Duty(SCD)'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'SCD_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-SCD (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'OTHER1'. ls_fieldcat-outputlen = 20. ls_fieldcat-seltext_m = 'Imp-Other Costs'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'WAERS'. ls_fieldcat-outputlen = 13. ls_fieldcat-seltext_m = 'Imp-Currency'. * ls_fieldcat-ddictxt = 'L'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_it_st_fieldcat. * CLEAR ls_fieldcat. * ls_fieldcat-fieldname = 'OTHER1_U'. * ls_fieldcat-outputlen = 20. * ls_fieldcat-seltext_m = 'Imp-OTHER (FOREIGN CURR)'. * ls_fieldcat-ddictxt = 'L'. * ls_fieldcat-key = 'X'. * APPEND ls_fieldcat TO p_it_st_fieldcat. * endform. "fieldcat *&---------------------------------------------------------------------* *& Form LAYOUT_BUILD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_ST_LAYOUT text
*----------------------------------------------------------------------*
FORM layout_build USING p_st_layout TYPE slis_layout_alv.
p_st_layout-box_fieldname = 'SELK'. " Checkbox
p_st_layout-get_selinfos = 'X'.
p_st_layout-f2code = 'PICK' . " Doppelklickfunktion
p_st_layout-confirmation_prompt = 'X'. "Sicherheitsabfrage
p_st_layout-key_hotspot = 'X'. "Schlüssel als Hotspot
p_st_layout-info_fieldname = 'COL'. "Zeilenfarbe
ENDFORM. " LAYOUT_BUILD
*&---------------------------------------------------------------------*
*& Form REUSE_ALV_LIST_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form reuse_alv_list_display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = S_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ALV_BACKGROUND'
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = it_st_fieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS = IT_slis_t_specialcol_alv[]
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'A'
* IS_VARIANT =
IT_EVENTS = IT_ST_EVENTS[]
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
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.
*&---------------------------------------------------------------------*
*& Form EVENTTAB_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_ST_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING p_st_events TYPE slis_t_event .
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_st_events.
READ TABLE p_st_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE st_formname_top_of_page TO ls_event-form.
APPEND ls_event TO p_st_events.
ENDIF.
* READ TABLE p_st_events WITH KEY name = slis_ev_user_command
* INTO ls_event.
* IF sy-subrc = 0.
* MOVE s_user_command TO ls_event-form.
* APPEND ls_event TO p_st_events.
* ENDIF.
*
***READ TABLE p_st_events WITH KEY name = slis_ev_pf_status_set
*** INTO ls_event.
****
***
***IF sy-subrc = 0.
*** MOVE s_status TO ls_event-form.
*** APPEND ls_event TO p_st_events.
*** ENDIF.
endform.
*&---------------------------------------------------------------------*
*& Form VARIANT_INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM variant_init . CLEAR s_variant. s_variant-report = s_repid. s_variant-handle = code. ENDFORM. " VARIANT_INIT
link us...
For Visitors
email-id :- avinashkr_raj@yahoo.com(any email)
email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)