At Seletion Screen

Hi,
What is the difference between at-selection screen and at-selection screen output ?
Vinay

hi
all r explain between at selection-screen and at selection-screen output
pls see the below example.
         Selection screen                                            *
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME  TITLE text-001.
If radio button is checked then upload file to DB.
PARAMETERS:rb_load RADIOBUTTON GROUP rb DEFAULT 'X' USER-COMMAND ucomm .
If radio button is checked then display the table details.
PARAMETERS:    rb_disp RADIOBUTTON GROUP rb .
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME  TITLE text-002 .
File to be uploaded (File Path)
PARAMETERS    : p_file LIKE ibipparms-path MODIF ID gr2 . "OBLIGATORY
SELECTION-SCREEN END OF BLOCK bl2.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME  TITLE text-003.
SELECT-OPTIONS: s_matgp  FOR   zsamp_alter-zmatgp MODIF ID gr3,   "Customer code
                s_werks  FOR   zsamp_alter-werks MODIF ID gr3,    "Plant
                s_matnr1  FOR   zsamp_alter-zmatnr1 MODIF ID gr3,  "Material number
                s_matnr2  FOR   zsamp_alter-zmatnr2 MODIF ID gr3.  "BOM material number
SELECTION-SCREEN END OF BLOCK bl3.
        At Selection screen                                          *
AT SELECTION-SCREEN OUTPUT.
  IF NOT rb_load IS INITIAL.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR3'.
        screen-invisible = 1.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'GR2'.
        screen-invisible = 1.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Select the file to upload
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = p_file.
thanks
kumar kk

