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: 

Dump ALV , display data

former_member810309
Participant
0 Kudos

hi everyone

i want to share my code beacause i have a dump and some expressions to correct

please tell me what i have to change, i think u can see in the code what i want to display.

i have an exception in the last ALV, i think i don't use right internal table but i dont can see where is the problem.

thanks for help me

<br>FORM get_list_env .<br>  CLEAR gt_s_env.<br>  gt_s_env = 'S4H'.<br>  APPEND gt_s_env TO gt_envs.<br>  gt_s_env = 'VIR'.<br>  APPEND gt_s_env TO gt_envs.<br>ENDFORM.<br>*&---------------------------------------------------------------------*<br>*& Form get_data<br>*&---------------------------------------------------------------------*<br>FORM get_data .<br>  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_t_e070<br>    FROM e070 AS a<br>    WHERE  a~trkorr IN p_ot<br>     AND   a~as4user IN p_nni<br>     AND   a~strkorr = space.<br><br>  IF sy-subrc <> 0.<br>    WRITE : / 'table interne vide '.<br>    EXIT.<br>  ENDIF.<br>  CHECK gt_t_e070 IS NOT INITIAL.<br>  LOOP AT gt_t_e070 INTO gt_s_e070.<br>    CLEAR : gt_wa_results, gt_s_e07t, gt_s_e070a, gt_s_e070create, gt_s_ctsproject.<br>******************************************************************<br>    gt_wa_results-trkorr   = gt_s_e070-trkorr.<br>******************************************************************<br>***********Date et heure de la libération de l'OT.**********<br>    IF gt_wa_results-trstatus NE lc_r.<br>      gt_wa_results-as4date = ' '.<br>      gt_wa_results-as4time = ' '.<br>    ELSE.<br>      gt_wa_results-as4date = gt_s_e070-as4date.<br>      gt_wa_results-as4time = gt_s_e070-as4time.<br>    ENDIF.<br>*******************************************************************<br>******************************************************************<br>    SELECT SINGLE * FROM e07t INTO gt_s_e07t WHERE trkorr = gt_s_e070-trkorr.<br>    IF sy-subrc EQ 0.<br>      gt_wa_results-as4text  = gt_s_e07t-as4text.<br>    ENDIF.<br>******************************************************************<br>    SELECT SINGLE * FROM e070create INTO gt_s_e070create WHERE trkorr = gt_s_e070-trkorr.<br>    IF sy-subrc EQ 0.<br>      gt_wa_results-cre_date = gt_s_e070create-cre_date.<br>    ENDIF.<br>******************************************************************<br>    SELECT SINGLE * FROM ctsproject INTO gt_s_ctsproject WHERE trkorr = gt_s_e070a-reference.<br>    IF sy-subrc EQ 0.<br>      gt_wa_results-externalid = gt_s_ctsproject-externalid.<br>    ENDIF.<br>******************************************************************<br>    gt_wa_results-trfunction = gt_s_e070-trfunction.<br>    IF gt_wa_results-trfunction = lc_w.<br>      gt_wa_results-trfunctn_l = lc_custo.<br>    ELSEIF gt_wa_results-trfunction = lc_k.<br>      gt_wa_results-trfunctn_l = lc_workbench.<br>    ELSE.<br>      gt_wa_results-trfunctn_l = lc_others.<br>    ENDIF.<br>************STATUT OT : LIBERE , MODIFIE OU AUTRE.*************<br>  READ TABLE gt_trstatus INTO ls_trstatus<br>      WITH KEY domvalue_l = gt_s_e070-trstatus BINARY SEARCH.<br>  IF sy-subrc = 0.<br>    gt_wa_results-trstatus_t = ls_trstatus-ddtext.<br>  ENDIF.<br>*************** creation OT ******************<br>    gt_wa_results-as4user  = gt_s_e070-as4user.<br>***************************************************<br>    APPEND gt_wa_results TO gt_results .<br>  ENDLOOP.<br><br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'trkorr'.<br>  ls_fieldcat-seltext_m  = 'Ordre/Tâche'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'trstatus_t'.<br>  ls_fieldcat-seltext_m  = 'Status'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'trfunction'.<br>  ls_fieldcat-seltext_m  = 'Type'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br><br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'as4user'.<br>  ls_fieldcat-seltext_m  = 'Titulaire'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'as4date'.<br>  ls_fieldcat-seltext_m  = 'Date'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'externalps'.<br>  ls_fieldcat-seltext_m  = 'externalps'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  ls_fieldcat-fieldname = 'externalid'.<br>  ls_fieldcat-seltext_m  = 'Id'.<br>  APPEND ls_fieldcat TO lt_fieldcat.<br>  CLEAR ls_fieldcat.<br>  LOOP AT gt_envs INTO gt_s_env.<br>    ls_fieldcat-fieldname = gt_s_env.<br><br>    IF ls_fieldcat-fieldname = 'S4H'.<br>      ls_fieldcat-seltext_m  = 'S4H'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>      CLEAR ls_fieldcat.<br>      ls_fieldcat-fieldname = 'as4date'.<br>      ls_fieldcat-seltext_m  = 'Date'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>      CLEAR ls_fieldcat.<br>      ls_fieldcat-fieldname = 'as4time'.<br>      ls_fieldcat-seltext_m  = 'Time'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>    ELSEIF ls_fieldcat-fieldname = 'VIR'.<br>      ls_fieldcat-seltext_m  = 'VIR'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>      CLEAR ls_fieldcat.<br>      ls_fieldcat-fieldname = 'as4date'.<br>      ls_fieldcat-seltext_m  = 'Date'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>      CLEAR ls_fieldcat.<br>      ls_fieldcat-fieldname = 'as4time'.<br>      ls_fieldcat-seltext_m  = 'Time'.<br>      APPEND ls_fieldcat TO lt_fieldcat.<br>    ENDIF.<br>  ENDLOOP.<br>  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'<br>    EXPORTING<br>      i_callback_program = sy-repid<br>      it_fieldcat        = lt_fieldcat[]<br>      i_save             = 'A'<br>      i_default          = 'X'<br>    TABLES<br>      t_outtab           = gt_t_e070<br>*     t_outtab           = gt_results<br>    EXCEPTIONS<br>      program_error      = 1<br>      OTHERS             = 2.<br>  IF sy-subrc <> 0.<br>    MESSAGE i002(zmess).<br>  ENDIF.<br>ENDFORM.<br>*&---------------------------------------------------------------------*<br>*& Form data_prerequis<br>*&---------------------------------------------------------------------*<br>FORM data_prerequis .<br>  CONSTANTS: lc_tr LIKE  dd07l-domname VALUE 'TRSTATUS'.<br>  CALL FUNCTION 'DD_DOMVALUES_GET'<br>    EXPORTING<br>      domname        = lc_tr<br>      text           = 'X'<br>      langu          = 'FR'<br>    TABLES<br>      dd07v_tab      = gt_t_e070<br>    EXCEPTIONS<br>      wrong_textflag = 1<br>      OTHERS         = 2.<br>  IF sy-subrc = 0.<br>    SORT gt_trstatus BY domvalue_l ASCENDING .<br>  ENDIF.<br>ENDFORM.<br>
5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos

