Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

connect to field if length is diffrent

Former Member
0 Kudos
117

i have a two fields and a two table

VBRP MKPF

VBRP-VGBEL CHAR 10 MKPF-VGBEL CHAR 16

BOTH THESE FIELDS ARE SAME.

can u tell me how to join these these two table in the following coding. it's urgent.

dinesh

&----


*& Report ZBIL

*&

&----


*&

*&

&----


REPORT ZBIL no standard page heading.

tables: vbrk,

vbrp,

kna1,

vbak,

likp,

j_1iexchdr,

marm,

mkpf,

mseg,

t151t.

type-pools:slis.

types: begin of it_final,

kunag like vbrk-kunag,

kdgrp like vbrk-kdgrp,

  • vbeln like vbrk-vbeln,

vbeln(10) type c,

fksto like vbrk-fksto,

fkdat like vbrk-fkdat,

  • stceg like vbrk-stceg,

STCEG(20) TYPE C,

regio like vbrk-regio,

rfbsk like vbrk-rfbsk,

TAXK1 LIKE VBRK-TAXK1,

TAXK2 LIKE VBRK-TAXK2,

  • aubel like vbrp-aubel,

aubel(10) type c,

werks like vbrp-werks,

  • vgbel like vbrp-vgbel,

vgbel(10) type c,

matnr like vbrp-matnr,

vrkme like vbrp-vrkme,

fkimg like vbrp-fkimg,

netwr like vbrp-netwr, "netwr_fp,

mwsbp like vbrp-mwsbp,

kzwi4 like vbrp-kzwi4,

VSTEL LIKE VBRP-VSTEL,

FKIMG1 TYPE FKIMG,

POSNR like vbrp-POSNR," by dinesh

name1 like kna1-name1,

ort01 like kna1-ort01,

pstlz like kna1-pstlz,

ekont like kna1-ekont,

kunnr like kna1-kunnr,

stras(35) type c,

audat like vbak-audat,

wadat_ist like likp-wadat_ist,

exnum(10) type c,

  • rdoc like j_1iexchdr-rdoc,

rdoc(10) type c,

umrez like marm-umrez,

meinh like marm-meinh,

umren like marm-umren,

freight LIKE VBRP-NETWR, "type STRING,

total like vbrp-netwr,

*******************************************

*

  • mblnr like mseg-mblnr,

    • matnr like mseg-matnr,

  • menge like mseg-menge,

  • meins like mseg-meins,

  • erfmg like mseg-erfmg,

*****************************************

budat like mkpf-budat,

mblnr like mkpf-mblnr,

  • xblnr like mkpf-xblnr,

xblnr(16) type c,

bktxt like mkpf-bktxt,

tcode2 like mkpf-tcode2,

ktext like t151t-ktext,

spras like t151t-spras,

  • *********************

end of it_final.

types: begin of it_vbrk,

kunag like vbrk-kunag,

kdgrp like vbrk-kdgrp,

  • vbeln like vbrk-vbeln,

vbeln(10) type c,

fksto like vbrk-fksto,

fkdat like vbrk-fkdat,

  • stceg like vbrk-stceg,

STCEG(20) TYPE C,

regio like vbrk-regio,

rfbsk like vbrk-rfbsk,

TAXK1 LIKE VBRK-TAXK1,

TAXK2 LIKE VBRK-TAXK2,

end of it_vbrk.

types: begin of it_vbrp,

werks like vbrp-werks,

  • vgbel like vbrp-vgbel,

vgbel(10) type c,

matnr like vbrp-matnr,

vrkme like vbrp-vrkme,

fkimg like vbrp-fkimg,

netwr like vbrp-netwr, "like vbrp-netwr,

mwsbp like vbrp-mwsbp, "like vbrp-mwsbp,

kzwi4 like vbrp-mwsbp, " like vbrp-kzwi4,

aubel like vbrp-aubel,

