Zsales
Zsales
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
FORM getdata .
SELECT vbeln
FROM likp
SELECT
vbeln
werks
FROM lips
SORT it_lips.
ENDIF.
SELECT vbeln
kunnr
kunag
btgew
ntgew
gewei
FROM likp
ENDIF.
SELECT vbelv
posnv
vbeln
posnn
vbtyp_n
FROM vbfa
ENDIF.
SELECT vbeln
vkorg
fkart
knumv
fkdat
netwr
waerk
kurrf
zterm
kunag
xblnr
FROM vbrk
DELETE it_vbrk WHERE ( fkart = 'L2' OR fkart = 'G2' OR fkart = 'RE' OR fkart =
'ZISC' ).
ENDIF.
* SELECT vbelv
* posnv
* vbeln
* posnn
* vbtyp_n
* FROM vbfa
* DELETE ADJACENT DUPLICATES FROM it_vbfa COMPARING vbelv posnv vbeln posnn
vbtyp_n .
SELECT vbeln
kunnr
parvw
SELECT vbeln
posnr
matnr
werks
fkimg
kursk
netwr
aubel
arktx
ntgew
vbelv
SELECT knumv
kposn
kschl
kwert
FROM konv
kschl = 'ZSUR').
awkey
FROM bkpf
APPEND it_bkpf.
CLEAR it_bkpf.
ENDLOOP.
zfbdt
zbd1t
REFRESH : it_vbpa.
ENDFORM.
FORM layout .
it_layout-colwidth_optimize = 'X'.
it_layout-zebra = 'X'.
ENDFORM.
*&---------------------------------------------------------------------*
FORM header_form .
it_vbfab[] = it_vbfa[] .
*break abap.
LOOP AT it_vbrk .
* ON CHANGE OF it_vbrp-vbeln .
it_head-xblnr = it_vbrk-xblnr.
it_head-werks = it_vbrp-werks.
***********************************************************************************
*************************************
***********************************************************************************
*************************************
IF sy-subrc NE 0 .
SELECT vbelv
it_wght WHERE
vbeln = it_vbrp-vbeln.
SELECT vbeln
kunnr
btgew
ntgew
gewei
LOOP AT it_wght1.
ELSE.
ENDIF.
ENDLOOP.
it_head-kunnr = it_wght1-kunnr.
ENDIF.
* break abap.
* ON CHANGE OF it_vbfa-vbelv .
ELSE.
ENDIF.
IF it_head-kunnr IS INITIAL .
it_head-kunnr = it_likp-kunnr.
ENDIF.
* endon .
ENDLOOP.
CLEAR it_vbfa .
ENDLOOP.
***********************************************************************************
*************************************
* it_head-kunnr = it_likp-kunnr.
IF sy-subrc EQ 0.
it_head-custname = it_kna1-name1.
ENDIF.
CLEAR : g_name1.
CLEAR : land1.
READ TABLE it_vbpa WITH KEY vbeln = it_vbrp-vbeln parvw = 'AG' .
IF sy-subrc NE 0.
IF sy-subrc EQ 0.
it_head-sold_to = it_vbpa-kunnr.
ENDIF.
ENDIF.
IF sy-subrc EQ 0.
it_head-sold_to = it_vbpa-kunnr.
ENDIF.
IF sy-subrc EQ 0.
it_head-soldname = it_kna1-name1.
IF sy-subrc EQ 0.
it_head-landx50 = it_t005t-landx50.
ENDIF.
ENDIF.
CLEAR : g_name1.
it_head-kunnr = it_vbrk-kunag.
it_head-custname = it_head-soldname.
ENDIF.
it_head-vbeln = it_vbrp-vbeln.
it_head-fkdat = it_vbrk-fkdat.
* ITAB-NETWR = IT_VBRP-NETWR.
it_head-waerk = it_vbrk-waerk.
it_head-vkorg = it_vbrk-vkorg.
IF sy-subrc EQ 0.
it_head-augbl = it_bseg-augbl.
g_date = it_bseg-zfbdt.
days = it_bseg-zbd1t.
ENDIF.
IF it_bseg-augbl IS INITIAL.
it_head-augbl = 'NotCleared'.
ENDIF.
* IF DAYS = 0.
* LV_DATE1 = G_DATE.
* ENDIF.
EXPORTING
i_date = g_date
i_days = days
i_calendar1 = 'X'
* I_CALENDAR2 =
IMPORTING
e_date = lv_date1
* E_RETURN =
* SY-SUBRC.
IF days = 0.
lv_date1 = g_date.
ENDIF.
it_head-paydate = lv_date1.
it_head-netwr = - ( it_vbrk-netwr ).
ELSE.
it_head-netwr = it_vbrk-netwr.
ENDIF.
***********************************************************************************
****************
ELSE.
IF sy-subrc EQ 0.
it_head-exnum = it_excd-exnum.
ENDIF.
ENDIF.
PERFORM gettax_header.
it_head-bill_value = it_head-valinr.
ELSE.
ENDIF.
IF it_vbrk-fkart = 'G2'.
it_head-bill_value = - ( it_head-bill_value ).
ENDIF.
***********************************************************************************
*****************************************************
* ENDIF.
* APPEND ITAB.
APPEND it_head.
CLEAR it_head.
CLEAR : g_name1,
netval_fc ,
fkart,
it_vbfa,
g_vtext,
lv_date1,
g_vtext,
it_vbrk,
* wa_bseg,
it_bseg,
it_vbpa,
it_kna1,
it_bkpf,
it_likp,
* it_cinv,
it_konv.
* it_ewbill.
CLEAR : g_date,
days,
taxval.
* ENDON.
ENDIF .
ENDLOOP.
ENDFORM.
FORM header_vkorg .
LOOP AT it_head WHERE vkorg = '1000'.
MODIFY it_head.
CLEAR it_head.
ENDLOOP.
ENDFORM.
FORM fillcatalog .
'KUNNR' 'Ship to Party #' '10' 'IT_HEAD' ' ' '' ' ' ' ' '
',
'CUSTNAME' 'Ship to Party Name' '7' 'IT_HEAD' ' ' '' ' ' '
' ' ',
'SOLD_TO' 'Sold to Party #' '10' 'IT_HEAD' ' ' '' ' ' ' ' '
',
'LANDX50' 'Country' '50' 'IT_HEAD' ' ' '' ' ' ' ' ' ',
'SOLDNAME' 'Sold to Party Name' '7' 'IT_HEAD' ' ' '' ' ' '
' ' ',
'WERKS' 'Plant' '5' 'IT_HEAD' ' ' '' ' ' ' ' ' ',
'VBELN' 'Inv #' '10' 'IT_HEAD' ' ' '' 'X' 'C71' ' ',
'FKDAT' 'Inv date' '10' 'IT_HEAD' ' ' '' ' ' ' ' ' ',
'PAYDATE' 'Payment Due Date' '10' 'IT_HEAD' ' ' '' ' ' '
' ' ',
* 'MATNR' 'Material Number' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',
* 'KDMAT' 'Customer Material' '18' 'IT_HEAD' ' ' ' ' ' ' ' '
' ',
* 'FKIMG' 'Quantity in PC' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',
'NETWR' 'Inv val(Dy+tx)Docur' '40' 'IT_HEAD' ' ' '' ' '
'C10' 'X',
'PR00' 'BasVal Docur(SP*QTY)' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',
'PR00INR' 'BasPrice(SP*QTY)-INR' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',
'OTDH' 'ToolCost-Doc Curr' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',
'OTDHINR' 'ToolCost-INR' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',
'K007' 'Discount in Doc Curr' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',
'K007INR' 'Discount in INR' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',
'ZTRA' 'Trans Cost Doc Curr' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',
'ZTRAINR' 'TransportCost in INR' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',
'EXNUM' 'Excise Inv #' '10' 'IT_HEAD' ' ' ' ' '' ' '
'X',
* 'PRICEPC' 'Price per PC in DOC CURR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' 'X' ,
* 'PRICEPCINR' 'Price per PC in INR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' ' ',
'WAERK' 'Inv Currency' '10' 'IT_HEAD' ' ' '' ' ' ' ' ' ',
'BEDINR' 'BED(INR)' '13' 'IT_HEAD' ' ' '' ' ' ' ' 'X',
'ECESSINR' 'Excise Ecess(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' '
' 'X',
'SHECESSINR' 'Excise SCess(INR)' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',
'TOTEXCISE' 'Total Exc Duty-INR' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',
'VATCST' 'VAT or CST' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',
'TAXVAL' 'Tax(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',
'JVSD' 'Serv Tax-Basic-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',
'JEC3' 'Serv Tax Ecess-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',
'JHC3' 'Serv Tax SHcess-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',
'TOTSERVTAX' 'Total Serv Tax-INR' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',
* 'VALINR' 'Net Value(INR)' '10' 'IT_HEAD' ' ' '' ' ' ' ',
'TOTDUTYTAX' 'Total duty+ Tax-INR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' 'X',
'TOTAL' 'GRInval-Dut+Tax-INR' '15' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',
* 'BILL_VALUE' 'BILL VALUE(INR)' '15' 'IT_HEAD' ' ' ' ' '
' ' ' 'X',
'BELNR' 'Accounting Doc #' '10' 'IT_HEAD' ' ' '' 'X' 'C60'
' ',
'AUGBL' 'Clearing Status' '10' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',
'ZTCSINR' 'TCS Value' '10' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',
'BTGEW' 'Gross Weight(Kg)' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',
'NTGEW' 'Net Weight(Kg)' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',
'XBLNR' 'GST Invoice' '18' 'IT_HEAD' ' ' '' ' ' ' ' ' ',
'CGST' 'CGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',
'SGST' 'SGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',
'IGST' 'IGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',
'GTCS' 'TCS(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X'.
ENDFORM.
FORM display_header .
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMANDS'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_head[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM gettax_header .
CLEAR : zfkart.
* SELECT SINGLE fkart FROM vbrk INTO zfkart WHERE vbeln = it_vbrk-vbeln.
zfkart = it_vbrk-fkart .
ENDLOOP.
ENDLOOP.
""""""ADDD BY MUBASHIR 2 AUG 2023
* IF sy-subrc = 0. """"""comm BY
MUBASHIR 5 AUG 2023
* ENDIF. """"""comm BY
MUBASHIR 5 AUG 2023
CLEAR : zcr00.
ENDLOOP.
IF sy-subrc = 0.
it_head-pr00 = - ( zcr00 ).
ELSE.
it_head-pr00 = - ( it_head-pr00 ).
ENDIF.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
LOOP AT it_konv WHERE knumv = it_vbrk-knumv
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
************************ADDING CODE**************************************
*************************************************************************
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
***********************************CHANGE OF CODE*********************
**********************************************************************
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
* CLEAR IT_KONV.
* ENDIF.
CLEAR it_konv.
** KPOSN = IT_VBRP-POSNR
**************************ADDING A CODE********************************
************************************************************************
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
it_head-ztrainr = it_head-ztra * it_vbrk-kurrf. "Transportation
Charges in INR
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
* KPOSN = IT_VBRP-POSNR
* IF SY-SUBRC = 0.
it_head-taxval = it_konv-kwert + it_head-taxval.
ENDLOOP.
* CLEAR IT_KONV.
* ENDIF.
IF sy-subrc = 0.
it_head-vatcst = 'CST'.
ENDIF.
* ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
CLEAR it_konv.
ENDLOOP.
IF sy-subrc = 0.
ENDIF.
it_head-cgst = - ( it_head-cgst ).
it_head-sgst = - ( it_head-sgst ).
it_head-igst = - ( it_head-igst ).
ENDIF.
CLEAR : zfkart.
ENDFORM.