Skip to Content
author's profile photo Former Member
Former Member

Program modification very urgent please

Hello experts

I have a program like following, when I run the report for goods movement date for month of may it gives deliveries from February. Can anyone help me in correcting the code.

Iam not full time ABAPer so could you please highlight the code you corrected(added),

Thanks

SP

TYPE-POOLS: slis.

TABLES: likp,

lips,

vbfa,

kssk,

klah,

ausp,

cabn,

vbak,

mara,

vbrk,

ser01,

vbpa,

vbrp,

nast,

zseri,

ltap,

pa0001,

kna1,

objk,

viqmel,

viqmma.

TYPES: BEGIN OF i_delivery,

vbeln LIKE likp-vbeln,

posnr LIKE lips-posnr,

kunnr LIKE likp-kunnr,

kunag LIKE likp-kunag,

vkorg LIKE vbak-vkorg,

matnr LIKE lips-matnr,

lfart LIKE likp-lfart,

arktx LIKE vbap-arktx,

vgbel LIKE lips-vgbel,

vgpos LIKE lips-vgpos,

pstyv LIKE lips-pstyv,

wadat TYPE likp-wadat,

lfdat TYPE likp-lfdat,

prodh TYPE lips-prodh,

lfimg TYPE lips-lfimg,

vkbur TYPE lips-vkbur,

werks TYPE lips-werks,

vkgrp TYPE lips-vkgrp,

mvgr1 TYPE lips-mvgr1,

sernr LIKE equi-sernr,

sernp LIKE equi-sernr,

equnr LIKE equi-equnr,

kttxt LIKE qpct-kurztext,

fkimg LIKE vbrp-fkimg,

bstnk LIKE vbak-bstnk,

vbelv LIKE lips-vgbel,

posnv LIKE lips-posnv,

uecha LIKE lips-uecha,

ernam LIKE vbak-ernam,

erdat LIKE vbak-erdat,

serail LIKE lips-serail,

anzsn LIKE lips-anzsn,

auart LIKE vbak-auart ,

netwr LIKE vbap-netwr,

fstno LIKE vbpa-pernr,

fstnm LIKE pa0001-ename,

ename LIKE pa0001-ename,

qname LIKE ltap-qname,

name1 LIKE kna1-name1,

name3 LIKE kna1-name2,

pernr LIKE vbpa-pernr,

aufnr LIKE viqmel-aufnr,

qmnum LIKE viqmel-qmnum,

mngrp LIKE viqmma-mngrp,

qmcod LIKE viqmel-qmcod,

qmcol LIKE viqmma-mncod,

cotxt(20),

invvalue like vbrp-netwr,

posnn like vbfa-posnn,

END OF i_delivery.

  • Global structure of list

*/ Selection and Input Parameters

SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.

SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.

SELECT-OPTIONS: s_vbeln FOR likp-vbeln,

s_lfart FOR likp-lfart,

s_kunnr FOR likp-kunnr,

s_erdat FOR likp-erdat,

s_wadat FOR likp-wadat,

s_werks FOR lips-werks,

s_matnr FOR lips-matnr,

s_prodh FOR lips-prodh,

s_qmnum FOR viqmel-qmnum.

SELECTION-SCREEN END OF BLOCK block2.

SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.

SELECT-OPTIONS: s_vbelv FOR vbak-vbeln,

s_auart FOR vbak-auart.

SELECTION-SCREEN END OF BLOCK block4.

PARAMETERS: p_vari LIKE disvariant-variant.

RANGES: r_vbeln FOR likp-vbeln.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,

rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,

i_nast TYPE nast OCCURS 0 WITH HEADER LINE,

gt_list_top_of_page TYPE slis_t_listheader,

gt_events TYPE slis_t_event,

gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

DATA: g_repid LIKE sy-repid,

g_count LIKE sy-tabix.

DATA: BEGIN OF i_serial OCCURS 0,

obknr TYPE ser01-obknr,

lief_nr TYPE ser01-lief_nr,

posnr TYPE ser01-posnr,

anzsn TYPE ser01-anzsn,

END OF i_serial.

DATA: BEGIN OF i_object_numbers OCCURS 0,

obknr TYPE objk-obknr,

obzae TYPE objk-obzae,

sernr TYPE objk-sernr,

equnr TYPE objk-equnr,

matnr TYPE objk-matnr,

taser TYPE objk-taser,

END OF i_object_numbers.

DATA: g_save(1) TYPE c,

  • g_default(1) TYPE c,

g_exit(1) TYPE c,

gx_variant LIKE disvariant,

g_variant LIKE disvariant.

