Application Development and Automation 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: 
Read only

How to create dynamically updating graph ?

Former Member
0 Likes
571

Hi,

I need to create a pie chart display, that is able to be refreshed/reloaded.

Since i'm new to ABAP, what i'm currently doing is trying to modify a given program example : GFW_PROG_PIE so that everytime i press enter (sy-ucomm is other than BACK and EXIT) it would refreshed with the new value.

I have tried to put the following code :

obj-objid = co_gfw_prog_objid_1.
  obj-grpid = co_gfw_prog_series1.
  obj-x_val = co_gfw_prog_long_category1.
  obj-y_val = 50. "new value
  call method dc_inst->set_obj_values
    exporting id     = my_id_at_dc
              obj    = obj
    importing retval = retval.

into the line which always executed when the page is "reloaded" :


  if firstcall is initial.

.............
  else.

* i inserted the code here

  endif.

But it doesn't seem working. Please help !

Thanks,

Ainun Najib

Edited by: Ainun Najib on May 6, 2008 8:40 AM

Edited by: Ainun Najib on May 6, 2008 8:40 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
525

Hi,

DYNP_VALUES_READ This function module will pass the value automatically with out pressing enter or any other.

See the following example code this the pice of code in my program look at this.

*----------------------------------------------------------------------*
* FORM F4HELP_OBJECTID                                                 *
*----------------------------------------------------------------------*
* This subroutine is used for F4help in object ID i.e. to get          *
* corresponding object ID based on the project ID entered.             *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM f4help_objectid.

  GET CURSOR LINE w_lineno.
  fs_sc_val-fieldname = 'FS_TIMESHEET-PID'.
  fs_sc_val-stepl     =  w_lineno.
  APPEND fs_sc_val TO it_sc_val.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-repid
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = it_sc_val
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.

  IF sy-subrc EQ 0.
    READ TABLE it_sc_val INTO fs_field
          WITH KEY fieldname = c_fieldname.
  ENDIF.                               " IF sy-subrc EQ 0

  SELECT  projectid                    " Project ID
          objectid                     " Object ID
          objectname                   " Object Name
    FROM  zcl_objects
    INTO  TABLE it_values
   WHERE  projectid EQ fs_field-fieldvalue.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = c_objectid
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = c_fieldoid
      value_org   = c_char_s
    TABLES
      value_tab   = it_values.

  CLEAR fs_timesheet-pid.
  REFRESH it_values.
  REFRESH it_sc_val.

ENDFORM.                               " F4HELP_OBJECTID

In the above code the function module DYNP_VALUES_READ helpful to u. in my requirment i want the F4 helf with the corresponding of privious value ( With out pressing the enter ). In your requirment you want to use the values thats it. but i think the function module is enough to u.

Regards,

Mahi.

2 REPLIES 2
Read only

Former Member
0 Likes
526

Hi,

DYNP_VALUES_READ This function module will pass the value automatically with out pressing enter or any other.

See the following example code this the pice of code in my program look at this.

*----------------------------------------------------------------------*
* FORM F4HELP_OBJECTID                                                 *
*----------------------------------------------------------------------*
* This subroutine is used for F4help in object ID i.e. to get          *
* corresponding object ID based on the project ID entered.             *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM f4help_objectid.

  GET CURSOR LINE w_lineno.
  fs_sc_val-fieldname = 'FS_TIMESHEET-PID'.
  fs_sc_val-stepl     =  w_lineno.
  APPEND fs_sc_val TO it_sc_val.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-repid
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = it_sc_val
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.

  IF sy-subrc EQ 0.
    READ TABLE it_sc_val INTO fs_field
          WITH KEY fieldname = c_fieldname.
  ENDIF.                               " IF sy-subrc EQ 0

  SELECT  projectid                    " Project ID
          objectid                     " Object ID
          objectname                   " Object Name
    FROM  zcl_objects
    INTO  TABLE it_values
   WHERE  projectid EQ fs_field-fieldvalue.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = c_objectid
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = c_fieldoid
      value_org   = c_char_s
    TABLES
      value_tab   = it_values.

  CLEAR fs_timesheet-pid.
  REFRESH it_values.
  REFRESH it_sc_val.

ENDFORM.                               " F4HELP_OBJECTID

In the above code the function module DYNP_VALUES_READ helpful to u. in my requirment i want the F4 helf with the corresponding of privious value ( With out pressing the enter ). In your requirment you want to use the values thats it. but i think the function module is enough to u.

Regards,

Mahi.

Read only

0 Likes
525

Hi Maheswari,

Thank you for your help. Apparently issue with my code lies on the following :


  obj-objid = co_gfw_prog_objid_1.
  obj-grpid = co_gfw_prog_series1.
  obj-x_val = co_gfw_prog_long_category1.
  obj-y_val = 50. "new value

  call method dc_inst->set_obj_values
    exporting id     = my_id_at_dc
              obj    = obj
    importing retval = retval.

  if retval <> cl_gfw=>ok. exit. endif.

The method call dc_inst->set_obj_values has retval other than 000 (meaning not OK). So it goes to exit statement in the next if.

When I debug, apparently this method doesn't allow repost of the same key (it seems like, the code portion behaves like INSERT so after the insertion we can't call the insert again). Meaning, I need to use some other way to update the old value to new value.

Please kindly advise if my analysis is correct, and please help on solution to update values in data container for the graph.

Thanks !

Ainun Najib