cancel
Showing results for 
Search instead for 
Did you mean: 

BAdI LSO_LEARNING_PROGRESS

former_member50965
Participant
0 Kudos
104

Hi all,

who can give an example for method IF_EX_LSO_LEARNING_PROGRESS~<b>MODIFY_PROGRESS_DETAILS</b> (BadI LSO_LEARNING_PROGRESS)?

The example implementation LSO_SINGLE_SCO_EXAMPLE includes only coding for if_ex_lso_learning_progress~get_learning_progress.

Thanks in advance

Frank

View Entire Topic
jochen_wilhelm
Explorer
0 Kudos

Hi Frank,

here is the example implementation which causes the learning progress tabel on the trainings detail screen to display the cmi.core.score.raw for each SCO.

The SCO name has to be added to the cmi.suspend data.

DATA lt_scorm12 TYPE LSO_SCORM_TPART_tab.

DATA ls_scorm12 TYPE LSO_SCORM_TPART.

DATA ls_suspend TYPE LSO_SCORM_SUSPEND.

DATA lt_suspend TYPE LSO_SCORM_SUSPEND_TAB.

data ls_progress LIKE LINE OF PROGRESS.

data lf_key type i.

CL_LSO_SCORM_WRAPPER=>GET_SCORM12_DATA( EXPORTING tpartdocno = PARTICIPATION-tpartdocno

IMPORTING SCORM_DATA = lt_scorm12

suspend_data = lt_suspend ).

lf_key = 9000.

LOOP AT lt_scorm12 into ls_scorm12.

clear: ls_progress, ls_suspend.

"only do this for SCO which reported rawscore, ignore others

if ls_scorm12-TRAWSCORE is not INITIAL.

read TABLE lt_suspend into ls_suspend

with key elu = ls_scorm12-elu.

"only if there is really some scorm data to display

if sy-subrc is INITIAL and not ls_suspend-SCORMSUSP is initial.

"TODO filter out that, we just using it.

ls_progress-key = lf_key. "any unique value above 9xxxxxx

ls_progress-text = ls_suspend-SCORMSUSP.

ls_progress-value = ls_scorm12-TRAWSCORE.

append ls_progress to progress.

lf_key = lf_key + 1.

endif.

endif.

ENDLOOP.

ls_progress-key = 9555. "any unique value above 9xxxxxx

ls_progress-text = 'test key'.

ls_progress-value = lf_key.

append ls_progress to progress.

Best regards

jochen

Former Member
0 Kudos

Hi Jochen,

We have run into a scenario whereby its essential to implement the BADI LSO_LEARNING_PROGRESS as we are expecting a significant quantam of legacy SCORM 1.2 based e-learning courses to be tracked (with Course Type 0091). Reference to your advise we have implemented the following 2 methods of the BADI LSO_LEARNING_PROGRESS but while accessing any WBT (with Course Type 0091) we are not experiencing any difference in the calculation of progress tracking. Furthermore, we are not even able to debug it throug external breakpoints while access it via Learner Account. Can you please guide, where we might be going wrong ?

Thanks,

Asim


METHOD IF_EX_LSO_LEARNING_PROGRESS~GET_LEARNING_PROGRESS.
* data for the actual processing.
  DATA lt_scorm     TYPE lso_scorm_tpart_tab.
  DATA ls_scorm     TYPE lso_scorm_tpart.
  DATA scorm_time   TYPE lso_ttimecrs_c.
  DATA ls_tform     TYPE lso_deliverymethod_c.
  DATA im_text      TYPE string.

  DATA lf_int       TYPE i.
  DATA no_elus     TYPE i.
* we can only handle single SCOs.
  IF account-lu_total > 1.
    RETURN.
  ENDIF.

  cl_lso_scorm_wrapper=>get_scorm12_data( EXPORTING tpartdocno = tpartdocno IMPORTING scorm_data = lt_scorm ).

  DESCRIBE TABLE lt_scorm LINES no_elus.

  IF no_elus > 1. " more than one elu under one lu => not a single sco content.
    RETURN.
  ENDIF.

  CLEAR account-achievement.
  CLEAR account-tmp_passed.
  CLEAR account-progress.
  CLEAR account-lu_percent.
  CLEAR account-ebo_percent.


  CALL FUNCTION 'LSO_TRAININGTYPE_GET_TFORM_C'
    EXPORTING
      plvar                      = trainingstype-planversion
      otype                      = trainingstype-otype
      objid                      = trainingstype-objid
*     GETDEFAULT                 = 'X'
    IMPORTING
      trainingform               = ls_tform
*     READBYDEFAULT              =
    EXCEPTIONS
      error_occured              = 1
      not_found                  = 2
      no_trainingform_maintained = 3
      OTHERS                     = 4.

* we don
  IF sy-subrc <> 0.
    im_text = 'In Class CL_LSO_SINGLE_SCO_PROGRESS, can not get trainingsform from trainingstype'."#EC NOTEXT
    CALL METHOD logger->write_free_entry
      EXPORTING
        im_text      = im_text
        functionname = 'GET_LEARNING_PROGRESS'
        im_msgty     = 'W'
        im_level     = 3.
  ENDIF.