DATA: g_mnkat LIKE viqmma-mnkat,

g_mngrp LIKE viqmma-mngrp,

g_atinn LIKE ausp-atinn.

  • Initialization fieldcatalog

INITIALIZATION.

g_repid = sy-repid.

PERFORM fieldcat_init USING gt_fieldcat[].

MOVE: 'I' TO s_vkorg-sign,

'EQ' TO s_vkorg-option,

'5090' TO s_vkorg-low.

APPEND s_vkorg.

MOVE: 'I' TO s_lfart-sign,

'EQ' TO s_lfart-option,

'LF' TO s_lfart-low.

APPEND s_lfart.

g_save = 'A'.

PERFORM variant_init.

  • Get default variant

gx_variant = g_variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = g_save

CHANGING

cs_variant = gx_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 0.

p_vari = gx_variant-variant.

ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

PERFORM f4_for_variant.

AT SELECTION-SCREEN.

PERFORM pai_of_selection_screen.

  • Start of Selection

START-OF-SELECTION.

PERFORM e03_eventtab_build USING gt_events[].

PERFORM select_data TABLES gt_outtab.

  • Display list

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ALV_BACKGROUND'

i_callback_user_command = 'USER_COMMAND'

is_variant = g_variant

i_save = g_save

i_callback_program = g_repid

it_fieldcat = gt_fieldcat[]

TABLES

t_outtab = gt_outtab.

*----


  • Forms

*----


  • Initialization fieldcatalog

FORM fieldcat_init

USING rt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: pos TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'VBELN'.

ls_fieldcat-seltext_s = 'Delivery'.

ls_fieldcat-seltext_m = 'Delivery'.

ls_fieldcat-key = 'X'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'POSNR'.

ls_fieldcat-key = 'X'.

ls_fieldcat-seltext_s = 'Item'.

ls_fieldcat-seltext_m = 'Item'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'LFART'.

ls_fieldcat-seltext_s = 'Del Type'.

ls_fieldcat-seltext_m = 'Delivery Type'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'VGBEL'.

ls_fieldcat-seltext_s = 'Source Doc'.

ls_fieldcat-seltext_m = 'Source Doc'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'AUART'.

ls_fieldcat-seltext_s = 'Type'.

ls_fieldcat-seltext_m = 'Type'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'KUNNR'.

ls_fieldcat-seltext_s = 'Customer'.

ls_fieldcat-seltext_m = 'Customer'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'NAME1'.

ls_fieldcat-seltext_s = 'Name'.

ls_fieldcat-seltext_m = 'Name1'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'WERKS'.

ls_fieldcat-seltext_s = 'Plant'.

ls_fieldcat-seltext_m = 'Plant'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MATNR'.

ls_fieldcat-seltext_s = 'Material'.

ls_fieldcat-seltext_m = 'Material'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MVGR1'.

ls_fieldcat-seltext_s = 'Speciality'.

ls_fieldcat-seltext_m = 'Speciality'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'PRODH'.

ls_fieldcat-seltext_s = 'Hierarchy'.

ls_fieldcat-seltext_m = 'Prod Hierarchy'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'ARKTX'.

ls_fieldcat-seltext_s = 'Description'.

ls_fieldcat-seltext_m = 'Description'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'ERNAM'.

ls_fieldcat-seltext_s = 'Created By'.

ls_fieldcat-seltext_m = 'Created By'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'ERDAT'.

ls_fieldcat-seltext_s = 'Created On'.

ls_fieldcat-seltext_m = 'Created On'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'WADAT'.

ls_fieldcat-seltext_s = 'GoodsMvt.Date'.

ls_fieldcat-seltext_m = 'Goods Mvt Date'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'SERNR'.

ls_fieldcat-seltext_s = 'Serial Shipped'.

ls_fieldcat-seltext_m = 'Serial Shipped'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'SERNP'.

ls_fieldcat-seltext_s = 'Old Serial'.

ls_fieldcat-seltext_m = 'Old Serial'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'VBELV'.

ls_fieldcat-seltext_s = 'Invoice'.

ls_fieldcat-seltext_m = 'Invoice'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'INVVALUE'.

ls_fieldcat-seltext_s = 'Invoice Amt'.

ls_fieldcat-seltext_m = 'Invoice Value'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'QMNUM'.

ls_fieldcat-seltext_s = 'Notification'.

ls_fieldcat-seltext_m = 'Notification'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'QMCOD'.

ls_fieldcat-seltext_s = 'Rep LevKST'.

ls_fieldcat-seltext_m = 'Repair Level KST'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'COTXT'.

