Skip to Content
0
Former Member
Nov 21, 2008 at 03:15 PM

structure set_table_for_first_display

433 Views

Hi abappers,

I want fill the ALV with the data of my table internal TAB2:

LOOP AT TAB1.
    MOVE TAB1-CAMPO+2(9) TO STCD1_OLD.
    MOVE TAB1-CAMPO+11(9) TO STCD1_NEW.

    SELECT SINGLE * FROM KNA1 WHERE STCD1 EQ STCD1_OLD.
    IF SY-SUBRC = 0.
      MOVE KNA1-KUNNR TO TAB2-KUNNR.
      MOVE KNA1-KTOKD TO TAB2-KTOKD.
      MOVE KNA1-LAND1 TO TAB2-LAND1.
      MOVE KNA1-NAME1 TO TAB2-NAME1.
        MOVE KNA1-STCD1 TO TAB2-STCD1_OLD.
        MOVE STCD1_NEW TO TAB2-STCD1_NEW.
      MOVE KNA1-STCEG TO TAB2-STCEG.
      MOVE KNA1-STCD4 TO TAB2-STCD4.
      MOVE KNA1-YYCTC TO TAB2-YYCTC.
      MOVE KNA1-AUFSD TO TAB2-AUFSD.
      MOVE KNA1-CASSD TO TAB2-CASSD.
      MOVE KNA1-LOEVM TO TAB2-LOEVM.
      MOVE KNA1-SPERR TO TAB2-SPERR.
      MOVE KNA1-SPERZ TO TAB2-SPERZ.

      APPEND TAB2.
    ELSE.
      WRITE: / TEXT-100, STCD1_OLD.
    ENDIF.
ENDLOOP.

    CALL METHOD go_grid->set_table_for_first_display
      EXPORTING i_structure_name = 'XXXXXXXX'
      CHANGING  it_outtab        = TAB2[].

But when I want call method, I don´t know the structure, and I can not pass the structure fo KNA1, because 2 fields are different STCD1_OLD and STCD1_NEW.

Can you help me, please?

Cordial greetings.