vbeln like vbrp-vbeln,

VSTEL LIKE VBRP-VSTEL,

POSNR like vbrp-POSNR,

end of it_vbrp.

types:begin of it_kna1,

name1 like kna1-name1,

ort01 like kna1-ort01,

pstlz like kna1-pstlz,

ekont like kna1-ekont,

kunnr like kna1-kunnr,

stras(35) type c,

end of it_kna1.

types: begin of it_vbak,

  • vbeln like vbak-vbeln,

vbeln(10) type c,

audat like vbak-audat,

KUNNR LIKE VBAK-KUNNR,

end of it_vbak.

types: begin of it_likp,

wadat_ist like likp-wadat_ist,

kunag like likp-kunag,

  • vbeln like likp-vbeln,

vbeln(10) type c,

end of it_likp.

types: begin of it_j_1iexchdr,

exnum(10) type c,

kunag like j_1iexchdr-kunag,

werks like j_1iexchdr-werks,

  • rdoc like j_1iexchdr-rdoc,

rdoc(10) type c,

end of it_j_1iexchdr.

types: begin of it_marm,

matnr like marm-matnr,

umrez like marm-umrez,

meinh like marm-meinh,

umren like marm-umren,

end of it_marm.

types: begin of it_t151t,

kdgrp like t151t-kdgrp,

ktext like t151t-ktext,

spras like t151t-spras,

end of it_t151t.

**********************************

*new code added by dinesh

*types: BEGIN OF it_mseg,

*

  • mblnr like mseg-mblnr,

  • matnr like mseg-matnr,

  • menge like mseg-menge,

  • meins like mseg-meins,

  • erfmg like mseg-erfmg,

  • end of it_mseg.

types: begin of it_mkpf,

budat like mkpf-budat,

mblnr like mkpf-mblnr,

bktxt like mkpf-bktxt,

xblnr(16) type c ,

tcode2 like mkpf-tcode2,

end of it_mkpf.

*end of code

*************************************************

*INTERNAL TABLE DECLARATION

DATA: i_final type standard table of it_final,

i_vbrp type standard table of it_vbrp,

i_vbrk type standard table of it_vbrk,

i_kna1 type standard table of it_kna1,

i_vbak type standard table of it_vbak,

i_likp type standard table of it_likp,

i_j_1iexchdr type standard table of it_j_1iexchdr,

i_t151t type standard table of it_t151t,

i_marm type standard table of it_marm,

  • i_mseg type standard table of it_mseg,

i_mkpf type standard table of it_mkpf.

*************************************************

*DECLARATION FOR THE WORK AREA

DATA: wa_final type it_final,

wa_vbrp type it_vbrp,

wa_vbrk type it_vbrk,

wa_kna1 type it_kna1,

wa_vbak type it_vbak,

wa_likp type it_likp,

wa_j_1iexchdr type it_j_1iexchdr,

wa_marm type it_marm,

wa_t151t type it_t151t,

  • wa_mseg type it_mseg,

wa_mkpf type it_mkpf.

*************************************************

data: freight type c.

**************************************************

  • * DECLARATION FOR THE FIELD CATALOG.

DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

WA_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA IT_SORT1 TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.

DATA HEADING1 TYPE SLIS_T_LISTHEADER WITH HEADER LINE.

DATA GD_REPID LIKE SY-REPID.

*********************************************************

*DECLARATION FOR THE SELECTION SCREEN

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: cust for vbrk-kunag,

cust_grp for vbrk-kdgrp,

mat_no for vbrp-matnr,

plant for vbrp-werks obligatory,

ship_pt for vbrp-vstel,

bill_doc for vbrk-vbeln,

sal_off for vbrp-vkbur,

bill_typ for vbrk-fkart,

date FOR vbrk-fkdat,

TAX1 FOR VBRK-TAXK1,

TAX2 FOR VBRK-TAXK2.

  • PARAMETERS:REGIO LIKE VBRK-REGIO DEFAULT '13' OBLIGATORY.

