How to display a report in tree format
hai can any one send me the code to display the report in a tree format
if i take example of customer numbers as tree branches and if i click each customer number the tree should expand showing all sales orders for a customer
ragrds
afzal
use FM HR_ALV_HIERSEQ_LIST_DISPLAY
there are 2 internal table , one for header and one for detail
below is code for reference
REPORT zinsd_quot_cont.
TYPES : BEGIN OF ty_vbak,
vbeln TYPE vbeln_va,
vkorg TYPE vkorg,
vtweg TYPE vtweg,
spart TYPE spart,
vkbur TYPE vkbur,
vkgrp TYPE vkgrp,
angdt TYPE angdt_v,
bnddt TYPE bnddt,
kunnr TYPE kunnr,
kwmeng TYPE kwmeng,
meins TYPE meins,
kunwe TYPE kunnr,
name1 TYPE name1_gp ,
name2 TYPE name1_gp ,
sel(1),
expand(1),
salesdocument TYPE bapivbeln-vbeln,
message TYPE bapi_msg,
END OF ty_vbak.
DATA : w_vbak TYPE ty_vbak,
t_vbak TYPE TABLE OF ty_vbak.
DATA : w_update TYPE ty_vbak,
t_update TYPE TABLE OF ty_vbak.
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kunnr,
name1 TYPE name1_gp ,
END OF ty_kna1.
DATA : w_kna1 TYPE ty_kna1,
t_kna1 TYPE TABLE OF ty_kna1.
TYPES : BEGIN OF ty_vbap,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
matnr TYPE matnr,
matkl TYPE matkl,
werks TYPE werks_ext,
kwmeng TYPE kwmeng,
meins TYPE meins,
mvgr5 TYPE mvgr5,
maktx TYPE maktx,
END OF ty_vbap.
DATA : w_vbap TYPE ty_vbap,
t_vbap TYPE TABLE OF ty_vbap.
TYPES : BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
DATA : w_makt TYPE ty_makt,
t_makt TYPE TABLE OF ty_makt.
TYPES : BEGIN OF ty_sum,
vbeln TYPE vbeln_va,
kwmeng TYPE kwmeng,
END OF ty_sum.
DATA : w_sum TYPE ty_sum,
t_sum TYPE TABLE OF ty_sum.
TYPES : BEGIN OF ty_vbpa,
vbeln TYPE vbeln,
posnr TYPE posnr,
parvw TYPE parvw,
kunnr TYPE kunnr,
END OF ty_vbpa.
DATA : w_vbpa TYPE ty_vbpa,
t_vbpa TYPE TABLE OF ty_vbpa.
TYPES : BEGIN OF ty_vbup,
vbeln TYPE vbeln,
posnr TYPE posnr ,
gbsta TYPE gbsta ,
END OF ty_vbup.
DATA : w_vbup TYPE ty_vbup,
t_vbup TYPE TABLE OF ty_vbup.
TYPE-POOLS slis.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv,
w_fieldcatalog TYPE slis_fieldcat_alv,
w_layout TYPE slis_layout_alv,
gs_keyinfo TYPE slis_keyinfo_alv.
DATA: g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname.
data definition
Batchinputdata of single transaction
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
messages of call transaction
DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA : g_lines TYPE i.
*Selection Screen
TABLES : vbak,vbap.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS s_vkorg FOR vbak-vkorg. " Sales Org
SELECT-OPTIONS s_vtweg FOR vbak-vtweg. " Dist Channel
SELECT-OPTIONS s_spart FOR vbak-spart. " Division
SELECT-OPTIONS s_vkbur FOR vbak-vkbur. " Sales Off
SELECT-OPTIONS s_vkgrp FOR vbak-vkgrp. " Sales Grp
SELECT-OPTIONS s_matkl FOR vbap-matkl. " Mat Grp
SELECT-OPTIONS s_werks FOR vbap-werks. " Plant
SELECT-OPTIONS s_period FOR vbak-angdt. " Sales Off
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM f_getdata.
PERFORM f_initdata.
END-OF-SELECTION.
PERFORM f_createalv.
PERFORM f_dispalv.
*& Form f_getdata
text
--> p1 text
<-- p2 text
FORM f_getdata .
*Sales Header
SELECT
vbeln
vkorg
vtweg
spart
vkbur
vkgrp
angdt
bnddt
kunnr
INTO TABLE t_vbak
FROM vbak
WHERE
vkorg IN s_vkorg " Sales Org
AND vtweg IN s_vtweg " Dist Channel
AND spart IN s_spart " Division
AND vkbur IN s_vkbur " Sales Off
AND vkgrp IN s_vkgrp " Sales Grp
AND angdt IN s_period
AND bnddt IN s_period
AND auart = 'ZQMO'
AND vbtyp = 'B'.
*CUST NAME
SELECT
kunnr
name1
INTO TABLE t_kna1
FROM kna1
FOR ALL ENTRIES IN t_vbak
WHERE
kunnr = t_vbak-kunnr
*Sales Item
SELECT
vbeln
posnr
matnr
matkl
werks
kwmeng
meins
mvgr5
INTO TABLE t_vbap
FROM vbap
FOR ALL ENTRIES IN t_vbak
WHERE
vbeln = t_vbak-vbeln
AND matkl IN s_matkl " Mat Grp
AND werks IN s_werks " Plant
*Partners
SELECT
vbeln
posnr
parvw
kunnr
INTO TABLE t_vbpa
FROM vbpa
FOR ALL ENTRIES IN t_vbak
WHERE
vbeln = t_vbak-vbeln.
IF t_vbpa[] IS NOT INITIAL.
SELECT
kunnr
name1
APPENDING TABLE t_kna1
FROM kna1
FOR ALL ENTRIES IN t_vbpa
WHERE
kunnr = t_vbpa-kunnr
ENDIF.
*Status - Sales Doc
SELECT
vbeln
posnr
gbsta
INTO TABLE t_vbup
FROM vbup
FOR ALL ENTRIES IN t_vbap
WHERE
vbeln = t_vbap-vbeln
AND posnr = t_vbap-posnr
AND gbsta NE 'C'.
SELECT
matnr
maktx
INTO TABLE t_makt
FROM makt
FOR ALL ENTRIES IN t_vbap
WHERE
matnr = t_vbap-matnr
AND spras = 'E'.
ENDFORM. " f_getdata
*& Form f_initdata
text
--> p1 text
<-- p2 text
FORM f_initdata .
SORT t_vbap BY vbeln DESCENDING.
*delete all closed stat items
LOOP AT t_vbap INTO w_vbap.
READ TABLE t_vbup INTO w_vbup
WITH KEY
vbeln = w_vbap-vbeln
posnr = w_vbap-posnr.
IF sy-subrc <> 0.
DELETE t_vbap.
CONTINUE.
ELSE.
READ TABLE t_makt INTO w_makt
WITH
KEY matnr = w_vbap-matnr.
IF sy-subrc = 0.
w_vbap-maktx = w_makt-maktx.
MODIFY t_vbap FROM w_vbap.
ENDIF.
ENDIF.
ENDLOOP.
*find the total quantity
LOOP AT t_vbap INTO w_vbap.
w_sum-vbeln = w_vbap-vbeln.
w_sum-kwmeng = w_vbap-kwmeng.
COLLECT w_sum INTO t_sum.
CLEAR w_sum.
ENDLOOP.
*populate header
LOOP AT t_vbak INTO w_vbak.
Quantity - Total
READ TABLE t_sum INTO w_sum
WITH KEY
vbeln = w_vbak-vbeln.
IF sy-subrc = 0.
w_vbak-kwmeng = w_sum-kwmeng.
ELSE.
CLEAR w_vbak-kwmeng.
ENDIF.
UoM
READ TABLE t_vbap INTO w_vbap
WITH KEY
vbeln = w_vbak-vbeln.
IF sy-subrc = 0.
w_vbak-meins = w_vbap-meins.
ELSE.
CLEAR w_vbak-meins.
ENDIF.
Partner
READ TABLE t_vbpa INTO w_vbpa
WITH KEY
vbeln = w_vbak-vbeln
parvw = 'WE'.
IF sy-subrc = 0.
w_vbak-kunwe = w_vbpa-kunnr.
ELSE.
CLEAR w_vbak-kunwe.
ENDIF.
SHIP TO PARTY NAME
READ TABLE t_kna1 INTO w_kna1
WITH KEY
kunnr = w_vbak-kunwe.
IF sy-subrc = 0.
w_vbak-name2 = w_kna1-name1.
ENDIF.
CUST NAM - SOLD TO PARTY
READ TABLE t_kna1 INTO w_kna1
WITH KEY
kunnr = w_vbak-kunnr.
IF sy-subrc = 0.
w_vbak-name1 = w_kna1-name1.
ENDIF.
MODIFY t_vbak FROM w_vbak.
ENDLOOP.
DELETE t_vbak WHERE kwmeng IS INITIAL.
SORT t_vbak BY vbeln DESCENDING.
SORT t_vbap BY vbeln DESCENDING posnr ASCENDING.
ENDFORM. " f_initdata
*& Form f_createalv
Create Field Cat.
--> p1 text
<-- p2 text
FORM f_createalv .
g_tabname_header = 't_vbak'.
g_tabname_item = 't_vbap' .
CLEAR gs_keyinfo.
gs_keyinfo-header01 = 'VBELN'.
gs_keyinfo-item01 = 'VBELN'.
*VBAK
w_fieldcatalog-fieldname = 'VBELN'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Sales Document'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'VKORG'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Sales Org'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'VTWEG'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Dist Channel'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'SPART'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Division'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'VKBUR'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Sales Office'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'VKGRP'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Sales GRP'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'KUNNR'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Sold to Party'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'NAME1'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-outputlen = 35.
w_fieldcatalog-seltext_l = 'Sold to Party Code - Name'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'KUNWE'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Ship to Party'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'NAME2'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Ship Party Code - Name'.
w_fieldcatalog-outputlen = 35.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'KWMENG'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Quantity'.
w_fieldcatalog-outputlen = 25.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MEINS'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'UoM'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'SALESDOCUMENT'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Document'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MESSAGE'.
w_fieldcatalog-tabname = 't_vbak'.
w_fieldcatalog-seltext_l = 'Log'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
*VBAP
w_fieldcatalog-fieldname = 'POSNR'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'POS'.
w_fieldcatalog-outputlen = 6.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MATNR'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'Material'.
w_fieldcatalog-outputlen = 18.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MAKTX'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'Material Desc'.
w_fieldcatalog-outputlen = 40.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MATKL'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'Material Grp'.
w_fieldcatalog-outputlen = 9.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MVGR5'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'MCNO'.
w_fieldcatalog-outputlen = 4.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'WERKS'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'Plant'.
w_fieldcatalog-outputlen = 91.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'KWMENG'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'Quantity'.
w_fieldcatalog-outputlen = 25.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
w_fieldcatalog-fieldname = 'MEINS'.
w_fieldcatalog-tabname = 't_vbap'.
w_fieldcatalog-seltext_l = 'UoM'.
APPEND w_fieldcatalog TO t_fieldcatalog.
CLEAR: w_fieldcatalog.
LAYOUT
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
w_layout-expand_fieldname = 'EXPAND'.
w_layout-box_fieldname = 'SEL'.
w_layout-box_tabname = 't_vbak'.
ENDFORM. " f_createalv
*& Form f_dispalv
Call ALV
--> p1 text
<-- p2 text
FORM f_dispalv .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = w_layout
it_fieldcat = t_fieldcatalog
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header = g_tabname_header
i_tabname_item = g_tabname_item
is_keyinfo = gs_keyinfo
TABLES
t_outtab_header = t_vbak
t_outtab_item = t_vbap
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " f_dispalv
*& Form set_pf_status
PF stat
-->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZINSD_QUOT_CONT_ST'.
ENDFORM. "set_pf_status
*& Form user_command
Process List UCOMM
-->R_UCOMM text
-->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
REFRESH t_update.
IF r_ucomm = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
IF r_ucomm = 'EXECUTE'.
LOOP AT t_vbak INTO w_update
WHERE
sel = 'X'
AND salesdocument = ' '.
APPEND w_update TO t_update.
ENDLOOP.
IF t_update[] IS NOT INITIAL.
LOOP AT t_update INTO w_update.
PERFORM f_bapi_contract_createfromdata USING w_update.
PERFORM f_bdc_contract_from_quotation.
MODIFY t_update FROM w_update.
ENDLOOP.
ELSE.
ENDIF.
PERFORM f_dispalv.
ENDIF.
IF r_ucomm = '&IC1'.
IF rs_selfield-sel_tab_field = 't_vbak-VBELN'.
SET PARAMETER ID 'AGN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.
ENDIF.
IF rs_selfield-sel_tab_field = 't_vbak-SALESDOCUMENT' AND
rs_selfield-value NE ' '.
SET PARAMETER ID 'KTN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "user_command
*& Form F_BAPI_CONTRACT_CREATEFROMDATA
BAPI CALL
-->P_W_UPDATE text
FORM f_bapi_contract_createfromdata USING p_w_update STRUCTURE w_update .
DATA : w_contract_header_in TYPE bapisdhd1 ,
w_contract_header_inx TYPE bapisdhd1x ,
t_contract_items_in TYPE TABLE OF bapisditm WITH HEADER LINE,
t_contract_items_inx TYPE TABLE OF bapisditmx WITH HEADER LINE,
t_contract_partners TYPE TABLE OF bapiparnr WITH HEADER LINE,
t_return TYPE TABLE OF bapiret2 WITH HEADER LINE.
CLEAR : w_contract_header_in,
w_contract_header_inx.
REFRESH : t_contract_items_in,
t_contract_items_inx,
t_contract_partners,
t_return.
w_contract_header_in-doc_type = 'ZCNT'.
w_contract_header_in-sales_org = p_w_update-vkorg.
w_contract_header_in-distr_chan = p_w_update-vtweg.
w_contract_header_in-division = p_w_update-spart.
w_contract_header_in-ct_valid_f = p_w_update-angdt.
w_contract_header_in-ct_valid_t = p_w_update-bnddt.
w_contract_header_inx-doc_type = 'X'.
w_contract_header_inx-sales_org = 'X'.
w_contract_header_inx-distr_chan = 'X'.
w_contract_header_inx-division = 'X'.
w_contract_header_inx-ct_valid_f = 'X'.
w_contract_header_inx-ct_valid_t = 'X'.
LOOP AT t_vbap INTO w_vbap
WHERE
vbeln = p_w_update-vbeln.
t_contract_items_in-material = w_vbap-matnr.
t_contract_items_in-plant = w_vbap-werks.
t_contract_items_in-target_qty = w_vbap-kwmeng.
t_contract_items_in-target_qu = w_vbap-meins.
t_contract_items_in-ref_doc = w_vbap-vbeln.
t_contract_items_in-ref_doc_it = w_vbap-posnr.
t_contract_items_in-ref_doc_ca = 'B'.
t_contract_items_in-prc_group5 = w_vbap-mvgr5.
t_contract_items_inx-material = 'X'.
t_contract_items_inx-plant = 'X'.
t_contract_items_inx-target_qty = 'X'.
t_contract_items_inx-target_qu = 'X'.
t_contract_items_inx-ref_doc = 'X'.
t_contract_items_inx-ref_doc_it = 'X'.
t_contract_items_inx-ref_doc_ca = 'X'.
t_contract_items_inx-prc_group5 = 'X'.
APPEND t_contract_items_in.
APPEND t_contract_items_inx.
ENDLOOP.
LOOP AT t_vbpa INTO w_vbpa
WHERE
vbeln = p_w_update-vbeln.
AND posnr = w_vbap-posnr.
t_contract_partners-partn_role = w_vbpa-parvw.
t_contract_partners-partn_numb = w_vbpa-kunnr.
t_contract_partners-itm_number = w_vbpa-posnr.
APPEND t_contract_partners.
ENDLOOP.
CALL FUNCTION 'BAPI_CONTRACT_CREATEFROMDATA'
EXPORTING
SALESDOCUMENTIN =
contract_header_in = w_contract_header_in
contract_header_inx = w_contract_header_inx
SENDER =
BINARY_RELATIONSHIPTYPE = ' '
INT_NUMBER_ASSIGNMENT = ' '
BEHAVE_WHEN_ERROR = ' '
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
salesdocument = p_w_update-salesdocument
TABLES
return = t_return
contract_items_in = t_contract_items_in
contract_items_inx = t_contract_items_inx
contract_partners = t_contract_partners
CONTRACT_CONDITIONS_IN =
CONTRACT_CONDITIONS_INX =
CONTRACT_CFGS_REF =
CONTRACT_CFGS_INST =
CONTRACT_CFGS_PART_OF =
CONTRACT_CFGS_VALUE =
CONTRACT_CFGS_BLOB =
CONTRACT_CFGS_VK =
CONTRACT_CFGS_REFINST =
CONTRACT_DATA_IN =
CONTRACT_DATA_INX =
CONTRACT_TEXT =
CONTRACT_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
IF p_w_update-salesdocument NE ' ' .
p_w_update-message = 'SUCCESS'.
ELSE.
READ TABLE t_return INDEX 1.
p_w_update-message = t_return-message.
ENDIF.
READ TABLE t_vbak INTO w_vbak
WITH KEY
vbeln = p_w_update-vbeln.
IF sy-subrc = 0.
MODIFY t_vbak INDEX sy-tabix FROM p_w_update .
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDFORM. " F_BAPI_CONTRACT_CREATEFROMDATA
*& Form f_bdc_contract_from_Quotation
BAPI CALL
-->P_W_UPDATE text
FORM f_bdc_contract_from_quotation.
DATA : l_date TYPE char10.
REFRESH : messtab, bdcdata.
CLEAR : messtab, bdcdata.
PERFORM bdc_dynpro USING 'SAPMV45A' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=COPY'.
PERFORM bdc_field USING 'VBAK-AUART'
'ZCNT'.
PERFORM bdc_dynpro USING 'SAPLV45C' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=RANG'.
PERFORM bdc_dynpro USING 'SAPLV45C' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=UEBR'.
PERFORM bdc_field USING 'LV45C-VBELN'
w_update-vbeln.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
IF NOT w_update-angdt IS INITIAL.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = w_update-angdt
IMPORTING
date_external = l_date
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
PERFORM bdc_field USING 'VBAK-GUEBG'
l_date.
ENDIF.
IF NOT w_update-bnddt IS INITIAL.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = w_update-bnddt
IMPORTING
date_external = l_date
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
PERFORM bdc_field USING 'VBAK-GUEEN'
l_date.
ENDIF.
CALL TRANSACTION 'VA41' USING bdcdata
MODE 'E'
UPDATE 'S'
MESSAGES INTO messtab.
break abap.
READ TABLE messtab WITH KEY msgid = 'V1'
msgnr = '311'.
IF sy-subrc EQ 0.
w_update-message = 'SUCCESS'.
w_update-salesdocument = messtab-msgv2.
ELSE.
READ TABLE messtab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
DATA : l_info TYPE einfo.
CLEAR l_info.
l_info-msgid = messtab-msgid.
l_info-msgty = messtab-msgtyp.
l_info-msgno = messtab-msgnr.
l_info-msgv1 = messtab-msgv1.
l_info-msgv2 = messtab-msgv2.
l_info-msgv3 = messtab-msgv3.
l_info-msgv4 = messtab-msgv4.
CALL FUNCTION 'MESSAGE_GET_TEXT'
EXPORTING
ieinfo = l_info
ilangu = sy-langu
IMPORTING
etext = w_update-message
EXCEPTIONS
no_t100_found = 1
OTHERS = 2.
ENDIF.
ENDIF.
READ TABLE t_vbak INTO w_vbak WITH KEY vbeln = w_update-vbeln.
IF sy-subrc = 0.
MODIFY t_vbak INDEX sy-tabix FROM w_update transporting message
salesdocument.
ENDIF.
ENDFORM. " f_bdc_contract_from_Quotation
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
Similar Messages
-
Display of report in excel format.
Hi,
How to display a report in excel format?? I have the display details in an internal table.
Is it possible for the output to come in excel format as soon as we run the pgm other.than downloading from list or grid format..If so how to do it??Kindly help..
Thanks..Hi,
Once you have all the data in the internal table, just use function module 'Download' or 'WS_Download' and pass the parameters in function module like the below for example.
if not i_list[] is initial. " i_list is an internal table
call function 'WS_DOWNLOAD'
exporting
filename = filename1
filetype = 'DAT'
tables
data_tab = i_list
fieldnames = i_header "i _header has the field names
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
others = 8.
endif.
Now, the excel will be created which has all the data.
Hope this helps.
Thanks,
Srinivasa -
How to get a report in pdf format.
Hi Experts,
Could any one let me know that, how to get the report in PDF format.
Once a report is generated it should be displayed in pdf format or downloaded in pdf format.
Thanks in Advance,
Regards,
Irfan HussainHi,
Check out this code:
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
Regards,
Gayathri -
How to generate my report in HTML format
Hi
I am using Forms and reports 6i . How to generate a report in Html format.
Please explain what are the option available in reports and the way to do
thanks in advance
prasanth a.s.*specify desformat=html in cmd line
refer
* Forms Reports integration 6i
http://otn.oracle.com/products/forms/pdf/277282.pdf
[ All Docs for all versions ]
http://otn.oracle.com/documentation/reports.html
[ Publishing reports to web - 10G ]
http://download.oracle.com/docs/html/B10314_01/toc.htm (html)
http://download.oracle.com/docs/pdf/B10314_01.pdf (pdf)
[ Building reports - 10G ]
http://download.oracle.com/docs/pdf/B10602_01.pdf (pdf)
http://download.oracle.com/docs/html/B10602_01/toc.htm (html)
[ Forms Reports Integration whitepaper 9i ]
http://otn.oracle.com/products/forms/pdf/frm9isrw9i.pdf
--------------------------------------------------------------------------------- -
How to export the report in HTML format for desktop application
Hi,
i have wrote the JRC desktop application to export the report and i am able to export it in PDF and other formats as mentioned in "ReportExportFormat" API.
i would like to know is there any API there which can export the report in HTML format.
i know it would be possible with web based application of JRC, but how can i do it in desktop application?There's no mechanism for static HTML pages that displays the report.
You can use the CrystalReportViewer DHTML viewer, but that's 'interactive'.
Sincerely,
Ted Ueda -
How to show alv report in tree structure
hi all,
how to show data or create a alv report in tree structure.
thanks in advance.
HarshaHi Harsha,
Its done using FM 'RS_TREE_CONSTRUCT'
and FM for displaying the tree: 'RS_TREE_LIST_DISPLAY'
Thanks
Shrila -
How to display a report in a container
Hello All,
There are 2 scenarios:-
1) On left side navigation panel, I have a tree control. On double click on a node of a tree, I want to display a "report output" on the right panel. I have created the left panel and right panel by splitting the main custom container using splitter control. But I am not able to submit a report output on double click event of tree node as I dont know how to specify the parent container for the report.
2) I want to divide the custom container into 4 equal parts. Then each part should display four reports which are output of 4 different programs.
Kindly help me out with his issue.
Needless to say that points will be awarded
Thanks n Regards,
AbhishekHi Abhishek,
you can't run a program in an container. That's not possible. But you can handle your requirement using one of the following ways:
Way 1:
Call the program in the double click event handler method by using the the statement e.g. submit and return. The program is then called in a separate screen(not in the container).
Way 2:
Copy the functionnality of the program in e.g. function module(FM). This FM gets the input parameters, processes the input and returns the results. The results are displayed e.g. in an ALV Grid. The steps getting the display results and setting the display data for the ALV are handled in the double click event handler method.
Best Regards, Edemey -
Display problem - report /w break formatting
Hi everyone,
I'm having a display problem in a standard report with break formatting on first column and repeat headings on break. Whenever I start a new page and a new group of data starts, the heading for the break is displayed 2 times. If the new page doesn't start with a new group, there's no problem.
I've made an exemple there : http://apex.oracle.com/pls/apex/f?p=25160:9
You can see the group #1 on the first page, no problem there.
On the second page, the group #2 begins and the header is repeated.
On the last page, the header for group #3 is not repeated because it was started on the previous page.
Why is the header for group #2 repeated ? How can I correct this ?
Thanks,
PatrickHi all,
I think it is a BUG, that was not fixed in 4.2.
Is it possible to workaround it????
Probably dynamic action with something like this javascript $("#my_table_id").find("tbody tr:(:eq(0))").remove(); With "On-Change" Event on the Region?
But this javascript should be execute only on the pages greather than 1. How can I check in javascript which page of report is actually shown???
Ideas, please! -
UG: Employee supervisor report in tree format in xml/rdf format
Hi Experts,
i have design the query for employee supervisor bur now i have to design a report just like "TREE STRUCTURE FORMAT"
Please guide how to do the same.
It's very Urgent
Query is :
SELECT LEVEL,
LPAD(' ',10*(LEVEL-1)) || peo.full_name name,
org.name assignment,
job.name job,
loc.location_code location,
asg.person_id person_id
FROM
per_all_assignments_f asg,
per_all_people_f peo,
hr_locations_all loc,
hr_all_organization_units_tl org,
per_jobs_tl job
WHERE 1=1
AND peo.person_id = asg.person_id
AND NVL(peo.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
AND NVL(asg.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
AND asg.assignment_status_type_id = 1
AND loc.location_id = asg.location_id
AND org.organization_id = asg.organization_id
AND job.job_id = asg.job_id
START WITH 1=1
--AND asg.person_id = 408
AND NVL(peo.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
AND NVL(asg.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
--AND peo.employee_number 'iExpense_Admin'
CONNECT BY PRIOR
asg.person_id = asg.supervisor_id
AND NVL(peo.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
AND NVL(asg.effective_end_date,TO_DATE('01-01-2200','dd-mm-yyyy')) > SYSDATE
--AND peo.employee_number 'iExpense_Admin'
ORDER SIBLINGS BY
peo.full_name,
org.nameHi Pratul,
As amit requirement to get report in Tree structure. Which standards file you want to say to customize.
Amit, we was having same requirements a long back, we full fill using OAF page in HGRID form.
Thanks -
Displaying a report in matrix format
Hi,
I want to display my report in the below given format, i have tried many ways but i didnt get the correct output. Please help.
I will one Change Request and some Transport Requests will be assigned to it and some objects which belong to that transport requests will be displayed below.
Now I have put 'X' mark to the objects which belong to the transport requests. There can be one or more objects for a particular transport request.
The data should be displayed like this.
SNO TR1 TR2 TR3
Obj1 X X
Obj2 X
Obj3 X X
Obj4 X X X
Obj5 X
TR above means Transport Request.
Objects can be either programs, tables, function modules etc.,
I have given just an example, the data should be displayed in the above manner, could anyone please help.
Thanks & Regards
Haritha.Hi
U should have an internal table like this:
.DATA: BEGIN OF ITAB OCCURS 0,
OBJECT_NAME TYPE TADIR-OBJ_NAME,
TR1 TYPE FLAG,
TR2 TYPE FLAG,
TR3 TYPE FLAG,
TR4 TYPE FLAG,
TR5 TYPE FLAG,
TRN TYPE FLAG,
END OF ITAB.
The first field is the abap object name, the others are the flag for the requets: the header of every TR* field will be the number of the request.
Now the problem is to understand how many transport u want to need to manage in your report: because if you need to manage N requests, your internal table ITAB will be a "statical" internal table with N fields type TR, else u need to use the dynamic internal table.
Max
Edited by: max bianchi on Nov 17, 2008 4:42 PM
Edited by: max bianchi on Nov 17, 2008 4:55 PM -
How to display currency values in indian format
hi all,
When I am displaying Currency values as output , those are displaying in U.S. format (ie.1,234,000.00) , But I need to display those in Indian Rupee format (i.e 12,34,000.00).
Plz any one can help me that how to display this
thank you,
regards
HanumaHi Hanuma kumar, please try this code.
REPORT ZAMOUNT_CONVERSION.
DATA : RESULT1(20).
PARAMETERS : NUM TYPE P DECIMALS 2.
DATA : num2 type STRING.
DATA : col_amt(20) type n,"15
col_b type i,
num_1(20) type C,"15
Length type i.
num_1 = num.
write : 'default format :',num.
uline.
skip.
IF ( num >= 999999999 ).
write num_1 using edit mask 'RR__,__,__,__,______' to col_amt.
CONDENSE col_amt.
length = STRLEN( col_amt ).
if length = 16.
REPLACE first OCCURRENCE OF ',' in col_amt with space.
write :/'amount indian format:',col_amt.
else.
write :/'amount indian format:',col_amt.
endif.
ELSEIF NUM < 999999999 AND NUM >= 9999999.
write num_1 using edit mask 'RR__,__,__,______' to col_amt.
condense col_amt .
length = STRLEN( COL_AMT ).
if length = 13.
REPLACE first OCCURRENCE OF ',' in col_amt with space.
write :/'amount indian format:',col_amt.
else.
write :/'amount indian format:',col_amt.
endif.
ELSEIF NUM < 9999999 AND NUM >= 99999.
write num_1 using edit mask 'RR__,__,______' to col_amt.
condense col_amt .
length = STRLEN( COL_AMT ).
write :/'amount indian format:',col_amt.
ELSEIF NUM < 99999.
data : dumy(10) type c.
dumy = num .
CONDENSE dumy.
length = STRLEN( dumy ).
if length <= 6.
write :/'amount indian format:',num.
else.
write num_1 using edit mask 'RR__,______' to col_amt.
write :/'amount indian format:',col_amt.
endif.
ENDIF.
uline. -
How to Display Excel Report in Client machine in Forms11g
Hi All,
we are running database in Linux server and separate Linux Application Server , But my question is how to display the data to Excel Report in the Client machine
in Forms11g applications.
Plesase suggest any method.
Regards
Venkatesulu GunisettyYou should use webutils.
For proper answer, place ur request here in oracle Forms Thread,
Forms -
How to generate jasper report in pdf format using swing
hi all,
im new to swing and jasper.. can anybody provide me some example on how to generate the jasper report in pdf format? i will call the reportManager from sessionBean.. below is my code:
1)delegate:
public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
GenerateReportDto generateReportDto = getAuditTrailServiceRemote().generateIntoPdfReport(fileName, outputFileName, parameters);
return generateReportDto;
2)sessionBean:
public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
//Map parameters = new HashMap();
ReportManager reportManager = new ReportManager();
3)ReportManager()
public void generateIntoPdfReport(String fileName, String outputFileName, Map parameters) {
Connection conn = null;
try {
conn = dataSource.getConnection();
//Generate the report to bytes
File reportFile = new File(fileName);
byte[] bytes =
JasperRunManager.runReportToPdf(
reportFile.getPath(),
parameters,
conn
//conn.close();
//Write the bytes to a file
ByteBuffer buf = ByteBuffer.wrap(bytes);
File file = new File(outputFileName);
// (if the file exists)
boolean append = false;
// Create a writable file channel
FileChannel wChannel = new FileOutputStream(file, append).getChannel();
// Write the ByteBuffer contents; the bytes between the ByteBuffer's
// position and the limit is written to the file
wChannel.write(buf);
// Close the file
wChannel.close();
} finally {
if (conn != null) {
conn.close();
Any help would be highly appreciated. Thanks in advanceHi ,
One 'simple' way is by using the DBMS_SCHEDULER db package and the procedure CREATE_JOB(....) using as job_type the value 'EXECUTABLE'...
Read for further info in 'PL/SQL Packages and Types Reference'.
If you have access to OEM ... you can configure this there using wizard.....
Other way is to use the External Procedure call capabiblity of Oracle DB Server...:
http://www.oracle.com/pls/db102/ranked?word=external+procedure+call&remark=federated_search
My greetings,
Sim -
hi experts
i have a report which displays out put in alv grid display with 17 fields.
my requirement is i have to change the alvgrid display output into ALV Tree with
9 levels with fields and their descriptions.
i should mantain back option in alv tree output.when i press back button it should come to
selection scree or previous screen.
3).can any one help me in the requirement.
thanks advanance.
sailajaHello Sailaja
You may want to have a look at sample report ZUS_SDN_ALV_TREE_DEMO in thread
alv tree checbox problem when attempt to get the selected checjboxes
Regards
Uwe -
Subject: How to get MB5B report in excel format
Dear experts,
Please help me how I get automatically MB5B Report in excel format. In Layout there is no option to convert excel format.
regards,
rss
Edited by: rs_sharma on Jun 26, 2011 10:16 AMDear experts,
Please help me how I get automatically MB5B Report in excel format. In Layout there is no option to convert excel format.
regards,
rss
Edited by: rs_sharma on Jun 26, 2011 10:16 AM
Maybe you are looking for
-
Icloud sync with outlook - 2 way
Folks I have had a problem syncing my calendar with outlook. OI seem top be able to enter an event in outlook and it makes it's way to the iphone - over wifi. what I can't do is the same thing the otherway around. tried loads of things and changed se
-
An unexpected error occurred I -200 in Muse.
I have reset password as well as followed all instructions here http://helpx.adobe.com/muse/kb/unexpected-error-occurred-i-200.html now I cannot even use Muse
-
N70 Unable to establish network connection using p...
. . . but can browse the net using handset alone; PC suite can do other functions but OTA is not able to connect. This happened after I downloaded the latest PC Suite 7. Recommendation of FAQ/Help is to check connections settings (duh) and have coope
-
New internal hard drive in my imac - troubles installing Mac OS
I just had to replace my imac's internal drive because it died. I bought an 500gb Western Digital Caviar Blue OEM WD5000AAKS. I installed it just fine, and I reformatted it by going to utilities and erasing the drive and setting it to mac os extended
-
Olap Excel Plug-in Security?
How does the OLAP Excel plug-in handle security? Does it require database level accounts, or can it use applications-mode security, similar to what presenting an OLAP AW Workspace through an apps-mode Drake EUL would do? We have users that potentiall