Skip to Content
Author's profile photo Ada Lv

Use BAPI_PPMSRVAPS_GETLIST to get PPMs

A customer asked a question about BAPI_PPMSRVAPS_GETLIST. The issue is they input some PPM names in input table PLAN_SELECTION, but only returns part of the PPMs. No error in the return table.

PPMs are selected in below coding at around line 140 in FORM SELECT_WITH_RANGES (Program /SAPAPO/SAPLOO_PPM).

       select x~ext_plannr x~logqs x~plannr x~planid

             p~pl_usage

             m~valfr m~valto

             into corresponding fields of table et_planid

             from /sapapo/planmap as x

                  join /sapapo/plan as p   on p~planid eq x~planid

                  join /sapapo/trprod as m on m~planid eq x~planid

             where x~ext_plannr in it_plan_sel and

                   x~logqs      eq iv_logqs and

                   p~pl_usage   like iv_planusage and

                   m~valfr      le iv_valto and

                   m~valto      ge iv_valfr.

So the PPMs are selected from table /sapapo/planmap, /sapapo/plan and /sapapo/trprod.
It first gets planid from table /sapapo/planmap, then read corresponding data from the other two tables.
In this specific issue, those PPMs that are not returned by the BAPI are not saved in table /sapapo/trprod.

The reason why PPMs are not saved in table /sapapo/trprod is that these PPMs are not assigned to any model.
After performing model assignment in /sapapo/scc03, the BAPI worked correctly.

Then customer found that if they input many PPMs in input table PLAN_SELECTION, they’ll get no result though the PPMs are assigned to model correctly.
In the return table, error “E APO_BAPI 072 XXX entries in selection tables exceed Maximum Number (100)” happens. The long text of error APO_BAPI 072 indicates that BAPI is not designed to be executed with huge amount of data. Is there any way to overcome this restriction? I noticed below coding:

In FM BAPI_PPMSRVAPS_GETLIST, line 243

*   -> change restriction for number of entries to be read
    read table extension_in with key structure = ‘MAX_RANGE_ENTRIES’
      into ls_extension_in.
    if sy-subrc is initial.
      TRY .
        lv_max_range_entries = ls_extension_in-valuepart1.
      CATCH cx_sy_conversion_no_number.
        clear lv_max_range_entries.
      CATCH cx_sy_conversion_overflow.
        lv_max_range_entries = 2147483647.
      ENDTRY.
      if lv_max_range_entries < 0.
        clear lv_max_range_entries.
      endif.
    endif.

Then in FORM GET_SELECTED_OBJECTS, line 8280

* -> restrict number of entries to be read
  IF NOT iv_max_range_entries IS INITIAL.
    lv_max_range_entries = iv_max_range_entries.
  ELSE.
    lv_max_range_entries = gc_apo_bapi_max_range_entries.

  ENDIF.

We can see that “gc_apo_bapi_max_range_entries = 100” is hard coded, but it could be overwritten by “iv_max_range_entries”, which comes from input parameter in BAPI’s input table EXTENSION_IN. By adding and entry:

– STRUCTURE                      MAX_RANGE_ENTRIES

– VALUEPART1                     (a number more than number of entries in input table PLAN_SELECTION)

into input table EXTENSION_IN, the BAPI returns all PPM’s information successfully.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.