SELECTION-SCREEN :END OF BLOCK B1.

********************************************************************************

*DECLARATION FOR THE SUBROUTIN FOR BASIC LIST.

PERFORM F_GET_I_vbrk_DATA.

PERFORM F_GET_I_vbrp_DATA.

PERFORM F_GET_I_kna1_DATA.

PERFORM F_GET_I_vbak_DATA.

PERFORM F_GET_I_likp_DATA.

PERFORM F_GET_I_j_1iexchdr_DATA.

PERFORM F_GET_I_marm_DATA.

PERFORM F_GET_I_t151t_DATA.

PERFORM F_GET_I_mkpf_DATA.

PERFORM F_GET_I_final_DATA.

PERFORM DATA_BUILD.

PERFORM data_call.

form f_get_i_vbrk_data.

select kunag kdgrp vbeln fksto fkdat stceg regio rfbsk REGIO TAXK1 TAXK2

from vbrk

into corresponding fields of table i_vbrk

where fkdat in date

and kunag in cust

and kdgrp in cust_grp

and vbeln in bill_doc

and fkart in bill_typ

AND TAXK1 IN TAX1

AND TAXK2 IN TAX2.

endform.

form f_get_i_vbrp_data.

select werks vgbel matnr vrkme fkimg netwr mwsbp kzwi4 vbeln aubel VSTEL posnr

from vbrp

into corresponding fields of table i_vbrp for all entries in i_vbrk

where vbeln = i_vbrk-vbeln

and vkbur in sal_off

and matnr in mat_no

and vstel in ship_pt

and werks in plant .

endform.

form f_get_i_kna1_data.

select name1 ort01 pstlz ekont kunnr stras

from kna1

into corresponding fields of table i_kna1

for all entries in i_vbrk

where kunnr = i_vbrk-kunag.

endform.

form f_get_i_vbak_data.

select vbeln audat kunnr

from vbak

into corresponding fields of table i_vbak

for all entries in i_vbrp

where vbeln = i_vbrp-aubel.

endform.

form f_get_i_likp_data.

select wadat_ist kunag vbeln

from likp

into corresponding fields of table i_likp

for all entries in i_vbrp

where vbeln = i_vbrp-vgbel.

endform.

form f_get_i_j_1iexchdr_data.

select exnum werks kunag rdoc

from j_1iexchdr

into corresponding fields of table i_j_1iexchdr

for all entries in i_vbrk

where rdoc = i_vbrk-vbeln .

endform.

form f_get_i_marm_data.

select matnr umrez umren meinh

from marm

into corresponding fields of table i_marm

for all entries in i_vbrp

where meinh = 'EA' and matnr = i_vbrp-matnr.

endform.

form f_get_i_t151t_data.

select kdgrp ktext spras

from t151t

into corresponding fields of table i_t151t

for all entries in i_vbrk

where kdgrp = i_vbrk-kdgrp and spras = 'E'.

endform.

************************************************************

********************************************************************

form f_get_i_mkpf_data.

select budat mblnr bktxt xblnr tcode2

from mkpf

into corresponding fields of table i_mkpf

for all entries in i_vbrp

where xblnr = i_vbrp-vgbel and tcode2 = 'MIGO_GR'.

endform.

**********************************

******************************

form f_get_i_final_data.

loop at i_vbrp into wa_vbrp.

wa_final-werks = wa_vbrp-werks.

wa_final-vgbel = wa_vbrp-vgbel.

wa_final-matnr = wa_vbrp-matnr.

wa_final-vrkme = wa_vbrp-vrkme.

wa_final-fkimg = wa_vbrp-fkimg.

wa_final-netwr = wa_vbrp-netwr.

wa_final-mwsbp = wa_vbrp-mwsbp.

wa_final-kzwi4 = wa_vbrp-kzwi4.

