Bi Abap
Bi Abap
Bi Abap
SELECT
user_id
wi_id
INTO TABLE lt_wi_ids1
FROM swwuserwi
WHERE user_id = s_bname
AND no_sel NE 'X'
AND no_execute NE 'X'
user_id
step 2:
SELECT wi_id
wi_rh_task
FROM swwwihead
INTO TABLE lt_wi_ids
FOR ALL ENTRIES IN lt_wi_ids1
WHERE wi_id = lt_wi_ids1-wi_id
AND ( wi_stat = c_ready
OR wi_stat
= c_started
OR wi_stat
= c_selected
OR wi_stat
= c_committed ).
step 3:
* Get the object keys for the work items in users inbox
SELECT wi_id
element
objkey
FROM sww_contob
INTO TABLE lt_objkey
FOR ALL ENTRIES IN lt_wi_ids
WHERE wi_id = lt_wi_ids-wi_id
AND ( element = c_invoice
OR element = c__wi_object_id
OR element = c__adhoc_objects
OR element = c_fippid ).
wi_id
step 4:
in step 2 data in internal
like this.
internal table
internal table.
step 6:
LOOP AT lt_wi_ids INTO ls_wi_ids1
WHERE wi_task IN lr_task_sel.
READ TABLE it_lv_wi_id into wa_lv_wi_id with key wi_id = ls_wi_ids1-wi_id BINARY
SEARCH.
IF SY-SUBRC Eq 0.
READ TABLE IT_LV_WI_ID1 INTO WA_LV_WI_ID1 WITH KEY wi_id = ls_wi_ids1-wi_id BINA
RY SEARCH.
Endif.
IF sy-subrc = 0.
WA_LV_WI_ID-wi_chckwi = WA_LV_WI_ID1-wi_chckwi.
ENDIF.
CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
EXPORTING
workitem_id = WA_lv_wi_id-wi_chckwi
TABLES
simple_container = lt_container.
IF sy-subrc = 0.
IF ls_wi_ids1-wi_task = c_ts90200307.
READ TABLE lt_container INTO lw_container
WITH KEY element = c_fippid.
IF sy-subrc IS INITIAL.
lt_objkey1-objkey = lw_container-value+20(18).
ENDIF.
ELSE.
READ TABLE lt_container INTO lw_container
WITH KEY element = c_invoice.
IF sy-subrc IS INITIAL.
lt_objkey1-objkey = lw_container-value+20(14).
ENDIF.
ENDIF.
lt_objkey1-wi_id = ls_wi_ids1-wi_id.
lt_objkey1-element = c_invoice.
APPEND lt_objkey1.
REFRESH: lt_container.
ENDIF.
ENDLOOP.
APPEND LINES OF lt_objkey1 TO lt_objkey.
* Collect data for FI invoices, if "Include FI invoices" is selected.
IF s_fiinv = 'X'.
* Collect the invoice number,companycode and fiscal year details comparing with
the fiscal year and companycode input data provided.
LOOP AT lt_objkey INTO ls_objkey
WHERE objkey+0(4) IN s_bukrs
AND objkey+14(4) IN s_gjahr.
IF numofchar( ls_objkey-objkey ) = 18. "FI invoice
ls_fiinv-belnr
ls_fiinv-gjahr
ls_fiinv-bukrs
ls_fiinv-wi_id
=
=
=
=
ls_objkey-objkey+4(10).
ls_objkey-objkey+14(4).
ls_objkey-objkey+0(4).
ls_objkey-wi_id.
ENDLOOP.
in step 2 fill the internal table lt_wi_ids based on that internal table
process some logic
fill the internal table lt_fiinv .
lt_fiinv
WI_ID.
STEP 7:
SELECT AUSBK BELNR GJAHR BUKRS BUZEI BSCHL SHKZG DMBTR WRBTR SGTXT LIFNR ZFBDT S
WAER BLART XBLNR XPRFG
FROM v_vbsegk
INTO TABLE lt_vbsegk
FOR ALL ENTRIES IN lt_fiinv
WHERE belnr = lt_fiinv-belnr
AND
gjahr = lt_fiinv-gjahr
AND
bukrs = lt_fiinv-bukrs.
Note: V_VBSEGK
internal table .
internal table.
STEP 8:
SELECT BELNR GJAHR BUKRS BUZEI DMBTR ZFBDT BLART CPUDT XBLNR XPRFG
FROM v_vbsegs
INTO TABLE lt_vbsegs
FOR ALL ENTRIES IN lt_fiinv
to lt_vbsegs_1
internal
INTO lv_bseg
WITH KEY bukrs = lw_vbsegs-bukrs
belnr = lw_vbsegs-xblnr
gjahr = lw_vbsegs-gjahr.
lw_vbsegk-lifnr = lv_bseg-lifnr.
lw_vbsegk-zfbdt = lv_bseg-zfbdt.
ENDIF.
APPEND lw_vbsegk TO lt_vbsegk.
ENDLOOP.
lt_vbsegs
fill the
DMBTR
ZFBDT
BLART
CPUDT
task text
SELECT
wi_id
FROM
INTO
FOR
WHERE
wi_rhtext
swwwihead
TABLE lt_witext
ALL ENTRIES IN lt_fiinv
wi_id = lt_fiinv-wi_id
short text
wi_rhtext
vendor name
name1 lifnr
lfa1
TABLE lt_vendor
ALL ENTRIES IN lt_vbsegk
lifnr = lt_vbsegk-lifnr.
step 13:
wa_lista-zbd1t
wa_lista-zbd2t
wa_lista-zbd3t
lv_fbdt.
wa_lista-zzfbdt = lv_fbdt.
APPEND wa_lista TO it_lista.
CLEAR wa_lista.
ENDLOOP.
step 14:
IF s_mminv = 'X'.
* Collect the invoice number and companycode details comparing with the fiscal y
ear input data provided.
LOOP AT lt_objkey INTO ls_objkey
WHERE objkey+10(4) IN lt_gjahr.
IF numofchar( ls_objkey-objkey ) = 14. "MM invoice
ls_mminv-belnr = ls_objkey-objkey+0(10).
ls_mminv-gjahr = ls_objkey-objkey+10(4).
ls_mminv-wi_id = ls_objkey-wi_id.
APPEND ls_mminv TO lt_mminv.
filed . it is selected
SELECT BELNR GJAHR BLART BLDAT BUDAT USNAM TCODE CPUDT CPUTM VGART XBLNR BUKRS L
IFNR WAERS KURSF RMWWR BEZNK MWSKZ1 ZTERM ZBD1T XRECH SAPRL LOGSYS IVTYP
RBSTAT ZFBDT NAME1
FROM rbkp
INTO TABLE lt_rbkp
FOR ALL ENTRIES IN lt_mminv
WHERE belnr = lt_mminv-belnr
AND gjahr = lt_mminv-gjahr.