* this loop is not really necessary, we only have one scorm data set.
  LOOP AT lt_scorm INTO ls_scorm.
* calculate learning progress.
    IF ls_tform-tac_write IS NOT INITIAL. "if the Single SCO is used as a test, we also mapp the test* -attributes
      "unfortunately we only support full numbers
      lf_int = ls_scorm-trawscore.
      WRITE lf_int TO account-testscore.
      "unfortunately we only support full numbers
      lf_int = ls_scorm-maxscore.
      WRITE lf_int TO account-testscoremax.
      IF ls_scorm-maxscore > 0 AND ls_scorm-maxscore  IS NOT INITIAL. "avoid shortdump if maxscore is 0 or initial
        account-testscorecutoff  = ls_scorm-minscore / ls_scorm-maxscore * 100. "description of the dataelement specifies this as an percentage
        account-testscoreperc   = ls_scorm-trawscore / ls_scorm-maxscore * 100.
      ENDIF.

      IF account-testscoreperc IS INITIAL. " logic is the same as for LSO TAC onlinetests
        CLEAR account-achievement.
      ELSE.
        IF account-testscorecutoff IS INITIAL OR account-testscorecutoff EQ 0.
          account-achievement = 100.
        ELSE.
          account-achievement =
          ( account-testscoreperc /
            account-testscorecutoff ) * 100.
        ENDIF.
     endif.
    ELSEIF ls_scorm-trawscore  IS NOT INITIAL AND ls_scorm-maxscore  IS NOT INITIAL AND ls_scorm-maxscore > 0.
      account-progress =  ls_scorm-trawscore / ls_scorm-maxscore * 100.

      if ls_scorm-minscore is initial OR ls_scorm-minscore EQ 0. " if there is no minimum, we always achieve 100%.
        account-achievement = 100.
      else.
        account-achievement = ls_scorm-trawscore / ls_scorm-minscore * 100.
      endif.
    ENDIF.

    IF account-achievement GT 100.
      account-achievement = 100.
    ENDIF.
* is the course/SCO passed?

    IF ls_scorm-telustat IS NOT INITIAL.
      IF ls_scorm-telustat EQ 'passed' OR ls_scorm-telustat EQ 'completed'.
        account-tmp_passed = 'X'.
      ENDIF.
    ELSE. " is the raw/achievt score greater than the min score? than we finally consider this course as passed.
      IF ls_scorm-minscore IS NOT INITIAL AND ls_scorm-trawscore >= ls_scorm-minscore.
        account-tmp_passed = 'X'.
      ENDIF.
    ENDIF.
* fill in the sco total time if appropriate.
* we have to convert it into seconds
    IF ls_scorm-ttimeelu IS NOT INITIAL.
      scorm_time = cl_lso_scorm_util=>get_seconds_from_scorm12( ls_scorm-ttimeelu ).
      IF scorm_time IS NOT INITIAL.
        account-timecrs = scorm_time.
      ENDIF.
    ENDIF.

  ENDLOOP.

ENDMETHOD.                    "if_ex_lso_learning_progress~get_learning_progress

=========================================================================================================


METHOD if_ex_lso_learning_progress~modify_progress_details.
*we change nothing here.

  DATA lt_scorm12  TYPE lso_scorm_tpart_tab.
  DATA ls_scorm12  TYPE lso_scorm_tpart.
  DATA ls_suspend  TYPE lso_scorm_suspend.
  DATA lt_suspend  TYPE lso_scorm_suspend_tab.
  DATA ls_progress LIKE LINE OF progress.
  DATA lf_key      TYPE i.

  cl_lso_scorm_wrapper=>get_scorm12_data( EXPORTING tpartdocno = participation-tpartdocno
  IMPORTING scorm_data = lt_scorm12
  suspend_data = lt_suspend ).

  lf_key = 0091.
  LOOP AT lt_scorm12 INTO ls_scorm12.
    CLEAR: ls_progress, ls_suspend.
    "only do this for SCO which reported rawscore, ignore others
    IF ls_scorm12-trawscore IS NOT INITIAL.
      READ TABLE lt_suspend INTO ls_suspend
      WITH KEY elu = ls_scorm12-elu.

      "only if there is really some scorm data to display
      IF sy-subrc IS INITIAL AND NOT ls_suspend-scormsusp IS INITIAL.
        "TO filter out that, we just using it.
        ls_progress-key = lf_key. "any unique value above 9xxxxxx
        ls_progress-text = ls_suspend-scormsusp.
        ls_progress-value = ls_scorm12-trawscore.

        APPEND ls_progress TO progress.
        lf_key = lf_key + 1.
      ENDIF.

    ENDIF.
  ENDLOOP.

  ls_progress-key = 9555. "any unique value above 9xxxxxx
  ls_progress-text = 'test key'.
  ls_progress-value = lf_key.

  APPEND ls_progress TO progress.
                                                            "#EC NEEDED
ENDMETHOD.