ls_fieldcat-seltext_s = 'CdTXT KST'.

ls_fieldcat-seltext_m = 'Repair Level Text KST'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'QMCOL'.

ls_fieldcat-seltext_s = 'Rep LevKSE'.

ls_fieldcat-seltext_m = 'Repair Level KSE'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'KTTXT'.

ls_fieldcat-seltext_s = 'CdTXT KSE'.

ls_fieldcat-seltext_m = 'Repair Level Text KSE'.

APPEND ls_fieldcat TO rt_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. "fieldcat_init

  • Data selection

FORM select_data TABLES rt_outtab LIKE gt_outtab[].

CLEAR: r_vbeln[].

  • Read all Invoices for the Selection

SELECT DISTINCT h~vbeln h~kunnr h~kunag

d~posnr d~matnr d~anzsn

d~serail d~vgbel d~vgpos

d~posnv d~lfimg d~arktx

d~uecha h~lfart h~erdat

h~ernam h~lfdat d~prodh

h~vkorg d~vkbur d~vkgrp

d~mvgr1 h~wadat_ist d~pstyv

d~werks

INTO (rt_outtab-vbeln, rt_outtab-kunnr,

rt_outtab-kunag, rt_outtab-posnr,

rt_outtab-matnr, rt_outtab-anzsn,

rt_outtab-serail, rt_outtab-vgbel,

rt_outtab-vgpos, rt_outtab-posnv,

rt_outtab-lfimg, rt_outtab-arktx,

rt_outtab-uecha, rt_outtab-lfart,

rt_outtab-erdat, rt_outtab-ernam,

rt_outtab-lfdat, rt_outtab-prodh,

rt_outtab-vkorg, rt_outtab-vkbur,

rt_outtab-vkgrp, rt_outtab-mvgr1,

rt_outtab-wadat, rt_outtab-pstyv,

rt_outtab-werks)

FROM likp AS h INNER JOIN lips AS d

ON h~vbeln = d~vbeln

WHERE h~vbeln IN s_vbeln

AND h~vkorg IN s_vkorg

AND h~lfart IN s_lfart

AND h~kunnr IN s_kunnr

AND h~erdat IN s_erdat

AND d~matnr IN s_matnr

AND d~werks IN s_werks

AND d~prodh IN s_prodh

AND d~vgbel IN s_vbelv

AND d~matnr LIKE 'S%'.

SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.

IF: sy-subrc EQ 0.

MOVE vbak-vbeln TO rt_outtab-vgbel.

MOVE vbak-auart TO rt_outtab-auart.

ENDIF.

SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr

AND mtart EQ 'FERT'.

CHECK sy-subrc EQ 0.

IF NOT rt_outtab-posnv IS INITIAL.

rt_outtab-vgpos = rt_outtab-posnv.

ENDIF.

CLEAR: vbfa.

SELECT SINGLE vbeln posnn rfwrt INTO

(rt_outtab-vbelv, rt_outtab-posnn, rt_outtab-netwr)

FROM vbfa WHERE vbelv EQ rt_outtab-vbeln

AND posnv EQ rt_outtab-posnr

AND vbtyp_n EQ 'M'.

  • SELECT SINGLE vbeln rfwrt INTO (rt_outtab-vbelv, rt_outtab-netwr)

*FROM vbfa WHERE vbelv EQ rt_outtab-vbeln

  • AND posnv EQ rt_outtab-posnr

  • AND vbtyp_n EQ 'M'.

  • DATA: xvbrp TYPE vbrp.

CLEAR : rt_outtab-invvalue.

SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv "invoice

AND posnr = rt_outtab-posnn. "invoice line number

rt_outtab-fkimg = vbrp-fkimg.

if rt_outtab-fkimg NE 0.

rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.

endif.

APPEND rt_outtab.

IF NOT r_vbeln-low IS INITIAL.

IF r_vbeln-low GT rt_outtab-vbeln.

r_vbeln-low = rt_outtab-vbeln.

ENDIF.

IF r_vbeln-high LT rt_outtab-vbeln.

r_vbeln-high = rt_outtab-vbeln.

ENDIF.

ELSE.

r_vbeln-low = rt_outtab-vbeln.

r_vbeln-high = rt_outtab-vbeln.

ENDIF.

CLEAR: rt_outtab.

ENDSELECT.

IF NOT r_vbeln IS INITIAL.

MOVE: 'I' TO r_vbeln-sign,

'BT' TO r_vbeln-option.

APPEND r_vbeln.

SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial

FROM ser01 WHERE lief_nr IN r_vbeln.

ENDIF.

