Application Development 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: 

How to declare a workarea of type index table

Former Member
0 Kudos

Hi Experts,

I am getting error as CT_RESULT is a generic type.Use of this type is only possible for typing field symbols and formal parameters  when using the below code. Please help me and let me know how to declare it.

  TYPES:BEGIN OF  ty_guid,

        guid TYPE guid,

        END OF ty_guid.

  DATA:it_guid TYPE STANDARD TABLE OF ty_guid INITIAL SIZE 0,

       it_item TYPE STANDARD TABLE OF bbp_pds_sc_item_d INITIAL SIZE 0.

  DATA:wa_guid TYPE ty_guid,

            wa_item TYPE bbp_pds_sc_item_d.

  FIELD-SYMBOLS: <fs_result> like LINE OF ct_result.

 

  SELECT guid FROM crmd_orderadm_h INTO TABLE it_guid

              WHERE object_id IN ct_result.

  IF sy-subrc = 0.

    LOOP AT it_guid INTO wa_guid.

      CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

       EXPORTING

          i_guid                           = wa_guid

*   I_OBJECT_ID                      =

*   I_ATTACH_WITH_DOC                = ' '

          i_with_itemdata                  = 'X'

*   I_ITEM_SORTED_BY_HIERARCHY       =

*   I_WITHOUT_HEADER_TOTALS          =

*   I_READ_FROM_ARCHIVE              = ' '

* IMPORTING

*   E_HEADER                         =

*   EV_IS_PD                         =

*   ET_ATTACH                        =

       TABLES

          e_item                     = it_item

*   E_ACCOUNT                        =

*   E_PARTNER                        =

*   E_CONFIRM                        =

*   E_LONGTEXT                       =

*   E_LIMIT                          =

*   E_ORGDATA                        =

*   E_TAX                            =

*   E_PRIDOC                         =

*   E_HCF                            =

*   E_ICF                            =

*   E_MESSAGES                       =

*   E_ACTVAL                         =

*   E_ACC_ACTVAL                     =

*   E_HEADER_REL                     =

*   E_ITMLIM_REL                     =

*   E_STATUS                         =

                .

    ENDLOOP.

  ENDIF.

  IF it_item[] IS NOT INITIAL.

    LOOP AT it_item INTO wa_item.

      LOOP AT ct_result ASSIGNING <fs_result>.

       <fs_result>-zzpurchase_cat = wa_item-be_tracking_no.

*        MODIFY ct_result FROM wa_result.

        CLEAR wa_result.

      ENDLOOP.

      CLEAR wa_item.

    ENDLOOP.

  ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Experts,

I got the solution. I found the structure of CT_RESULT under local tab during debugging and declared like that.

Thanks,

Ajay

5 REPLIES 5

jrg_wulf
Active Contributor
0 Kudos

Hi,

i'm not quite sure where ct_result is first introduced. There seems to be no declaration?

Judging by the name-prefix, it would be a changing parameter of which form?

Where is it populated, since you intend to loop it?

And then, from which hat do you draw wa_result? it neither seems to be declared nor is there an assignment of values.

On the other hand, you're trying to change table ct_result directly by altering a field of an assigned field-symbol. Why do you feel it necessary to follow up with a modify statement?

After so many question-marks i have lost the point of your initial question.

Maybe, you can start with a short description of your intention and a more accurate code-snippet.

Best regards - Jörg

Former Member
0 Kudos

Hi Jorg,

CT_RESULT is a changing parameter of CHANGE_SELECT_RESULT method of /SAPSRM/IF_EX_BD_POWL_SEL_RSL badi.

wa_result is a commented code, i am not using it as shown below.

*        MODIFY ct_result FROM wa_result.

Please help me in getting my issue resolved.

Regards,

Ajay

Former Member
0 Kudos

Hi Ajaya,

Since CT_RESULT is generically types, you can't declare a field-symbol as "LIKE LINE OF ct_result".  If you know what the structure of CT_RESULT is, then declare your field symbol as that type; otherwise you'll have to declare it as TYPE ANY.

It seems funny that in your SELECT statement you treat CT_RESULT as a range table ("WHERE object_id IN ct_result"); but later you specify a field name ZZPURCHASE_CAT from ct_result.

Jim

nishantbansal91
Active Contributor
0 Kudos

Dear ajaya,

I think your  CT_RESULT  of type DATA     is an importing parameter in SAP SRM.

For this you have to do one thing.

Field-symbol: <FS> type any.

ASSIGN  ct_result->*  to <fs>.

Thanks

Nishant

Former Member
0 Kudos

Hi Experts,

I got the solution. I found the structure of CT_RESULT under local tab during debugging and declared like that.

Thanks,

Ajay