wa_final-aubel = wa_vbrp-aubel.

wa_final-vstel = wa_vbrp-vstel.

wa_final-vbeln = wa_vbrp-vbeln.

wa_final-posnr = wa_vbrp-posnr.

clear wa_vbrk.

read table i_vbrk into wa_vbrk with key vbeln = wa_vbrp-vbeln.

if sy-subrc = 0.

wa_final-kunag = wa_vbrk-kunag.

wa_final-kdgrp = wa_vbrk-kdgrp.

wa_final-vbeln = wa_vbrk-vbeln.

wa_final-fksto = wa_vbrk-fksto.

wa_final-fkdat = wa_vbrk-fkdat.

wa_final-stceg = wa_vbrk-stceg.

wa_final-regio = wa_vbrk-regio.

wa_final-rfbsk = wa_vbrk-rfbsk.

WA_FINAL-TAXK1 = WA_VBRK-TAXK1.

WA_FINAL-TAXK2 = WA_VBRK-TAXK2.

endif.

clear wa_kna1.

read table i_kna1 into wa_kna1 with key kunnr = wa_vbrk-kunag.

if sy-subrc = 0.

wa_final-name1 = wa_kna1-name1.

wa_final-ort01 = wa_kna1-ort01.

wa_final-pstlz = wa_kna1-pstlz.

wa_final-stras = wa_kna1-stras.

wa_final-kunag = wa_kna1-kunnr.

endif.

clear wa_vbak.

read table i_vbak into wa_vbak with key vbeln = wa_vbrp-aubel. "kunnr = wa_vbrk-kunag.

if sy-subrc = 0.

wa_final-audat = wa_vbak-audat.

wa_final-kunag = wa_vbak-kunnr.

endif.

clear wa_likp.

read table i_likp into wa_likp with key vbeln = wa_vbrp-vgbel. "kunag = wa_vbrk-kunag.

if sy-subrc = 0.

wa_final-wadat_ist = wa_likp-wadat_ist.

wa_final-kunag = wa_likp-kunag.

endif.

clear wa_j_1iexchdr.

CLEAR WA_FINAL-EXNUM.

read table i_j_1iexchdr into wa_j_1iexchdr with key rdoc = wa_vbrk-vbeln. "kunag = wa_vbrk-kunag.

if sy-subrc = 0.

wa_final-exnum = wa_j_1iexchdr-exnum.

wa_final-kunag = wa_j_1iexchdr-kunag.

wa_final-werks = wa_j_1iexchdr-werks.

wa_final-rdoc = wa_j_1iexchdr-rdoc.

endif.

clear wa_marm.

read table i_marm into wa_marm with key matnr = wa_vbrp-matnr.

if sy-subrc = 0.

wa_final-meinh = wa_marm-meinh.

wa_final-umrez = wa_marm-umrez.

wa_final-umren = wa_marm-umren.

wa_final-matnr = wa_marm-matnr.

wa_final-FKIMG1 = wa_vbrp-FKIMG * ( wa_marm-umren / wa_marm-umrez ).

endif.

*clear wa_mseg.

*read table i_mseg into wa_mseg with key matnr = wa_vbrp-matnr.

*

*if sy-subrc = 0.

*

*wa_final-matnr = wa_mseg-matnr.

*wa_final-mblnr = wa_mseg-mblnr.

**wa_final-bktxt = wa_mkpf-bktxt.

**wa_final-xblnr = wa_mseg-xblnr.

*endif.

clear wa_mkpf.

read table i_mkpf into wa_mkpf with key xblnr = wa_vbrp-vgbel.

if sy-subrc = 0.

wa_final-budat = wa_mkpf-budat.

wa_final-mblnr = wa_mkpf-mblnr.

wa_final-bktxt = wa_mkpf-bktxt.

wa_final-xblnr = wa_mkpf-xblnr.

endif.

clear wa_t151t.

