-vbak --header table
--vbap --item table
--objective of the program :--create program on sd sales which has following category.
INTERACTIVE REPORT
--when user ineract with any item than it shows detail of that item.
--first we need order header data structure ty_vbak from this we gona call ty_vbap.
---there are two level of creation in first level we create it as usual.
--another way of creating table is
--in second level we have created work area first and then use like line of to put it in internal
[Link] is not compulsory to create like this.
--for two report shows we have to use hide statement.
--for first hide statement.
---we have to use hide after write statement in second index also.
--at line selection is used which confirm that which level we are in.
-- program is like
REPORT ZR_SALES.
TABLES : vbak,vbap,vbep.
TYPES : BEGIN OF ty_vbak,
vbeln TYPE vbeln_va,
erdat TYPE erdat,
ernam TYPE ernam,
END OF ty_vbak.
types : BEGIN OF ty_vbap,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
matnr TYPE matnr,
END OF ty_vbap.
TYPES : BEGIN OF ty_vbep,
vbeln type vbeln_va,
posnr TYPE posnr,
etenr TYPE etenr,
wmeng TYPE wmeng,
bmeng TYPE bmeng,
END OF ty_vbep.
data :it_vbep TYPE TABLE OF ty_vbep,
wa_vbep TYPE ty_vbep.
data : it_vbap TYPE TABLE OF ty_vbap,
wa_vbap TYPE ty_vbap.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
data : it_vbak TYPE TABLE OF ty_vbak,
wa_vbak TYPE ty_vbak.
SELECT vbeln erdat ernam from vbak into TABLE it_vbak
WHERE vbeln in s_vbeln.
LOOP AT it_vbak INTO wa_vbak.
WRITE : wa_vbak-vbeln,wa_vbak-erdat,wa_vbak-ernam.
hide : wa_vbak-vbeln,wa_vbak-erdat,wa_vbak-ernam.
ENDLOOP.
AT LINE-SELECTION.
if sy_lsind = 1.
SELECT vbeln posnr matnr from vbap INTO TABLE it_vbap WHERE vbeln = wa_vb
ak-vbeln.
LOOP AT it_vbap INTO wa_vbap.
WRITE : / wa_vbap-vbeln,wa_vbap-posnr,wa_vbap-matnr.
hide : wa_vbap-vbeln,wa_vbap-posnr,wa_vbap-matnr.
ENDLOOP.
ENDIF.
if sy_lsind = 2.
SELECT vbeln posnr etenr ernam from vbep INTO TABLE it_vbep
WHERE vbeln = wa_vbap-vbeln
and posnr = wa_vbap-posnr.
---sy_lsind is index no in which you are in if you are on first level than
sy_lsind = 1 and if you are on second level than sy_lsind = 2.
--
orwe can write also
GET CURSOR
--For what i click in base table it should show respective data ex-if i click order filed it gets info
of order and if i click customer it get info about customer.
--first we need to create fields and value.
--fld,val is a variable .
--filed specify technical descrpition of field.
--value specify actual value of that field.
--we have click on order no so its shows wa_vbak-vbeln
--if we click on customer no it shows wa_vbak-kunnr.
and value contain custoer no.
--then vbeln (order) is executed.
--then customer no is executed.