TABLES :

advertisement
TABLES :
lips,
likp,
j_1iexcdtl,
vbrp,
vbrk,
kna1,
stxh,
t005t,
eket,
ekbe.
DATA : BEGIN
vbeln
posnr
matnr
werks
charg
lfimg
meins
arktx
vgbel
vgpos
bwart
"SD document: Delivery: Item data
"SD Document: Delivery Header Data
"Excise invoice line item details
"Billing: Item Data
"Billing: Header Data
"General Data in Customer Master
"STXD SAPscript text file header
"Country Names
"Scheduling Agreement Schedule Lines
"History per Purchasing Document
OF itab_sdet_lips OCCURS 0 ,
LIKE lips-vbeln,
"Delivery
LIKE lips-posnr,
"Delivery item
LIKE lips-matnr,
"Material number
LIKE lips-werks,
LIKE lips-charg,
"Batch
LIKE lips-lfimg,
"Actual quantity delivered
LIKE lips-meins,
"unit
LIKE lips-arktx,
"Material Description
LIKE lips-vgbel,
"Reference document
LIKE lips-vgpos,
"Item number of the reference item
LIKE lips-bwart,
END OF itab_sdet_lips.
DATA : BEGIN OF itab_sdet_likp OCCURS 0 ,
vbeln LIKE lips-vbeln,
"Delivery
lfdat LIKE likp-lfdat,
"Delivery date
kunnr LIKE likp-kunnr,
"Ship-to party
kunag LIKE likp-kunag,
"Sold-to party
fkdat LIKE likp-fkdat,
END OF itab_sdet_likp.
**modification by suji for performance
*DATA : BEGIN OF itab_sdet_vbrp OCCURS 0,
*
vbeln1 LIKE vbrp-vbeln,
*
vgbel LIKE vbrp-vgbel,
*
aland TYPE vbrp-aland,
*
END OF itab_sdet_vbrp.
*modification by suji for performance
*DATA: BEGIN OF itab_sdet_t005t OCCURS 0,
*
land1 TYPE land1,
*
landx TYPE landx,
*
END OF itab_sdet_t005t.
** modification by suji for performance
*
DATA: BEGIN OF itab_sdet_j_1iexcdtl OCCURS 0,
exnum LIKE j_1iexcdtl-exnum,
exdat LIKE j_1iexcdtl-exdat,
rdoc1 LIKE j_1iexcdtl-rdoc1,
END OF itab_sdet_j_1iexcdtl.
*
*DATA: BEGIN OF itab_sdet_stxh OCCURS 0,
*
tdobject LIKE stxh-tdobject,
*
tdname LIKE stxh-tdname,
*
*
*
tdid LIKE stxh-tdid,
tdspras LIKE stxh-tdspras,
END OF itab_sdet_stxh.
*DATA : BEGIN OF itab_sdet_land OCCURS 0,
*
*
vbeln LIKE vbrk-vbeln,
*
vgbel LIKE vbrp-vgbel,
*
land1 LIKE vbrk-land1,
*
END OF itab_sdet_land.
* DATA: BEGIN OF ITAB_KNA1 OCCURS 0,
*
KUNNR LIKE KNA1-KUNNR,
*
NAME1 LIKE KNA1-NAME1,
*
END OF ITAB_KNA1.
DATA : BEGIN OF itab_sdet OCCURS 0 ,
vbeln LIKE lips-vbeln,
"Delivery
posnr LIKE lips-posnr,
"Delivery item
matnr LIKE lips-matnr,
"Material number
werks LIKE lips-werks,
charg LIKE lips-charg,
"Batch
lfimg LIKE lips-lfimg,
"Actual quantity delivered
meins LIKE lips-meins,
"unit
arktx LIKE lips-arktx,
"Material Description
vgbel LIKE lips-vgbel,
"Reference document
vgpos LIKE lips-vgpos,
"Item number of the reference item
bwart LIKE lips-bwart,
kunag LIKE likp-kunag,
"Sold-to party
kunnr LIKE likp-kunnr,
"Ship-to party
lfdat LIKE likp-lfdat,
"Delivery date
rdoc1 LIKE j_1iexcdtl-rdoc1,
exnum LIKE j_1iexcdtl-exnum,"Excise Document Number
exdat LIKE j_1iexcdtl-exdat,"Excise Document Date
land1 LIKE t005t-land1,
landx LIKE t005t-landx,
*
land1 LIKE vbrk-land1,
"Destination country code
pvbeln LIKE vbrk-vbeln,
tdname LIKE stxh-tdname,
line LIKE tline ,
shnam LIKE kna1-name1,
sonam LIKE kna1-name1,
fkdat LIKE likp-fkdat,
TDOBJECT LIKE STXH-TDOBJECT,
TDID LIKE STXH-TDID,
TDSPRAS LIKE STXH-TDSPRAS,
"Destination country Name
END OF itab_sdet.
"Name
"Text line
DATA:BEGIN OF itab_351 OCCURS 0 ,
matnr LIKE ekbe-matnr,
"Material number
maktx LIKE makt-maktx,
"Material Description
charg LIKE ekbe-charg,
"Batch
menge LIKE ekbe-menge,
"Actual quantity delivered
lsmeh LIKE ekbe-lsmeh,
"unit
soname LIKE t001w-name1,
"Sold-to party
shname LIKE t001w-name1,
eindt LIKE eket-eindt,
"Delivery date
exnum LIKE j_1iexcdtl-exnum,"Excise Document Number
exdat LIKE j_1iexcdtl-exdat,"Excise Document Date
land1 LIKE t001w-land1,
"Destination country code
landx LIKE t005t-landx,
"Destination country Name
*land1 LIKE t005t-land1,
tdname LIKE stxh-tdname,
"Name
line LIKE tline ,
"Text line
ebeln LIKE ekbe-ebeln,
ebelp LIKE ekbe-ebelp,
werks LIKE ekbe-werks,
werks1 LIKE ekbe-werks,
meins LIKE ekpo-meins,
budat LIKE ekbe-budat,
bwart LIKE ekbe-bwart,
cpudt LIKE ekbe-cpudt,
shname1 LIKE t001w-name1,
shname2 LIKE t001w-name2,
soname1 LIKE t001w-name1,
soname2 LIKE t001w-name2,
END OF itab_351.
DATA
s
DATA
DATA
DATA
DATA
DATA
:itline LIKE tline OCCURS 0 WITH HEADER LINE ."SAPscript text line
itab_stxh LIKE stxh OCCURS 0 WITH HEADER LINE .
long(300) TYPE c .
"Variable for CONCATENATING
lt LIKE stxh-tdname . "Variable for passing name to READ_TEXT fn
bel TYPE string.
"used to get tdname
pos TYPE string.
""used to get tdname
***********************************************************************
*
* ALV DECLARATION
*
***********************************************************************
*
TYPE-POOLS : slis.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: g_repid LIKE sy-repid.
DATA :
*
used for individual column
gt_fieldcat TYPE slis_t_fieldcat_alv,
g_tabname
TYPE slis_tabname VALUE 'ITAB_OPEN_H',
*
used for layout type
gs_layout
TYPE slis_layout_alv,
gt_variant TYPE slis_vari,
*
*
*
*
used for subtotal
gs_sub
TYPE slis_subtot_text,
gt_sp_group TYPE slis_t_sp_group_alv,
used for events in the report
gt_events
TYPE slis_t_event,
gt_col
TYPE slis_color, "used for layout color
for sorting the table
gt_sort
TYPE slis_t_sortinfo_alv,
gt_list_top_of_page TYPE slis_t_listheader,
contains the user event
g_user_command LIKE slis_ev_user_command VALUE 'USER_COMMAND',
alv_event TYPE slis_alv_event, "structure event handling
gt_print TYPE slis_print_alv.
INITIALIZATION.
g_repid = sy-repid.
PERFORM fieldcat_init USING gt_fieldcat[].
PERFORM
sort_init USING gt_sort[].
***********************************************************************
*
SELECTION-SCREEN DECLARATIONS
***********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_werks FOR lips-werks .
SELECT-OPTIONS s_matnr FOR lips-matnr .
SELECT-OPTIONS s_kunag FOR likp-kunag .
SELECT-OPTIONS s_erdat FOR lips-erdat.
SELECT-OPTIONS s_kunnr FOR likp-kunnr.
SELECT-OPTIONS s_charg FOR lips-charg.
SELECT-OPTIONS s_lfdat FOR likp-lfdat.
SELECT-OPTIONS s_bwart FOR lips-bwart.
SELECT-OPTIONS s_land1 FOR t005t-land1.
SELECT-OPTIONS s_exnum FOR j_1iexcdtl-exnum.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
PARAMETERS: alv_def LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b3.
***********************************************************************
*
*
Includes
***********************************************************************
*
INCLUDE rm07alvi.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR alv_def.
PERFORM alvget.
* PERFORM fetch_data.
START-OF-SELECTION.
SELECT vbeln posnr matnr werks charg lfimg meins arktx vgbel vgpos bwar
t
FROM lips
INTO TABLE itab_sdet_lips
WHERE erdat IN s_erdat
AND matnr IN s_matnr
AND werks IN s_werks
AND charg IN s_charg
AND lfimg
NE 0
AND bwart IN s_bwart.
SORT itab_sdet_lips BY vbeln.
IF itab_sdet_lips[] IS NOT INITIAL.
SELECT vbeln lfdat kunnr kunag fkdat
INTO TABLE itab_sdet_likp
FROM likp
FOR ALL ENTRIES IN itab_sdet_lips
WHERE vbeln = itab_sdet_lips-vbeln
AND lfdat IN s_lfdat
AND kunag IN s_kunag
AND kunnr IN s_kunnr.
if itab_sdet_likp[] is NOT INITIAL.
SELECT exnum exdat rdoc1 FROM j_1iexcdtl
INTO TABLE itab_sdet_j_1iexcdtl
FOR ALL ENTRIES IN itab_sdet_likp
WHERE rdoc1 EQ itab_sdet_likp-vbeln AND
exnum IN s_exnum .
**********pls check this**********it is getting fetched
But in loop it s not moving
MOVE itab_sdet_j_1iexcdtl-rdoc1 to itab_sdet-rdoc1.
MOVE itab_sdet_j_1iexcdtl-exnum to itab_sdet-exnum.
MOVE itab_sdet_j_1iexcdtl-exdat to itab_sdet-exdat.
pls see ma
************************************************************
ENDIF.
endif.
SORT itab_sdet_likp BY vbeln.
LOOP AT itab_sdet_lips.
READ TABLE itab_sdet_likp WITH
IF sy-subrc = 0.
MOVE itab_sdet_lips-vbeln TO
MOVE itab_sdet_lips-posnr TO
MOVE itab_sdet_lips-matnr TO
MOVE itab_sdet_lips-arktx TO
MOVE itab_sdet_lips-charg TO
MOVE itab_sdet_lips-lfimg TO
MOVE itab_sdet_lips-meins TO
MOVE itab_sdet_lips-vgbel TO
KEY vbeln = itab_sdet_lips-vbeln.
itab_sdet-vbeln.
itab_sdet-posnr.
itab_sdet-matnr.
itab_sdet-arktx.
itab_sdet-charg.
itab_sdet-lfimg.
itab_sdet-meins.
itab_sdet-vgbel.
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
MOVE
itab_sdet_lips-vgpos TO itab_sdet-vgpos.
itab_sdet_lips-bwart TO itab_sdet-bwart.
itab_sdet_lips-werks TO itab_sdet-werks.
itab_sdet_likp-kunag TO itab_sdet-kunag.
itab_sdet_likp-kunnr TO itab_sdet-kunnr.
itab_sdet_likp-lfdat TO itab_sdet-lfdat.
itab_sdet_likp-fkdat TO itab_sdet-fkdat.
itab_sdet_j_1iexcdtl-rdoc1 to itab_sdet-rdoc1.
itab_sdet_j_1iexcdtl-exnum to itab_sdet-exnum.
itab_sdet_j_1iexcdtl-exdat to itab_sdet-exdat.
APPEND itab_sdet.
ENDIF.
ENDLOOP.
SORT itab_sdet BY vbeln posnr.
LOOP AT itab_sdet.
SELECT SINGLE vbeln
INTO itab_sdet-pvbeln FROM vbrp
WHERE vgbel EQ itab_sdet-vbeln.
SELECT SINGLE land1
INTO itab_sdet-land1
FROM vbrk WHERE vbeln EQ itab_sdet-pvbeln.
SELECT SINGLE landx
INTO itab_sdet-landx FROM t005t
WHERE spras EQ 'EN' AND
land1 IN s_land1 .
IF sy-subrc IS INITIAL .
MODIFY itab_sdet.
CLEAR itab_sdet.
ELSE.
DELETE itab_sdet. " delete remaining countries
ENDIF.
ENDLOOP.
*
*
*
*
*
*
*
*
*
*
*
*
*
IF itab_sdet_lips[] IS NOT INITIAL.
SELECT land1 landx FROM t005t INTO TABLE
itab_sdet_t005t FOR ALL ENTRIES IN
itab_sdet_land
WHERE land1 = itab_sdet_land-land1 AND
spras EQ 'EN' AND
land1 IN s_land1.
SELECT exnum exdat rdoc1 FROM j_1iexcdtl
INTO TABLE itab_sdet_j_1iexcdtl
FOR ALL ENTRIES IN itab_sdet_lips
WHERE rdoc1 EQ itab_sdet_lips-vbeln AND
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
exnum IN s_exnum .
LOOP AT itab_sdet.
SELECT SINGLE exnum exdat
INTO (itab_sdet-exnum,itab_sdet-exdat)
FROM j_1iexcdtl
WHERE rdoc1 EQ itab_sdet-vbeln
AND exnum IN s_exnum .
IF NOT sy-subrc IS INITIAL.
DELETE itab_sdet.
ELSE.
MODIFY itab_sdet.
CLEAR itab_sdet.
ENDIF.
CLEAR itab_sdet.
ENDLOOP.
LOOP AT itab_sdet.
MOVE itab_sdet-vgbel TO bel.
MOVE itab_sdet-vgpos TO pos.
CONCATENATE bel pos INTO itab_sdet-tdname." id for tdname
select single *
from stxh
where tdname = itab_sdet-tdname and
tdid eq '0001' and
tdobject = 'VBBP' and
tdspras eq 'EN'.
IF sy-subrc IS INITIAL .
CLEAR lt .
REFRESH itline.
CLEAR long .
lt = itab_sdet-tdname .
IF sy-subrc IS INITIAL .
CALL FUNCTION 'READ_TEXT'
EXPORTING
id
= '0001'
language = 'E'
name
= lt
object
= 'VBBP'
TABLES
lines
= itline.
LOOP AT itline WHERE tdline NE ' '.
CONCATENATE long itline-tdline INTO long.
ENDLOOP.
MOVE : long TO itab_sdet-line.
MODIFY itab_sdet.
CLEAR itab_sdet.
ELSE.
CLEAR itab_sdet.
ENDIF.
ELSE.
CLEAR itab_sdet.
ENDIF.
ENDLOOP.
LOOP at itab_sdet.
SELECT SINGLE name1
FROM kna1
INTO itab_sdet-shnam
WHERE kunnr EQ itab_sdet-kunnr.
IF sy-subrc IS INITIAL.
MODIFY itab_sdet.
ENDIF.
IF itab_sdet-bwart = '641'.
SELECT SINGLE name1 INTO
itab_sdet-sonam FROM t001w
WHERE werks EQ itab_sdet-werks.
IF sy-subrc = 0.
MODIFY itab_sdet.
ENDIF.
ELSE.
SELECT SINGLE name1
FROM kna1
INTO itab_sdet-sonam
WHERE kunnr EQ itab_sdet-kunag.
IF sy-subrc IS INITIAL.
MODIFY itab_sdet.
ENDIF.
*
ENDIF.
CLEAR itab_sdet.
ENDIF.
ENDLOOP.
SELECT matnr charg menge ebeln ebelp werks budat bwart cpudt INTO
(itab_351-matnr,itab_351-charg,itab_351-menge,
itab_351-ebeln, itab_351-ebelp,itab_351-werks,itab_351-budat,
itab_351-bwart,itab_351-cpudt)
FROM ekbe
WHERE werks IN s_werks
AND matnr IN s_matnr
AND budat IN s_erdat
AND charg IN s_charg
AND budat IN s_lfdat
AND menge
NE 0
AND bwart IN s_bwart
AND bwart IN ('351','352').
IF sy-subrc = 0.
IF itab_351-bwart = '352'.
itab_351-menge = itab_351-menge * -1.
ENDIF.
APPEND itab_351.
CLEAR itab_351.
ENDIF.
ENDSELECT.
LOOP AT itab_351.
IF s_exnum IS INITIAL.
SELECT SINGLE exnum exdat INTO
(itab_351-exnum,itab_351-exdat) FROM j_1iexcdtl
WHERE rdoc1 = itab_351-ebeln.
IF sy-subrc = 0 .
MODIFY itab_351.
CLEAR itab_351.
ENDIF.
ELSE.
SELECT SINGLE exnum exdat INTO
(itab_351-exnum,itab_351-exdat) FROM j_1iexcdtl
WHERE rdoc1 = itab_351-ebeln AND
exnum NE ' '
AND
exnum IN s_exnum.
IF sy-subrc = 0.
MODIFY itab_351.
CLEAR itab_351.
ELSE.
DELETE itab_351.
CLEAR itab_351.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT itab_351.
SELECT SINGLE werks meins txz01 INTO
(itab_351-werks1,itab_351-meins,itab_351-maktx)
FROM ekpo
WHERE ebeln EQ itab_351-ebeln AND
ebelp EQ itab_351-ebelp.
IF sy-subrc IS INITIAL.
MODIFY itab_351.
CLEAR itab_351.
ENDIF.
ENDLOOP.
LOOP AT itab_351.
SELECT SINGLE name1 name2 land1 INTO
(itab_351-soname1,itab_351-soname2,itab_351-land1 ) FROM t001w
WHERE werks EQ itab_351-werks.
IF itab_351-soname2 EQ space.
MOVE itab_351-soname1 TO itab_351-soname.
ELSE.
MOVE itab_351-soname2 TO itab_351-soname.
ENDIF.
IF sy-subrc = 0.
MODIFY itab_351.
ENDIF.
SELECT SINGLE name1 name2
INTO
(itab_351-shname1,itab_351-shname2) FROM t001w
WHERE werks EQ itab_351-werks1.
IF itab_351-shname2 EQ space.
MOVE itab_351-shname1 TO itab_351-shname.
ELSE.
MOVE itab_351-shname2 TO itab_351-shname.
ENDIF.
IF sy-subrc = 0.
MODIFY itab_351.
CLEAR itab_351.
ENDIF.
CLEAR itab_351.
ENDLOOP.
LOOP AT itab_351.
SELECT SINGLE landx FROM t005t INTO itab_351-landx
WHERE land1 EQ itab_351-land1 AND
spras EQ 'EN'.
IF sy-subrc = 0.
MODIFY itab_351.
CLEAR itab_351.
ENDIF.
ENDLOOP.
LOOP AT itab_351.
MOVE: itab_351-matnr TO itab_sdet-matnr,
itab_351-maktx TO itab_sdet-arktx,
itab_351-charg TO itab_sdet-charg,
*
ITAB_351-EINDT TO ITAB_SDET-LFDAT,
itab_351-menge TO itab_sdet-lfimg,
itab_351-soname TO itab_sdet-sonam,
itab_351-shname TO itab_sdet-shnam,
itab_351-exnum TO itab_sdet-exnum,
itab_351-exdat TO itab_sdet-exdat,
itab_351-landx TO itab_sdet-landx,
itab_351-bwart TO itab_sdet-bwart,
itab_351-budat TO itab_sdet-fkdat,
itab_351-cpudt TO itab_sdet-lfdat,
itab_351-maktx TO itab_sdet-line,
itab_351-meins TO itab_sdet-meins.
APPEND itab_sdet.
CLEAR itab_sdet.
ENDLOOP.
*endform.
" F_FETCH_DATA
***********************************************************************
* Alv Layout properties
*
***********************************************************************
CLEAR gs_layout.
gs_layout-colwidth_optimize = 'X'.
gs_layout-totals_before_items = 'X'.
gs_layout-key_hotspot
= 'X'.
gs_layout-no_keyfix
= 'X'.
gs_layout-get_selinfos
= 'X'.
gs_layout-group_change_edit = 'X'.
gs_layout-detail_popup
= 'X'.
gs_layout-totals_text
= 'Total'.
gs_layout-subtotals_text
= 'Total'.
gs_layout-no_subtotals
= ''.
gs_layout-numc_sum
= ''.
gs_layout-confirmation_prompt = 'X'.
gs_layout-detail_initial_lines = 'X'.
gs_layout-no_hotspot
= ' '.
* gs_layout-no_colhead
= ' '.
gs_layout-colwidth_optimize
= ''.
gs_layout-totals_before_items = ' '.
gs_layout-key_hotspot
= 'X'.
gs_layout-no_vline
= ' '.
gs_layout-def_status
= 'X'.
* gs_layout-numc_sum
= 'X'.
gs_layout-no_keyfix
= 'X'.
gs_layout-zebra
= ''. "striped pattern
gs_layout-hotspot_fieldname
= ''.
gs_layout-window_titlebar
= 'Sales Delivery Report'.
gs_layout-no_uline_hs
= ' '.
gs_layout-get_selinfos
= 'X'.
gs_layout-detail_popup
= 'X'.
gs_layout-detail_titlebar
= 'Sales Delivery Report'.
***********************************************************************
*
* ALV REUSE FUNCTION
*
***********************************************************************
*
DATA: variant_detail
LIKE disvariant.
variant_detail-report = g_repid.
variant_detail-variant = alv_def.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program
= g_repid
is_layout
= gs_layout
it_sort
= gt_sort[]
i_callback_user_command = 'USER_COMMAND'
it_fieldcat
= gt_fieldcat[]
it_events
= gt_events[]
i_save
= 'X'
is_variant
= variant_detail
TABLES
t_outtab
= itab_sdet.
***********************************************************************
*
*&--------------------------------------------------------------------*
*&
Form FIELDCAT_INIT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
*
-->P_GT_FIELDCAT[] text
*---------------------------------------------------------------------*
*&--------------------------------------------------------------------*
*&
Form fieldcat_init
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
*
-->RT_FIELDCAT text
*---------------------------------------------------------------------*
FORM fieldcat_init USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '1'.
ls_fieldcat-fieldname
= 'VBELN'.
ls_fieldcat-key
= 'X'.
ls_fieldcat-hotspot
= 'X'.
ls_fieldcat-outputlen
= '10'.
ls_fieldcat-seltext_l = 'Delivery'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '2'.
ls_fieldcat-fieldname
= 'POSNR'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '6'.
ls_fieldcat-seltext_l = 'Item'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '3'.
ls_fieldcat-fieldname
= 'MATNR'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '18'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '4'.
ls_fieldcat-fieldname
= 'ARKTX'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '40'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '5'.
ls_fieldcat-fieldname
= 'CHARG'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '10'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '6'.
ls_fieldcat-fieldname
= 'LFDAT'.
* LS_FIELDCAT-FIELDNAME
= 'FKDAT'.
ls_fieldcat-key
= ''.
ls_fieldcat-do_sum
= ''.
ls_fieldcat-outputlen
= '12'.
ls_fieldcat-ref_tabname = 'LIKP'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
ls_fieldcat-col_pos
* LS_FIELDCAT-FIELDNAME
ls_fieldcat-fieldname
ls_fieldcat-key
ls_fieldcat-do_sum
ls_fieldcat-outputlen
= '1'.
= '6'.
= 'LFDAT'.
= 'FKDAT'.
= ''.
= 'x'.
= '12'.
ls_fieldcat-ref_tabname = 'LIKP'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '6'.
ls_fieldcat-fieldname
= 'BWART'.
ls_fieldcat-key
= ''.
ls_fieldcat-do_sum
= ''.
ls_fieldcat-outputlen
= '12'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '7'.
ls_fieldcat-fieldname
= 'LFIMG'.
ls_fieldcat-key
= ''.
ls_fieldcat-do_sum
= 'X'.
ls_fieldcat-outputlen
= '16'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '8'.
ls_fieldcat-fieldname
= 'MEINS'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '3'.
ls_fieldcat-ref_tabname = 'LIPS'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '9'.
ls_fieldcat-fieldname
= 'SONAM'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '40'.
ls_fieldcat-seltext_l = 'Sold-Party'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '10'.
ls_fieldcat-fieldname
= 'SHNAM'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '40'.
ls_fieldcat-seltext_l = 'Ship-Party'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '11'.
ls_fieldcat-fieldname
= 'EXNUM'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '10'.
ls_fieldcat-seltext_l = 'Excise.No'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '12'.
ls_fieldcat-fieldname
= 'EXDAT'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '12'.
ls_fieldcat-seltext_l = 'Excise.Date'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '13'.
ls_fieldcat-fieldname
= 'LANDX'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '15'.
ls_fieldcat-seltext_l = 'Country'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos
= '1'.
ls_fieldcat-col_pos
= '14'.
ls_fieldcat-fieldname
= 'LINE'.
ls_fieldcat-key
= ''.
ls_fieldcat-outputlen
= '200'.
ls_fieldcat-seltext_l = 'L. TEXT'.
APPEND ls_fieldcat TO rt_fieldcat.
ENDFORM.
"FIELDCAT_INIT
*&--------------------------------------------------------------------*
*&
Form SORT_INIT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
*
-->P_GT_SORT[] text
*---------------------------------------------------------------------*
FORM sort_init USING
rt_sort TYPE slis_t_sortinfo_alv.
DATA lt_sort TYPE slis_sortinfo_alv.
lt_sort-spos
= 1.
lt_sort-fieldname = 'VBELN'.
lt_sort-up
= 'X'.
lt_sort-subtot
= 'X'.
APPEND lt_sort TO rt_sort.
lt_sort-spos
= 1.
lt_sort-fieldname = 'FKDAT'.
lt_sort-up
= 'X'.
lt_sort-subtot
= 'X'.
APPEND lt_sort TO rt_sort.
ENDFORM
.
"SORT_INIT
*&--------------------------------------------------------------------*
*&
Form alvget
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM alvget.
alv_variant-report = g_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save
= 'A'
IMPORTING
es_variant = alv_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.
alv_def = alv_variant-variant.
ENDIF.
ENDFORM.
" alvget
*---------------------------------------------------------------------*
*
FORM USER_COMMAND
*
*---------------------------------------------------------------------*
*
........
*
*---------------------------------------------------------------------*
* --> UCOMM
*
* --> SELFIELD
*
*---------------------------------------------------------------------*
FORM user_command USING ucomm LIKE syucomm selfield TYPE slis_selfield.
CASE selfield-fieldname.
WHEN 'VBELN'.
READ TABLE itab_sdet INDEX selfield-tabindex.
SET PARAMETER ID 'VL' FIELD itab_sdet-vbeln.
CALL TRANSACTION 'VL02N'
AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM.
"USER_COMMAND
Download