Similar Messages

  • Display seletion screen values in alv grid output

    Hi,
    I am changing from alv list to alv grid. In ALV list after displaying output, in application tool bar one button is there that is "Display selections", when i click it, is giving all selection screen values in a popup. i want same funtionality in ALV grid.
    By
    jagan

    Hi,
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = l_repid
          i_callback_top_of_page = 'TOP_OF_PAGE'
    FORM top_of_page .
      PERFORM populate_top_of_page .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = ig_header.
    ENDFORM.                    " top_of_page
    *&      Form  populate_top_of_page
    FORM populate_top_of_page .
      REFRESH ig_header.
      CLEAR wg_header .
      wg_header-typ  = c_h.
      wg_header-info = 'Selection Criteria:'(004).
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      IF NOT s_lgort IS INITIAL.
        CONCATENATE s_lgort-low '-'(111) s_lgort-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Storage Location :'(005).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
      IF NOT s_ekgrp IS INITIAL.
        CONCATENATE s_ekgrp-low '-'(111) s_ekgrp-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Purchasing Group :'(006).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
      IF NOT s_werks IS INITIAL.
        CONCATENATE s_werks-low '-'(111) s_werks-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Plant :'(007).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
    ENDFORM.                    " populate_top_of_page
    Hope this is helpful...
    Regards
    Milan

  • Seletion screen

    Hello experts,
    In selection screen there is input field... when user type into field & enter  then automatically display data of related regarding same.....in front of input field....
    How I can do this ?
    Thanks & R,
    Rahul S.

    Hi,
    Do like this
    PARAMETERS: p_bukrs LIKE bsis-bukrs OBLIGATORY DEFAULT 'SEPV'.
    SELECTION-SCREEN COMMENT 45(30) ws_comp.                " Co.Name
    now :
    AT SELECTION-SCREEN ON p_bukrs.               " Company code
      PERFORM wl01_bukrs_text USING p_bukrs
                           CHANGING ws_comp   w_country  w_rc.
      IF w_rc <> 0.
        MESSAGE w405 WITH p_bukrs.
        SET CURSOR FIELD 'P_BUKRS'.
      ENDIF.
    subroutine
                     Screen literal - Company name                       *
    FORM wl01_bukrs_text  USING    in_bukrs
                       CHANGING    ot_text  ot_land1  ot_subrc.
      IF in_bukrs  <> t001-bukrs.                 " Same Company code
        CLEAR ot_text.                            " Initialise
        SELECT SINGLE bukrs butxt land1 FROM t001 CLIENT SPECIFIED
          INTO (t001-bukrs, t001-butxt, t001-land1)
            WHERE mandt = sy-mandt
            AND   bukrs = in_bukrs.
        ot_subrc = sy-subrc.
        IF sy-subrc <> 0.                         " Unsuccessful
          CLEAR ot_text.                          " Not found
        ELSE.
          ot_text  = t001-butxt.                  " Text
          ot_land1 = t001-land1.                  " Country
        ENDIF.
      ELSE.
        ot_text  = t001-butxt.                    " Text
        ot_land1 = t001-land1.                    " Country
      ENDIF.
    ENDFORM.                                      " wl01_bukrs_text
    regards,
    Advait

  • Selection screen fields in SAP Query

    HI friends,
    I have to make the seletion screen field as mandatory in SAP-Query.
    Please let me know the procedure to make field as mandatory or Let me know how to validate the selection-screen field in Query.
    Thanks in Advance,
    Ravi

    Go to SQ02
    Select your Infoset-->Change
    On next Screen.
    Select GoTo->Code->Initialization.
    Write there code
    LOOP AT SCREEN.
      IF screen-name EQ 'SP$00004'.
           screen-required = 1.
           MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  • Selection screen problem in module pool

    Hi friends,
    I am working on module pool programming, I need to put select screen on the screen of the module pool porgramming. I used Input/Output field to do that and activated. But I am getting message invalid field format (screen error) can any one tell me why I am not able to run the seletion screen when I am using input/output field, also please let me know how to solve this problem.
    Regards,
    Line

    Hello,
    Think that this is useful for u/
    SELECTION-SCREEN - Defining selection screens
    Variants:
    1a. SELECTION-SCREEN BEGIN OF SCREEN scr.
    1b. SELECTION-SCREEN END   OF SCREEN scr.
    2. SELECTION-SCREEN BEGIN OF SCREEN scr AS SUBSCREEN.
    Effect
    Defines a selection screen with the number scr. scr may be up to 4 digits.
    SELECTION-SCREEN BEGIN OF SCREEN scr.
    Additions:
    (zu SELECTION-SCREEN BEGIN OF SCREEN scr) 1. ... TITLE title
    2. ... AS WINDOW
    Notes
    In reports (type 1 programs), a selection screen with number 1000 is created automatically when you use the SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statments. This selection screen appears when you SUBMIT the report.
    In any type of program (apart from subroutine pools - type S), you can define further selection screens using SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN. You enclose these statements between the SELECTION-SCREEN BEGIN OF SCREEN and SELECTION-SCREEN END OF SCREEN statements.
    You call these screens using the CALL SELECTION-SCREEN statement.
    Screen number 1000 is not allowed (reserved for standard selection screen).
    When you generate the program, all user-defined selection screens are also generated.
    Within a report (type 1 program), all SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements outside a SELECTION-SCREEN BEGIN/END OF SCREEN block form part of selection screen 100 (standard selection screen)
    Regards,
    LIJO JOHN.

  • At selection-screen regarding

    hi all,
    i have a seletion screen in my report with two different blocks
    begin of block b1.
    select-options: s_date like sy-datum.
    end of block b1.
    and the date is in the format like 200801
    and i have another block
    begin of block b2.
    parameters : p_date as checkbox default no.
    select-options: o_print like pbed-perxx.
    end of block b2.
    and the requirement is like when i enter the date in s_date in 200801 format then the last two values should be automatically
    filled in o_print.
    like as follows
    s_date      200801   to  200812
    o_print      01      to     12
    please help me in this regard i have tried with at selection-screen output but its not relevent.
    thanks in advance.
    anupama

    Hi,
    Use the below code.
    data: v_date(6) type n.
    SELECTION-SCREEN BEGIN OF BLOCK B1 with frame.
    SELECT-OPTIONS: S_DATE FOR v_date.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 with frame.
    parameters : p_date as checkbox user-command rusr.
    SELECT-OPTIONS: O_PRINT FOR PBED-PERXX.
    SELECTION-SCREEN END OF BLOCK B2.
    AT SELECTION-SCREEN OUTPUT.
    if p_date = 'X'.
      IF NOT S_DATE[] IS INITIAL.
        O_PRINT-SIGN  = 'I'.
        O_PRINT-OPTION  = 'BT'.
        O_PRINT-LOW = S_DATE-LOW+4(2).
        O_PRINT-HIGH  = S_DATE-HIGH+4(2).
        APPEND O_PRINT.
        CLEAR O_PRINT.
      ENDIF.
    else.
       refresh o_print.
    endif.
    Note: After entering the dates in S_DATE, select the check box
    then only you can see the values in o_print. if you deselect the check box then the values in o_print will be deleted

  • Navigate to selection screen from ALV.

    Hi All,
    I am using ALV in my report which is editable alv. when i save after edit one more alv is generated with loggs. but when i click on back tab from application toolbar it navigate to previous alv. But i want to navigate to selection screen. so how to achive it.
    i have defined my own PF status and i tried following code which gives short dump.
    IF sy-ucomm = 'BACK'.
        SET SCREEN 1000.
        LEAVE TO SCREEN 1000.
      ENDIF.
    thanks ,
    Swarup.

    Hi Swarup,
    I have implemented the exact scenario, this is what you need to do.
    FORM f_alv_user_comm USING i_ucomm TYPE syucomm           
                              i_rs TYPE slis_selfield.
    *  Display ALV2 (This list shows the list blocked/unblocked customers)
        PERFORM f_display_alv2 CHANGING i_ucomm.
      IF i_ucomm EQ '&F03'.         " here you can use the back button code
    * Return to seletion screen
        LEAVE TO SCREEN 0.
      ENDIF.
    endform.
    In f_display_alv2 do like this :
    FORM f_display_alv2 CHANGING e_ucomm TYPE syucomm.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_bypassing_buffer = c_mark
            i_callback_program = w_repid
            is_layout          = lws_layout
            it_fieldcat        = int_fieldcat2[]
            it_events          = int_events_alv2
          TABLES
            t_outtab           = int_alv2_out
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
          e_ucomm = '&F03'.                          " This will take the back button code
        ENDIF.
    endform.
    This is the right way to do it.
    Regards,
    Salil Sonam

  • How to display the selection screen fields for selected checkboxes

    Hi all,
             I have 7 checkboxes, for each check box we have some seletion screen fields.if i select first check box,i want to display first slection screen fields only.
    and if we select more than one check box how to display the selection screen fields for selected check boxes,please help me this
    Thanks
    sriman.

    hi,
    Try this code
    report z_13317_sdn2.
    tables : mara, marc, dd03l.
    parameters : p_chk1 as checkbox user-command ABC,
                 p_chk2 as checkbox user-command PQR,
                 p_chk3 as checkbox user-command XYZ.
    select-options : s_matnr for mara-matnr modif id A,
                     s_ersda for mara-ersda modif id A,
                     s_werks for marc-werks modif id B,
                     s_lvorm for marc-lvorm modif id B,
                     s_tab for dd03l-tabname modif id C.
    data: v_chk1,
          v_chk2,
          v_chk3.
    at selection-screen output.
      loop at screen.
        if screen-group1 = 'A' or
           screen-group1 = 'B' or
           screen-group1 = 'C'.
            screen-input = 0.
           modify screen.
        endif.
      endloop.
      loop at screen.
        if v_chk1 = 'X'.
          if screen-group1 = 'A'.
            screen-input = 1.
            modify screen.
          endif.
        endif.
        if v_chk2 = 'X'.
          if screen-group1 = 'B'.
            screen-input = 1.
            modify screen.
          endif.
        endif.
        if v_chk3 = 'X'.
          if screen-group1 = 'C'.
            screen-input = 1.
            modify screen.
          endif.
        endif.
      endloop.
    at selection-screen.
      if sy-ucomm = 'ABC'.
        if v_chk1 = ' '.
          v_chk1 = 'X'.
        else.
          v_chk1 = ' '.
        endif.
      endif.
      if sy-ucomm = 'PQR'.
        if v_chk2 = ' '.
          v_chk2 = 'X'.
        else.
          v_chk2 = ' '.
        endif.
      endif.
      if sy-ucomm = 'XYZ'.
        if v_chk3 = ' '.
          v_chk3 = 'X'.
        else.
          v_chk3 = ' '.
        endif.
      endif.
    Regards,
    Sailaja.

  • Search help in selection screens for interactive report

    A search help can only be assigned to DB table.
    So my doubt is can it also be used for seletion screens created for an interactive report?
    If yes what is the procedure.. Please give me one example at least...
    waiting for your valuable suggestions.....
    Thanks,
    regards,
    Chinmay

    Hi Chinmay,
    I suppose your requirement is to give search help to selection screen elements.
    Here is the code.
    REPORT  ZSHAIL_F4HELP                           .
    parameters: name(10) type c .
    TYPES: BEGIN OF VALUES,
             CARRID TYPE SPFLI-CARRID,
             CONNID TYPE SPFLI-CONNID,
           END OF VALUES.
    dATA: PROGNAME LIKE SY-REPID,
          DYNNUM   LIKE SY-DYNNR,
          DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
          FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,
          VALUES_TAB TYPE TABLE OF VALUES.
    at selection-screen on value-request for name.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
        tabname                   = 'DEMOF4HELP'
        fieldname                 = 'CARRIER1'
      SEARCHHELP                = ' '
      SHLPPARAM                 = ' '
       DYNPPROG                  = PROGNAME
       DYNPNR                    = DYNNUM
       DYNPROFIELD               = 'CARRIER'
      STEPL                     = 0
      VALUE                     = ' '
      MULTIPLE_CHOICE           = ' '
      DISPLAY                   = ' '
      SUPPRESS_RECORDLIST       = ' '
      CALLBACK_PROGRAM          = ' '
      CALLBACK_FORM             = ' '
      SELECTION_SCREEN          = ' '
    IMPORTING
      USER_RESET                =
    TABLES
      RETURN_TAB                =
    EXCEPTIONS
       FIELD_NOT_FOUND           = 1
       NO_HELP_FOR_FIELD         = 2
       INCONSISTENT_HELP         = 3
       NO_VALUES_FOUND           = 4
       OTHERS                    = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    AT SELECTION-SCREEN OUTPUT.
    PROGNAME = SY-REPID.
      DYNNUM   = SY-DYNNR.
      CLEAR: FIELD_VALUE, DYNPRO_VALUES.
      FIELD_VALUE-FIELDNAME = 'CARRIER'.
      APPEND FIELD_VALUE TO DYNPRO_VALUES.
    I hope your query is solved.
    If so,please award points.
    Regards,
    Sylendra.

  • How to pass Selection screen values to another program's selection screen

    Hello,
    I have a requriement where in which i need to pass the selection screen values (say list of pernrs) and few others of one program to selection screen of another. 
    One option that i came across is using Submit. But am unware how to pass only the selection screen values (there wont be any data processing or filtering).  Just the values of one prgm's selection screen are to be sent to another.
    Thanks
    RK

    prog1.
    data:lt_params type table of RSPARAMS.
    data:wa like line of lt_params.
    parameters:pa1 type sy-datum.
    select-options:so1 type sy-dtaum.
    wa-SELNAME = 'PA2'.               "Seletion screen field name
    wa-KIND     = 'P'.                    "P-Parameter,S-Select-options
    wa-SIGN     = 'I'.                    "I-in
    wa-OPTION     = 'EQ'.               "EQ,BT,CP
    wa-LOW     = pa1.                    "Selection Option Low,Parameter value
    append wa to lt_params.
    loop at so1.
    wa-SELNAME = 'SO2'.               "Seletion screen field name
    wa-KIND     = 'S'.                    "P-Parameter,S-Select-options
    wa-SIGN     = 'I'.                    "I-in
    wa-OPTION     = 'EQ'.               "EQ,BT,CP
    wa-LOW     = so1-low.               "Selection Option Low,Parameter value
    wa-HIGH     = so1-high.               "Selection Option Low,Parameter value
    append wa to lt_params.
    endloop.
    CALL FUNCTION 'SUBMIT_REPORT'
      EXPORTING
        report                 = 'ZPROG2.'   "report name of ur tocde
        RET_VIA_LEAVE          = ''            "IF 'X' returns to the called program after execution
        SKIP_SELSCREEN         = 'X'       "If 'X' selection screen of called program is not displayed
    TABLES
       SELECTION_TABLE        = lt_params       "Contains values to the selection screen
    EXCEPTIONS
      JUST_VIA_VARIANT       = 1
      NO_SUBMIT_AUTH         = 2
      OTHERS                 = 3
    Prog2.
    parameters:pa2 type sy-datum.
    select-options:so2 type sy-dtaum.
    write pa2.
    skip 1.
    loop at so2.
    write:so2-low,so2-high.
    skip 1.
    endloop.
    Edited by: Keshu Thekkillam on Aug 20, 2009 3:22 PM

  • Add a field in selection screen and enter data in that field .......

    Hi,
    I want to add a field in the seletion screen and when the user enters data , it should store in the data base table, the data base table is MKPF-BKTXT, please can any one let me know how to do this... very urgent...

    Hi
    Try to use EXIT_SAPMM07M_001, it's to update the item (not header) text, but you can try to use it:
    FIELD-SYMBOLS: <BKTXT> TYPE MKPF-BKTXT.
    ASSIGN ('(SAPMM07M)MKPF-BKTXT') TO <BKTXT>.
    IF SY-SUBRC = 0.
      <BKTXT> = <.....>.
    ENDIF.
    Max

  • Selection screen error meassage

    Hi ,
    I have 1 seletion screen for a query .
    in that scletion screen i have 1 veariable shoung the period from 00 to 18.
    but i want user must select only 1 to 18 not 0.
    so when he selects 0 it should give a error message .
    Jimmy

    Hi Jimmy,
       You can do this using user exit.
    Here is the sample code:
    data : loc_var_range like rrrangeexit.
    If I_step = 3.
       Loop at I_T_RANGE INTO LOC_VAR_RANGE WHREE VNAM = 'FISCPER' .
       IF LOC_VAR_RANGE-LOW LE 1 OR
          LOC_VAR_RANGE-HIGH GT 18.
          CALL FUNCTION 'RRMS_MESSGE_HANDLING'
               eXPORTING
                 I_CLASS =
                 I_TYPE  =
                 I_NUMBER =
                 I_MSGV1 = 'ENTER vALUE BETWEEN BE IN 1 TO 18 ONLY'.
        ENDIF.
        ENDLOOP.
    ENDIF.
    If user enters other than 1 to 18 message will be raised.
    Give your mail id.. i will send you nice how to... doc.
    Hope it Helps
    Srini

  • SPOOL_INTERNAL_ERROR spool overflow when submitting the same program

    I am submitting the same program via job with different seletion screen values after JOB_OPEN, and then SUBMIT statement and JOB_CLOSE FM. But this job get cancelled with message "ABAP/4 processor: SPOOL_INTERNAL_ERROR" . The submit is as follows:
    SUBMIT (sy-repid) USER sy-uname
             VIA JOB 'ZTP_SAl_REG_MONITOR_JOBS'
             NUMBER l_jobcount
             TO SAP-SPOOL
             SPOOL PARAMETERS fp_user_print_params
              NEW LIST IDENTIFICATION 'X'
             WITHOUT SPOOL DYNPRO
             WITH rb_monit EQ 'X'
             WITH s_jobcnt IN s_jobcnt
             WITH p_date EQ p_date
             WITH rb_row EQ rb_row
             WITH rb_col EQ rb_col
             AND RETURN.
    Is it possible to use the same program to be scheduled....Let me include that the submit is happening with rb_monit = X and it has separate branch...so infinite looping can not happen.

    Hi Sumit,
    I hope that the flag is ensuring that it doesnt go into infinite loop. You may wish to check that once bcz Spool overflow seems to be bcz of infinite loop or bcz of layout issue.
    Goto SP01 in the same client where you have scheduled the job.
    Check the spool no. which was generated bcz of the job.
    Double click on the STATUS of the spool ( it should be in red background color).
    System will give a popup with status details.
    Again double click on the status. System will again give a popup.
    The popup will give the details of why the spool ran into errors.
    Also check the layout.
    Thanks,
    Best regards,
    Prashant

  • When clic in the field "i_ekpo-ebeln" tab exit in report ALV

    Good Afternoon! *********************************************************
    Coloquei all the code, I believe for better clarification. When clico in the field i_ekpo-ebeln in the report is called transaction ME23 c/o GRID this functioning normally, but with the reports List and Hierarquico it does not happen the same and it prints in the baseboard the message "Invalid Function". when standard use buttons, functions of course.
    obs.: I had that to create a SET Pf-status for each type of report pos I wanted that when clicar in the field box and clicar in the button "TO PRINT REPORT" it printed sapscript. How I make to solve such problem?
    Att, Carlos Eduardo.
    REPORT ztreino NO STANDARD PAGE HEADING LINE-SIZE 220.
    ************************declarações*********************
    DATA: BEGIN OF y_ekko OCCURS 0,
            ebeln TYPE ekko-ebeln,  "Nº documento de compra
            bukrs TYPE ekko-bukrs,  "Empresa
            bsart TYPE ekko-bsart,  "Documento de compra
            loekz TYPE ekko-loekz,  "Código de eliminação
            aedat TYPE ekko-aedat,  "Data de criação do registro
            ernam TYPE ekko-ernam,  "Nome do responsável que criou o objeto
            lifnr TYPE ekko-lifnr,  "Nº conta do fornecedor
            ekgrp TYPE ekko-ekgrp,  "Grupo de compradores
            waers TYPE ekko-waers,  "Chave da moeda
            BOX   TYPE ptrv_approval-box, "campo para chekinbox
          END OF y_ekko,
          BEGIN OF y_ekpo OCCURS 0,
            ebeln TYPE ekpo-ebeln,  "Nº documento de compra
            ebelp TYPE ekpo-ebelp,  "Nº item do documento de compra
            loekz TYPE ekpo-loekz,  "Código de eliminação
            txz01 TYPE ekpo-txz01,  "Texto breve
            matnr TYPE ekpo-matnr,  "Nº material
            bukrs TYPE ekpo-bukrs,  "Empresa
            werks TYPE ekpo-werks,  "Centro
            menge TYPE ekpo-menge,  "Quantidade do pedido
            netpr TYPE ekpo-netpr,  "Preço líquido no documento de compra
            BOX   TYPE ptrv_approval-box, "campo para chekinbox
          END OF y_ekpo.
    *início seleção de dados
    SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-000.
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
                                    *Nº documento de compra
    SELECT-OPTIONS : s_ebeln FOR ekko-ebeln NO INTERVALS OBLIGATORY,
                     s_bukrs FOR ekko-bukrs OBLIGATORY,  "Empresa
                     s_bsart FOR ekko-bsart.  "Documento de compra
    SELECTION-SCREEN END OF BLOCK bl1.
    SELECTION-SCREEN END OF BLOCK bl2.
    **fim da seleção de dados----
    **início da variante
    SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE text-000.
    SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-002.
    PARAMETERS : p_vari LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK bl3.
    SELECTION-SCREEN END OF BLOCK bl4.
    ***fim variante -
    ***início modo relatório
    SELECTION-SCREEN BEGIN OF BLOCK bl5 WITH FRAME TITLE text-000.
    SELECTION-SCREEN BEGIN OF BLOCK bl6 WITH FRAME TITLE text-003.
    SELECTION-SCREEN SKIP.
      PARAMETERS : rb1 RADIOBUTTON GROUP TIPO DEFAULT 'X',
                   rb2 RADIOBUTTON GROUP TIPO,
                   rb3 RADIOBUTTON GROUP TIPO.
    SELECTION-SCREEN END OF BLOCK bl6.
    SELECTION-SCREEN END OF BLOCK bl5.
    ****fim modo relatório
    *******início da opção de download
    Dados do arquivo texto de saída.
    SELECTION-SCREEN BEGIN OF BLOCK bl9 WITH FRAME TITLE text-004.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) text-005.
    PARAMETERS: p_gerar  AS CHECKBOX.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) text-006.
    PARAMETERS: p_dir  LIKE rlgrap-filename DEFAULT 'c:'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) text-007.
    PARAMETERS: p_arq  LIKE rlgrap-filename DEFAULT 'nota-geral.txt'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK bl9.
    DATA :
          i_ekko  LIKE     y_ekko OCCURS 0 WITH HEADER LINE,
          i_ekpo  LIKE     y_ekpo OCCURS 0 WITH HEADER LINE.
         i_tabsaida LIKE  y_saida OCCURS 0 WITH HEADER LINE.
    *********************Fim Declarações*******************************
    *********************Declarações ALV*******************************
    TYPE-POOLS : slis.
    DATA :
           s_layout    TYPE  slis_layout_alv,
           t_sort      TYPE  slis_t_sortinfo_alv WITH HEADER LINE,
           t_fieldcat  TYPE  slis_t_fieldcat_alv WITH HEADER LINE,
           s_grupos    TYPE  slis_t_sp_group_alv WITH HEADER LINE,
           s_keyinfo   TYPE  slis_keyinfo_alv,
           extab       TYPE  slis_t_extab.
    DATA :
           variant_exit(1) TYPE  c,
           def_variant(1)  TYPE  c,
           s_print      TYPE  slis_print_alv,
           s_top        TYPE  slis_t_listheader,
           variante     TYPE  disvariant,
           def_variante TYPE  disvariant,
           v_repid      LIKE  sy-repid,
    *------pega a data que esta rodando a transação
           v_datasaida(10)  TYPE C,
    *------para saber quantos Pedidos na EKKO
           v_exibe      TYPE I,
           s_selfield type slis_selfield,
           v_ucomm like sy-ucomm.
    **********************Fim declarações ALV*************************
                   Contants para Sapscript e declarações                 *
    TABLES: ITCPO.
    CONSTANTS:  c_on(1)  TYPE  C  VALUE  'X',    "Parâmetro para o Sapscript
                c_off(1) TYPE  C  VALUE  ''.     "Parâmetro para o Sapscript
    Data:
          v_element(15) TYPE C,  "Elemento de texto do Sap Script
          v_type(15)    TYPE C,  "BODY
          v_window(15)  TYPE C,  "Janela
          flag          TYPE I,  "Uma condição para impressão do sapscript
          resp          TYPE C,  "resposta para confirmação do download tab
          zlen          TYPE I,  "Para verificar o um diretório válido
    Para a função WS_DOWNLOAD só em declarar as variaveis deste tipo já *
    seria o bastante para passar o caminho para a função
    TABLES : ekko, ekpo.
                       initialization                                    *
    INITIALIZATION.
      PERFORM zf_verifica_variante.
                   at selection-screen on value-request                  *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM zf_busca_variante_existente.
                 at seletion-screen                                      *
    AT SELECTION-SCREEN.
      PERFORM zf_valida_variante.
    validar os campo antes de fazer download do arquivo
      PERFORM zf_trata_parametros_gerar_arqu.
                start-of-selection                                       *
    START-OF-SELECTION.
      PERFORM zf_seleciona_dados.
                       Criando ALV                                       *
      PERFORM zf_alv.
    *&      Form  zf_verifica_variante
          text
    -->  Verifica se a variante selecionada é existente
    FORM zf_verifica_variante.
      CLEAR variante.
      v_repid = sy-repid.
      variante-report = v_repid.
    Buscar variante default
      def_variante = variante.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save        = 'A'
           CHANGING
                cs_variant    = def_variante
           EXCEPTIONS
                wrong_input   = 1
                not_found     = 2
                program_error = 3
                OTHERS        = 4.
      IF sy-subrc EQ 0.
        p_vari = def_variante-variant.
      ENDIF.
    ENDFORM.                    " zf_verifica_variante
    *&      Form  zf_busca_variante_existente
    *-       text
    *-  --> Vai buscar a variante existente
    FORM zf_busca_variante_existente.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = variante      " Report com as
                i_save              = 'A'           " Variantes Salvas
                i_tabname_header    = 'I_EKPO'      " Tabela interna saida
                it_default_fieldcat = t_fieldcat[]  " Tabela de formatação
                i_display_via_grid  = 'X'  " Dispara POPUP em ALV
           IMPORTING
                e_exit           = variant_exit  " Se não existir variante X
                es_variant       = def_variante     " Variante default
           EXCEPTIONS
                not_found           = 1
                program_error       = 2
                OTHERS              = 3.
      IF sy-subrc = 2.
          MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF variant_exit = space.
          p_vari = def_variante-variant. " Recebe variante escolhida
        ENDIF.
      ENDIF.
    ENDFORM.                    " zf_busca_variante_existente
    *-&      Form  zf_valida_variante
    *-       text
    *-  -->  Verifica se a variante digitada é válida.
    FORM zf_valida_variante.
      IF NOT p_vari IS INITIAL.
        variante             =     def_variante.    "nome do report
        def_variante-variant =     p_vari.          "nome que foi digitado
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = 'A'
             CHANGING
                  cs_variant = def_variante
                  variante   = def_variante.
      ELSE.
        clear variante.
        variante-report = v_repid.
      ENDIF.
    ENDFORM.                    " zf_valida_variante
    -&      Form  zf_seleciona_dados
    *-       text
    -->  Seleciona os dados da ekko e ekpo
    FORM zf_seleciona_dados.
      SELECT ebeln
           bukrs
           bsart
           loekz
           aedat
           ernam
           lifnr
           ekgrp
           waers
            FROM ekko
            INTO TABLE i_ekko
            WHERE
                 ( ebeln IN s_ebeln AND
                   bsart EQ 'NB' ).
    SORT I_EKKO ASCENDING.
      IF sy-subrc EQ 0.
        SELECT ebeln
               ebelp
               loekz
               txz01
               matnr
               bukrs
               werks
               menge
               netpr
                FROM ekpo
                INTO TABLE i_ekpo
                FOR ALL ENTRIES IN i_ekko
                WHERE
                     ( ebeln EQ i_ekko-ebeln ).
      ENDIF.
    SORT I_EKPO ASCENDING.
    Para exibir no topo do relatório no grid
    DESCRIBE TABLE I_EKKO LINES v_exibe.
    ENDFORM.                    " zf_seleciona_dados
    *-&      Form  zf_ALV
    *-       text
    -->  Opções de alv
    FORM zf_alv.
    IF rb1 = 'X'.
              PERFORM zf_gri.
    ENDIF.
    IF rb2 = 'X'.
              PERFORM ZF_HIERARQUICO.
    ENDIF.
    IF rb3  =  'X'.
              PERFORM ZF_LIST.
    ENDIF.
    ENDFORM.                    " zf_ALV
    *&      Form  zf_gri
    *-       text
    *-  -->  Seqüência para gerar o alv grid
    FORM zf_gri.
      PERFORM zf_layout.
      PERFORM zf_ordena_campos.
      PERFORM zf_monta_campos_alv.
      PERFORM zf_print.
      PERFORM zf_grupo.
      PERFORM zf_top  USING  s_top.
      IF  NOT  I_EKPO[] IS INITIAL.
        PERFORM zf_imprime_alv.
      ELSE.
        MESSAGE s000(zcl001)  WITH  'Nenhum registro encontrado.'.
        STOP.
      ENDIF.
    ENDFORM.                    " zf_gri
    *-&      Form  zf_layout
    *-       text
    -->  cria o layout do alv
    FORM zf_layout.
      s_layout-box_tabname          = 'I_EKPO'.
      s_layout-box_fieldname        = 'BOX'.
      s_layout-get_selinfos         =  'X'.
      s_layout-detail_popup         =  'X'.
      s_layout-detail_initial_lines =  'X'.
      s_layout-zebra                =  'X'.
      s_layout-colwidth_optimize    =  'X'.
    ENDFORM.                    " zf_layout
    *-&      Form  zf_ordena_campos
    *-       text
    -->  Ordenação dos campos
    FORM zf_ordena_campos.
      CLEAR t_sort.
      t_sort-spos      =  '1'.          "prioridade de ordenação
      t_sort-fieldname =  'EBELN'.      "campo da tab int. de saida
      t_sort-tabname   =  'I_EKPO'.     "tab inter de saida
      t_sort-up        =  'X'.          "ordenação do maior para o menor
      APPEND t_sort.
    ENDFORM.                    " zf_ordena_campos
    *-&      Form  zf_monta_campos_alv
          text
    -->  è passado os campos de acordo com a ordem de exibição inicial
    FORM zf_monta_campos_alv.
    IF rb2  =  'X'.
      CLEAR t_FIELDCAT.
      t_FIELDCAT-FIELDNAME      =  'BOX'.
      t_FIELDCAT-TABNAME        =  'I_EKKO'.
      t_FIELDCAT-CHECKBOX       =  'X'.
      t_FIELDCAT-INPUT          =  'X'.
      APPEND t_FIELDCAT.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'EBELN'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'EBELN'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'BUKRS'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'BUKRS'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'BSART'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'BSART'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'AEDAT'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'AEDAT'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'ERNAM'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'ERNAM'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'LIFNR'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'LIFNR'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'EKGRP'.
      t_fieldcat-tabname        =  'I_EKKO'.
      t_fieldcat-ref_fieldname  =  'EKGRP'.
      t_fieldcat-ref_tabname    =  'EKKO'.
      APPEND t_fieldcat.
    ENDIF.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'EBELN'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'EBELN'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      t_fieldcat-key            =  'X'.
      t_fieldcat-Hotspot        =  'X'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      T_fieldcat-fieldname     = 'EBELP'.
      T_fieldcat-tabname       = 'I_EKPO'.
      T_fieldcat-ref_fieldname = 'EBELP'.
      T_fieldcat-ref_tabname   = 'EKPO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'MATNR'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'MATNR'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'WERKS'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'WERKS'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'MENGE'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'MENGE'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'NETPR'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'NETPR'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      t_fieldcat-do_sum         =  'X'. "totalizar campo
      APPEND t_fieldcat.
      CLEAR t_fieldcat.
      t_fieldcat-fieldname      =  'TXZ01'.
      t_fieldcat-tabname        =  'I_EKPO'.
      t_fieldcat-ref_fieldname  =  'TXZ01'.
      t_fieldcat-ref_tabname    =  'EKPO'.
      APPEND t_fieldcat.
    ENDFORM.                    " zf_monta_campos_alv
    *-&      Form  zf_top
    *-       text
    *-  --> Cria o texto de cabeçalho do ALV, passando por parametro o
    --> p_S_TOP para s_top
    FORM zf_top USING p_s_top  TYPE slis_t_listheader.
      DATA: ls_line  TYPE  slis_listheader.
      CLEAR  ls_line.
      ls_line-typ  =  'H'.
      ls_line-info  =  'Relatório de Compras por Classificação Contábil'.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-KEY  =  'Parametros Seleção '.
      ls_line-info  = '- Documento de compra'.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-info  = '- Empresa'.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-info  = '- Tip.doc.compra'.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-KEY  =  'Total Pedido'.
      ls_line-info  = v_exibe.
      APPEND ls_line  TO  p_s_top.
    início Formatar a data
      CALL FUNCTION 'DATUMSAUFBEREITUNG'
       EXPORTING
         IDATE                 = SY-DATUM
       IMPORTING
         TDAT8                 = v_datasaida.
    Fim Formatar a data
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-KEY  =  'Data da execução'.
      ls_line-info  = v_datasaida.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'S'.
      ls_line-KEY  =  'Usuário'.
      APPEND ls_line  TO  p_s_top.
      CLEAR  ls_line.
      ls_line-typ  =  'A'.
      ls_line-info  = sy-uname.
      APPEND ls_line  TO  p_s_top.
    ENDFORM.                    " zf_top
    *-&      Form  zf_print
    *-       text
    *-  -->  Parametros de Impressão para o ALV
    FORM zf_print.
      s_print-no_print_selinfos     =  'N'.
      s_print-no_print_listinfos    =  'N'.
    ENDFORM.                    " zf_print
    *-&      Form  zf_imprime_alv
    *-       text
    *-  -->  Imprime o ALV c/ seu parametros
    FORM zf_imprime_alv.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PF_STATUS_SET          = 'ZSET_PF_STATUS'
         I_CALLBACK_USER_COMMAND           = 'ZF_USER_COMMAND'
         i_callback_program                = v_repid
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         is_layout                         =  s_layout
         it_fieldcat                       =  t_fieldcat[]
        IT_EXCLUDING                      =
         IT_SPECIAL_GROUPS                 = S_GRUPOS[]
         it_sort                           = t_sort[]
        IT_FILTER                         =
        IS_SEL_HIDE                       =
         i_default                         = 'X'
         i_save                            = 'A'
         is_variant                        = variante
        IT_EVENTS                         =
        IT_EVENT_EXIT                     =
         IS_PRINT                          = S_PRINT
        IS_REPREP_ID                      =
         I_SCREEN_START_COLUMN             = 0
         I_SCREEN_START_LINE               = 0
         I_SCREEN_END_COLUMN               = 0
         I_SCREEN_END_LINE                 = 0
        IT_ALV_GRAPHICS                   =
        IT_ADD_FIELDCAT                   =
        IT_HYPERLINK                      =
        I_HTML_HEIGHT_TOP                 =
        I_HTML_HEIGHT_END                 =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = I_EKPO
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " zf_imprime_alv
    *-&      Form  zf_top-of-page
    *-       text
    -->  Cabeçalho ALV
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary       = s_top
                i_logo                   = 'CARLOS_LOGO3'.
      I_END_OF_LIST_GRID       = .
    ENDFORM.                    " zf_top-of-page
    *-&      Form  ZF_HIERARQUICO
    *-       text
    *-  -->  RELATÓRIO HIERÁQUICO
    form ZF_HIERARQUICO.
      PERFORM zf_layout.
      PERFORM zf_ordena_campos.
      PERFORM zf_monta_campos_alv.
      PERFORM zf_print.
      PERFORM zf_grupo.
      IF  NOT  I_EKPO[] IS INITIAL.
        PERFORM zf_imprime_hierarquico_alv.
      ELSE.
        MESSAGE s000(zcl001)  WITH  'Nenhum registro encontrado.'.
        STOP.
      ENDIF.
    endform.                    " ZF_HIERARQUICO
    *-&      Form  zf_grupo
         text
    -->  Não é fundamental a criação de grupos de campos, mas facilita
    ao usuário na hora de escolher os campos de exibição após o clique do
    botão MODIFICAR LAYOUT . Vários campos da fieldcat podem ser
    definidos para um mesmo grupo de campo.
    form zf_grupo.
    MOVE:'Moeda' TO S_GRUPOS-SP_GROUP,
         'Campos moeda' TO S_GRUPOS-TEXT.
         APPEND S_GRUPOS.
    endform.                    " zf_grupo
    *&      Form  zf_imprime_hierarquico_alv
          text
    -->  p1        text
    <--  p2        text
    form zf_imprime_hierarquico_alv.
    Vamos definir as ligações entre as tabelas para as quebras no momento
    da impressão.
      s_keyinfo-header01  =  'EBELN'.
      s_keyinfo-item01    =  'EBELN'.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_USER_COMMAND           = 'ZF_USER_COMMAND'
         I_CALLBACK_PF_STATUS_SET          = 'ZF_SET_PF_STATUS_HIERARQ'
          I_CALLBACK_PROGRAM                = v_repid
          IS_LAYOUT                         = S_LAYOUT
          IT_FIELDCAT                       = T_FIELDCAT[]
          IT_SPECIAL_GROUPS                 = S_GRUPOS[]
         IT_SORT                        =
         IT_FILTER                      =
    -    Parâmetro p/executar sempre com a variante default
          I_DEFAULT                         = 'X'
    -                     Se é possível salvar as variantes
          I_SAVE                            = 'A'
    -                          Nome da variante selecionada
          IS_VARIANT                        = VARIANTE
         IT_EVENTS                      =
         IT_EVENT_EXIT                  =
          i_tabname_header                  = 'I_EKKO'
          i_tabname_item                    = 'I_EKPO'
         I_STRUCTURE_NAME_HEADER        =
         I_STRUCTURE_NAME_ITEM          =
          is_keyinfo                        = S_KEYINFO
          IS_PRINT                          = S_PRINT
         IS_REPREP_ID                   =
         I_BUFFER_ACTIVE                =
         I_BYPASSING_BUFFER             =
      IMPORTING
         E_EXIT_CAUSED_BY_CALLER        =
         ES_EXIT_CAUSED_BY_USER         =
        tables
          t_outtab_header                   = I_EKKO
          t_outtab_item                     = I_EKPO.
    endform.                    " zf_imprime_hierarquico_alv
    *&      Form  ZF_LIST
          text
    -->  p1        text
    <--  p2        text
    form ZF_LIST.
      PERFORM zf_layout.
      PERFORM zf_ordena_campos.
      PERFORM zf_monta_campos_alv.
      PERFORM zf_print.
      PERFORM zf_grupo.
      IF  NOT  I_EKPO[] IS INITIAL.
          PERFORM zf_imprime_list_alv.
      ELSE.
        MESSAGE s000(zcl001)  WITH  'Nenhum registro encontrado.'.
        STOP.
      ENDIF.
    endform.                    " ZF_LIST
    *&      Form  zf_imprime_list_alv
          text
    -->  p1        text
    <--  p2        text
    form zf_imprime_list_alv.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
          I_CALLBACK_PF_STATUS_SET       = 'ZF_SET_PF_STATUS_LIST'
          I_CALLBACK_USER_COMMAND        = 'ZF_USER_COMMAND'
        I_INTERFACE_CHECK              = ' '
        I_BYPASSING_BUFFER             =
        I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = v_repid
         I_STRUCTURE_NAME               = 'I_EKPO'
         IS_LAYOUT                      = S_LAYOUT
         IT_FIELDCAT                    = T_FIELDCAT[]
        IT_EXCLUDING                   =
         IT_SPECIAL_GROUPS              = S_GRUPOS[]
         IT_SORT                        = T_SORT[]
        IT_FILTER                      =
        IS_SEL_HIDE                    =
         I_DEFAULT                      = 'X'
         I_SAVE                         = 'A'
         IS_VARIANT                     = VARIANTE
        IT_EVENTS                      =
        IT_EVENT_EXIT                  =
         IS_PRINT                       = S_PRINT
        IS_REPREP_ID                   =
         I_SCREEN_START_COLUMN          = 0
         I_SCREEN_START_LINE            = 0
         I_SCREEN_END_COLUMN            = 0
         I_SCREEN_END_LINE              = 0
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER        =
        ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = I_EKPO.
    endform.                    " zf_imprime_list_alv
    *&      Form  zf_user_command
          text
    -->  p1        text
    <--  p2        text
    form zf_user_command using p_v_ucomm like SY-UCOMM
                               p_s_selfield type slis_selfield.
    *---tratamento de impressão do Sapscript----
    CASE p_v_ucomm.
      FLAG = 0.
         WHEN 'IMPRIMIR' OR 'PRINT'.
             LOOP AT i_ekpo.
                  IF NOT i_ekpo-BOX IS INITIAL.
                    FLAG = FLAG + 1.
                  ENDIF.
            ENDLOOP.
    se tiver selecionado apenas uma box
            IF flag EQ 1.
                IF p_gerar EQ 'X'.
    *-----perform para confirmação de download
                  PERFORM zf_popup_to_confirm.
                ENDIF.
    *------chama o form para imprimir o sapscript
                  PERFORM zf_sapscript.
            ENDIF.
    box estiver vazia
            IF flag EQ 0.
               MESSAGE E017(ZCL_GRUPO04). "Selecione apenas uma BOX
                                          "referente ao pedido de compras.
               STOP.
            ENDIF.
    "estiver selecionado + de uma box
            IF flag GT 1.
               MESSAGE E017(ZCL_GRUPO04). "Selecione apenas uma
                                         "BOX referente ao pedido de compra.
               STOP.
            ENDIF.
    ENDCASE.
    CASE p_s_selfield-sel_tab_field.
    *observe na exibição do relatório(hierarquico) que temos o EKKO-EBELN
    ficaria  melhor visualmente, a utilização de clicar no mesmo
         WHEN 'I_EKPO-EBELN'. "tab de saida
               SET PARAMETER ID 'BES' FIELD p_s_selfield-VALUE.
               CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
    ENDCASE.
    endform.                    " zf_user_command
    *&      Form  ZSET_PF_STATUS
          text
         -->P_EXTAB  text
    form ZSET_PF_STATUS using    p_extab.
      set pf-status 'BOTOES' EXCLUDING extab.
    endform.                    " ZSET_PF_STATUS
    *&      Form  zf_sapscript
          text
    -->  p1        text
    <--  p2        text
    form zf_sapscript.
    --carregar a ITCPO----
      PERFORM zf_itcpo.
    ----chamar a função Open_form
      PERFORM zf_open_form.
    *----buscar o fornecedor e seus dados
    LOOP AT I_ekko.
            v_element  =  'CABPRIN'.
            v_type     =  'BODY'.
            v_window   =  'JANCABEC'.
            PERFORM  zf_imprime_form USING  v_element
                                            v_type
                                            v_window.
    ENDLOOP.
    *----buscar o documento de compra selecionado
    LOOP AT i_ekpo.
        IF i_ekpo-BOX = 'X'.
            v_element  =  'MAIN'.
            v_type     =  'BODY'.
            v_window   =  'MAIN'.
            PERFORM  zf_imprime_form USING  v_element
                                            v_type
                                            v_window.
    *---o comando EXIT é para que somente quando 1 registro for selecionado
    no relatório e a verificação da igualdade acontecer faz que saia do
    Loop
        EXIT.
        ENDIF.
    ENDLOOP.
      PERFORM zf_close_form.
    endform.                    " zf_sapscript
    *&      Form  zf_itcpo
          text
    -->  p1        text
    <--  p2        text
    form zf_itcpo.
    *Parâmetros para impressão da tabela ITCPO
    ITCPO-TDCOPIES   = 1.           "Quantidade de cópias
    ITCPO-TDPAGESLCT = ''.          "Seleção de páginas
    ITCPO-TDPROGRAM  = SY-REPID.    "Captura o nome do programa
    ITCPO-TDIMMED    = c_on.        "Saída imediata do relatório
    ITCPO-TDPREVIEW  = c_on.        "Exibição prévia do relatório
    ITCPO-TDDEST     = 'LOCL'.      "SPOOL: dispositivo de saída
    ITCPO-TDFAXUSER  = SY-UNAME.    "Usuário logado naquele momento
    ITCPO-TDSENDDATE = SY-DATUM.    "Data de envio desejada
    ITCPO-TDSENDTIME = SY-UZEIT.    "Hora envio desejada
    ITCPO-TDNEWID    = c_on.        "Nova ordem SPOOL
    ITCPO-TDARMOD    = c_on.       "IMPRIMIR: modo de arquivamento
    ITCPO-TDTITLE    = 'Relatório de Compras por Classificação Contábil'.
    endform.                    " zf_itcpo
    *&      Form  zf_open_form

    Boa Tarde Carlos,
    Welcome to the SDN Forums. SDN gets it's power from the large community throughout the world. To harvest that power of knowledge we have settled on one language for posts here which is English.
    Clearly English is not your first language, but don't be afraid, I would vouch that for most of the participant here on SDN English is the second language.
    As it is for me. I am just lucky, that I am living in the States long enough that German colleagues start to look at me strangely when I talk to them in German, because it doesn't totally sound right anymore
    So we are very forgiving her in SDNland regarding grammar and spelling (although not as much anymore in the Weblogs), we even provide a spell checker.
    Please post your question again in English.
    If people don't understand you they will ask you about the things that they don't understand and you can then clarify.
    Try it out. Your chance of an excellent responds is way higher.
    Boa sorte, Mark.

  • Line layout option for G/L account

    Dear All,
    When we clear G/L account using tcode F-03, we get line layout as
    Assignment, document no, document type, Posting key, posting date, amount.
    I want to add  material number column to this line layout.
    1. I tried using  IMG -> Fi-> AR/AP -> Vendor accounts->Line items-> Open item processing -> define line layout
    Here we cannot add material in line layout, because fields are extracted from structure RFOPS.
    MATNR(material number) field is exist in table BSEG, not in structure RFOPS. So we cannot add MATNR field in Line Layout here.
    2. In this path, IMG -> FI -> G/L accounting -> Buisnes stransactions->open item clearing -> Make settings for processing open items ->  Here we do not have option to change line layout for clearing of G/L account. Here we can change it for diaply and change documents.
    Could any one help me in this case?
    Thanks in Advance!
    Regards,
    Nidhi

    Hi Nidhi,
    1.Please refer to note: 647773 and note:693288 if you want to make another field available in open line items seletion screen. these are modification notes.
    2.as far as I confirmed in sap testing systems( release 470 and 600), there is create and change button existed, so if you don't have change and create button available in T-cd:O7Z1, I guess that you don't have the change or create authorization.
    Addition if you want to maintain default value in T-cd:07V1, please double click the layout,then you can define it.
    WIth Best Regards,
    Gladys xing

Maybe you are looking for