57F4 - for SC vendor
Dear Gurus,
PO created for components to main vendor with SC vendor as delivery address.MIGO done.
I created 57F4 challan for 101-O stock wrt MIGO document .(challan-no:001)
Now when I reciveing the SemiFinshed products from SC vendor, while doing refering the challan no:001, System giving error. : 'Challan 001 not valid, Material doc having diff.vendor.'
If I display that 001 challan, the vendor is 'Main vendor' not 'SC vendor'.
Please guide me how to get this solve..
regards
Ram
Hi Ramu,
I understand that following is ur scenario
U have placed a PO on vendor-A for material 123. This material has to be delivered by vendor-a at Vendor-b. This vendor-b u have given as the delivery address and marked it as SC vendor. You have done MIGO with ref to PO on vendor-a and created a SC challan with ref to this material document
Is it right?
If that is the case, please check ur configuration of movement type groups in excise configuration. You should include movement type 101-"o" in the movement group for "Issues". This u can do in L.G. ---> TAx on goods movement ->India>Business Transactions-> Subcontracing----> Maintain movement type groups
Here u have to include movement type 101-"o" in group "0001". Also u delete movement type 101 from 0002 group
Hope this resolves ur problem
award points if found useful
Similar Messages
-
Report to find open items and close items for given vendor
Hi All,
What are the steps needed to write a REPORT to find out
open and close items for a given vendor.
Which are the fields i'll have to take and what are the comparisons i'll have to make.
I know,
BSIK is for open Vendor &
BSAK for closed Vendors..
what are the conditions i'll have to check.
Thanks in Advance..
Pradeep AlexHi Pradeep,
This report I developed is definitely useful to you.
*& Report ZFI_PROV_IT_VENDOR
REPORT ZFI_VENDOR.
TYPE-POOLS: slis.
tables: BKPF,
BSEG,
bsik,
bsak,
bsid,
bsad,
lfa1,
t005u, "Region Description
J_1IMOVEND.
TYPES: BEGIN OF ty_bkpf,
bukrs type bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr type bkpf-gjahr,
blart TYPE bkpf-blart,
budat TYPE bkpf-budat,
END OF ty_bkpf.
types: begin of ty_J_1IMOVEND,
lifnr type lfa1-lifnr,
J_1IPANNO type J_1IMOVEND-J_1IPANNO,
J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
J_1ISERN type J_1IMOVEND-J_1ISERN,
end of ty_J_1IMOVEND.
TYPES: BEGIN OF ty_bseg,
belnr TYPE bseg-belnr,
gjahr type bseg-gjahr,
bschl TYPE bseg-bschl,
umskz type bseg-umskz,
shkzg type bseg-shkzg,
wrbtr TYPE bseg-wrbtr,
hkont type bseg-hkont,
lifnr TYPE bseg-lifnr,
END OF ty_bseg.
types: begin of ty_t005u,
bland type t005u-bland,
bezei type t005u-bezei,
end of ty_t005u.
types: begin of ty_lfa1,
lifnr type lfa1-lifnr,
name1 type lfa1-name1, "35
ort01 type lfa1-ort01, "35
ort02 type lfa1-ort02, "35
pfach type lfa1-pfach, "10
pstlz type lfa1-pstlz, "10
regio type lfa1-regio, "3
stras type lfa1-stras, "35
ktokk type lfa1-ktokk,
telf1 type lfa1-telf1, "16
telf2 type lfa1-telf2, "16
end of ty_lfa1.
types: begin of ty_bsik,
bukrs type bsik-bukrs,
lifnr type bsik-lifnr,
augdt type bsik-augdt,
augbl type bsik-augbl,
belnr type bsik-belnr,
budat type bsik-budat,
blart type bsik-blart,
shkzg type bsik-shkzg,
wrbtr type bsik-wrbtr,
end of ty_bsik.
types: begin of ty_bsid,
bukrs type bsid-bukrs,
lifnr type bsid-kunnr,
augdt type bsid-augdt,
augbl type bsid-augbl,
belnr type bsid-belnr,
budat type bsid-budat,
blart type bsid-blart,
shkzg type bsid-shkzg,
wrbtr type bsid-wrbtr,
end of ty_bsid.
types: begin of ty_out2,
lifnr type bsik-lifnr,
wrbtr type bsik-wrbtr,
end of ty_out2.
types: begin of ty_out,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
addr(162) type c,
J_1IPANNO type J_1IMOVEND-J_1IPANNO,
J_1ICSTNO type J_1IMOVEND-J_1ICSTNO,
J_1ISERN type J_1IMOVEND-J_1ISERN,
opbal type bseg-wrbtr,
purch type bseg-wrbtr,
PAYM type bseg-wrbtr,
grdeb type bseg-wrbtr,
othdeb type bseg-wrbtr,
othcre type bseg-wrbtr,
tds type bseg-wrbtr,
bal type bseg-wrbtr,
blart type bkpf-blart,
bschl type bseg-bschl,
end of ty_out.
types: begin of ty_bsegtemp,
lifnr TYPE bseg-lifnr,
end of ty_bsegtemp.
types: begin of ty_bsegnew,
wrbtr TYPE bseg-wrbtr,
lifnr TYPE bseg-lifnr,
end of ty_bsegnew.
data: it_bsik type table of ty_bsik with header line,
it_bsid type table of ty_bsid with header line,
it_bsak type table of ty_bsik with header line,
it_out2 type table of ty_out2 with header line,
it_out3 type table of ty_out2 with header line.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
it_listheader TYPE slis_t_listheader,
it_alvevent TYPE slis_t_event,
gt_events TYPE slis_t_event WITH HEADER LINE.
DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA : wa_fieldcat TYPE slis_fieldcat_alv,
wa_listheader TYPE slis_listheader,
wa_alvevent TYPE slis_alv_event.
DATA: WA_SORT TYPE SLIS_SORTINFO_ALV.
DATA: ls_line TYPE slis_listheader.
DATA : g_repid LIKE sy-repid, " Program ID
g_layout TYPE slis_layout_alv. " Layout Workarea
DEFINE m_fieldcat.
wa_fieldcat-col_pos = &1. " Fieldcat column postion
wa_fieldcat-fieldname = &2. " Field name
wa_fieldcat-DO_SUM = &3.
wa_fieldcat-seltext_m = &4. " Column Text
wa_fieldcat-outputlen = &5.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
DATA: wa_lfa1 TYPE ty_lfa1,
wa_bkpf TYPE ty_bkpf,
wa_bkpf1 type ty_bkpf,
wa_bsegtemp type ty_bsegtemp,
wa_bsegnew type ty_bsegnew,
wa_bsegnew1 type ty_bsegnew,
wa_J_1IMOVEND type ty_J_1IMOVEND,
wa_t005u type ty_t005u,
wa_bseg TYPE ty_bseg,
wa_out TYPE ty_out.
DATA: gt_out TYPE STANDARD TABLE OF ty_out,
gt_out1 TYPE STANDARD TABLE OF ty_out,
gt_lfa1 TYPE STANDARD TABLE OF ty_lfa1,
gt_bsegtemp type standard table of ty_bsegtemp with header line,
gt_bsegnew type standard table of ty_bsegnew with header line,
gt_bsegnew1 type standard table of ty_bsegnew with header line,
gt_J_1IMOVEND type standard table of ty_J_1IMOVEND,
gt_bkpf1 TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE,
gt_t005u type standard table of ty_t005u,
gt_bseg TYPE STANDARD TABLE OF ty_bseg WITH HEADER LINE,
gt_bkpf TYPE STANDARD TABLE OF ty_bkpf WITH HEADER LINE.
selection-screen begin of block b1 with frame title text-001.
select-options: s_budat for bkpf-budat obligatory,
s_ktokk for lfa1-ktokk obligatory.
s_wrbtr for bseg-wrbtr.
parameters: p_bukrs type bkpf-bukrs obligatory default '1000'.
p_gjahr type bkpf-gjahr obligatory.
p_lifnr type bseg-lifnr obligatory default '300040',
p_ktokk type lfa1-ktokk obligatory default 'Z200'.
selection-screen end of block b1.
START-OF-SELECTION.
PERFORM sub_fetch_data.
PERFORM sub_process_data.
END-OF-SELECTION.
PERFORM sub_build_fieldcat.
PERFORM sub_build_layout.
PERFORM eventtab_build USING gt_events[].
PERFORM comment_build USING it_listheader[].
PERFORM sub_disp_data.
*& Form SUB_BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
FORM sub_build_fieldcat .
sort gt_out by name1.
*DEFINE M_SORT.
ADD 1 TO WA_SORT-SPOS.
WA_SORT-FIELDNAME = &1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = &2.
APPEND WA_SORT TO I_SORT.
END-OF-DEFINITION.
*m_sort 'NAME1' 'X'.
*M_SORT 'ADDR' 'X'.
m_fieldcat 1 'LIFNR' ' ' text-026 10.
m_fieldcat 2 'NAME1' ' ' text-006 35.
m_fieldcat 3 'ADDR' ' ' text-007 162.
m_fieldcat 4 'J_1IPANNO' '' text-008 40.
m_fieldcat 5 'J_1ICSTNO' '' text-009 40.
m_fieldcat 6 'J_1ISERN' '' text-010 40.
m_fieldcat 7 'OPBAL' '' text-011 18.
m_fieldcat 8 'PURCH' '' text-012 18.
m_fieldcat 9 'PAYM' '' text-013 18.
m_fieldcat 10 'GRDEB' '' text-014 18.
m_fieldcat 11 'OTHDEB' '' text-020 18.
m_fieldcat 12 'OTHCRE' '' text-021 18.
m_fieldcat 13 'BAL' '' text-023 18.
m_fieldcat 14 'TDS' '' text-022 18.
ENDFORM. " SUB_BUILD_FIELDCAT
*& Form SUB_BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM sub_build_layout .
g_layout-zebra = 'X'.
g_layout-colwidth_optimize = 'X'.
ENDFORM. " SUB_BUILD_LAYOUT
*& Form EVENTTAB_BUILD
text
-->P_GT_EVENTS[] text
FORM eventtab_build USING gt_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 = gt_events.
READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO gt_events.
ENDIF.
ENDFORM. " EVENTTAB_BUILD
*& Form COMMENT_BUILD
text
-->P_IT_LISTHEADER[] text
FORM comment_build USING p_it_listheader TYPE
slis_t_listheader.
data: v_text(30) type c,
v_datelow(10) type c,
v_datehigh(10) type c,
v_month(2) type c,
v_day(2) type c,
v_year(4) type c.
v_day = s_budat-low+6(2).
v_month = s_budat-low+4(2).
v_year = s_budat-low+0(4).
concatenate v_day '.' v_month '.' v_year into v_datelow.
clear: v_day,v_month,v_year.
v_day = s_budat-high+6(2).
v_month = s_budat-high+4(2).
v_year = s_budat-high+0(4).
concatenate v_day '.' v_month '.' v_year into v_datehigh.
clear: v_day,v_month,v_year.
concatenate 'From' v_datelow 'To' v_datehigh into v_text
separated by space.
clear: v_datelow, v_datehigh.
ls_line-typ = 'H'.
ls_line-info = text-116.
APPEND ls_line TO p_it_listheader.
ls_line-typ = 'S'.
ls_line-key = text-090.
ls_line-info = v_text.
APPEND ls_line TO p_it_listheader.
ENDFORM. " COMMENT_BUILD
*& Form TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. " TOP_OF_PAGE
*& Form SUB_DISP_DATA
text
--> p1 text
<-- p2 text
FORM sub_disp_data .
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
it_fieldcat = it_fieldcat[]
is_layout = g_layout
i_save = 'U'
it_events = gt_events[]
IT_SORT = I_SORT[]
TABLES
t_outtab = gt_out1[].
ENDFORM. " SUB_DISP_DATA
*& Form sub_fetch_data
text
--> p1 text
<-- p2 text
form sub_fetch_data .
select bukrs
belnr
gjahr
blart
budat
from bkpf
into table gt_bkpf
where budat in s_budat
and bukrs = p_bukrs
and gjahr = p_gjahr
and blart in ('KR','KG','KZ','RE','DK','Z1','AB','SA','KA','DZ').
select belnr
gjahr
bschl
umskz
shkzg
wrbtr
hkont
lifnr
from bseg
into table gt_bseg
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and gjahr = gt_bkpf-gjahr
and gjahr = p_gjahr
and bschl in (21,25,29,31,50,39,38,19,35).
and kunnr in gt_
and lifnr = '0000300019'.
select belnr
gjahr
bschl
umskz
shkzg
wrbtr
hkont
kunnr
from bseg
appending table gt_bseg
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and gjahr = gt_bkpf-gjahr
and gjahr = p_gjahr
and bschl in (21,25,29,31,50,39,38,19).
break manukapur.
sort gt_bseg by lifnr bschl.
delete adjacent duplicates from gt_bseg comparing all fields.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
move: wa_bseg-lifnr to wa_bsegtemp-lifnr.
append wa_bsegtemp to gt_bsegtemp.
endif.
endloop.
delete adjacent duplicates from gt_bsegtemp comparing lifnr.
select lifnr
name1
ort01
ort02
pfach
pstlz
regio
stras
ktokk
telf1
telf2
from lfa1
into table gt_lfa1
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr
and ktokk in s_ktokk.
and lifnr = '0000300030'.
select bland
bezei
from t005u
into table gt_t005u
for all entries in gt_lfa1
where bland = gt_lfa1-regio
and land1 = 'IN'
and spras = sy-langu.
select lifnr
J_1IPANNO
J_1ICSTNO
J_1ISERN
from J_1IMOVEND
into table gt_J_1IMOVEND
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr.
*select bukrs
belnr
blart
budat
from bkpf
into table gt_bkpf1
where budat < s_budat-low.
and zfdbt < s_budat-low.
select
wrbtr
lifnr
from bseg
into table gt_bsegnew
for all entries in gt_bkpf
where belnr = gt_bkpf-belnr
and xopvw = 'X' .
and zfbdt < s_budat-low.
select bukrs
lifnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsik
into table it_bsik
for all entries in gt_bseg
where lifnr = gt_bseg-lifnr
and lifnr = '0000300000'
and bukrs = '1000'
and budat <= s_budat-low.
select bukrs
lifnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsak
appending table it_bsik
for all entries in gt_bseg
where bukrs = '1000'
and lifnr = gt_bseg-lifnr
and lifnr = '0000300000'
and budat <= s_budat-low
and augdt > s_budat-low.
select bukrs
kunnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsid
into table it_bsid
for all entries in gt_bseg
where bukrs = '1000'
and kunnr = gt_bseg-lifnr
and kunnr = '0000300000'
and budat <= s_budat-low.
select bukrs
kunnr
augdt
augbl
belnr
budat
blart
shkzg
wrbtr
from bsad
appending table it_bsid
for all entries in gt_bseg
where bukrs = '1000'
and kunnr = gt_bseg-lifnr
and kunnr = '0000300000'
and budat <= s_budat-low
and augdt > s_budat-low.
if it_bsid[] is not initial.
append lines of it_bsid to it_bsik.
endif.
*delete gt_bsegnew where lifnr <> '0000300000'.
*break manukapur.
*sort gt_bsegnew by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*collect wa_bsegnew into gt_bsegnew1.
*endloop.
loop at it_bsik .
it_out2-lifnr = it_bsik-lifnr.
*it_out1-budat = it_bsik-budat.
*it_out1-blart = it_bsik-blart.
if it_bsik-SHKZG = 'H'.
it_out2-wrbtr = it_bsik-wrbtr.
else .
it_out2-wrbtr = it_bsik-wrbtr * -1.
endif.
append it_out2.
clear: it_out2, it_bsik.
*endif.
*clear it1.
endloop.
sort it_out2 by lifnr.
loop at it_out2.
it_out3-lifnr = it_out2-lifnr.
it_out3-wrbtr = it_out2-wrbtr.
collect it_out3.
clear: it_out3, it_out2.
endloop.
endform.
*& Form sub_process_data
text
--> p1 text
<-- p2 text
form sub_process_data .
*sort gt_bsegtemp by lifnr .
sort gt_bseg by lifnr bschl.
sort gt_bsegnew by lifnr.
sort it_out3 by lifnr.
*loop at gt_bsegnew into wa_bsegnew.
*at end of lifnr.
*sum.
*endat.
*endloop.
sort gt_bkpf by blart.
loop at gt_bseg into wa_bseg.
if wa_bseg-lifnr is not initial.
read table gt_lfa1 into wa_lfa1 with key lifnr = wa_bseg-lifnr.
move: wa_lfa1-name1 to wa_out-name1,
wa_lfa1-lifnr to wa_out-lifnr.
read table gt_t005u into wa_t005u with key bland = wa_lfa1-regio.
concatenate wa_lfa1-stras ',' wa_lfa1-ort01 ','
wa_lfa1-ort02 ',' wa_t005u-bezei ','
wa_lfa1-pfach ','
wa_lfa1-pstlz ',' 'Ph:'
wa_lfa1-telf1 ','
wa_lfa1-telf2
into wa_out-addr separated by space.
read table gt_J_1IMOVEND into wa_J_1IMOVEND with key lifnr = wa_bseg-lifnr.
move: wa_J_1IMOVEND-J_1IPANNO to wa_out-J_1IPANNO,
wa_J_1IMOVEND-J_1ICSTNO to wa_out-J_1ICSTNO,
wa_J_1IMOVEND-J_1ISERN to wa_out-J_1ISERN.
read table gt_bkpf into wa_bkpf with key belnr = wa_bseg-belnr.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 31 or
wa_bkpf-blart = 'KR' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-purch = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KR' and wa_bseg-bschl = 50.
*wa_out-tds = wa_out-tds + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-tds = wa_bseg-wrbtr * -1.
endif.
endif.
*wa_out-tds = wa_bseg-wrbtr.
endif.
if wa_bkpf-blart = 'KG' and wa_bseg-bschl = 21.
*wa_out-grdeb = wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'RE' and wa_bseg-bschl = 21.
*wa_out-grdeb = wa_out-grdeb + wa_bseg-wrbtr.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-grdeb = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 25
*or wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29
**and wa_bseg-umskz = 'A'
or wa_bkpf-blart = 'SA' and wa_bseg-bschl = 25.
if wa_bseg-shkzg = 'H'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
*wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
wa_out-paym = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DK' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'SA' and wa_bseg-bschl = 31.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 38.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'DZ' and wa_bseg-bschl = 19
and wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 39
and wa_bseg-umskz = 'G' or
wa_bseg-umskz = 'H' or
wa_bseg-umskz = 'J' or
wa_bseg-umskz = 'L' OR
wa_bseg-umskz = 'A'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'KA' and wa_bseg-bschl = 35.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if ( wa_bkpf-blart = 'KZ' and wa_bseg-bschl = 29 )
and wa_bseg-umskz = 'A' or
wa_bseg-umskz = 'B' or
wa_bseg-umskz = 'I' or
wa_bseg-umskz = 'M' or
wa_bseg-umskz = 'O' or
wa_bseg-umskz = 'V'.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21 .
if wa_bseg-shkzg = 'H'.
wa_out-othcre = wa_bseg-wrbtr.
else.
if wa_bseg-shkzg = 'S'.
wa_out-othcre = wa_bseg-wrbtr * -1.
endif.
endif.
endif.
**if wa_bseg-shkzg = 'H'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr.
**else.
**if wa_bseg-shkzg = 'S'.
***wa_out-purch = wa_out-purch + wa_bseg-wrbtr.
**wa_out-othdeb = wa_bseg-wrbtr * -1.
**endif.
**endif.
**endif.
***if wa_bkpf-blart = 'AB' and wa_bseg-bschl = 27.
wa_out-othdeb = wa_bseg-wrbtr.
***endif.
***if wa_bkpf-blart = 'Z1' and wa_bseg-bschl = 21.
wa_out-othdeb = wa_bseg-wrbtr.
***endif.
read table it_out3 with key lifnr = wa_bseg-lifnr binary search.
on change of wa_bseg-lifnr.
*move: wa_lfa1-name1 to wa_out-name1,
wa_lfa1-lifnr to wa_out-lifnr.
wa_out-opbal = it_out3-wrbtr.
endon.
*if wa_out-opbal is not initial.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
**else.
*wa_out-bal = wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
*endif.
wa_out-bal = wa_out-opbal + wa_out-purch + wa_out-paym + wa_out-grdeb + wa_out-othdeb + wa_out-othcre.
at end of lifnr.
*wa_out-bal = wa_out-opbal + wa_out-purch - wa_out-grdeb - wa_out-othdeb + wa_out-othcre.
append wa_out to gt_out.
*collect wa_out into gt_out.
clear wa_out.
clear it_out3.
clear wa_bsegnew1.
endat.
endif.
clear: wa_bseg, wa_bkpf, wa_J_1IMOVEND.
endloop.
loop at gt_out into wa_out.
collect wa_out into gt_out1.
endloop.
endform. " sub_process_data
Regards,
Santosh Kumar M. -
How to create one primary key for each vendor
Hi all
i am doing IDOC to jdbc scenario
i am triggering idoc from R/3 and the data is going into DB table vendor through XI.
structures are as follows:
sender side: ZVendorIdoc (this is a customized IDOC , if i triger IDOC for multiple vendors then it triggers only 1 idoc with multiple segment )
Receiver side:
DT_testVendor
Table
tblVendor
action UPDATE_INSERT
access 1:unbounded
cVendorName 1
cVendorCode 1
fromdate 1
todate 1
Key1
cVendorName 1
if i trigger idoc for multiple vendors ,for example vendor 2005,2006 and 2010 . then i can see that the only key comes from the very first field (2005) and the whole record for vendor 2005,2006 and 2010 goes into the table with this(2005) as a primary key
now again if i send data for these three vendor 2005, 2006 , 2010, in which record for the vendor 2005 is same and for 2006 and 2010 are different than it takes 2005 as a primary key and it does not update the data in the table.
my requirement is like this: for each vendor there should be one unique key assigned.
for above said example there should come three keys one for each vendor .
could you please help me how to do this???????????Hi,
In Mapping Make the statement is 0-unbounded.For each vendor create a statement.This will solve your problem.
Regards,
Prakasu.M -
Shipment freight cost not posted for 4th vendor after GR
Hello,
I have tested and found that isystem limits the number of vendors in Shipment to 3 only.
It sort all the vendors in the shipment and create the entries for 1st three vendors (after sorting smallest to largest vendor number) and after GR posting it creates the entires in accouting doc for 3 vendors only.
I have 5 stages in the shipment and 5 items in shipment cost doc. If number of vendors are upto 3 it works fine if there are 4 or more vendors are added then it doesnot create the entries for those vendors.
Please suggest.
regards,
JPSHello,
Any idea. -
Multiple APP run's for same vendor
Dear Friends,
I would like to know whether it is possible to do multiple payment proposals for a vendor on same dates.
here is the scenario:
Each business area would like to creat and edit payment proposals for the same dates, for ex: Run date is 1.1.08, next payment date will be 02.01.08 and schedule the actul payment run on say 03.01.08.
The actual payment runs will be processed by different paying coc.ode on 03.1.08
so for a given vendor say we have 2 open items which are due for each business area. I tried giving Business area in free selections .
when I try to create a secong payment proposal system gives me the message saying no payment proposal found for the co.code Message nO.FZ349
Yes it does makes sense to this meesage in the sense system wants to check that no invoice is paid twice by mistake.
But my question is since I am restricting open items by Busines area in the selection parameters itself shouldnt that be considered by system.
Hope I am clear.
Please let me know your inputs on the same.
Points assured for useful replies.
Thanks,
VamsiHi Chandra,
Thanks for your inputs.
When you say that same vendor can be paid more than 1 once in a given day by APP, I belive you meant that once paymnet run has been done we can create another APP process for the same vendor.
Yes I dont see any issues there.
I also have no doubt that we can create multiple payment runs for a given vendor for 2 different co.codes on the same day.
But the issue I have is a case of centralised payment for all regions which are represented by Business areas.
Each region will do business with the same pan india vendor and would like to create thier payment proposals. The payment runs for these proposals will be done by the head office.
while trying to the second payment proposal, thi sis the message:
"Vendor 54 222 is contained in proposal 24.01.2008 SB1; no editing"
Hope I am clear.
Thanks,
Vamsi -
Function module for getting Vendor Address details
Hi,
Im new to this group,and new to ABAP
plz hep me out by solving ABAP Query...
i want to generate a report for getting Vendor Details
like Vendor address,Ph num and Email
input fields are Company code,country key and Account Group.
im Using Smart Forms for this..
but im not getting the Exact Function module to get All Required Details..
regards
Smithathanks for ur quick reply...
SELECT SINGLE LIFNR
FROM LFB1
INTO V_LIFNR
WHERE BUKRS EQ V_BUKRS.
CALL FUNCTION 'VENDOR_READ'
EXPORTING
i_bukrs = V_BUKRS
i_lifnr = V_LIFNR
EXCEPTIONS
NOT_FOUND = 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.
this is the code i have written...
but my problem is there no table in the Function module....
for Example...
CALL FUNCTION 'QPAX_PLMKB_READ_FROM_PLKO'
EXPORTING
i_plnty = 'Q'
i_plnnr = V_PLNNR
I_PLNAL = V_PLNAL
i_sttag = V_DATUV
TABLES
T_PLMKB_TAB = IT_TAB
i want the function modules with tables and proper input... -
Unable to process downpayment request (F-47) for the vendor with the PO
Hi All,
We are not able to process the advance payment request for the vendor 450004398 with the PO 3000086605 due to below mentioned error
" You cannot use this transaction type to post this asset.u201D After getting error we double click that error we got these full information.
The traanction type entered type entered belongs to transaction type group 15, According to the specifications for this transactipn type group,posting with trasnction types belonging to this group are only allowed in specifi asset classes ( for asset classes for asset under construction)
The asset to which you are posting belongs to class group
Above error we are facing, we checked "OAYB" also that asset class in maintained in that transaction code.
Awaiting for your reply
Thanks
Ram
09769004602Hi Ram,
Please check AO90 and OAYB
In AO90 you should assign one Asset GL Account.
for this: go to AO90 select you chart of accounts and double click on acocunt Determination select your asset determination against which asset you are paying down payment and double click on Balance sheet accounts there you need to assign under acquisition account assginment * Acquisition:Down Payment* and Down Payment clearing Account. This is only for AUC.
In OAYB select 15 Down payment and double click on specification of asset class there you need assign your asset class.
Hope this will help you.
Regards,
Schilukuri -
Report for inactive vendors from past 2 years
Hi,
We have a request to create a report for the vendors who are not active for last 2 years. Can anyone please advise me the points I should keep in mind to consider a particular vendor inactive. eg. if a vendor has 0 balance in table LFC1 for last 2 years, will be considered as inactive but, that vendor could have some PO's activity on it in these 2 years, which are not appearing on FI side.
Please also tell me if there is a table to find open and close POs for vendors for last 2 years.
If anyone please advise, the points to keep in mind and important tables to refer for create this report.
Quick response will be appreciated.
Thanks & RegardsHi,
Thanks for your prompt reply, Can you please tell me where is the parameter SALDO0 in report RFKSLD00.
Quick response will be appreciated.
Thanks & Regards -
Balance Confirmation Report for multiple vendors
Hi all,
I have developed report in FI which gives details about opening balance,fiscal year, document number, posting date and amount in the output.In selection screen I am passing single values of fiscal year(GJAHR), vendor(LIFNR) and company code(BUKLRS). This report is working fine for single vendor but now I need to change it for multiple vendors. I tried but not getting desired result in the output.
Following is code for single vendor in selection screen.
SORT t_bsikbsak BY bukrs belnr gjahr buzei.
LOOP AT t_bsikbsak.
t_pre_bal-netpr = t_bsikbsak-dmbtr.
t_pre_bal-sgtxt = 'Opening Balance'.
IF t_bsikbsak-shkzg EQ 'H'.
t_pre_bal-netpr = t_pre_bal-netpr * -1.
ENDIF.
COLLECT t_pre_bal.
ENDLOOP.
LOOP AT t_pre_bal.
itab-netpr = t_pre_bal-netpr.
itab-sgtxt = t_pre_bal-sgtxt.
APPEND itab.
ENDLOOP.
SORT t_bseg BY bukrs belnr gjahr buzei.
CLEAR itab.
LOOP AT t_bseg.
ON CHANGE OF t_bseg-bukrs OR t_bseg-belnr OR t_bseg-gjahr.
READ TABLE t_bkpf WITH KEY bukrs = t_bseg-bukrs
belnr = t_bseg-belnr
gjahr = t_bseg-gjahr.
IF sy-subrc IS INITIAL.
itab-budat = t_bkpf-budat.
itab-belnr = t_bkpf-belnr.
itab-gjahr = t_bkpf-gjahr.
ENDIF.
ENDON.
IF t_bseg-koart = 'K' AND t_bseg-lifnr = s_lifnr.
itab-sgtxt = t_bseg-sgtxt.
READ TABLE t_bsak WITH KEY bukrs = t_bseg-bukrs
belnr = t_bseg-belnr
gjahr = t_bseg-gjahr.
IF t_bseg-shkzg EQ 'H'.
t_bseg-dmbtr = t_bseg-dmbtr * -1.
ENDIF.
itab-netpr = itab-netpr + t_bseg-dmbtr.
ELSEIF t_bseg-hkont = '0044100040'. " G/L for INTEREST EXPENSES
itab-inamt = t_bseg-dmbtr.
ELSEIF t_bseg-hkont = '0012300060'. " G/L for TDS ON INTEREST
itab-tdamt = t_bseg-dmbtr.
ENDIF.
AT END OF bukrs.
append_flag = 'X'.
ENDAT.
AT END OF belnr.
append_flag = 'X'.
ENDAT.
AT END OF gjahr.
append_flag = 'X'.
ENDAT.
IF append_flag = 'X'.
APPEND itab.
CLEAR itab.
CLEAR : append_flag.
ENDIF.
ENDLOOP.
Closing Balance
LOOP AT itab.
t_temp-netpr = itab-netpr.
t_temp-sgtxt = 'Closing Balance'.
COLLECT t_temp.
ENDLOOP.
CLEAR itab.
LOOP AT t_temp.
itab-netpr = t_temp-netpr.
itab-sgtxt = 'Closing Balance'.
APPEND itab.
ENDLOOP.
Kindly provide some input how to do it for multiple vendors in same code otherwise provide some suggestions for new code.
Thanks in Advance.waiting for response.
Thanks & Regards,
Harshada PatilHi,
Thanks for quick response.Following is the structure of internal tables which I am using in this program.
TYPES : BEGIN OF ty_bsikbsak ,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
zuonr TYPE bsik-zuonr,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
END OF ty_bsikbsak.
TYPES : BEGIN OF ty_bkpf ,
bukrs TYPE bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr TYPE bkpf-gjahr,
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
stblg TYPE bkpf-stblg,
stjah TYPE bkpf-stjah,
END OF ty_bkpf.
TYPES : BEGIN OF ty_bseg ,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
buzei TYPE bseg-buzei,
koart TYPE bseg-koart,
shkzg TYPE bseg-shkzg,
dmbtr TYPE bseg-dmbtr,
sgtxt TYPE bseg-sgtxt,
hkont TYPE bseg-hkont,
lifnr TYPE bseg-lifnr,
END OF ty_bseg.
DATA : t_bsik TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
DATA : t_bsak TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
DATA : t_bsikbsak TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
DATA : t_bkpf TYPE TABLE OF ty_bkpf WITH HEADER LINE.
DATA : t_bkpf2 TYPE TABLE OF ty_bkpf WITH HEADER LINE.
DATA : wa_bkpf TYPE ty_bkpf .
DATA : t_bseg TYPE TABLE OF ty_bseg WITH HEADER LINE.
DATA: BEGIN OF t_pre_bal OCCURS 0,
netpr TYPE bseg-dmbtr,
sgtxt TYPE bseg-sgtxt,
lifnr TYPE bseg-lifnr,
END OF t_pre_bal.
DATA: t_pre_bal1 LIKE t_pre_bal.
DATA: BEGIN OF t_temp OCCURS 0,
netpr TYPE bseg-dmbtr,
sgtxt TYPE bseg-sgtxt,
lifnr TYPE bseg-lifnr,
END OF t_temp.
DATA: BEGIN OF itab OCCURS 0,
gjahr LIKE bsik-gjahr,
belnr LIKE bsik-belnr,
budat LIKE bkpf-budat,
sgtxt LIKE bseg-sgtxt,
lifnr LIKE lfa1-lifnr,
netpr LIKE bseg-dmbtr, " Net Amount
inamt LIKE bseg-dmbtr, " Interest Amount
tdamt LIKE bseg-dmbtr, " TDS Amount
END OF itab.
RANGES: r_budat FOR bkpf-budat.
I have Included vendor(LIFNR) in all these structures.Now I am using three internal tables to hold opening balance, Closing balance and line item accounting documents from bseg table respectively.here, I need to collect all these three internal tables into one internal table according to vendor(LIFNR) with it's opening balance, accounting documents and closing balance. can anyone guide me through this so that I can collect all these three internal tables into single one.
Thanks & Regards,
Harshada Patil
Edited by: Harshada.up on Feb 15, 2011 9:33 AM -
I Need Interactive Report for displaying vendor information. Based on the s
Interactive Report for displaying vendor information. Based on the selection made by the corresponding Vendor Bank Details are listed such that the line selected in the basic list was visible along with the secondary list.
hi
Hi
Use the Table LFA1 and LFB1 in the basic list
and LFBK table details in the secondary list
see the sample code related to customer Sales orders
modify it with the Vendor tables
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
<b>Vendor performance report</b>
See this sample code
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
*--- ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
*--- Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
*--- Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP[] = T_CDPOS[].
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP[] = T_EKKO[].
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP[] = T_DATAELE[].
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
<b>Reward if usefull</b> -
Opening & closing balance for Multiple Vendors
Hi Friends,
I have an issue. This is my code.
*& Report ZVEN_OPEN_CLOSE_BAL
REPORT ZVEN_OPEN_CLOSE_BAL.
*& Report ZVEN_OPEN_CLOSE_BAL
TABLES:lfa1,bsik.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
blart TYPE bsik-blart,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
* bal TYPE char30,
sgtxt TYPE bsik-sgtxt,
END OF ty_bsik.
TYPES: BEGIN OF ty_bsak,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsak-lifnr,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsik-dmbtr,
* shkzg1 TYPE bsak-shkzg,
sgtxt TYPE bsak-sgtxt,
END OF ty_bsak.
TYPES: BEGIN OF ty_lfc1,
lifnr TYPE lfc1-lifnr,
bukrs TYPE lfc1-bukrs,
gjahr TYPE lfc1-gjahr,
umsav TYPE lfc1-umsav,
END OF ty_lfc1.
TYPES: BEGIN OF ty_all,
lifnr TYPE bsik-lifnr,
zuonr TYPE bsik-zuonr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
hkont TYPE bseg-hkont,
blart TYPE bsik-blart,
ltext TYPE text20,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
opbal TYPE p DECIMALS 2,
deb TYPE p DECIMALS 2 ,"bsik-dmbtr,
cre TYPE p DECIMALS 2,"bsik-dmbtr,
bal TYPE p DECIMALS 2,
augbl TYPE bsik-augbl,
sgtxt TYPE bsik-sgtxt,
END OF ty_all.
TYPE-POOLS: slis.
DATA: t_layout TYPE slis_layout_alv,
s_fieldtab TYPE slis_fieldcat_alv,
t_fieldtab TYPE slis_t_fieldcat_alv,
wa_header TYPE slis_listheader,
it_header TYPE slis_t_listheader.
DATA:it_bsik TYPE TABLE OF ty_bsik,
it_bsak TYPE TABLE OF ty_bsak,
it_all TYPE TABLE OF ty_all,
it_lfc1 TYPE TABLE OF ty_lfc1,
it_t003 TYPE TABLE OF t003t,
wa_bsik TYPE ty_bsik,
wa_bsak TYPE ty_bsak,
wa_all TYPE ty_all,
wa_lfc1 TYPE ty_lfc1,
wa_t003 TYPE t003t.
DATA: gt_fldcat TYPE slis_t_fieldcat_alv,
gs_fldcat TYPE slis_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
gv_save TYPE c VALUE 'X'.
types :BEGIN OF ty_bseg,
BUKRS TYPE BUKRS,
BELNR TYPE BELNR_D,
GJAHR TYPE GJAHR,
BUZEI TYPE BUZEI,
koart type koart,
HKONT TYPE HKONT,
END OF ty_bseg.
DATA: it_bseg type TABLE OF ty_bseg,
wa_bseg type ty_bseg.
data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
s_bukrs FOR bsik-bukrs,
s_budat FOR bsik-budat OBLIGATORY.
PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process_data.
PERFORM display.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
break naidu.
SELECT bukrs
lifnr
augbl
zuonr
gjahr
xblnr
belnr
buzei
blart
bldat
budat
shkzg
dmbtr
sgtxt FROM bsik
INTO TABLE it_bsik
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
SELECT bukrs
lifnr
augbl
zuonr
gjahr
belnr
buzei
budat
bldat
xblnr
blart
shkzg
dmbtr
sgtxt FROM bsak
INTO TABLE it_bsak
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
if it_bsik is INITIAL and it_bsak is INITIAL.
*DATA v_date type budat.
*data :year(4),
* month(2),
* date(2).
* year = s_budat-low+0(4).
* date = s_budat-low+6(2).
* month = s_budat-low+4(2).
* month = month - 01.
*CONCATENATE year month date INTO v_date .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* xblnr
* belnr
* buzei
* blart
* bldat
* budat
* shkzg
* dmbtr
* sgtxt FROM bsik
* INTO TABLE it_bsik
* WHERE lifnr IN s_lifnr AND
* bukrs in s_bukrs and
* budat eq v_date AND
* gjahr = p_gjahr .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* belnr
* buzei
* budat
* bldat
* xblnr
* blart
* shkzg
* dmbtr
* sgtxt FROM bsak
* INTO TABLE it_bsak
* WHERE lifnr IN s_lifnr AND
* bukrs IN s_bukrs AND
* budat eq v_date AND
* gjahr = p_gjahr .
CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
EXPORTING
companycode = s_bukrs-low
vendor = s_lifnr-low
keydate = s_budat-low
* BALANCESPGLI = ' '
* NOTEDITEMS = ' '
* IMPORTING
* RETURN =
TABLES
keybalance = t_balence
endif.
ENDFORM. " GET_DATA
*& Form PROCESS_DATA
* text
* --> p1 text
* <-- p2 text
FORM process_data .
DATA:v_bal TYPE netpr.
LOOP AT it_bsak INTO wa_bsak.
wa_bsik-bukrs = wa_bsak-bukrs.
wa_bsik-lifnr = wa_bsak-lifnr.
wa_bsik-augbl = wa_bsak-augbl.
wa_bsik-zuonr = wa_bsak-zuonr.
wa_bsik-gjahr = wa_bsak-gjahr.
wa_bsik-belnr = wa_bsak-belnr.
wa_bsik-buzei = wa_bsak-buzei.
wa_bsik-budat = wa_bsak-budat.
wa_bsik-bldat = wa_bsak-bldat.
wa_bsik-xblnr = wa_bsak-xblnr.
wa_bsik-blart = wa_bsak-blart.
wa_bsik-shkzg = wa_bsak-shkzg.
wa_bsik-dmbtr = wa_bsak-dmbtr.
wa_bsik-sgtxt = wa_bsak-sgtxt .
APPEND wa_bsik TO it_bsik.
CLEAR:wa_bsik.
ENDLOOP.
IF it_bsik IS NOT INITIAL .
SELECT lifnr bukrs gjahr umsav
FROM lfc1
INTO TABLE it_lfc1 FOR ALL ENTRIES IN it_bsik
WHERE
lifnr EQ it_bsik-lifnr AND
bukrs EQ it_bsik-bukrs AND
gjahr EQ it_bsik-gjahr.
SELECT * FROM t003t
INTO TABLE it_t003
FOR ALL ENTRIES IN it_bsik
WHERE blart = it_bsik-blart AND
spras = 'EN'.
*&Bindu........................................
select bukrs "Company Code
belnr "Document Number
gjahr "Fiscal Year
buzei "Line item
koart "Account Type
hkont "General Ledger Account
from bseg into TABLE it_bseg
FOR ALL ENTRIES IN it_bsik
WHERE belnr eq it_bsik-belnr and
bukrs in s_bukrs and
gjahr eq p_gjahr and
BUZEI eq it_bsik-buzei.
ENDIF.
SORT it_bsik BY lifnr.
DATA:c,
l_dmbtr type p DECIMALS 2.
DATA:v1(15),
v2(3).
DATA:v_umsav(18).
DATA v_fbal TYPE umsav.
LOOP AT it_bsik INTO wa_bsik.
READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
bukrs = wa_bsik-bukrs
gjahr = wa_bsik-gjahr.
if sy-subrc = 0.
at FIRST.
v_umsav = wa_lfc1-umsav.
SPLIT v_umsav at '.' INTO v1 v2.
wa_all-LTEXT = 'Opening Balance'.
IF v2+2(1) = '-'.
wa_all-cre = wa_lfc1-umsav.
ELSE.
wa_all-deb = wa_lfc1-umsav.
ENDIF.
wa_all-bal = wa_lfc1-umsav.
v_fbal = wa_all-bal.
APPEND wa_all to it_all.
CLEAR wa_all.
endat.
endif.
AT NEW lifnr.
c = 0.
ENDAT.
wa_all-lifnr = wa_bsik-lifnr.
wa_all-zuonr = wa_bsik-zuonr.
wa_all-xblnr = wa_bsik-xblnr.
wa_all-belnr = wa_bsik-belnr.
wa_all-blart = wa_bsik-blart.
wa_all-bldat = wa_bsik-bldat.
wa_all-budat = wa_bsik-budat.
*&Bindu............
READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
buzei = wa_bsik-buzei."Bindu.......
if sy-subrc = 0.
wa_all-hkont = wa_bseg-hkont. "Bindu.....
endif.
IF wa_bsik-shkzg = 'S'.
wa_all-deb = wa_bsik-dmbtr.
ELSEIF wa_bsik-shkzg = 'H'.
wa_all-cre = wa_bsik-dmbtr.
ENDIF.
READ TABLE it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
IF sy-subrc = 0.
wa_all-ltext = wa_t003-ltext.
ENDIF.
* READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
* bukrs = wa_bsik-bukrs
* gjahr = wa_bsik-gjahr.
*break naidu.
IF sy-subrc = 0.
* IF c = 0.
* clear:l_dmbtr.
* wa_all-opbal = wa_lfc1-umsav.
* c = c + 1.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
l_dmbtr = wa_all-bal.
* ELSE.
* wa_all-bal = l_dmbtr + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
* ENDIF.
ENDIF.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
if v_fbal is NOT INITIAL.
wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
CLEAR:v_fbal.
else.
wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
ENDIF.
wa_all-augbl = wa_bsik-augbl.
wa_all-sgtxt = wa_bsik-sgtxt.
*v_balance = wa_all-bal.
APPEND wa_all TO it_all.
v_bal = wa_all-bal.
CLEAR :wa_all.
*& Closing Balence.................
at last.
wa_all-LTEXT = 'Closing Balance'.
* IF .
wa_all-BAL = v_bal.
APPEND wa_all to it_all.
CLEAR wa_all.
* ENDIF.
endat.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM display .
DATA : ls_layout TYPE slis_layout_alv.
PERFORM create_fldcat.
ls_layout-expand_all = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-expand_fieldname = 'X'.
ls_layout-zebra = 'X'.
if it_all is initial .
wa_all-LTEXT = 'Opening Balance'.
wa_all-bal = t_balence-LC_BAL.
wa_all-lifnr = s_lifnr-low.
APPEND wa_all to it_all.
ENDIF.
IF it_all IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ls_layout
it_fieldcat = gt_fldcat
i_save = 'X'
TABLES
t_outtab = it_all[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " DISPLAY
*& Form CREATE_FLDCAT
* text
* --> p1 text
* <-- p2 text
FORM create_fldcat .
PERFORM : append_val USING 'LIFNR' 'IT_ALL' 'vendor' '' '' 'X' ' '.
PERFORM : append_val USING 'HKONT' 'IT_ALL' 'G/L Acc' '' '' 'X' ' '.
PERFORM : append_val USING 'ZUONR' 'IT_ALL' 'account' '' '' '' ''.
PERFORM : append_val USING 'XBLNR' 'IT_ALL' 'number' '' '' 'X' ''.
PERFORM : append_val USING 'BELNR' 'IT_ALL' 'ref no' '' '' 'X' ''.
PERFORM : append_val USING 'BLART' 'IT_ALL' 'type' '' '' 'X' ''.
PERFORM : append_val USING 'LTEXT' 'IT_ALL' 'type text' '' '' 'X' ''.
PERFORM : append_val USING 'BLDAT' 'IT_ALL' 'doc date' '' '' 'X' ''.
PERFORM : append_val USING 'BUDAT' 'IT_ALL' 'post date' '' '' 'X' ''.
PERFORM : append_val USING 'OPBAL' 'IT_ALL' 'op balance' '' '' '' ''.
PERFORM : append_val USING 'DEB' 'IT_ALL' 'debit' '' '' '' ''.
PERFORM : append_val USING 'CRE' 'IT_ALL' 'credit' '' '' '' ''.
PERFORM : append_val USING 'BAL' 'IT_ALL' 'balance' '' '' '' ''.
PERFORM : append_val USING 'AUGBL' 'IT_ALL' 'clr doc' '' '' 'X' ''.
PERFORM : append_val USING 'SGTXT' 'IT_ALL' 'text ' '' '' 'X' ''.
ENDFORM. " CREATE_FLDCAT
*& Form APPEND_VAL
* text
* -->P_0578 text
* -->P_0579 text
* -->P_TEXT_010 text
* -->P_0581 text
* -->P_0582 text
* -->P_0583 text
FORM append_val USING p_a
p_b
p_c
p_d
p_e
p_f
p_g.
CLEAR gs_fldcat.
gs_fldcat-fieldname = p_a.
gs_fldcat-tabname = p_b.
gs_fldcat-seltext_m = p_c.
gs_fldcat-qfieldname = p_d.
gs_fldcat-datatype = p_e.
gs_fldcat-no_zero = p_f.
gs_fldcat-do_sum = p_g.
APPEND gs_fldcat TO gt_fldcat.
ENDFORM. " APPEND_VAL
This is working for single vendor.
Now my problem is Opening & closing balance should be displayed for multiple vendors.
Please suggest me.
Thanks in advance.Hi Friends,
I have an issue. This is my code.
*& Report ZVEN_OPEN_CLOSE_BAL
REPORT ZVEN_OPEN_CLOSE_BAL.
*& Report ZVEN_OPEN_CLOSE_BAL
TABLES:lfa1,bsik.
TYPES: BEGIN OF ty_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
blart TYPE bsik-blart,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
shkzg TYPE bsik-shkzg,
dmbtr TYPE bsik-dmbtr,
* bal TYPE char30,
sgtxt TYPE bsik-sgtxt,
END OF ty_bsik.
TYPES: BEGIN OF ty_bsak,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsak-lifnr,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsik-dmbtr,
* shkzg1 TYPE bsak-shkzg,
sgtxt TYPE bsak-sgtxt,
END OF ty_bsak.
TYPES: BEGIN OF ty_lfc1,
lifnr TYPE lfc1-lifnr,
bukrs TYPE lfc1-bukrs,
gjahr TYPE lfc1-gjahr,
umsav TYPE lfc1-umsav,
END OF ty_lfc1.
TYPES: BEGIN OF ty_all,
lifnr TYPE bsik-lifnr,
zuonr TYPE bsik-zuonr,
xblnr TYPE bsik-xblnr,
belnr TYPE bsik-belnr,
hkont TYPE bseg-hkont,
blart TYPE bsik-blart,
ltext TYPE text20,
bldat TYPE bsik-bldat,
budat TYPE bsik-budat,
opbal TYPE p DECIMALS 2,
deb TYPE p DECIMALS 2 ,"bsik-dmbtr,
cre TYPE p DECIMALS 2,"bsik-dmbtr,
bal TYPE p DECIMALS 2,
augbl TYPE bsik-augbl,
sgtxt TYPE bsik-sgtxt,
END OF ty_all.
TYPE-POOLS: slis.
DATA: t_layout TYPE slis_layout_alv,
s_fieldtab TYPE slis_fieldcat_alv,
t_fieldtab TYPE slis_t_fieldcat_alv,
wa_header TYPE slis_listheader,
it_header TYPE slis_t_listheader.
DATA:it_bsik TYPE TABLE OF ty_bsik,
it_bsak TYPE TABLE OF ty_bsak,
it_all TYPE TABLE OF ty_all,
it_lfc1 TYPE TABLE OF ty_lfc1,
it_t003 TYPE TABLE OF t003t,
wa_bsik TYPE ty_bsik,
wa_bsak TYPE ty_bsak,
wa_all TYPE ty_all,
wa_lfc1 TYPE ty_lfc1,
wa_t003 TYPE t003t.
DATA: gt_fldcat TYPE slis_t_fieldcat_alv,
gs_fldcat TYPE slis_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
gv_save TYPE c VALUE 'X'.
types :BEGIN OF ty_bseg,
BUKRS TYPE BUKRS,
BELNR TYPE BELNR_D,
GJAHR TYPE GJAHR,
BUZEI TYPE BUZEI,
koart type koart,
HKONT TYPE HKONT,
END OF ty_bseg.
DATA: it_bseg type TABLE OF ty_bseg,
wa_bseg type ty_bseg.
data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
s_bukrs FOR bsik-bukrs,
s_budat FOR bsik-budat OBLIGATORY.
PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process_data.
PERFORM display.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM get_data .
break naidu.
SELECT bukrs
lifnr
augbl
zuonr
gjahr
xblnr
belnr
buzei
blart
bldat
budat
shkzg
dmbtr
sgtxt FROM bsik
INTO TABLE it_bsik
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
SELECT bukrs
lifnr
augbl
zuonr
gjahr
belnr
buzei
budat
bldat
xblnr
blart
shkzg
dmbtr
sgtxt FROM bsak
INTO TABLE it_bsak
WHERE lifnr IN s_lifnr AND
bukrs IN s_bukrs AND
budat IN s_budat AND
gjahr = p_gjahr .
if it_bsik is INITIAL and it_bsak is INITIAL.
*DATA v_date type budat.
*data :year(4),
* month(2),
* date(2).
* year = s_budat-low+0(4).
* date = s_budat-low+6(2).
* month = s_budat-low+4(2).
* month = month - 01.
*CONCATENATE year month date INTO v_date .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* xblnr
* belnr
* buzei
* blart
* bldat
* budat
* shkzg
* dmbtr
* sgtxt FROM bsik
* INTO TABLE it_bsik
* WHERE lifnr IN s_lifnr AND
* bukrs in s_bukrs and
* budat eq v_date AND
* gjahr = p_gjahr .
* SELECT bukrs
* lifnr
* augbl
* zuonr
* gjahr
* belnr
* buzei
* budat
* bldat
* xblnr
* blart
* shkzg
* dmbtr
* sgtxt FROM bsak
* INTO TABLE it_bsak
* WHERE lifnr IN s_lifnr AND
* bukrs IN s_bukrs AND
* budat eq v_date AND
* gjahr = p_gjahr .
CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
EXPORTING
companycode = s_bukrs-low
vendor = s_lifnr-low
keydate = s_budat-low
* BALANCESPGLI = ' '
* NOTEDITEMS = ' '
* IMPORTING
* RETURN =
TABLES
keybalance = t_balence
endif.
ENDFORM. " GET_DATA
*& Form PROCESS_DATA
* text
* --> p1 text
* <-- p2 text
FORM process_data .
DATA:v_bal TYPE netpr.
LOOP AT it_bsak INTO wa_bsak.
wa_bsik-bukrs = wa_bsak-bukrs.
wa_bsik-lifnr = wa_bsak-lifnr.
wa_bsik-augbl = wa_bsak-augbl.
wa_bsik-zuonr = wa_bsak-zuonr.
wa_bsik-gjahr = wa_bsak-gjahr.
wa_bsik-belnr = wa_bsak-belnr.
wa_bsik-buzei = wa_bsak-buzei.
wa_bsik-budat = wa_bsak-budat.
wa_bsik-bldat = wa_bsak-bldat.
wa_bsik-xblnr = wa_bsak-xblnr.
wa_bsik-blart = wa_bsak-blart.
wa_bsik-shkzg = wa_bsak-shkzg.
wa_bsik-dmbtr = wa_bsak-dmbtr.
wa_bsik-sgtxt = wa_bsak-sgtxt .
APPEND wa_bsik TO it_bsik.
CLEAR:wa_bsik.
ENDLOOP.
IF it_bsik IS NOT INITIAL .
SELECT lifnr bukrs gjahr umsav
FROM lfc1
INTO TABLE it_lfc1 FOR ALL ENTRIES IN it_bsik
WHERE
lifnr EQ it_bsik-lifnr AND
bukrs EQ it_bsik-bukrs AND
gjahr EQ it_bsik-gjahr.
SELECT * FROM t003t
INTO TABLE it_t003
FOR ALL ENTRIES IN it_bsik
WHERE blart = it_bsik-blart AND
spras = 'EN'.
*&Bindu........................................
select bukrs "Company Code
belnr "Document Number
gjahr "Fiscal Year
buzei "Line item
koart "Account Type
hkont "General Ledger Account
from bseg into TABLE it_bseg
FOR ALL ENTRIES IN it_bsik
WHERE belnr eq it_bsik-belnr and
bukrs in s_bukrs and
gjahr eq p_gjahr and
BUZEI eq it_bsik-buzei.
ENDIF.
SORT it_bsik BY lifnr.
DATA:c,
l_dmbtr type p DECIMALS 2.
DATA:v1(15),
v2(3).
DATA:v_umsav(18).
DATA v_fbal TYPE umsav.
LOOP AT it_bsik INTO wa_bsik.
READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
bukrs = wa_bsik-bukrs
gjahr = wa_bsik-gjahr.
if sy-subrc = 0.
at FIRST.
v_umsav = wa_lfc1-umsav.
SPLIT v_umsav at '.' INTO v1 v2.
wa_all-LTEXT = 'Opening Balance'.
IF v2+2(1) = '-'.
wa_all-cre = wa_lfc1-umsav.
ELSE.
wa_all-deb = wa_lfc1-umsav.
ENDIF.
wa_all-bal = wa_lfc1-umsav.
v_fbal = wa_all-bal.
APPEND wa_all to it_all.
CLEAR wa_all.
endat.
endif.
AT NEW lifnr.
c = 0.
ENDAT.
wa_all-lifnr = wa_bsik-lifnr.
wa_all-zuonr = wa_bsik-zuonr.
wa_all-xblnr = wa_bsik-xblnr.
wa_all-belnr = wa_bsik-belnr.
wa_all-blart = wa_bsik-blart.
wa_all-bldat = wa_bsik-bldat.
wa_all-budat = wa_bsik-budat.
*&Bindu............
READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
buzei = wa_bsik-buzei."Bindu.......
if sy-subrc = 0.
wa_all-hkont = wa_bseg-hkont. "Bindu.....
endif.
IF wa_bsik-shkzg = 'S'.
wa_all-deb = wa_bsik-dmbtr.
ELSEIF wa_bsik-shkzg = 'H'.
wa_all-cre = wa_bsik-dmbtr.
ENDIF.
READ TABLE it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
IF sy-subrc = 0.
wa_all-ltext = wa_t003-ltext.
ENDIF.
* READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
* bukrs = wa_bsik-bukrs
* gjahr = wa_bsik-gjahr.
*break naidu.
IF sy-subrc = 0.
* IF c = 0.
* clear:l_dmbtr.
* wa_all-opbal = wa_lfc1-umsav.
* c = c + 1.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
l_dmbtr = wa_all-bal.
* ELSE.
* wa_all-bal = l_dmbtr + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
* ENDIF.
ENDIF.
* IF wa_bsik-shkzg = 'S'.
* wa_all-bal = wa_all-opbal + wa_bsik-dmbtr.
* ELSEIF wa_bsik-shkzg = 'H'.
* wa_all-bal = wa_all-opbal - wa_bsik-dmbtr.
* ENDIF.
if v_fbal is NOT INITIAL.
wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
CLEAR:v_fbal.
else.
wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
ENDIF.
wa_all-augbl = wa_bsik-augbl.
wa_all-sgtxt = wa_bsik-sgtxt.
*v_balance = wa_all-bal.
APPEND wa_all TO it_all.
v_bal = wa_all-bal.
CLEAR :wa_all.
*& Closing Balence.................
at last.
wa_all-LTEXT = 'Closing Balance'.
* IF .
wa_all-BAL = v_bal.
APPEND wa_all to it_all.
CLEAR wa_all.
* ENDIF.
endat.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM display .
DATA : ls_layout TYPE slis_layout_alv.
PERFORM create_fldcat.
ls_layout-expand_all = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-expand_fieldname = 'X'.
ls_layout-zebra = 'X'.
if it_all is initial .
wa_all-LTEXT = 'Opening Balance'.
wa_all-bal = t_balence-LC_BAL.
wa_all-lifnr = s_lifnr-low.
APPEND wa_all to it_all.
ENDIF.
IF it_all IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ls_layout
it_fieldcat = gt_fldcat
i_save = 'X'
TABLES
t_outtab = it_all[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " DISPLAY
*& Form CREATE_FLDCAT
* text
* --> p1 text
* <-- p2 text
FORM create_fldcat .
PERFORM : append_val USING 'LIFNR' 'IT_ALL' 'vendor' '' '' 'X' ' '.
PERFORM : append_val USING 'HKONT' 'IT_ALL' 'G/L Acc' '' '' 'X' ' '.
PERFORM : append_val USING 'ZUONR' 'IT_ALL' 'account' '' '' '' ''.
PERFORM : append_val USING 'XBLNR' 'IT_ALL' 'number' '' '' 'X' ''.
PERFORM : append_val USING 'BELNR' 'IT_ALL' 'ref no' '' '' 'X' ''.
PERFORM : append_val USING 'BLART' 'IT_ALL' 'type' '' '' 'X' ''.
PERFORM : append_val USING 'LTEXT' 'IT_ALL' 'type text' '' '' 'X' ''.
PERFORM : append_val USING 'BLDAT' 'IT_ALL' 'doc date' '' '' 'X' ''.
PERFORM : append_val USING 'BUDAT' 'IT_ALL' 'post date' '' '' 'X' ''.
PERFORM : append_val USING 'OPBAL' 'IT_ALL' 'op balance' '' '' '' ''.
PERFORM : append_val USING 'DEB' 'IT_ALL' 'debit' '' '' '' ''.
PERFORM : append_val USING 'CRE' 'IT_ALL' 'credit' '' '' '' ''.
PERFORM : append_val USING 'BAL' 'IT_ALL' 'balance' '' '' '' ''.
PERFORM : append_val USING 'AUGBL' 'IT_ALL' 'clr doc' '' '' 'X' ''.
PERFORM : append_val USING 'SGTXT' 'IT_ALL' 'text ' '' '' 'X' ''.
ENDFORM. " CREATE_FLDCAT
*& Form APPEND_VAL
* text
* -->P_0578 text
* -->P_0579 text
* -->P_TEXT_010 text
* -->P_0581 text
* -->P_0582 text
* -->P_0583 text
FORM append_val USING p_a
p_b
p_c
p_d
p_e
p_f
p_g.
CLEAR gs_fldcat.
gs_fldcat-fieldname = p_a.
gs_fldcat-tabname = p_b.
gs_fldcat-seltext_m = p_c.
gs_fldcat-qfieldname = p_d.
gs_fldcat-datatype = p_e.
gs_fldcat-no_zero = p_f.
gs_fldcat-do_sum = p_g.
APPEND gs_fldcat TO gt_fldcat.
ENDFORM. " APPEND_VAL
This is working for single vendor.
Now my problem is Opening & closing balance should be displayed for multiple vendors.
Please suggest me.
Thanks in advance. -
Function Module for FB01 Vendor line items postings in 3.1 Version
Hello all,
Is there any Function Module for FB01 Vendor line items postings in 3.1 Version. I do not want to go for BDC. Please suggest.
Thanks,
SubbaHi,
search for function module ACCPOSTING* or get development class of transaction FB01 and goto SE80, enter development class - and search in function group's function module.
Cheers.
...Reward if useful. -
Vendor Reconciliation account change for specific vendor
Hi All,
Client want to change the Reconciliation account in the Vendor Master but same reconciliation account assign to multiple vendor master but client want to change specific vendor not for all vendor . The vendor has postings to it right now. We want that all the existing postings should be transferred to the new recon account line item wise and the new postings will go to the new recon account.
Please suggest some approach so that this can be effected.
Regards,
DevHi Debabrata ,
To clear the reconciliation Account one option is that you create a new open item managed GL Account and use Transaction FB05 to clear each open item in the Vendor Account one at a Time and post on the new open item clearing Account. Then change the reconciliation Account in the master data and then again use FB05 to post the transactions back on the Vendor Account one at a time,
As far as impact on Balance sheet is concerned, there should not be an impact except that the balance will be reflected in a different GL Account.
Thanks
Muthu -
Inspection lot should be created only for particular vendor
Hi
Can anyone please help in achieving the below scenario:
*Material has been assigned to the inspection type A (one time inspection) has been set as preffered and active in the inspection set up in the material master.
*Quality level has been created for material and vendor such that inspection should be carried out when next stage is 1 and no inspection should carried out when next stage is 2.
*Tasklist has been assigned with material and vendor .
Material can be supplied by different vendors,For this material, inspection should be done only for one vendor and for other vendors there should not be any inspection to be done and no inspection lot should be created.i.e Inspection lot should be created only for one vendor say AA whereas now inspection lot is getting created when goods receipt is done for the purchase order with other vendor BB.
My requirement is the inspection lot should not be created when goods receipt is done with other vendors say BB except AA.
Is there any other way other than using quality info record to achieve this.
I can try with DMR but the thing is there should not be inspection lot created while posting GR.
can anyone suggest me any other way to achieve this requirement.There are user exits when you create an inspection lot. One of those could be used to suppress the inspection lot. Have you looked at these? Have you researched any QM user exits yourself yet? This isn't the first time this specific question has been asked over the years.
It's not hard and there are lists of QM user exits available all over the internet.
Please do some research.
You can also assign vendors to inspection plans with a DMR that requires one inspection, and than after that creates all skip lot inspections which you automatically close by a batch job. The first lot can be manually forced closed. Thereaftter all receipts would be skipped. Not 100% but pretty darn close. This requires that you know which vendors to assign to which plan. Probably as much data maintenance as maintaing the Q-info records.
And yes.. your client needs to come up with better reasons than "I don't wanna..". It's part of a consultants job to convince them.
Craig -
GR/IR Account - one for internal vendor and another for external vendors
Hi Experts,
Can I have two GR/IR accounts - one for internal vendors and another for external vendors? Please let me know.
Thank you.
with regards,
Muthu Ganapathy.Hi Muthu,
GR/IR accounts are not dependent on Vendors, they are dependent on Materials, to be precise on Plant/Valclass.
You can post to 2 different GR/IR accounts if you set up 2 different classes. then it is possible.
For setting up the same. Go to T.code : OBYC, Transaction : WRX.
Here Setup different GR/IR accounts per val.class.
Letme know if you need further info
Thanks
Kalyan
Maybe you are looking for
-
Can't View text Message on PC suite 6.86.9.0
Phone: N82 OS: Windows XP Media Edition SP2 Connectivity: USB with CA-101 Cable i'm been using PC suite 6.85.14 from past 3 months.. everything works fine, recently new update to ver 6.86.9.0. i start having problem reading & Send text message from P
-
Extraction of Purchase Order from BOP background Worklist
Hi to all, have you got any idea on how to have on the BOP worklist the purchase order or other categories that have been taken in consideration during the background job? Are notes 376773 and 377186 the right once? Thanks Maria
-
i dont understand how to use it.
-
Can you replace the screen on an ipod, can you replace the screen on an ipod
My son just cracked the screen on his iPod touch...can it be replaced?
-
Is it a must to migrate 3.x DataSources
Hi, We have BI 7.0 newly installed, DataSource activated from Business Contents are in 3.X version (e.g. 2LIS_11_VAHDR). What is the best practice to these 3.x DataSources from Business Content? Is it recommended to migrate them to newer version? I r