Skip to Content
-1

How to get internal table select options from : GT_DYN_TRANGE .

Dear All ,

I have a requirement that I need only the select options fields from this table

GT_DYN_TRANGE .

I have made a zcopy of the program RFKOPR10 (Report for open item analysis for vendors) . Also made zcopy of the LDB : SAPDBKDF..

So my zcopy is ZSAMPLED21 and for the LDB zcopy is : SAPDBZKDF2 .

In the program of the ldb : SAPDBZKDF2 .

There is a function module mentioned below :-


call function 'RS_REFRESH_FROM_DYNAMICAL_SEL'
exporting
CURR_REPORT = SY-CPROG
MODE_WRITE_OR_MOVE = 'M'
importing
P_TRANGE = GT_DYN_TRANGE
exceptions
NOT_FOUND = 1
WRONG_TYPE = 2
others = 3.

if SY-SUBRC > 1.
exit.
endif.

From the above function module I ma getting the internal table : GT_DYN_TRANGE.

This internal table I only need the select options fields which is there inside this internal table I am unable to fetch this select options internal table from this table GT_DYN_TRANGE..

What I have done is I am moving the data of GT_DYN_TRANGE to my internal table mentioned below .

Data : ITAB_RAN TYPE RSDS_TRANGE,

WA_RAN TYPE RSDS_RANGE.

ITAB_RAN = GT_DYN_TRANGE[].

then I am looping the itab_ran to fetch the select options filed that is sign option low and high from this internal table .

It is available here : -

ITAB_RAN[1]-FRANGE_T[1]-SELOPT_T


Below is the structure of SELOP_T internal table .Which is inside the table ITAB_RAN.

line sign option low high

1 I EQ 1200

So from above inside SELOPT_T internal table I have the sign, option, low ,high fields . I only need these fields to be fetched in my separate internal table so that I can pass these fields to my main program .

I am unable to reach the select options fields .

How to fetch these select options field in my separate internal table please guide .

Please guide how to fetch only the SELECT OPTIONS fields from ITAB_RAN which is a hierarchy table .


LOOP AT ITAB_RAN INTO WA_RAN.

endloop.

Dear gurus need your help .

Regards

Deep

Add comment
10|10000 characters needed characters exceeded

  • That's a very bad idea to COPY a standard program. The right way is to enhance it (Enhancement Framework). It has been discussed many times in the forum. Copying was the right way in the old ages of R/3, but it's been 10 years that we don't do it this way anymore because of issues after upgrade (copied code not upgraded).

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 08 at 08:16 AM

    If I understand well, your only issue is "how to get ITAB_RAN[1]-FRANGE_T[1]-SELOPT_T" ?

    From 7.40:

    DATA(range) = VALUE rangetype( itab_ran[ tablename = 'yourtable' ]-frange_t[ fieldname = 'yourfield' ]-selopt_t OPTIONAL ).

    Before 7.40 (+ you need to declare the field symbol):

    LOOP AT itab_ran ASSIGNING <table> WHERE tablename = 'yourtable'.
      LOOP AT <table>-frange_t ASSIGNING <field> WHERE fieldname = 'yourfield'.
        LOOP AT <field>-selopt_t ASSIGNING <signoptionlowhigh>.
        ENDLOOP.
      ENDLOOP.
    ENDLOOP.
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 07 at 04:40 PM

    The values entered in a screen field defined for a column of a node of the logical database (whatever it's a field defined with Select-options or Parameters), should be reflected in RS_REFRESH_FROM_DYNAMICAL_SEL. You need to call this function module only from the program "calling" the LDB, not from the LDB program, because the select-options/parameters can be directly accessed in the LDB program.

    Add comment
    10|10000 characters needed characters exceeded

    • Dear Sir ,

      My requirement is different , I just need the SELECT OPTIONS fields in my separate internal table . which is available inside the deep structure : GT_DYN_TRANGE .

      I understand that whatever field defined with Select-options or Parameters), should be reflected in RS_REFRESH_FROM_DYNAMICAL_SEL.

      But I need the profit center values only from the GT_DYN_TRANGE table which are the SELECT-OPTIONS values.

      How to get the sign option low high fields in a separate internal table which is available inside the deep structure .

      GT_DYN_TRANGE .

      Actually what I am doing is that once I will get the select options data in separate internal table then I will pass that internal table through export statement to memory id .Then in the main program I will use the import statement to fetch that internal table which is stored in the memory .Then I will filter HBSIK table in main program from my fetched internal table from memory .

      So please guide me how to fetch the select options from our deep structure : GT_DYN_TRANGE .

      Regards

      Deep

  • Jan 08 at 08:36 AM

    Small sample to convert returned deep structure to flat structure of type LDB_REPORT_CALL:

      CALL FUNCTION 'RS_REFRESH_FROM_DYNAMICAL_SEL'
        EXPORTING
          curr_report        = curr_report
          mode_write_or_move = 'M'
        IMPORTING
          p_trange           = lt_dyn_range " TYPE rsds_trange
        EXCEPTIONS
          not_found          = 1
          wrong_type         = 2
          OTHERS             = 3.
      " handle error there
      LOOP AT lt_dyn_range ASSIGNING <level1>. " TYPE rsds_range
        LOOP AT <level1>-frange_t ASSIGNING <level2>. " TYPE rsds_frange
          LOOP AT <level2>-selopt_t ASSIGNING <level3>. " TYPE rsdsselopt
            APPEND INITIAL LINE TO itab ASSIGNING <wa>. " TYPE ldb_report_call
            <wa>-tablename = <level1>-tablename.
            <wa>-fieldname = <level2>-fieldname.
            MOVE-CORRESPONDING <level3> TO <wa>. 
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.

    What's your current Abap version, if recent I will expect you will convert, and post, a cooler version of code...

    Add comment
    10|10000 characters needed characters exceeded