read table i_t151t into wa_t151t with key kdgrp = wa_vbrk-kdgrp.

if sy-subrc = 0.

wa_final-ktext = wa_t151t-ktext.

endif.

IF SY-SUBRC = 0.

wa_final-freight = wa_final-netwr - wa_final-kzwi4.

ENDIF.

IF SY-SUBRC = 0.

wa_final-total = wa_final-netwr + wa_final-mwsbp + wa_final-kzwi4 .

ENDIF.

APPEND WA_FINAL TO I_FINAL.

endloop.

endform.

FORM DATA_BUILD.

*break-point.

WA_FIELDCATALOG-FIELDNAME = 'KUNAG'.

WA_FIELDCATALOG-SELTEXT_M = 'Sold-to Party'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'KDGRP'.

WA_FIELDCATALOG-SELTEXT_M = 'Customer Group'.

WA_FIELDCATALOG-OUTPUTLEN = 13 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'KTEXT'.

WA_FIELDCATALOG-SELTEXT_M = 'Name'.

WA_FIELDCATALOG-OUTPUTLEN = 8 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'AUBEL'.

WA_FIELDCATALOG-SELTEXT_M = 'Sales Doc'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'AUDAT'.

WA_FIELDCATALOG-SELTEXT_M = 'Doc Date'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'VGBEL'.

WA_FIELDCATALOG-SELTEXT_M = 'Pgi. No.'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'WADAT_IST'.

WA_FIELDCATALOG-SELTEXT_M = 'Pgi.Date'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'EXNUM'.

WA_FIELDCATALOG-SELTEXT_M = 'Excise No.'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'VBELN' .

WA_FIELDCATALOG-SELTEXT_M = 'Bill Doc'.

WA_FIELDCATALOG-OUTPUTLEN = 12 .

wa_fieldcatalog-key = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'WERKS'.

WA_FIELDCATALOG-SELTEXT_M = 'Plant'.

WA_FIELDCATALOG-OUTPUTLEN = 8 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FKSTO'.

WA_FIELDCATALOG-SELTEXT_M = 'Cancel'.

WA_FIELDCATALOG-OUTPUTLEN = 8 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FKDAT'.

WA_FIELDCATALOG-SELTEXT_M = 'Billing Date'.

WA_FIELDCATALOG-OUTPUTLEN = 12 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'MATNR'.

WA_FIELDCATALOG-SELTEXT_M = 'Mat. No.'.

WA_FIELDCATALOG-OUTPUTLEN = 12 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'VRKME'.

WA_FIELDCATALOG-SELTEXT_M = 'Sales Unit'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

  • WA_FIELDCATALOG-SUBTOT = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FKIMG'.

WA_FIELDCATALOG-SELTEXT_L = 'Billed Qty in M/4FT/EA'.

WA_FIELDCATALOG-OUTPUTLEN = 20 .

WA_FIELDCATALOG-DO_SUM = 'X'.

  • COLLECT WA_FIELDCATALOG INTO FIELDCATALOG.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FKIMG1'.

WA_FIELDCATALOG-SELTEXT_M = 'Billed Qty in NOS.'.

WA_FIELDCATALOG-OUTPUTLEN = 20 .

WA_FIELDCATALOG-DO_SUM = 'X'.

  • COLLECT WA_FIELDCATALOG INTO FIELDCATALOG.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'NETWR'.

WA_FIELDCATALOG-SELTEXT_M = 'After Freight Amt.'."'Net Value'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

WA_FIELDCATALOG-DO_SUM = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'MWSBP'.

WA_FIELDCATALOG-SELTEXT_M = 'Tax Amount'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

WA_FIELDCATALOG-DO_SUM = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'KZWI4'.

WA_FIELDCATALOG-SELTEXT_M = 'Freight'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

WA_FIELDCATALOG-DO_SUM = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FREIGHT'.

WA_FIELDCATALOG-SELTEXT_M = 'Before freight Amt'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

