1 Reply Latest reply: Mar 5, 2012 8:04 AM by abdur rafique RSS

Reg: Field Symbols and Dynamic Info Types?

abdur rafique
Currently Being Moderated

Dear Experts,

 

I'm developing a code to delete the respective records from the info type.. It will be a generic code, Need to fetch the infotype based on the selection screen input and fetch the values and delete the values using the help of the function modules.

'HR_READ_INFOTYPE', 'HR_INFOTYPE_OPERATION'.

 

I saw sdn, for dynamic related stuff we need to use field symobls.. I'm new to this topic but working on it.

I'm getting a dump "Field symbol has not yet been assigned." Please see the selection screen code

ELECTION-SCREEN BEGIN OF BLOCK screen3 WITH FRAME TITLE text-001.
PARAMETERS: date RADIOBUTTON GROUP opt USER-COMMAND aaa,
            no_date RADIOBUTTON GROUP opt  DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK screen3.

SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_pernr FOR  p0001-pernr.

PARAMETERS:     p_subty TYPE p0001-subty OBLIGATORY,
                p_infty TYPE p0001-infty,
                p_table TYPE dd03l-tabname,
                p_abkrs TYPE p0001-abkrs,
                p_bukrs TYPE p0001-bukrs,
                p_werks TYPE p0001-werks,
                p_begda TYPE p0001-begda.
SELECTION-SCREEN END OF BLOCK a.

SELECTION-SCREEN : BEGIN OF BLOCK b WITH FRAME TITLE text-003.
PARAMETERS:     p_endda TYPE pa0001-endda.
SELECTION-SCREEN END OF BLOCK b.

FIELD-SYMBOLS: <fs_table> TYPE table,
               <wa_table> TYPE ANY.
DATA: xtable TYPE REF TO data.
CREATE DATA xtable TYPE TABLE OF (p_table).
ASSIGN xtable->* TO <fs_table>.


DATA: W_SUBRC TYPE SY-SUBRC.

Now below is the dump occuring place at the loop statement, it was working fine, suddenly its going for dump not able to understand why? can anyone help me on this.

 SELECT * FROM pa0001
           INTO CORRESPONDING FIELDS OF TABLE td_p0001
           WHERE pernr IN s_pernr
             AND abkrs = p_abkrs
             AND werks = p_werks
             AND bukrs = p_bukrs
             AND endda = '99991231'.
  IF td_p0001 IS NOT INITIAL.
    SELECT * FROM (p_table) INTO TABLE <fs_table>
                 FOR ALL ENTRIES IN td_p0001
               WHERE pernr = td_p0001-pernr
                 AND subty = p_subty
                 AND begda = p_begda.
  ENDIF.
  FIELD-SYMBOLS <comp>    TYPE ANY.
  IF <fs_table> IS NOT INITIAL.
    LOOP AT <fs_table> INTO <wa_table>.
      ASSIGN COMPONENT sy-index OF STRUCTURE <wa_table> TO <comp>.
      WRITE: '1'.
    ENDLOOP.
  ENDIF.

 

Once the loop starts working, need to proceed with the development.

Please provide me some assistance, it would be of great help.

 

Regards,

Abdur Rafique

  • Re: Reg: Field Symbols and Dynamic Info Types?
    abdur rafique
    Currently Being Moderated

    Hi Expert,

     

    Got it Guys,

    Need to write the loop statement as mentioned below.

      DATA: wa_p0001 TYPE p0001,
            v_pernr TYPE p0001-pernr.
    
      SELECT * FROM pa0001
               INTO CORRESPONDING FIELDS OF TABLE td_p0001
               WHERE pernr IN s_pernr
                 AND abkrs = p_abkrs
                 AND werks = p_werks
                 AND bukrs = p_bukrs
                 AND endda = '99991231'.
      IF td_p0001 IS NOT INITIAL.
        SELECT * FROM (p_table) INTO TABLE <fs_table>
                     FOR ALL ENTRIES IN td_p0001
                   WHERE pernr = td_p0001-pernr
                     AND subty = p_subty
                     AND begda = p_begda.
      ENDIF.
      FIELD-SYMBOLS <comp>    TYPE ANY.
      IF <fs_table> IS NOT INITIAL.
     LOOP AT <fs_table> ASSIGNING <wa_table>. " Correct Statement
          ASSIGN COMPONENT sy-index OF STRUCTURE <wa_table> TO <comp>.
          WRITE: '1'.
        ENDLOOP.
      ENDIF.