SORT i_serial.

IF NOT i_serial[] IS INITIAL.

SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers

FROM objk

FOR ALL ENTRIES IN i_serial

WHERE obknr EQ i_serial-obknr

AND taser EQ 'SER01'.

ENDIF.

SORT i_object_numbers BY obknr obzae.

LOOP AT rt_outtab.

clear: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,

rt_outtab-sernp, rt_outtab-kttxt.

  • Read the Sold To Name

SELECT SINGLE name1 INTO rt_outtab-name1

FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.

  • Read Ship-to Customer

CLEAR: objk.

IF NOT rt_outtab-serail IS INITIAL.

READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln

posnr = rt_outtab-posnr.

IF sy-subrc EQ 0.

DO i_serial-anzsn TIMES.

clear: rt_outtab-sernr, rt_outtab-sernp.

READ TABLE i_object_numbers WITH KEY obknr = i_serial-obknr

matnr = rt_outtab-matnr

BINARY SEARCH.

IF sy-subrc EQ 0.

rt_outtab-sernr = i_object_numbers-sernr.

DELETE i_object_numbers INDEX sy-tabix.

MOVE '1' TO rt_outtab-lfimg.

CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,

rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.

SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat

INTO (rt_outtab-aufnr, rt_outtab-qmnum,

rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)

FROM viqmel WHERE matnr = rt_outtab-matnr

AND serialnr = rt_outtab-sernr

AND qmart EQ 'S4'

AND qmnum IN s_qmnum.

CLEAR: rt_outtab-cotxt.

SELECT SINGLE kurztext INTO rt_outtab-cotxt

FROM qpct WHERE katalogart EQ g_mnkat

AND codegruppe EQ g_mngrp

AND code EQ rt_outtab-qmcod

AND sprache EQ sy-langu.

  • Read Serial Number from Name Plate Data.

CLEAR: klah, kssk, ausp, cabn, g_atinn.

SELECT SINGLE atinn INTO (g_atinn) FROM cabn

WHERE atnam = 'SBANK_SERIAL_NUMBER'.

SELECT SINGLE atwrt

INTO (rt_outtab-sernp)

FROM ( klah AS a INNER JOIN kssk AS k

ON aclint = kclint )

JOIN ausp AS p

ON kobjek = pobjek

AND p~atinn = g_atinn

AND pklart = aklart

WHERE a~klart = '002'

AND a~class = 'KSE_SN_ENDOSCOPES'

AND k~objek = rt_outtab-equnr.

*KSE Repair level (activity code text from KSE-SM07 code group)

CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.

CLEAR: rt_outtab-qmcol.

CLEAR: g_mnkat, g_mngrp.

SELECT SINGLE mnkat mngrp mncod INTO

(g_mnkat, g_mngrp, rt_outtab-qmcol)

FROM viqmma WHERE qmnum = rt_outtab-qmnum

AND mngrp EQ 'KSE-SM07'

AND kzloesch EQ space.

CLEAR: rt_outtab-kttxt.

SELECT SINGLE kurztext INTO rt_outtab-kttxt

FROM qpct WHERE katalogart EQ g_mnkat

AND codegruppe EQ g_mngrp

AND code EQ rt_outtab-qmcol

AND sprache EQ sy-langu.

rt_outtab1 = rt_outtab.

APPEND rt_outtab1.

ENDIF.

ENDDO.

ENDIF.

ENDIF.

ENDLOOP.

CLEAR: rt_outtab[].

rt_outtab[] = rt_outtab1[].

SORT rt_outtab BY vbeln posnr.

ENDFORM.

----


  • FORM get_repname *

----


  • ........ *

----


  • --> P_VBELN *

  • --> P_POSNR *

  • --> P_PERNR *

  • --> P_ENAME *

----


FORM get_repname USING p_vbeln

p_posnr

CHANGING p_pernr

p_ename. "

DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.

CLEAR: i_vbpa[].

CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'

EXPORTING

g_salesdocument = p_vbeln

g_sales_item = p_posnr

TABLES

st_vbpa = i_vbpa.

READ TABLE i_vbpa INDEX 1.

IF sy-subrc = 0.

p_pernr = i_vbpa-pernr.

SELECT SINGLE ename INTO p_ename

FROM pa0001

WHERE pernr = i_vbpa-pernr.

ENDIF.

ENDFORM. " get_repname

----


  • FORM E03_EVENTTAB_BUILD *

----


  • ........ *

----


  • --> E03_LT_EVENTS *

----


FORM e03_eventtab_build USING e03_lt_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 = e03_lt_events.

READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE gc_formname_top_of_page TO ls_event-form.

APPEND ls_event TO e03_lt_events.

ENDIF.

ENDFORM.

----


  • FORM TOP_OF_PAGE *

----


  • ........ *

----


FORM top_of_page.

*

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = gt_list_top_of_page.

ENDFORM.

*&----


*& Form USER_COMMAND

*&----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

PERFORM display_delivery USING r_ucomm

rs_selfield.

ENDCASE.

ENDFORM.

&----


*& Form display_delivery

&----


FORM display_delivery

USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE rs_selfield-sel_tab_field.

WHEN '1-VBELN'.

SET PARAMETER ID 'VL' FIELD rs_selfield-value.

CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.

WHEN '1-VBELV'.

SET PARAMETER ID 'VF' FIELD rs_selfield-value.

CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM.

&----


*& Form VARIANT_INIT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM variant_init.

*

CLEAR g_variant.

g_variant-report = g_repid.

ENDFORM. " VARIANT_INIT

&----


*& Form F4_FOR_VARIANT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f4_for_variant.

*

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = g_variant

i_save = g_save

  • it_default_fieldcat =

IMPORTING

e_exit = g_exit

es_variant = gx_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF g_exit = space.

p_vari = gx_variant-variant.

ENDIF.

ENDIF.

ENDFORM.

&----


*& Form PAI_OF_SELECTION_SCREEN

&----


  • text

----


FORM pai_of_selection_screen.

*

IF NOT p_vari IS INITIAL.

MOVE g_variant TO gx_variant.

MOVE p_vari TO gx_variant-variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

EXPORTING

i_save = g_save

CHANGING

cs_variant = gx_variant.

g_variant = gx_variant.

ELSE.

PERFORM variant_init.

ENDIF.

ENDFORM.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2006 at 06:53 PM

    to select by goods movement date I would add WADAT here and use selection by WADAT rather than ERDAT

    FROM likp AS h INNER JOIN lips AS d

    ON hvbeln = dvbeln

    WHERE h~vbeln IN s_vbeln

    AND h~vkorg IN s_vkorg

    AND h~lfart IN s_lfart

    AND h~kunnr IN s_kunnr

    AND h~erdat IN s_erdat

    AND h~wadat in s_wadat <<<<<<<

    btw, the program is not good from the performance point of view. just one example -> you select the SAME value inside the loop... not sure why. Other parts of logic need some changes as well.

    SELECT SINGLE atinn INTO (g_atinn) FROM cabn

    WHERE atnam = 'SBANK_SERIAL_NUMBER'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2006 at 07:19 PM

    Hi

    SELECT DISTINCT hvbeln hkunnr h~kunag

    dposnr dmatnr d~anzsn

    dserail dvgbel d~vgpos

    dposnv dlfimg d~arktx

    duecha hlfart h~erdat

    hernam hlfdat d~prodh

    hvkorg dvkbur d~vkgrp

    dmvgr1 hwadat_ist d~pstyv

    d~werks

    INTO (rt_outtab-vbeln, rt_outtab-kunnr,

    rt_outtab-kunag, rt_outtab-posnr,

    rt_outtab-matnr, rt_outtab-anzsn,

    rt_outtab-serail, rt_outtab-vgbel,

    rt_outtab-vgpos, rt_outtab-posnv,

    rt_outtab-lfimg, rt_outtab-arktx,

    rt_outtab-uecha, rt_outtab-lfart,

    rt_outtab-erdat, rt_outtab-ernam,

    rt_outtab-lfdat, rt_outtab-prodh,

    rt_outtab-vkorg, rt_outtab-vkbur,

    rt_outtab-vkgrp, rt_outtab-mvgr1,

    rt_outtab-wadat, rt_outtab-pstyv,

    rt_outtab-werks)

    FROM likp AS h INNER JOIN lips AS d

    ON hvbeln = dvbeln

    WHERE h~vbeln IN s_vbeln

    AND h~vkorg IN s_vkorg

    AND h~lfart IN s_lfart

    AND h~kunnr IN s_kunnr

    <b>AND h~erdat IN s_erdat</b>

    AND d~matnr IN s_matnr

    AND d~werks IN s_werks

    AND d~prodh IN s_prodh

    AND d~vgbel IN s_vbelv

    AND d~matnr LIKE 'S%'.

    Change it to h~wadat in s_wadat...

    I think you are already having s_wadat in your selection screen.. use that instead of s_erdat.. this should solve your problem.

    wadat = Planned goods movement date

    erdat = Date on which the record was created

    Let me know if it doesnt..

    Prince

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.