Thursday, December 27, 2012

Download and Upload files in Application Server


Download file from Application server
Tcode: CG3Y 

Upload files to Application Server
Tcode: CG3Z

Check files in AL11


Thursday, December 20, 2012

Dynamically make cell readonly in table web dynpro






Now assign to all the fields.

** condition for the editable or read only.
method WDDOINIT .

  DATA lo_nd_mara TYPE REF TO if_wd_context_node.
  DATA lt_mara TYPE wd_this->elements_mara.
  DATA ls_mara TYPE wd_this->element_mara.

* navigate from <CONTEXT> to <MARA> via lead selection
  lo_nd_mara = wd_context->get_child_node( name = wd_this->wdctx_mara ).

select matnr mtart mbrsh matkl meins from mara into corresponding fields of table lt_mara up to 10 rows.
  loop at lt_mara into ls_mara where matnr = '000000000000000010' or
 matnr = '000000000000000023' .
ls_mara-readonly = 'X'.
modify lt_mara from ls_mara transporting readonly where matnr = ls_mara-matnr.
  endloop.
lo_nd_mara->bind_table( new_items = lt_mara set_initial_elements = abap_true ).

endmethod.

Done!.

Do Varying with Field symbols



call function 'HR_READ_INFOTYPE'
    exporting
      tclas           = 'A'
      pernr           = iv_pernr
      infty           = '0027'
      begda           = iv_begda
      endda           = iv_endda
      bypass_buffer   = ' '
    tables
      infty_tab       = lt_p0027
    exceptions
      infty_not_found = 1
      others          2.


  if sy-subrc = 0.
    read table lt_p0027 into ls_p0027 index 1.
    do 12 times
          varying lv_bukrs from ls_p0027-kbu01 next ls_p0027-kbu02  "25
          varying lv_gsber from ls_p0027-kgb01 next ls_p0027-kgb02
          varying lv_kostl from ls_p0027-kst01 next ls_p0027-kst02
          varying lv_pkprz from ls_p0027-kpr01 next ls_p0027-kpr02

          varying lv_fcenter from ls_p0027-fct01 next ls_p0027-fct02 "12
          varying lv_fund from ls_p0027-fcd01 next ls_p0027-fcd02
          varying lv_farea from ls_p0027-fkber01 next ls_p0027-fkber02
          varying lv_grant from ls_p0027-grant01 next ls_p0027-grant02

          varying lv_order from ls_p0027-auf01 next ls_p0027-auf02 " order 25
          varying lv_wbs from ls_p0027-psp01 next ls_p0027-psp02 " wbs element 25

          varying lv_segment from ls_p0027-sgm01 next ls_p0027-sgm02 " SEGMENT 12
          varying lv_budget from ls_p0027-budget_pd01 next ls_p0027-budget_pd02." budget 12


      clear lv_t1018.

      ls_t1018-bukrs = lv_bukrs.
      ls_t1018-gsber = lv_gsber.
      ls_t1018-kostl = lv_kostl.
      ls_t1018-prozt = lv_pkprz.


      if ls_t1018-prozt is initial.
        exit.
      endif.


      ls_t1018-fistl = lv_fcenter.
      ls_t1018-fincode = lv_fund.
      ls_t1018-fkber = lv_farea.
      ls_t1018-grant_nbr = lv_grant.
      ls_t1018-aufnr = lv_order.
      ls_t1018-posnr = lv_wbs.
      ls_t1018-sgmnt = lv_segment.
      ls_t1018-budget_pd = lv_budget.
      append ls_t1018 to lt_t1018.
    enddo.
  endif.


********************
 code in Field Symbols : sample for 2 fields
********************
** dynamic get the field value.
  field-symbols: <fs_burks> type any,   
                 <fs_fcenter> type any.


  data lv_index(2) type n.

  data: s_burkr(5) type value 'KBU  '
  data s_fcenter(5) type value 'FCT  '.


read table lt_p0027 into ls_p0027 index 1.
do 12 times.
   lv_index = sy-index.
   s_burkr+3(2) = lv_index.
   s_fcenter+3(2) = lv_index.

   assign component s_burkr of structure ls_p0027 to <fs_burks>.
   if <fs_burks> is assigned.
     lv_bukrs = <fs_burks>.
   endif.


   assign component s_fcenter of structure ls_p0027 to <fs_fcenter>.
   if <fs_fcenter> is assigned.
     lv_fCenter = <fs_fcenter>.
   endif.


ls_t1018-bukrs = lv_bukrs.
ls_t1018-fistl = lv_fcenter.
append ls_t1018 to lt_t1018.

end do.