Be careful to read again your question after posting. Your code is not legible, there are lots of <br> inserted by SAP.

Sandra_Rossi
Active Contributor
0 Kudos

Also, what exception do you have? At which exact line?

former_member810309
Participant
0 Kudos

the <br> are generated by this website, i sent the question in 'code' mode, the website made it visible in a single line and i understant that this is annoying.

the exception is in the last function module used, when I comment it my program works, it is to have in the column (status) written in full and not 'R' or 'L'

former_member810309
Participant
0 Kudos

i solved some problems but i can't display the data in the iexternalid column.
i have this code , if it's not complet i can share more :

  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_t_e070
FROM e070 AS a
WHERE a~trkorr IN p_ot
AND a~as4user IN p_nni
AND a~strkorr = space.
....
SELECT SINGLE * FROM ctsproject
INTO gt_s_ctsproject
WHERE trkorr = gt_s_e070a-reference.
IF sy-subrc EQ 0.
gt_wa_results-externalid = gt_s_ctsproject-externalid.
...
...
gt_wa_results-externalid = gt_s_e070a-reference.
...
...
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'externalid'.
ls_fieldcat-seltext_m = 'Id'.
APPEND ls_fieldcat TO lt_fieldcat.

FredericGirod
Active Contributor
0 Kudos

it is a question for the Crystal Ball forum

Or provide information about how you display data