Z BR Log Customizing Analyzerw
Z BR Log Customizing Analyzerw
Z BR Log Customizing Analyzerw
REPORT z_br_log_customizing_analyzerw.
DATA:
* Status of the current tab - Z_CUSTOMIZING_ANALYZER_BR_LOG
gv_currtab TYPE i VALUE 10,
lv_access_error(5) TYPE c,
lv_error_message TYPE string,
lv_curruser TYPE sy-uname. "#EC *
LOOP AT SCREEN.
IF screen-group1 = '001'.
IF p_sd = abap_true.
screen-active = '1'.
ELSE.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
END-OF-SELECTION.
* This form gets all the information necessary from the sales order's doc number
to complete all
* the fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to VA03 Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM salesorderinfo USING p_docnso.
ENDIF.
* This form gets all the information necessary from the billing's doc number to
complete all the
* fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to VF03 Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM billinginfo USING p_docbil.
ENDIF.
* This form gets all the information necessary from the purchase order's doc
number to complete
* all the fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to MIGO Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM purchaseorderinfo USING p_docnpo.
ENDIF.
* This form gets all the information necessary from the material's doc number to
complete all
* the fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to ME23N Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM materialdoc USING p_docmd p_fyear.
ENDIF.
* This form gets all the information necessary from the invoice's doc number to
complete all
* the fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to MIRO Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM invoicedata USING p_docinv p_fyear.
ENDIF.
* This form gets all the information necessary from the nota fiscal's doc number
to complete
* all the fields of the files automatically
IF sy-subrc NE 0.
MESSAGE 'You do not have access to J1BTAX Transaction. Please, contact your
Manager' TYPE 'E'.
ELSE.
PERFORM notafiscal USING p_docnf.
ENDIF.
* This form gets all tables inside the package informed by the user
IF sy-subrc NE 0.
MESSAGE 'You do not have access to SE11 Transaction. Please, contact your
Manager.' TYPE 'E'.
ELSE.
PERFORM metadatafilter USING p_metapk.
ENDIF.
* CLEAR lv_access_error.
CLEAR lv_error_message.
ELSE.
IF sy-subrc NE 0.
lv_access_error = 'FALSE'.
lv_error_message = 'You do not have access to SD Transactions. Please,
contact your Manager!'.
ENDIF.
ENDIF.
IF sy-subrc NE 0.
lv_access_error = 'FALSE'.
lv_error_message = 'You do not have access to MM Transactions. Please,
contact your Manager!'.
ENDIF.
ENDIF.
IF sy-subrc NE 0.
lv_access_error = 'FALSE'.
lv_error_message = 'You do not have access to NF Transactions. Please,
contact your Manager!'.
ENDIF.
ENDIF.
IF sy-subrc NE 0.
lv_access_error = 'FALSE'.
lv_error_message = 'You do not have access to Metadata Transactions.
Please, contact your Manager!'.
ENDIF.
ENDIF.
IF lv_access_error EQ 'FALSE'.
MESSAGE lv_error_message TYPE 'E'.
ELSE.
PERFORM formsfilter USING p_metadt
p_sd
p_mm
p_others
p_compcd
''
p_proced
p_onlysp
p_busspl.
ENDIF.
ENDIF.
ELSE.
MESSAGE 'Please, insert data in one of the fields.' TYPE 'I'. "#EC NOTEXT
ENDIF.
* This form erase the inserted fields of the previous tab
FORM clearfields
USING tabnumber TYPE i.
CASE tabnumber.
WHEN gc_ten.
CLEAR p_docnso.
CLEAR p_docbil.
MODIFY SCREEN.
WHEN gc_twenty.
CLEAR p_docnpo.
CLEAR p_docmd.
CLEAR p_docinv.
MODIFY SCREEN.
WHEN gc_thirty.
CLEAR p_docnf.
MODIFY SCREEN.
WHEN gc_forty.
CLEAR p_metapk.
CLEAR p_metatb.
MODIFY SCREEN.
WHEN gc_fifty.
CLEAR p_compcd.
CLEAR p_busspl.
CLEAR p_metadt.
CLEAR p_sd.
CLEAR p_mm.
CLEAR p_others.
CLEAR p_proced.
CLEAR p_onlysp.
MODIFY SCREEN.
ENDCASE.
ENDFORM.
* ------------------------------------------------------------------------- OLD
INCLUDES
-----------------------------------------------------------------------------------
---
* This TOP include contains the declaration of the global variables
* Metadata - ZAUTO_METADATA
TYPES: BEGIN OF ty_tab,
tabname TYPE j_1bviewmap-tabname,
END OF ty_tab.
* Metadata - ZAUTO_METADATA
TYPES: BEGIN OF ty_desc,
tab TYPE j_1bviewmap-tabname,
desc TYPE dd02t-ddtext,
END OF ty_desc.
* Metadata - ZAUTO_METADATA
TYPES: BEGIN OF ty_getdata,
tabname TYPE tabname,
fieldname TYPE fieldname,
keyflag TYPE keyflag,
datatype TYPE datatype_d,
leng TYPE ddleng,
decimals TYPE decimals,
rollname TYPE rollname,
scrtext_m TYPE scrtext_m,
END OF ty_getdata.
* Metadata - ZAUTO_METADATA
TYPES: BEGIN OF ty_search_help,
tabname TYPE tabname,
fieldname TYPE fieldname,
rollname TYPE rollname,
datatype TYPE datatype_d,
checktable TYPE checktable,
shlporigin TYPE shlporigin,
shlpname TYPE komp_shlp,
defaults TYPE valexi,
domname TYPE domname,
reftable TYPE reftable,
reffield TYPE reffield,
END OF ty_search_help.
DATA:
* Calculation Procedure Data - ZAUTO_CALCPROIT2
gt_calcprotab TYPE STANDARD TABLE OF ty_calcpro, "#EC *
gt_calcprotabf TYPE STANDARD TABLE OF ty_calcpro, "#EC *
gs_calcprotab TYPE ty_calcpro, "#EC *
gv_land1 TYPE v_t001-land1, "#EC *
gv_kalsm TYPE t683-kalsm, "#EC *
gv_headerkalsm TYPE string, "#EC *
gt_acckeys TYPE STANDARD TABLE OF ty_acckey, "#EC *
gs_acckeys TYPE ty_acckey, "#EC *
* Metadata - ZAUTO_METADATA
gs_metainfo TYPE ty_tab, "#EC *
gt_metainfo TYPE STANDARD TABLE OF ty_tab, "#EC *
gt_getdata TYPE STANDARD TABLE OF ty_getdata, "#EC *
gt_getdata2 TYPE STANDARD TABLE OF ty_getdata, "#EC *
gs_getdata TYPE ty_getdata, "#EC *
gs_getdata2 TYPE ty_getdata, "#EC *
gt_desctext TYPE STANDARD TABLE OF ty_desc, "#EC *
gs_desctext TYPE ty_desc, "#EC *
gv_contdesc TYPE i VALUE 1, "#EC *
gt_search_help TYPE STANDARD TABLE OF ty_search_help, "#EC *
gs_search_help TYPE ty_search_help, "#EC *
* Structure used by tables that will organize how to print each table
TYPES: BEGIN OF ty_getdata,
rollname TYPE rollname,
outputlen TYPE outputlen,
headlen TYPE headlen,
reptext TYPE reptext,
scrtext_s TYPE scrtext_s,
scrtext_m TYPE scrtext_m,
scrlen_s TYPE scrlen_s,
scrlen_l TYPE scrlen_l,
END OF ty_getdata.
ENDIF.
* If the number of fields from the table is more than 10 probably all fields won't
* appear in the screen, so will be used header type(3) as header
IF lv_cont >= gc_ten.
* HEADER
LOOP AT lt_getdata INTO ls_getdata.
ELSE.
ENDIF.
lv_rest = gc_zero.
lv_filled = ''.
ENDLOOP.
* END OF HEADER
WRITE:/ lv_header.
SKIP.
* TABLE
ASSIGN COMPONENT ls_getdata-rollname
OF STRUCTURE us_structure
TO <text>.
ENDIF.
* lv_linebreaker contains the number that will be used to break the line in
the right point
ADD gc_one TO lv_linebreaker.
IF lv_cont = lv_linebreaker.
ENDIF.
lv_rest = gc_zero.
lv_filled = ''.
ENDLOOP.
ENDLOOP.
* END OF TABLE
SKIP.
WRITE
'__________________________________________________________________________________
___________________________________________________________________________________
______________________'. "#EC NOTEXT
SKIP.
* HEADER
IF ls_getdata-outputlen <= gc_three.
* Some data element have the short field description empty when they are less
than 3 c
IF ls_getdata-scrtext_s = ''.
CONCATENATE lv_header ls_getdata-scrtext_m ' '
INTO lv_header RESPECTING BLANKS.
ELSE.
CONCATENATE lv_header ls_getdata-scrtext_s ' '
INTO lv_header RESPECTING BLANKS.
ENDIF.
ELSE.
ENDIF.
lv_rest = gc_zero.
lv_filled = ''.
ENDLOOP.
* END OF HEADER
WRITE:/ lv_header.
SKIP.
* TABLE
ASSIGN COMPONENT ls_getdata-rollname
OF STRUCTURE us_structure
TO <text>.
IF ls_getdata-scrtext_s = ''.
lv_rest = ls_getdata-scrlen_l - ls_getdata-outputlen.
ELSE.
lv_rest = gc_ten - ls_getdata-outputlen.
ENDIF.
ENDIF.
* lv_linebreaker contains the number that will be used to break the line in
the right point
ADD gc_one TO lv_linebreaker.
IF lv_cont EQ lv_linebreaker.
ENDIF.
lv_rest = gc_zero.
lv_filled = ''.
ENDLOOP.
* END OF TABLE
ENDLOOP.
SKIP.
WRITE
'__________________________________________________________________________________
___________________________________________________________________________________
______________________'. "#EC NOTEXT
SKIP.
ENDIF.
ENDFORM.
* Get the number of blank necessary and return them into a variable
FORM fillwtblank USING uv_nspace TYPE i
CHANGING cv_filled TYPE string.
DO uv_nspace TIMES.
CONCATENATE cv_filled ' '
INTO cv_filled RESPECTING BLANKS.
ENDDO.
ENDFORM.
* This IF verify if the form was called by the tab MetadataFilter, if yes,
* won't get information about the default tables shown by the program
IF uv_fromfilter = ''.
SELECT tabname
FROM j_1bviewmap
INTO TABLE gt_metainfo
WHERE gruop = lc_unique_table.
SKIP.
WRITE:/'FIELDS SUBTAB'.
SKIP.
WRITE:/ 'FIELD ', 'KEY ', 'DATA ELEMENT
', "#EC NOTEXT
'MEDIUM TEXT ', 'DATA TYPE ', 'LENGTH ', 'DECIMALS'. "#EC
NOTEXT
SKIP.
WRITE:/
'..................................................................................
...................................................................................
......................'.
SKIP.
ENDLOOP.
WRITE:/
'..................................................................................
...................................................................................
......................'.
SKIP.
ENDLOOP.
WRITE
'__________________________________________________________________________________
___________________________________________________________________________________
______________________'. "#EC NOTEXT
SKIP.
ADD 1 TO gv_contdesc.
ENDLOOP.
ELSE.
* Here, this loop will verify if the rollname has a medium text corresponding
LOOP AT gt_getdata ASSIGNING <getdata>.
READ TABLE gt_getdata2 INTO gs_getdata2 WITH KEY rollname = <getdata>-
rollname.
IF sy-subrc = 0.
<getdata>-scrtext_m = gs_getdata2-scrtext_m.
ELSE.
<getdata>-scrtext_m = gc_blank.
ENDIF.
ENDLOOP.
SKIP.
WRITE:/'FIELDS SUBTAB'.
SKIP.
WRITE:/ 'FIELD ', 'KEY ', 'DATA ELEMENT
', "#EC NOTEXT
'MEDIUM TEXT ', 'DATA TYPE ', 'LENGTH ', 'DECIMALS'. "#EC
NOTEXT
SKIP.
WRITE:/
'..................................................................................
...................................................................................
......................'.
SKIP.
ENDLOOP.
WRITE:/
'..................................................................................
...................................................................................
......................'.
SKIP.
ENDLOOP.
WRITE
'__________________________________________________________________________________
___________________________________________________________________________________
______________________'. "#EC NOTEXT
SKIP.
ADD 1 TO gv_contdesc.
ENDLOOP.
ENDIF.
ENDFORM.
* Tax regions
* Entities > Tax Regions
FORM taxregionstabs.
ENDFORM.
* Here, this loop pass to the final table, only the procedure informed
LOOP AT lt_txcdmm INTO ls_txcdmm WHERE kalsm_d = uv_proced.
APPEND ls_txcdmm TO lt_txcdmmf.
ENDLOOP.
SELECT *
FROM j_1btxsdct
INTO TABLE lt_txsdtable
WHERE langu = lc_english_language.
ENDFORM.
SELECT *
INTO TABLE lt_txconditiontab
FROM j_1btxcond.
SELECT *
INTO TABLE lt_maptxratetab
FROM j_1bviewmap.
* Tax types
* Condition Setup > Tax Types
FORM taxtypestabs.
* Get the country where the company code is equal of the informed
* and verify if the company code exists
SELECT SINGLE land1
FROM t001
INTO gv_land1
WHERE bukrs = uv_compcode.
IF sy-subrc = 0.
* This select join the princing procedure with the internal codes related
SELECT DISTINCT t683s~mandt j_1btxcond~code t683s~kappl t683s~kalsm
t683s~stunr t683s~zaehk t683s~kschl t683s~stunb t683s~stun2
t683s~kauto t683s~kobli t683s~kstat t683s~drukz t683s~kzwiw
t683s~kobed t683s~kofrm t683s~kofra t683s~kvsl1 t683s~kvsl2
INTO gs_calcprotab
FROM t683s
LEFT JOIN j_1btxcond "#EC *
ON t683s~kschl = j_1btxcond~kschl
WHERE ( t683s~kalsm = u_procedure )
AND kalsm = u_procedure
ORDER BY stunr. "Ordering by the number step
ENDFORM.
* This select join the princing procedure with the internal codes related
SELECT SINGLE land1
FROM t001
INTO gv_land1
WHERE bukrs = uv_compcode.
IF sy-subrc = 0.
* This select join the princing procedure with the internal codes related
SELECT DISTINCT t683s~mandt j_1btxcond~code t683s~kappl t683s~kalsm
t683s~stunr t683s~zaehk t683s~kschl t683s~stunb t683s~stun2
t683s~kauto t683s~kobli t683s~kstat t683s~drukz t683s~kzwiw
t683s~kobed t683s~kofrm t683s~kofra t683s~kvsl1 t683s~kvsl2
INTO TABLE gt_calcprotab
FROM t683s
LEFT JOIN j_1btxcond "#EC *
ON t683s~kschl = j_1btxcond~kschl
WHERE ( t683s~kalsm = uv_proced )
ORDER BY stunr.
ENDFORM.
ELSE.
IF sy-subrc = 0.
SELECT t683v~mandt t683v~vkorg t683v~vtweg t683v~spart t683v~kalvg
t683v~kalks t683v~kalsm t683u~vtext t683v~kartv t685t~vtext
INTO TABLE lt_priprosadoc
FROM t683v
INNER JOIN t685t
ON t685t~kschl EQ t683v~kartv
INNER JOIN t683u "#EC *
ON t683u~kalsm EQ t683v~kalsm
FOR ALL ENTRIES IN lt_salesorg
WHERE t683u~spras = lc_language_key
AND t685t~spras = lc_language_key
AND t683u~kvewe = lc_usage
AND t683u~kappl = lc_application_sd
AND t685t~kvewe = lc_usage
AND t685t~kappl = lc_application_sd
AND t683v~kalsm = uv_proced
AND t683v~vkorg = lt_salesorg-vkorg.
ENDIF.
ENDIF.
ENDFORM.
* Conditions Types
* Condition Setup > Condition Types > Condition Types SD
FORM conditiontypesd USING uv_header TYPE c.
* It inform if the condition types are from MM or SD, and then print the right
header
IF uv_header = abap_true.
WRITE:/ 'Table name: V_T685A ', "#EC NOTEXT
'Description: View mode of Condition Types SD used by Brazilians Procedures'.
"#EC NOTEXT
ENDIF.
WRITE:/
'//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////'. "#EC NOTEXT
WRITE:/
'----------------------------------------------------------------------------- ',
'End of Condition Type: ', gs_unique-kschl, '
------------------------------------------------------------------------------'.
"#EC NOTEXT
WRITE:/
'//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//////////////////////'. "#EC NOTEXT
ENDLOOP.
ENDFORM.
CLEAR gt_unique.
CLEAR gs_unique.
ENDFORM.
IF lv_actcondtxcal = gc_blank.
WRITE:/ 'Condition-based calculation (CBT): No (Classic)'. "#EC NOTEXT
SKIP.
ELSE.
WRITE:/ 'Condition-based calculation (CBT): Active'. "#EC NOTEXT
SKIP.
ENDIF.
* PERFORM formatter USING lt_compcond
* ls_compcond
* '' "#EC NOTEXT
* ''. "#EC NOTEXT
ENDFORM.
* Access Sequences
FORM accesseqsd USING uv_saponly TYPE c.
* Feed the table that contains only the condition types, to be displayed later
LOOP AT gt_calcprotab INTO gs_calcprotab.
APPEND gs_calcprotab-kschl TO lt_kschlsd.
ENDLOOP.
* Vefiry the variable and use the condition to get only no delivered by SAP
IF uv_saponly = abap_true.
ELSE.
ENDIF.
* This loop gets all accesses seq. that have the actual condition type
LOOP AT lt_accesses INTO ls_accesses WHERE kozgf = ls_kschlsd-kschl.
APPEND ls_accesses TO lt_accessesf.
ENDLOOP.
ENDLOOP.
WRITE:/
'----------------------------------------------------------------------------', '
End of Condition Type: ',ls_kschlsd-kschl, '
-------------------------------------------------------------------------------'.
"#EC NOTEXT
SKIP.
ENDIF.
ENDLOOP.
ENDFORM.
SELECT *
INTO TABLE lt_txgrpintcdsd
FROM j_1btaxgrpcd.
* Movement Type
FORM movementypes.
IF sy-subrc = 0.
* Subtabs from Movement Type Information
ENDIF.
* Header
lv_mvttext = ls_movementyp.
IF sy-subrc = 0.
PERFORM formatter USING lt_mvtinfoentryctf
ls_mvtinfoentryct
'' "#EC NOTEXT
''. "#EC NOTEXT
CLEAR lt_mvtinfoentryctf.
ENDIF.
IF sy-subrc = 0.
PERFORM formatter USING lt_mvtinfoupdatectf
ls_mvtinfoupdatect
'' "#EC NOTEXT
''. "#EC NOTEXT
CLEAR lt_mvtinfoupdatectf.
ENDIF.
IF sy-subrc = 0.
PERFORM formatter USING lt_mvtinfointctf
ls_mvtinfointct
'' "#EC NOTEXT
''. "#EC NOTEXT
CLEAR lt_mvtinfointctf.
ENDIF.
IF sy-subrc = 0.
PERFORM formatter USING lt_mvtallowtranf
ls_mvtallowtran
'' "#EC NOTEXT
''. "#EC NOTEXT
CLEAR lt_mvtallowtranf.
ENDIF.
IF sy-subrc = 0.
PERFORM formatter USING lt_mvtreversalflwf
ls_mvtreversalflw
'' "#EC NOTEXT
''. "#EC NOTEXT
CLEAR lt_mvtreversalflwf.
ENDIF.
WRITE:/
'#########################################################################', 'End
of Movement Type: ', lv_mvttext,
'##################################################################################
####'. "#EC NOTEXT
SKIP.
ENDLOOP.
ENDFORM.
IF sy-subrc = 0.
PERFORM formatter USING lt_taxpostingstr
ls_taxpostingstr
'' "#EC NOTEXT
'J_1BIM01'. "#EC NOTEXT
ENDIF.
ENDFORM.
IF sy-subrc = 0.
PERFORM formatter USING lt_nfamouttransd
ls_nfamouttransd
'' "#EC NOTEXT
'J_1BSDKON0'. "#EC NOTEXT
ENDIF.
ENDFORM.
IF sy-subrc = 0.
PERFORM formatter USING lt_poststrvalue
ls_poststrvalue
'Posting string values' "#EC NOTEXT
'V156W'. "#EC NOTEXT
ENDIF.
ENDFORM.
DATA:
lt_bpnotafiscal TYPE STANDARD TABLE OF ty_bpnotafiscal,
ls_bpnotafiscal TYPE ty_bpnotafiscal,
ls_bpnotafiscal-bukrs = ls_bbranch-bukrs.
ls_bpnotafiscal-j_1bbranc_ = ls_bbranch-branch.
ls_bpnotafiscal-name1 = ls_bbranch-name.
ls_bpnotafiscal-j_1bcgcbra = ls_bbranch-cgc_branch.
ls_bpnotafiscal-j_1bstains = ls_bbranch-state_insc.
ls_bpnotafiscal-j_1bmunins = ls_bbranch-munic_insc.
ls_bpnotafiscal-j_1bindus2 = ls_bbranch-industry.
ls_bpnotafiscal-j_1bsuframa = ls_bbranch-suframa.
ls_bpnotafiscal-j_1bcrtn = ls_bbranch-crtn.
ls_bpnotafiscal-j_1btdt = ls_bbranch-tdt.
ls_bpnotafiscal-j_1bnire = ls_bbranch-nire.
ls_bpnotafiscal-j_1bnfdec = ls_bbranch-nfdec.
ls_bpnotafiscal-j_1bsingle = ls_bbranch-single.
ls_bpnotafiscal-j_1bipicontributor = ls_bbranch-ipicontributor.
ls_bpnotafiscal-j_1b_source_danger_goods_data = ls_bbranch-soure_dangergood.
ls_bpnotafiscal-j_1bcnae = ls_bbranch-cnae.
ls_bpnotafiscal-j_1bicmstaxpay = ls_bbranch-icmstaxpay.
ls_bpnotafiscal-j_1bcomsize = ls_bbranch-comsize.
ls_bpnotafiscal-j_1bniredt = ls_bbranch-niredt.
ls_bpnotafiscal-j_1bdecregpc = ls_bbranch-decregpc.
ls_bpnotafiscal-j_1blegalnat = ls_bbranch-legalnat.
ls_bpnotafiscal-j_1bindtyp = ls_bbranch-indtyp.
ls_bpnotafiscal-j_1bspedactind = ls_bbranch-spedactind.
CLEAR ls_bpnotafiscal.
NEW-LINE.
SKIP.
WRITE
'__________________________________________________________________________________
___________________________________________________________________________________
______________________'. "#EC NOTEXT
SKIP.
ENDFORM.
* Get the country that have the same company code informed
SELECT SINGLE land1
FROM t001
INTO gv_land1
WHERE bukrs = uv_compcode.
IF sy-subrc = 0.
ENDFORM.
ENDFORM.
* Account Keys
* Transaction OBCN > Double click on the Accounting Keys
FORM accountkeys.
* This loop make the formatter prints each account key as a table
LOOP AT gt_acckeys INTO gs_acckeys.
ENDLOOP.
ENDFORM.
ENDFORM.
SELECT *
FROM j_1bnftxcond
INTO TABLE lt_nftaxtypes
WHERE kalsm = uv_proced_mm.
IF sy-subrc = 0.
WRITE:/ 'Table Name: J_1BNFTXCOND ', "#EC NOTEXT
'Table Description: Map Tax Conditions to Nota Fiscal Fields'. "#EC NOTEXT
SKIP.
LOOP AT lt_nftaxtypes INTO ls_nftaxtypes.
ENDLOOP.
ENDIF.
ENDFORM.
* Validate the fields that will be displayed
FORM formsfilter USING uv_metadata TYPE c
uv_sd TYPE c
uv_mm TYPE c
uv_others TYPE c
uv_compcode TYPE bukrs
uv_salesorg TYPE vkorg
uv_proced TYPE kalsm_d
uv_onlysap TYPE c
uv_bussines_place TYPE j_1bbranc_.
* Data from view V_T001 by uv_compcode, ACB confirmation from table J_1BCONDTAXACT
* and main procedure from table V_T005
PERFORM compcodeprint USING uv_compcode.
IF uv_metadata = gc_positive.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/'
Metadata Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' End
of Metadata Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
SKIP.
SKIP.
ENDIF.
IF uv_sd = gc_positive.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' SD
Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
* Data from Condition Setup > Condition Types > Condition Types SD
PERFORM conditiontypesd USING gc_positive.
* Data from Condition Setup > Accesses Sequences > Accesses Sequences SD > Tables
T682I and Fields from T682Z
PERFORM accesseqsd USING uv_onlysap.
SKIP.
SKIP.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' End
of SD Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
SKIP.
SKIP.
ENDIF.
IF uv_mm = gc_positive.
* When the user call the program by the filters, the variable uv_proced cames
empty
IF uv_proced = gc_blank.
uv_proced = lc_procedmm.
ENDIF.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' MM
Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
* Data from Condition Setup > Condition Types > Condition Types MM
PERFORM conditiontypemm.
* Data from Nota Fiscal > Inventory Management > NF Category Derivation
PERFORM nfrelevance.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' End
of MM Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
SKIP.
SKIP.
ENDIF.
IF uv_others = gc_positive.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/'
Others Filer Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
* SPRO: Logistics General > Tax on Goods Movement > CNPJ Business Places > Define
Business Place
PERFORM businessplace USING uv_compcode
uv_bussines_place.
* SPRO > Financial Accounting (New) > Financial Accounting Global Settings (New)
>
* Tax on Sales/Purchases > Basic Settings> External Tax Calculation >
* Active External Tax Calculation
PERFORM ttxdexternalsys USING uv_compcode.
* SPRO > Financial Accounting (New) > Financial Accounting Global Settings (New)
>
* Tax on Sales/Purchases > Basic Settings> External Tax Calculation > Define
Logical Destination
PERFORM aeslogicaldest.
* Condition Setup > Condition Mapping > Max Tax Rate Tables to Condition Tables
PERFORM maptxratetabs.
PERFORM get_j1balv.
PERFORM get_j1bamitv.
PERFORM get_j1bamhv.
SKIP.
SKIP.
SKIP.
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
WRITE:/' End
of Others Filter Information
'. "#EC NOTEXT
WRITE:/'---------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------'. "#EC NOTEXT
SKIP.
SKIP.
SKIP.
ENDIF.
ENDFORM.
* Billing information
* SELECT SINGLE vbeln "#EC WARNOK
* INTO lv_billingnum
* FROM vbfa
* WHERE vbelv = uv_doc_sales_order
* AND vbtyp_n = lc_billing_ind.
IF sy-subrc EQ 0.
READ TABLE lt_vbfa INTO ls_vbfa WITH KEY vbtyp_n = 'M'.
lv_billingnum = ls_vbfa-vbeln.
ENDIF.
* Customer info
* SELECT SINGLE vbak~kunnr vbpa~kunnr vbak~vtweg vbak~spart kna1~ktokd "#EC WARNOK
* kna1~stcd1 kna1~cfopc knb1~akont knvv~bzirk knvv~konda
* knvv~kalks knvv~vwerk kna1~ort01 kna1~regio kna1~land1
* knvi~taxkd knvi~tatyp
* INTO lv_customerinfo
* FROM vbak
* INNER JOIN kna1
* ON kna1~kunnr = vbak~kunnr
* INNER JOIN knvi
* ON knvi~kunnr = vbak~kunnr
* INNER JOIN vbpa
* ON vbpa~vbeln = vbak~vbeln
* INNER JOIN knb1
* ON knb1~kunnr = vbak~kunnr
* INNER JOIN knvv
* ON knvv~kunnr = vbak~kunnr
* WHERE vbak~vbeln = uv_doc_sales_order
* AND knb1~bukrs = vbak~bukrs_vf
* AND vbpa~parvw = lc_customer_ind
* AND vbpa~vbeln = uv_doc_sales_order.
IF sy-subrc EQ 0.
lv_customerinfo-customer = ls_vbak-kunnr.
lv_customerinfo-shipto = ls_vbpa-kunnr.
lv_customerinfo-distchan = ls_vbak-vtweg.
lv_customerinfo-division = ls_vbak-spart.
lv_customerinfo-custaccg = ls_kna1-ktokd.
lv_customerinfo-taxnumb1 = ls_kna1-stcd1.
lv_customerinfo-ccfopcat = ls_kna1-cfopc.
lv_customerinfo-recaccgl = ls_knb1-akont.
lv_customerinfo-salesdis = ls_knvv-bzirk.
lv_customerinfo-pricgrp = ls_knvv-konda.
lv_customerinfo-custpp = ls_knvv-kalks.
lv_customerinfo-devplant = ls_knvv-vwerk.
lv_customerinfo-city = ls_kna1-ort01.
lv_customerinfo-region = ls_kna1-regio.
lv_customerinfo-country = ls_kna1-land1.
lv_customerinfo-taxkd = ls_knvi-taxkd.
lv_customerinfo-tatyp = ls_knvi-tatyp.
lt_salesorderdata-bukrs = ls_vbak-bukrs_vf.
lt_salesorderdata-vkorg = ls_vbak-vkorg.
lt_salesorderdata-kalsm = ls_vbak-kalsm.
lt_salesorderdata-vtweg = ls_vbak-vtweg.
lt_salesorderdata-spart = ls_vbak-spart.
lt_salesorderdata-purdoc = ls_vbak-bstnk.
lt_salesorderdata-materi = ls_vbap-matnr.
lt_salesorderdata-taxcod = ls_vbap-j_1btxsdc.
IF sy-subrc NE 0.
"EXPORTATION LANDSCAPE
CALL FUNCTION 'KNA1_READ_SINGLE'
EXPORTING
ID_KUNNR = lv_customerinfo-shipto
IMPORTING
ES_KNA1 = ls_kna1_export
EXCEPTIONS
NOT_FOUND = 1.
IF sy-subrc NE 0.
MESSAGE 'KNA1 ERROR' TYPE 'E'.
ELSE.
IF ls_kna1_export-LAND1 NE 'BR'.
MESSAGE 'This Sales Order does not define a Brazilian Localization
Landscape.' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
CLEAR ls_vbap.
IF sy-subrc EQ 0.
READ TABLE lt_mard INTO ls_mard INDEX 1.
ENDIF.
* Material Data
* SELECT vbap~matnr vbap~werks vbap~j_1btxsdc vbap~posnr mara~mbrsh
* mara~mtart mara~meins mara~matkl mard~lgort makt~maktx
* marc~indus mbew~bklas mbew~vprsv mbew~mtuse mbew~mtorg
* INTO TABLE lt_materialinfosd
* FROM vbap
* INNER JOIN vbrp
* ON vbrp~matnr = vbap~matnr
* INNER JOIN mara
* ON mara~matnr = vbap~matnr
* INNER JOIN mard
* ON mard~matnr = vbap~matnr
* INNER JOIN makt
* ON makt~matnr = vbap~matnr
* INNER JOIN marc
* ON marc~matnr = vbap~matnr
* INNER JOIN mbew
* ON mbew~matnr = vbap~matnr
* WHERE vbap~vbeln = uv_doc_sales_order
* AND makt~spras = 'E'
* AND marc~werks = vbap~werks
* AND mard~werks = vbap~werks.
ls_materialinfosd-matnr = ls_vbap-matnr.
ls_materialinfosd-werks = ls_vbap-werks.
ls_materialinfosd-j_1btxsdc = ls_vbap-j_1btxsdc.
ls_materialinfosd-posnr = ls_vbap-posnr.
ls_materialinfosd-mbrsh = ls_mara-mbrsh.
ls_materialinfosd-mtart = ls_mara-mtart.
ls_materialinfosd-meins = ls_mara-meins.
ls_materialinfosd-matkl = ls_mara-matkl.
ls_materialinfosd-lgort_d = ls_mard-lgort.
ls_materialinfosd-maktx = ls_makt-maktx.
ls_materialinfosd-j_1bindus3 = ls_marc-indus.
ls_materialinfosd-bklas = ls_mbew-bklas.
ls_materialinfosd-vprsv = ls_mbew-vprsv.
ls_materialinfosd-j_1bmatuse = ls_mbew-mtuse.
ls_materialinfosd-j_1bmatorg = ls_mbew-mtorg.
ENDLOOP.
lv_material_code = ls_vbap-matnr.
* IF sy-subrc NE 0.
* WRITE: 'TESTE'.
* ENDIF.
* Business Place
SELECT SINGLE j_1bbranch
INTO lv_branch
FROM t001w
WHERE werks = ls_materialinfosd-werks.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
WRITE:/'|
Document Overview'. "#EC NOTEXT
WRITE:/'| Sales order: ', uv_doc_sales_order. "#EC NOTEXT
WRITE:/'| Billing Document: ', lv_billingnum. "#EC NOTEXT
WRITE:/'| Procedure: ', lt_salesorderdata-kalsm. "#EC NOTEXT
WRITE:/'| Sales Org.: ', lt_salesorderdata-vkorg. "#EC NOTEXT
WRITE:/'| Business Place: ', lv_branch. "#EC NOTEXT
WRITE:/'| Distribution Channel: ', lt_salesorderdata-vtweg. "#EC NOTEXT
WRITE:/'| Division: ', lt_salesorderdata-spart. "#EC NOTEXT
WRITE:/'| Sold-to Party: ', lv_customerinfo-customer. "#EC
NOTEXT
WRITE:/'| Ship-to Party: ', lv_customerinfo-shipto. "#EC NOTEXT
WRITE:/'| Purchasing Document: ', lt_salesorderdata-purdoc. "#EC
NOTEXT
WRITE:/'| Tax Code: ', lt_salesorderdata-taxcod. "#EC
NOTEXT
WRITE:/'| '. "#EC NOTEXT
WRITE:/'|
Customer Information'. "#EC NOTEXT
WRITE:/'| Customer: ', lv_customerinfo-customer. "#EC
NOTEXT
WRITE:/'| Account Group', lv_customerinfo-custaccg. "#EC
NOTEXT
* WRITE:/'| City: ', lv_customerinfo-city. "#EC NOTEXT
* WRITE:/'| Country: ', lv_customerinfo-country. "#EC NOTEXT
* WRITE:/'| Region: ', lv_customerinfo-region. "#EC NOTEXT
WRITE:/'| Tax Number 1: ', lv_customerinfo-taxnumb1. "#EC
NOTEXT
WRITE:/'| CFOP Category: ', lv_customerinfo-ccfopcat. "#EC
NOTEXT
WRITE:/'| Rec Account: ', lv_customerinfo-recaccgl. "#EC
NOTEXT
WRITE:/'| Sales District: ', lv_customerinfo-salesdis. "#EC
NOTEXT
WRITE:/'| Price Group: ', lv_customerinfo-pricgrp. "#EC NOTEXT
WRITE:/'| Customer Pricing Procedure: ', lv_customerinfo-custpp. "#EC NOTEXT
WRITE:/'| Delivering Plant: ', lv_customerinfo-devplant. "#EC
NOTEXT
WRITE:/'| Tax Classification: ', lv_customerinfo-taxkd. "#EC NOTEXT
WRITE:/'| Tax Category: ', lv_customerinfo-tatyp. "#EC NOTEXT
WRITE:/'|
Materials'. "#EC NOTEXT
WRITE:/'| Item Number Tax Code Material'. "#EC NOTEXT
LOOP AT lt_materialinfosd INTO ls_materialinfosd.
WRITE:/'| ', ls_materialinfosd-posnr NO-ZERO, '
',ls_materialinfosd-j_1btxsdc,
' ', ls_materialinfosd-matnr. "#EC NOTEXT
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
SKIP.
SKIP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
WRITE:/'Table name: MARA/MBEW Description: Material
Information'. "#EC NOTEXT
SKIP.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
SKIP.
ENDIF.
PERFORM formsfilter
USING gc_blank
gc_positive
gc_positive
gc_positive
lt_salesorderdata-bukrs
lt_salesorderdata-vkorg
lt_salesorderdata-kalsm
gc_positive
lv_branch.
ELSE.
MESSAGE 'This number of Sale Order does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
* PO Information
* SELECT SINGLE ekko~ekorg ekko~kalsm ekko~ekgrp ekko~bukrs ekko~bstyp "#EC WARNOK
* ekko~bsart ekko~lifnr ekpo~mwskz ekpo~repos ekpo~webre
* INTO lv_purorderinfo
* FROM ekko
* INNER JOIN ekpo
* ON ekko~ebeln = ekpo~ebeln
* WHERE ekko~ebeln = uv_doc_purchase_order.
IF sy-subrc EQ 0.
IF sy-subrc EQ 0.
READ TABLE lt_ekpo INTO ls_ekpo WITH KEY ebeln = ls_ekko-ebeln.
ENDIF.
*
lv_purorderinfo-purorg = ls_ekko-ekorg.
lv_purorderinfo-purkaslm = ls_ekko-kalsm.
lv_purorderinfo-purgroup = ls_ekko-ekgrp.
lv_purorderinfo-bukrs = ls_ekko-bukrs.
lv_purorderinfo-purcat = ls_ekko-bstyp.
lv_purorderinfo-purtype = ls_ekko-bsart.
lv_purorderinfo-vendacc = ls_ekko-lifnr.
lv_purorderinfo-taxcode = ls_ekpo-mwskz.
lv_purorderinfo-invrecip = ls_ekpo-repos.
lv_purorderinfo-grbsdiv = ls_ekpo-webre.
IF sy-subrc NE 0.
* VERIFY II IT IS A IMPORTATION
CALL FUNCTION 'LFA1_READ_SINGLE'
EXPORTING
ID_LIFNR = lv_purorderinfo-vendacc
IMPORTING
ES_LFA1 = ls_lfa1_import
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF ls_lfa1_import-land1 NE 'BR'.
MESSAGE 'This Purchase Order does not define a Brazilian Localization
Landscape. ' TYPE 'E'.
ENDIF.
ENDIF.
* Vendor Information
* SELECT SINGLE lfa1~ktokk lfa1~ort01 lfa1~regio lfa1~land1 lfa1~stcd1 "#EC WARNOK
* lfa1~ipisp lfb1~akont lfb1~zterm lfb1~zwels lfm1~waers
* lfm1~webre
* INTO lv_vendorinfo
* FROM lfa1
* INNER JOIN lfb1
* ON lfb1~lifnr = lfa1~lifnr
* INNER JOIN lfm1
* ON lfm1~lifnr = lfa1~lifnr
* WHERE lfa1~lifnr = lv_purorderinfo-vendacc
* AND lfb1~bukrs = lv_purorderinfo-bukrs
* AND lfm1~ekorg = lv_purorderinfo-purorg.
lv_vendorinfo-accgroup = ls_lfa1-ktokk.
lv_vendorinfo-city = ls_lfa1-ort01.
lv_vendorinfo-region = ls_lfa1-regio.
lv_vendorinfo-country = ls_lfa1-land1.
lv_vendorinfo-cnpj = ls_lfa1-stcd1.
lv_vendorinfo-taxsplit = ls_lfa1-ipisp.
lv_vendorinfo-recacc = ls_lfb1-akont.
lv_vendorinfo-payterm = ls_lfb1-zterm.
lv_vendorinfo-paymeth = ls_lfb1-zwels.
lv_vendorinfo-currkey = ls_lfm1-waers.
lv_vendorinfo-grbased = ls_lfm1-webre.
* Material data
* SELECT mseg~mblnr mseg~mjahr mseg~matnr ekpo~werks ekpo~mwskz ekpo~ebelp
* mara~mbrsh mara~mtart mara~meins mara~matkl mard~lgort makt~maktx
* marc~indus mbew~bklas mbew~vprsv mbew~mtuse mbew~mtorg
* INTO TABLE lt_materialinfo
* FROM mseg
* INNER JOIN ekpo
* ON ekpo~matnr = mseg~matnr
* INNER JOIN mara
* ON mara~matnr = mseg~matnr
* INNER JOIN mard
* ON mard~matnr = mseg~matnr
* INNER JOIN makt
* ON makt~matnr = mseg~matnr
* INNER JOIN marc
* ON marc~matnr = mseg~matnr
* INNER JOIN mbew
* ON mbew~matnr = mseg~matnr
* WHERE mseg~ebeln = uv_doc_purchase_order
* AND makt~spras = sy-langu
* AND marc~werks = mseg~werks
* AND mard~werks = mseg~werks.
SELECT *
INTO TABLE lt_mseg
FROM mseg
WHERE ebeln = uv_doc_purchase_order.
IF sy-subrc EQ 0.
READ TABLE lt_mard INTO ls_mard INDEX 1.
ENDIF.
CALL FUNCTION 'MAKT_SINGLE_READ' "1
EXPORTING
MATNR = ls_mseg-matnr
SPRAS = sy-langu
IMPORTING
WMAKT = ls_makt
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 3.
ls_materialinfo-mblnr = ls_mseg-mblnr.
ls_materialinfo-mjahr = ls_mseg-mjahr.
ls_materialinfo-matnr = ls_mseg-matnr.
ls_materialinfo-werks = ls_ekpo-werks.
ls_materialinfo-mwskz = ls_ekpo-mwskz.
ls_materialinfo-ebelp = ls_ekpo-ebelp.
ls_materialinfo-mbrsh = ls_mara-mbrsh.
ls_materialinfo-mtart = ls_mara-mtart.
ls_materialinfo-meins = ls_mara-meins.
ls_materialinfo-matkl = ls_mara-matkl.
ls_materialinfo-lgort_d = ls_mard-lgort.
ls_materialinfo-maktx = ls_makt-maktx.
ls_materialinfo-j_1bindus3 = ls_marc-indus.
ls_materialinfo-bklas = ls_mbew-bklas.
ls_materialinfo-vprsv = ls_mbew-vprsv.
ls_materialinfo-j_1bmatuse = ls_mbew-mtuse.
ls_materialinfo-j_1bmatorg = ls_mbew-mtorg.
ENDLOOP.
** Material header
* SELECT ebelp mwskz matnr
* INTO TABLE lt_matheader
* FROM ekpo
* WHERE ebeln = uv_doc_purchase_order.
CLEAR ls_matheader.
ls_matheader-ebelp = ls_ekpo_header-ebelp.
ls_matheader-mwskz = ls_ekpo_header-mwskz.
ls_matheader-matnr = ls_ekpo_header-matnr.
ENDLOOP.
* Sort the material header by the item number
SORT lt_matheader BY ebelp ASCENDING.
* Invoice data
SELECT SINGLE rseg~belnr rseg~gjahr rbkp~j_1bnftype "#EC WARNOK
INTO lv_invoiceinfo
FROM rseg
INNER JOIN rbkp
ON rbkp~belnr = rseg~belnr
WHERE ebeln = uv_doc_purchase_order
AND rbkp~gjahr = rseg~gjahr.
IF sy-subrc = 0.
* To get the Material doc and year
READ TABLE lt_materialinfo INTO ls_materialinfo INDEX 1.
SKIP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
WRITE:/'|
Document Overview'. "#EC NOTEXT
WRITE:/'| Purchase Order: ', uv_doc_purchase_order. "#EC NOTEXT
WRITE:/'| Purchase Procedure: ', lv_purorderinfo-purkaslm. "#EC
NOTEXT
WRITE:/'| Company Code: ', lv_purorderinfo-bukrs. "#EC NOTEXT
WRITE:/'| Purchasing Document Category: ', lv_purorderinfo-purcat. "#EC
NOTEXT
WRITE:/'| Purchasing Document Type: ', lv_purorderinfo-purtype. "#EC
NOTEXT
WRITE:/'| Tax Code: ', lv_purorderinfo-taxcode. "#EC
NOTEXT
WRITE:/'| Inv. Receipt: ', lv_purorderinfo-invrecip. "#EC
NOTEXT
WRITE:/'| GR-Bsd IV: ' , lv_purorderinfo-grbsdiv. "#EC
NOTEXT
WRITE:/'| Material Document: ', ls_materialinfo-mblnr. "#EC NOTEXT
WRITE:/'| Material Document Year: ', ls_materialinfo-mjahr. "#EC NOTEXT
WRITE:/'| '. "#EC NOTEXT
WRITE:/'|
Vendor Information'. "#EC NOTEXT
WRITE:/'| Vendor Account: ', lv_purorderinfo-vendacc. "#EC
NOTEXT
WRITE:/'| Purchase Org.: ' , lv_purorderinfo-purorg. "#EC
NOTEXT
WRITE:/'| Account Group: ', lv_vendorinfo-accgroup. "#EC
NOTEXT
* WRITE:/'| CNPJ/CPF: ', lv_vendorinfo-cnpj. "#EC NOTEXT
WRITE:/'| Tax Split: ', lv_vendorinfo-taxsplit. "#EC
NOTEXT
* WRITE:/'| City: ', lv_vendorinfo-city. "#EC NOTEXT
* WRITE:/'| Country: ', lv_vendorinfo-country. "#EC NOTEXT
* WRITE:/'| Region: ', lv_vendorinfo-region. "#EC NOTEXT
WRITE:/'| Recon. Account: ', lv_vendorinfo-recacc. "#EC NOTEXT
WRITE:/'| Payment Terms: ', lv_vendorinfo-payterm. "#EC NOTEXT
WRITE:/'| Payment Methods: ', lv_vendorinfo-paymeth. "#EC NOTEXT
* WRITE:/'| Order Currency: ', lv_vendorinfo-currkey. "#EC
NOTEXT
WRITE:/'| GR-Based Inv. Verif.: ', lv_vendorinfo-grbased. "#EC NOTEXT
WRITE:/'| '. "#EC NOTEXT
WRITE:/'|
Invoice Information'. "#EC NOTEXT
WRITE:/'| Invoice Document (Most recent): ', lv_invoiceinfo-docnum. "#EC
NOTEXT
WRITE:/'| Invoice Document Year: ', lv_invoiceinfo-year. "#EC NOTEXT
WRITE:/'| Nota Fiscal Type: ', lv_invoiceinfo-nftype. "#EC
NOTEXT
WRITE:/'| '. "#EC NOTEXT
WRITE:/'|
Materials'. "#EC NOTEXT
WRITE:/'| Item Number Tax Code Material'. "#EC NOTEXT
LOOP AT lt_matheader INTO ls_matheader.
WRITE:/'| ', ls_matheader-ebelp NO-ZERO, ' ',ls_matheader-
mwskz
, ' ', ls_matheader-matnr. "#EC NOTEXT
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
SKIP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
WRITE:/'Table name: MARA/MBEW Description: Material
Information'. "#EC NOTEXT
SKIP.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
SKIP.
ENDIF.
ELSE.
MESSAGE 'This number of Purchase Order does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
* Billing filter
* Info of Billing Doc.
FORM billinginfo USING uv_doc_billing TYPE vbeln_vf.
IF sy-subrc = 0.
PERFORM salesorderinfo USING lv_docnso.
PERFORM get_spec_j1balv USING p_docnf.
PERFORM get_spec_j1bamitv USING p_docnf.
PERFORM get_spec_j1bamhv USING p_docnf.
ELSE.
MESSAGE 'This number of Billing Document does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
* Invoice filter
* Info of Invoice Doc.
FORM invoicedata USING uv_doc_invoice TYPE ebeln
uv_fiscal_year TYPE gjahr.
IF sy-subrc = 0.
PERFORM purchaseorderinfo USING lv_ponumber.
PERFORM get_spec_j1balv USING p_docnf.
PERFORM get_spec_j1bamitv USING p_docnf.
PERFORM get_spec_j1bamhv USING p_docnf.
ELSE.
MESSAGE 'This number of Invoice Document does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
IF sy-subrc = 0.
* The field refkey come with the number of Materials Doc or Invoices Doc and the
year
* together in the same string, so this IF will split it in two variables
IF lv_countle > 10.
SUBTRACT 4 FROM lv_countle.
lv_year = lv_reftype-docnumber+10.
lv_docfinal = lv_reftype-docnumber(lv_countle).
ELSE.
lv_docfinal = lv_reftype-docnumber.
ENDIF.
IF lv_reftype-reftype = lc_billing.
PERFORM billinginfo USING lv_docfinal.
ELSEIF lv_reftype-reftype = lc_invoice.
PERFORM invoicedata USING lv_docfinal
lv_year.
ELSEIF lv_reftype-reftype = lc_material_doc.
PERFORM materialdoc USING lv_docfinal
lv_year.
ELSE.
MESSAGE 'This number of Nota Fiscal does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ELSE.
MESSAGE 'This number of Nota Fiscal does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
IF sy-subrc = 0.
PERFORM purchaseorderinfo USING lv_ponumber.
PERFORM get_spec_j1balv USING p_docnf.
PERFORM get_spec_j1bamitv USING p_docnf.
PERFORM get_spec_j1bamhv USING p_docnf.
ELSE.
MESSAGE 'This number of Material Document does not exist.' TYPE 'E'. "#EC
NOTEXT
ENDIF.
ENDFORM.
* Metadata filter
* Metadata Info
FORM metadatafilter USING uv_package_tables TYPE devclass.
IF sy-subrc = 0.
* Call this form to show the DDICs of those tables
PERFORM j1btaxtabs USING gc_positive.
ELSE.
MESSAGE 'This packages name does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
* Table/structure filter
* Receive a table/structure to display his DDICs
FORM tablesfilter USING uv_tables_name TYPE string.
IF sy-subrc = 0.
SORT gt_metainfo BY tabname.
DELETE ADJACENT DUPLICATES FROM gt_metainfo.
ELSE.
MESSAGE 'This name of table does not exist.' TYPE 'E'. "#EC NOTEXT
ENDIF.
ENDFORM.
***********************************************************************************
***********************************************
************************************************************* J_1BALV
************************************************************
***********************************************************************************
***********************************************
FORM get_j1balv.
TYPES: BEGIN OF TY_OUTPUT_ALV,
nftype TYPE j_1bal-nftype,
manual TYPE j_1bal-manual,
modef TYPE j_1bal-modef,
sconrf TYPE j_1bal-sconrf,
nfttxt TYPE j_1baat-nfttxt,
scnrft TYPE j_1bamht-scnrft,
scr_cont_it TYPE j_1bal-scr_cont_it,
END OF TY_OUTPUT_ALV.
IF sy-subrc NE 0.
MESSAGE 'TRY AGAIN' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BALV Description: Screen
Control for Group Assignment'.
SKIP.
WRITE: 'NF Type', ' ', 'Description', '
', 'Manual', ' ', 'Mode', ' Scr.Ctl.He.Fiel',' ', 'Description',
' ', 'SC Header Scr.'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-nftype, ' ', ls_output-nfttxt, ' ', ls_output-
manual, ' ', ls_output-modef, ' ', ls_output-sconrf, '
',ls_output-scnrft,
' ', ls_output-scr_cont_it.
NEW-LINE.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
ENDIF.
ENDFORM.
IF sy-subrc NE 0.
MESSAGE 'TRY AGAIN' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BALV Description: Screen
Control for Group Assignment'.
SKIP.
WRITE: 'NF Type', ' ', 'Description', '
', 'Manual', ' ', 'Mode', ' Scr.Ctl.He.Fiel',' ', 'Description'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-nftype, ' ', ls_output-nfttxt, ' ', ls_output-
manual, ' ', ls_output-modef, ' ', ls_output-sconrf, '
',ls_output-scnrft.
NEW-LINE.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
ENDIF.
ENDFORM.
***********************************************************************************
***********************************************
*********************************************************** J_1BAMITV
************************************************************
***********************************************************************************
***********************************************
FORM get_j1bamitv.
IF sy-subrc NE 0.
MESSAGE 'Error at J_1BAMITV View.' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BAMITV Description: Screen
Control for Fields (Item)'.
SKIP.
WRITE: 'SC ItemFI', ' ', 'Service', ' ', 'NF ItmType',' ',
'Description'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-sconrf, ' ', ls_output-tmiss, ' ',
ls_output-itmtyp, ' ', ls_output-scnrft.
NEW-LINE.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
ENDIF.
ENDFORM.
FORM get_spec_j1bamitv USING lv_docnumber TYPE j_1bdocnum.
IF sy-subrc NE 0.
MESSAGE 'Error at J_1BAMITV View.' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BAMITV Description: Screen
Control for Fields (Item)'.
SKIP.
WRITE: 'SC ItemFI', ' ', 'Service', ' ', 'NF ItmType',' ',
'Description'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-sconrf, ' ', ls_output-tmiss, ' ',
ls_output-itmtyp, ' ', ls_output-scnrft.
NEW-LINE.
ENDLOOP.
WRITE:/'
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------'. "#EC NOTEXT
ENDIF.
ENDFORM.
***********************************************************************************
***********************************************
************************************************************ J_1BAMHV
************************************************************
***********************************************************************************
***********************************************
FORM get_j1bamhv.
IF sy-subrc NE 0.
MESSAGE 'Error at J_1BAMHV View.' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BAMHV Description: Screen
Control for Fields (Header)'.
SKIP.
WRITE: 'Scr.Ctl.He.Fiel', ' ', 'Description', '
', 'Scr.Ctl.It.Fiel'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-sconrf, ' ', ls_output-scnrft, ' ',
ls_output-sconrfit.
NEW-LINE.
ENDLOOP.
ENDIF.
ENDFORM.
IF sy-subrc NE 0.
MESSAGE 'TRY AGAIN' TYPE 'E'.
ELSE.
WRITE: 'Table Name: J_1BAMHV Description: Screen
Control for Fields (Header)'.
SKIP.
WRITE: 'Scr.Ctl.He.Fiel', ' ', 'Description', '
', 'Scr.Ctl.It.Fiel'.
NEW-LINE.
DELETE ADJACENT DUPLICATES FROM lv_output.
LOOP AT lv_output INTO ls_output.
WRITE: ls_output-sconrf, ' ', ls_output-scnrft, ' ',
ls_output-sconrfit.
NEW-LINE.
ENDLOOP.
ENDIF.
ENDFORM.