WA_FIELDCATALOG-DO_SUM = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'TOTAL'.

WA_FIELDCATALOG-SELTEXT_M = 'Total Amount '.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

WA_FIELDCATALOG-DO_SUM = 'X'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'STCEG'.

WA_FIELDCATALOG-SELTEXT_M = 'Vat Reg. No.'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'VSTEL'.

WA_FIELDCATALOG-SELTEXT_M = 'Shipping Pt'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'REGIO'.

WA_FIELDCATALOG-SELTEXT_M = 'Region'.

WA_FIELDCATALOG-OUTPUTLEN = 8 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'RFBSK'.

WA_FIELDCATALOG-SELTEXT_M = 'PsSt'.

WA_FIELDCATALOG-OUTPUTLEN = 5 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'NAME1'.

WA_FIELDCATALOG-SELTEXT_M = 'Party Name'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'STRAS'.

WA_FIELDCATALOG-SELTEXT_M = 'Street Name'.

WA_FIELDCATALOG-OUTPUTLEN = 15 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'ORT01'.

WA_FIELDCATALOG-SELTEXT_M = 'City'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'PSTLZ'.

WA_FIELDCATALOG-SELTEXT_M = 'Postal Code'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'TAXK1'.

WA_FIELDCATALOG-SELTEXT_M = 'TAX1'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'TAXK2'.

WA_FIELDCATALOG-SELTEXT_M = 'TAX2'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'BUDAT'.

WA_FIELDCATALOG-SELTEXT_M = 'Grn Date'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'MBLNR'.

WA_FIELDCATALOG-SELTEXT_M = 'Grn NO'.

WA_FIELDCATALOG-OUTPUTLEN = 10 .

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

CLEAR WA_FIELDCATALOG.

REFRESH IT_SORT1.

CLEAR IT_SORT1.

IT_SORT1-FIELDNAME = 'VBELN'.

IT_SORT1-UP = 'X'.

IT_SORT1-SUBTOT = 'X'.

APPEND IT_SORT1.

CLEAR IT_SORT1.

  • IT_SORT1-FIELDNAME = 'VRKME'.

  • IT_SORT1-UP = 'X'.

  • IT_SORT1-SUBTOT = 'X'.

  • APPEND IT_SORT1.

  • CLEAR IT_SORT1.

endform.

FORM DATA_CALL.

  • data : itab type it_final occurs 0,

  • wa_itab type it_final.

*

*

*loop at i_final into wa_final.

*

*MOVE wa_final-VRKME to wa_itab-VRKME.

*

*add wa_final-fkimg to wa_itab-fkimg.

*

*

*

*

*

*MOVE wa_final-VRKME to wa_itab-VRKME.

*add wa_final-fkimg to wa_itab-fkimg.

*MOVE wa_final-VRKME to wa_itab-VRKME.

*

*

*append wa_itab to itab.

*clear: wa_final, wa_itab.

**endon.

**endat.

  • endloop.

*

*i_final[] = itab[].

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = GD_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = 'USER-COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = 'List Of Billing Document'

  • I_GRID_SETTINGS =

IS_LAYOUT = GD_LAYOUT

IT_FIELDCAT = FIELDCATALOG[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = IT_SORT1[]

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

I_SAVE = 'X'

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = I_FINAL

EXCEPTIONS

PROGRAM_ERROR = 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.

ENDFORM. "data_call

2 REPLIES 2

Former Member
0 Kudos
65

There is nop need the join the tables.

U can better use

<b>Select for all entries</b> statement since the records from first table are stored in an internal table.

Please reward if helpful.

Former Member
0 Kudos
65

Hi

Use for all entries of VBRP to fetch data from MKPF

if not i_vbrp{} is initial.

select f1 f2.. from mkpf for all entries in i_vbrp into table i_mkpf

where vgbel = i_vbrp-vgbel..

endif.

regards

Anji