BAPI_CUSTOMER_CREATE STCD1

Hi, All:
We need to create a customer in a online report, but We are trying to use BAPI_CUSTOMER_CREATEFRONDATA1, but this Bapi has no field for STCD1 (Tax Number 1) and this field is obligatory for us.
Anyone could help us, please?

Can you tell me which fields in all the structures of this bapi BAPI_CUSTOMER_CREATEFROMDATA1 you pass data to?  The issue I have is, if I pass data to PI_PERSONALDATA structure, I have an error saying the language field is required.  When I enter data to the language field, I have error 'Double creation of company and user address not created'.  It seems like I get an error if I don't enter anything and get the error when enter something.  Please advise.

Similar Messages

  • Validation on KNA1-STCD1

    Hi,
    I need to keep a validation on the field KNA1-STCD1 (Tax Number 1) without using any user exits etc...
    Is there any simple configuration by displaying a warning message when the Tax number 1 already exists in the system.
    Thanks,
    Srini

    Hi,
    No, you'll have to make it through user-exit (you can use SAPMF02D enhancement).
    Regards,
    Eli

  • BAPI_VENDOR_CREATE & BAPI_CUSTOMER_CREATE

    Hi,
    We have a External System from where we input, data Required for Vendor
    master Data & Customer Master Data. We are trying to use the following
    BAPi's BAPI_VENDOR_CREATE & BAPI_CUSTOMER_CREATE to pass the value
    to SAP. But there is no option to give the Input, because these BAPi's
    are using call transaction. Kindly guide how to use these BAPI's to
    pass value from External System to SAP.
    Regards,
    Sekar.

    Friends Any input.
    Rgds,
    Sekar.

  • STCD1 Tax Number 1 - Format Change

    Dear Gurus,
    I want to change the format of this table: STCD1 which only contains numbers in the standard SAP settings.
    The reason why I need to change it is because the client in which we do the implementation is Romanian.
    In Romania, the format of the tax number contains LETTERS and '/' signs as follow:
    J23/2808/2008
    We are not allowed by law to 'compress' this number and remove the letters and the signs
    This number has to appear on all official documents such as Invoices, Credit Memo, Debit Note etc...
    I have the 2 following questions for you:
    1- How can I change this format?
    2- How can I make sure this information appears on all sales documents?
    Your help is needed please.
    Regards
    Chris

    Problem solved

  • Bapi_customer_create

    Hi,
    can i get a sample code on bapi_customer_create, mean to say what are the parameters to be passed.waiting for your reply
    thanks and regards
    Sarala

    Hello,
    check this......code may helpful to u...
    Data:it_personaldata like standard table of bapikna101_1 with header line,
         it_copyreference like standard table of bapikna102 with header line,
         return like standard table of bapireturn1 with header line.
    data:v_customerno like bapikna103-customer.
    it_personaldata-title_p     = 'Mr.'.
    it_personaldata-firstname   = 'Jambavant'.
    it_personaldata-lastname    = 'jai'.
    it_personaldata-middlename  = 'john'.
    it_personaldata-date_birth  = '19780101'.
    *IT_PERSONALDATA-REGION      = 'CA'.
    it_personaldata-city        = 'Hyderabad'.
    it_personaldata-langu_p     = 'EN'.
    it_personaldata-district    = 'Hyd'.
    it_personaldata-postl_cod1  = '56012'.
    *IT_PERSONALDATA-PO_BOX      = '116'.
    it_personaldata-street      = 'Street'.
    it_personaldata-house_no    = '11/230'.
    it_personaldata-building    = 'Super'.
    it_personaldata-room_no     = '113'.
    it_personaldata-country     = 'DE'.
    it_personaldata-title_key   = '0002'.
    it_personaldata-currency    = 'DEM'.
    append it_personaldata.
    it_copyreference-salesorg   = '1000'.
    it_copyreference-distr_chan = '12'.
    it_copyreference-division   = '00'.
    it_copyreference-ref_custmr = '0000002140'.
    append it_copyreference.
    call function 'BAPI_CUSTOMER_CREATEFROMDATA1'
      exporting
        pi_personaldata              = it_personaldata
      PI_OPT_PERSONALDATA          = PI_OPT_PERSONALDATA
      PI_COMPANYDATA               = PI_COMPANYDATA
      PI_OPT_COMPANYDATA           = PI_OPT_COMPANYDATA
      PI_CONSUMEREN                = PI_CONSUMEREN
        pi_copyreference             = it_copyreference
      PI_CREDIT_CONTROL_FLAG       = PI_CREDIT_CONTROL_FLAG
    importing
       customerno                   = v_customerno
       return                       = return.
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.
    append return.
    loop at return.
      write:/ return-type, return-message.
    endloop.
    Thank u,
    santhosh

  • Updating problem stcd1,stcd2 fields in bsec table (one time account)

    Hi.
    I have problem to use one time customer.
    stcd1,stcd2 fields in bsec table did not input.
    Other fields have no problem.
    how can i solve it?
    Our SAP version is 4.7. package level is  SAPKH47025 (SAP_APPL).

    done

  • BADI For XK01 and MK01('bout STCD1)

    Hi, i need a badi for this transactions XK01 and MK01, what i need to do is to validate that the input for STCD1 exists into LFA1-STCD1
    Tks
    ttorres

    Good day,
    I want to add customer define screen or subscreen in subscreen area for xko1 tcode, there is Badi avialable vendor_add_data and vendor_add_data_cs but
    how adjuctly i have to attach screen using this.
    if u can help me.
    regards.

  • Index on LFA1 for STCD1..URGENT..!!!!

    HI All,
    IN transaction FBL1N, F4 help for vendor based on Tax code 1 is taking lot of time. After analysing SQL trace on this i understand that Index needs to be created on LFA1 table for STCD1.
    Can anyone please help me out as to what all fields i need to include in the index. Is it that i have to include only STCD1 in the index?
    Any pointers on this would be appriciated.
    Thanks in advance.
    -Sanjay

    hai
    kulkarni,
             if u want to retrieve the data based on stdc1 only , then u should create a  secondary index based on that field. if u want to use any other combination of fields other than primary key with stdc1, then it is better to create an index on those combination of fields rather than stdc1 only.
    Reward points if useful,
    thank you
    G.V.K.Prasad
    Edited by: PRASAD GVK on Apr 17, 2008 7:50 AM

  • Tax Code1(STCD1 for Vendor) Field Length Customizing based on Country

    Hi ,
    I want the TAX Code1(STCD1) info that when we create a vendor through Tcode XK01(With Control Checkbox), we get Tax Code1 field on the next screen,here based on the Vendor Country the lengths are defined. Now My Question is that :-
    If Length of STCD1 field is defined through Customizing, then where exactly it is done.Please help me out.
    If it is already fixed based on Country(Pre-defined) then its what about other countries which are not mentioned in F1 help of this list. I understand it is 16 Characters only.But need Confirmation.
    ~Manoj

    The length is defined in the IMG by country.  Depending on which version of SAP you are on the path names may be slightly different.  But, this is the path I know:
    SAP Netweaver - General Settings - Set Countries - Set Country Specific Checks.  You will need to click on each country you expect to have a vendor set up and change the length for tax code 1.
    Monique

  • Tax Classification STCD1

    Hello!!
    What Note Can I aplly in the SAP ECC release 6.0, Support Package 11 for repeated CNPJ validation?
    Thanks.
    Regards,
    Chagas, Vitor.

    Hi,
    You wont find any table for tax classification maintained in sales org-1 of material master.
    we maintain this while config in OVK4- which will store in Table:TSKM.
    based on tax category this tax classification called in material master.
    if you chek tax class in sales org-1. it shows some table structure.
    it wont store in any table.
    all the fields which is there in structures called from some other tables- wont have memory to store the records.
    hope it helps

  • Modify STCD1 Tax number

    Hi, i am trying to modify the tax number of a supplier but i cant. how can i do it.
    Thx

    Problem solved

  • [3.10] Foreignid Errado - idEstrangeiro

    Olá Experts,
    Seguindo o entendimento do meu cliente (e meu também), olhando o manual da NT2013.005, o campo foreignid = tag <idEstrangeiro> só deveria ser preenchido no XML 3.10 quando:
    1) A operação for Importação / Exportação E
    2) O parceiro destinatário for uma Pessoa Natural;
    Nesta linha de raciocínio temos que o Sap Standard, após a nota 2039647, está usando uma lógica errada para preenchimento do campo, pois ele busca primeiro KNA1-STCD1, caso vazio tenta KNA1-STCD2 e caso este esteja vazio, por ultimo vai no campo novo KNA1-RN, conforme o trecho de código abaixo:
    Para Fornecedor:
    Função J_1B_NF_VENDOR_READ
        IF NOT lfa1-stcd1 IS INITIAL.                         "2039647
          MOVE lfa1-stcd1     TO parnad-foreignid.            "2039647
        ELSEIF NOT lfa1-stcd2 IS INITIAL.                     "2039647
          MOVE lfa1-stcd2     TO parnad-foreignid.            "2039647
        ELSE.                                                 "2039647
          MOVE lfa1-rne       TO parnad-foreignid.            "2039647
        ENDIF.                                                "2039647
    Para Cliente:
    Função J_1B_NF_CUSTOMER_READ
        IF NOT kna1-stcd1 IS INITIAL.                         "2039647
          MOVE kna1-stcd1     TO parnad-foreignid.            "2039647
        ELSEIF NOT kna1-stcd2 IS INITIAL.                     "2039647
          MOVE kna1-stcd2     TO parnad-foreignid.            "2039647
        ELSE.                                                 "2039647
          MOVE kna1-rne       TO parnad-foreignid.            "2039647
        ENDIF.                                                "2039647
    Em nenhum momento o standard está verificando se o estrangeiro se trata de uma pessoa natural (flag KNA1-STKZN) antes de sair preenchendo o campo foreignid na Nota Fiscal.
    Alguém já passou por este problema? Alguma solução oficial ou não?
    Att.,
    Flavio Albuquerque

    Olá Flávio,
    seguindo a nota técnica 2013.005 na versão 1.21 de novembro 2014 o tag <idEstrangeiro> deverá ser preenchido
    1) A operação for Importação / Exportação
    OU
    2) O parceiro destinatário for uma Pessoa Natural estrangeiro como consumidor final;
    Veja a descrição do campo nas páginas 19, 50 (No. campo 64a), e a descrição das regras de validação (E03a) na página 103:
    Por isto, a lógica da SAP está correto. Se o pais do parceiro é diferente de BR = Operação com exterior, que necessita o ID estrangeiro.
    Espero de ter ajudado. Abraços, Titus.

  • Erro Transferência em duas etapas MM T.Mov 833/835

    Pessoal,
    Estou enfrentando um problema estranho aqui, cujo qual já pesquisei por notas, aqui no fórum e demais recursos.
    Utilizo o cenário de transf. em duas etapas, com solução standard de NFe. Na geração da NF do centro de origem (via mov.merc) ocorre tudo certo, nfe autoriza e tudo. Neste momento uma entrada é gerada na tabela J_1BNFE_ACTIVE (monitor da nfe).
    O problema ocorre quando efetuo a MBSU no centro de destino. O sistema identifica ser uma NFe, busca os dados da NFe de origem (via doc de material), preenche todos os campos para a NF nova de entrada no centro de destino, porém ao gravar, um erro ocorre no módulo de função J_1B_NFE_UPDATE_ACTIVE (in update task = SM13).
    O que acontece aqui é que esta função tenta inserir um novo registro no monitor (até ai tudo coerente..) só que na tabela J_1BNFE_ACTIVE  existe um índice unico (não permite duplicidade), pelos seguintes campos (abaixo) o que impede que a mesma nfe seja de saída em um centro e entrada em outro.
    MANDT   Mandante
    REGIO   Região do emissor NF-e
    NFYEAR   Ano da data do documento da NF-e
    NFMONTH   Mês da data do documento da NF-e
    STCD1   Nº CNPJ do emissor da NF-e
    MODEL   Modelo da nota fiscal
    SERIE   Série
    NFNUM9   Nº NF-e de nove posições
    DOCNUM9   NF-e: nº aleatório
    CDV   Dígito controle p/chave de acesso NF-e
    Perdi algo no caminho? Alguém sabe de alguma nota para isto ou já enfrentou este problema? Entendo que estã correto o preenchimento da tabela com os valores da NF de origem...mas este índice eu não entendi...
    Grato,
    SAP ECC 6.00 Versões..
    Componente software    Release      Nível   Supp.Package sup.      Descrição do componente software                          
    SAP_ABA                700          0022    SAPKA70022             Componente válido para várias aplicações                  
    SAP_BASIS              700          0022    SAPKB70022             Componentes de base SAP                                    
    PI_BASIS               2005_1_700   0022    SAPKIPYJ7M             PI_BASIS 2005_1_700                                        
    ST-PI                  2008_1_700   0002    SAPKITLRD2             SAP Solution Tools plug-in                                
    SAP_BW                 700          0024    SAPKW70024             SAP NetWeaver BI 7.0                                      
    SAP_AP                 700          0021    SAPKNA7021             SAP Application Platform                                  
    SAP_APPL               600          0018    SAPKH60018             Logística e contabilidade

    Boa noite Fernando,
    Eu tenho dois usuários pois um foi criado via uma conta da minha empresa que tem acesso a OSS (o login por certificado para mim é muito melhor).
    Criei a thread em meu PC de casa e nem notei que era outra conta.
    Não lhe conheço, mas vejo que contribui muito com o fórum, o que admiro, mas não pense que respondi para ganhar estes pontos..nem sei mesmo para o que servem....
    O intuito foi contribuir com quem tiver o mesmo problema.
    Abraços,

  • Script modification need

    DOCU – WINDOW
    This is the window on the top right side
    1.Document no (hard coded)
    2.Then display the document number for the first document for the current row. Maybe you should check prior to printing if the current row was posted error free   
       and invoke printing only if this is the case. Then get the first(!!!) document number from the error/message log for this row. ZGF_ICO_RECHR_L-DOCFR
    3. Document date (hard coded) it is P_BLDAT on the selection screen, already correct in the form
    4. VAT No (hard coded)
    5. Then display the EU VAT reg.no of that company. This is in table KNA1, where KUNNR = L_ROW-CUSTFR. The field is KNA1-STCEG, if it is empty, try to populate
         KNA1-STCD1.
    6. Order number(Hard coded)
    7. Just concatenate L_ROW-REF + the last number for that reference from the log table ZGF_ICO_RECHR_L (notice this table has not yet been created!!! and also
        the part is missing where we populate that table when posting both documents for a particular row) ZGF_ICO_RECHR_L-REF+NUMBER
    report  ZG00F_.
    Top Include for the data declarations
    class LCL_REF definition deferred.
    include ZG00F_INT_POST_INVOICE_TOP.
    data: G_ALV_TREE         type ref to CL_GUI_ALV_TREE,
          G_CUSTOM_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER,
          G_TEXT_CONTAINER   type ref to CL_GUI_CUSTOM_CONTAINER,
          G_LOGGER           type ref to CL_GUI_TEXTEDIT,
          G_TOOLBAR          type ref to CL_GUI_TOOLBAR.
    data: " gt_zgf_ico_rechr      type zgf_ico_rechr occurs 0,
                           "Output-Table
          OKCODE like SY-UCOMM.
          CLASS LCL_REF DEFINITION
    class LCL_REF definition.
      public section.
        data : VALID type BOOLEAN,
               CAN type BOOLEAN.
        methods : CONSTRUCTOR
                    importing IM_REF type ZGF_ICO_RECHR,
                  CAN_POST
                    returning VALUE(CAN) type BOOLEAN,
                  IS_VALID
                    returning VALUE(IS_VALID) type BOOLEAN,
                  GET_DIVA  returning VALUE(DIVA) type LVC_S_LAYN,
                  GET_DIVAC returning VALUE(DIVAC) type LVC_S_LACN,
                  FILL_BAPI_TABLES,
                  GET_REF returning VALUE(R_REF) type ZGF_ICO_RECHR-REF,
                  POST_INVOICE,
                  PRINT_INVOICE,
                  GET_ERRORS returning
                  VALUE(R_ERROR_TAB) type ABAPTXT255_TAB,
                  GET_PRDATA returning
                  VALUE(PR_REF) type ZGF_ICO_RECHR.
      private section.
        data: LINE type ABAPTXT255,
              ERROR_TAB type ABAPTXT255_TAB,
              FIELD like LINE.
        methods :  CHECK_VALIDITY.
    endclass.                    "lcl_ref DEFINITION
          CLASS lcl_ref IMPLEMENTATION
    class LCL_REF implementation.
      method GET_ERRORS.
        R_ERROR_TAB = ME->ERROR_TAB.
      endmethod.                    "get_errors
      method IS_VALID.
        IS_VALID = ME->VALID.
      endmethod.                    "is_valid
      method GET_PRDATA.
        PR_REF = L_REF.
      endmethod.                    "is_valid
      method PRINT_INVOICE.
        data: L_KUNNR type KNA1-KUNNR.
        data: L_ROW type ZGF_ICO_RECHR.
        call function 'OPEN_FORM'
         exporting
           APPLICATION                       = 'TX'
        ARCHIVE_INDEX                     =
        ARCHIVE_PARAMS                    =
           DEVICE                            = 'PRINTER'
           DIALOG                            = 'X'
             FORM                              = 'ZGF_INVOICE'
             LANGUAGE                          = SY-LANGU
         OPTIONS                           = is_options
         exceptions
             CANCELED                          = 1
             DEVICE                            = 2
             others                            = 12.
        if SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        call function 'START_FORM'
         exporting
           ARCHIVE_INDEX          =
           FORM                   = 'ZGF_INVOICE'
           LANGUAGE               = SY-LANGU
         exceptions
           FORM                   = 1
           others                 = 8.
        if SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        IF L_REF-TOTAL >= 0.
          IV_INVOICE = 'INVOICE  (COMCoE Recharge)'.
        ELSE.
          IV_INVOICE = 'Credit Memo  (COMCoE Recharge)'.
        ENDIF.
        call method ME->GET_PRDATA
          receiving
            PR_REF = L_ROW.
        L_KUNNR = L_ROW-CUSTFR.
        select single RCOMP ADRNR LAND1 ORT01
        into (IV_RCOMP, IV_ADRNR, IV_COMPLAND1, IV_COMPORT01)
        from T001 where BUKRS = L_ROW-CCFR.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'INVOICE'
            ELEMENT = 'T3'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
        IV_DOCDATE = P_BLDAT.
        IV_ORDNU = L_ROW-REF.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'DOCU'
            ELEMENT = 'T2'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
        select single KUNNR STRAS NAME1 LAND1 ORT01 STCEG
        into
        (IV_CUSTNO, IV_CUSTADD, IV_CUSTNAME1, IV_CUSTLAND1, IV_CUSTCITY,
    IV_DOCVAT)
        from KNA1
        where KUNNR = L_KUNNR.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'CUST'
            ELEMENT = 'T6'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
        IV_CUSTNO = L_KUNNR.
        IV_CURR = L_ROW-CURR.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'CUSTNO'
            ELEMENT = 'T4'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
        data: L_VAR(21).
        concatenate P_DATEFR0(4) '/' P_DATEFR4(2) '/' P_DATEFR+6(2)
        '-' P_DATETO0(4) '/' P_DATETO4(2) '/' P_DATETO+6(2)
        into L_VAR.
        IV_PERDAT = L_VAR.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'MAIN'
            ELEMENT = 'T1'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
        call function 'WRITE_FORM'
          exporting
            WINDOW  = 'FOOTER'
            ELEMENT = 'T5'
          exceptions
            WINDOW  = 1
            ELEMENT = 2.
    *CALL FUNCTION 'END_FORM'
    IMPORTING
      RESULT                         =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SPOOL_ERROR                    = 3
    CODEPAGE                        = 4
      OTHERS                         = 5.
        call function 'END_FORM'
          exceptions
            UNOPENED = 1.
        if SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        call function 'CLOSE_FORM'
          exceptions
            others = 6.
        if SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
      endmethod.                    "is_valid
      method GET_REF.
        R_REF = REF.
      endmethod.                    "get_ref
      method CONSTRUCTOR.
        L_REF = IM_REF.
        REF = IM_REF-REF.
        call method ME->CHECK_VALIDITY.
      endmethod.                    "constructor
      method GET_DIVA.
        DIVA-ISFOLDER = ''.
        if VALID <> 'X'.
          DIVA-N_IMAGE = ICON_NEGATIVE.
        else.
          DIVA-N_IMAGE = ICON_POSITIVE.
        endif.
      endmethod.                    "get_diva
      method GET_DIVAC.
        if V_ERROR1 = 'Y' or V_ERROR2 = 'Y'.
          DIVAC-N_IMAGE = ICON_RED_LIGHT.
        elseif V_ERROR1 = 'N' and V_ERROR2 = 'N'.
          DIVAC-N_IMAGE = ICON_GREEN_LIGHT.
        endif.
        DIVAC-U_N_IMAGE = 'X'.
      endmethod.                    "get_divac
      method CAN_POST.
        CAN = 'X'.
        call method ME->FILL_BAPI_TABLES.
      endmethod.                    "can_post
      method CHECK_VALIDITY.
    *Reference field must begin with M, Q, Y or J. Otherwise display an
    *error msg with text symbol TEXT-001 (ZGF_ICO_RECHR validation error –
    *Reference incorrect – rec.x) where x ist the numebr of the incorrect
    *record.
        data:  L_CHAR(1),
               L_REF1 type ZGF_ICO_RECHR-REF,
               L_ERR type OUTTAB_LINE_ERROR,
               L_NUM type N,
               L_KNB1 type KNB1,
               L_TBSL type TBSL,
               L_CSKS type CSKS,
               L_LFB1 type LFB1.
              l_flag(1).
        clear: L_CHAR, L_NUM, VALID.
        VALID = 'X'.
        L_REF1 = L_REF-REF.
        L_CHAR = L_REF1+0(1).
        if not ( L_CHAR = 'M'  or L_CHAR = 'Q'
                 or L_CHAR = 'Y' or L_CHAR = 'J').
         MESSAGE E398(00) WITH TEXT-001 ' ' ' ' ' '.
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-001.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
        clear: L_CHAR, L_NUM.
        L_CHAR = L_REF1+1(1).
        L_NUM = L_CHAR.
        if not L_CHAR = '0'.
          if L_NUM = 0.
            clear L_ERR.
            L_ERR = L_REF.
            L_ERR-ERR_MESG = TEXT-001.
            L_ERR-REC_NO = G_CNTR.
            append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
            append L_ERR-ERR_MESG to ERROR_TAB.
            VALID = 'F'.
          endif.
        endif.
        clear: L_CHAR, L_NUM.
        L_CHAR = L_REF1+2(1).
        L_NUM = L_CHAR.
        if not L_CHAR = '0'.
          if L_NUM = 0.
            clear L_ERR.
            L_ERR = L_REF.
            L_ERR-ERR_MESG = TEXT-001.
            L_ERR-REC_NO = G_CNTR.
            append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
            append L_ERR-ERR_MESG to ERROR_TAB.
            VALID = 'F'.
          endif.
        endif.
        clear: L_CHAR, L_NUM.
        L_CHAR = L_REF1+3(1).
        L_NUM = L_CHAR.
        if not L_CHAR = '0'.
          if L_NUM = 0.
            clear L_ERR.
            L_ERR = L_REF.
            L_ERR-ERR_MESG = TEXT-001.
            L_ERR-REC_NO = G_CNTR.
            append L_ERR-ERR_MESG to GT_ZGF_ICO_RECHR_ERRORS.
            VALID = 'F'.
          endif.
        endif.
        if not ( L_REF-FREQ = 'M' or L_REF-FREQ = 'Q' or L_REF-FREQ = 'Y').
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-002.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
        if not ( L_REF-CODE = 'A' or L_REF-CODE = 'B' or L_REF-CODE = 'C'
                 or L_REF-CODE = 'D' or L_REF-CODE = 'E'
                 or L_REF-CODE = 'F' ).
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-003.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
    *Customer FROM must not be flagged for deletion in KNB1. (KNB1-LOEVM
    *must be space), otherwise error message with TEXT-007. (ZGF_ICO_RECHR
    *validation error – From customer marked for deletion– rec.x) where x
    *ist the number of the incorrect record.
        select single * from KNB1 into L_KNB1
               where KUNNR = L_REF-CUSTFR.
        if SY-SUBRC = 0.
          if not L_KNB1-LOEVM is initial.
            clear L_ERR.
            L_ERR = L_REF.
            L_ERR-ERR_MESG = TEXT-007.
            L_ERR-REC_NO = G_CNTR.
            append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
            append L_ERR-ERR_MESG to ERROR_TAB.
            VALID = 'F'.
          endif.
          if not L_KNB1-SPERR  is initial.
            clear L_ERR.
            L_ERR = L_REF.
            L_ERR-ERR_MESG = TEXT-006.
            L_ERR-REC_NO = G_CNTR.
            append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
            append L_ERR-ERR_MESG to ERROR_TAB.
            VALID = 'F'.
          endif.
        endif.
       select single * from TBSL into L_TBSL
              where BSCHL = L_REF-PKFRD.
       if not L_TBSL-KOART = 'D'.
         clear L_ERR.
         L_ERR = L_REF.
         L_ERR-ERR_MESG = TEXT-008.
         L_ERR-REC_NO = G_CNTR.
         append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
         append L_ERR-ERR_MESG to ERROR_TAB.
         VALID = 'F'.
       endif.
       select single * from TBSL into L_TBSL
              where BSCHL = L_REF-PKFRS.
       if not L_TBSL-KOART = 'S'.
         clear L_ERR.
         L_ERR = L_REF.
         L_ERR-ERR_MESG = TEXT-009.
         L_ERR-REC_NO = G_CNTR.
         append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
         append L_ERR-ERR_MESG to ERROR_TAB.
         VALID = 'F'.
       endif.
       if not L_REF-PLTFR is initial.
         select single * from CSKS into L_CSKS
         where ZZWERKS = L_REF-PKFRS.
         if SY-SUBRC <> 0.
           clear L_ERR.
           L_ERR = L_REF.
           L_ERR-ERR_MESG = TEXT-012.
           L_ERR-REC_NO = G_CNTR.
           append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
           append L_ERR-ERR_MESG to ERROR_TAB.
           VALID = 'F'.
         endif.
       endif.
        select single * from LFB1 into L_LFB1
               where LIFNR = L_REF-CUSTTO.
        if not L_LFB1-LOEVM is initial.
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-018.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
        if not LFB1-SPERR is initial.
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-019.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
       select single * from TBSL into L_TBSL
              where BSCHL = L_REF-PKTOK.
       if not L_TBSL-KOART = 'K'.
         clear L_ERR.
         L_ERR = L_REF.
         L_ERR-ERR_MESG = TEXT-020.
         L_ERR-REC_NO = G_CNTR.
         append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
         append L_ERR-ERR_MESG to ERROR_TAB.
         VALID = 'F'.
       endif.
       select single * from TBSL into L_TBSL
              where BSCHL = L_REF-PKTOS.
       if not L_TBSL-KOART = 'S'.
         clear L_ERR.
         L_ERR = L_REF.
         L_ERR-ERR_MESG = TEXT-021.
         L_ERR-REC_NO = G_CNTR.
         append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
         append L_ERR-ERR_MESG to ERROR_TAB.
         VALID = 'F'.
       endif.
        if not L_REF-TOTAL > 0.
          clear L_ERR.
          L_ERR = L_REF.
          L_ERR-ERR_MESG = TEXT-017.
          L_ERR-REC_NO = G_CNTR.
          append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
          append L_ERR-ERR_MESG to ERROR_TAB.
          VALID = 'F'.
        endif.
       return valid.
      endmethod.                    "check_validity
    --- Method Post Invoice Start ---
      method POST_INVOICE.
      endmethod.                    "post_invoice
    --- Method Post Invoice End ---
    --- Method Filling Bapi Tables Start ---
      method FILL_BAPI_TABLES.
    *---- Populating Bapi for Customer
        V_TOTAL = L_REF-TOTAL.
        perform FILL_BAPI_CUSTOMER.
        V_ERROR1 = 'N'.
        V_ERROR2 = 'N'.
        delete IT_ERROR where NODE_ID = L_SELECTED_NODE.
        IS_ERROR-NODE_ID = L_SELECTED_NODE.
        IS_ERROR-ERROR  = SY-ULINE(30).
        append IS_ERROR to IT_ERROR.
        IS_ERROR-NODE_ID = L_SELECTED_NODE.
        IS_ERROR-ERROR  = L_REF-REF.
        append IS_ERROR to IT_ERROR.
        IS_ERROR-NODE_ID = L_SELECTED_NODE.
        IS_ERROR-ERROR  = SY-ULINE(30).
        append IS_ERROR to IT_ERROR.
        IS_ERROR-NODE_ID = L_SELECTED_NODE.
        IS_ERROR-ERROR   = '*** Checking Customer Document ***'.
        append IS_ERROR to IT_ERROR.
        clear IS_ERROR.
    *---- Checking for 1st Document
        call function 'BAPI_ACC_DOCUMENT_CHECK'
          exporting
            DOCUMENTHEADER       = WA_DOCUMENTHEADER
          tables
            ACCOUNTGL            = LT_ACCOUNTGL
            ACCOUNTRECEIVABLE     =
            LT_ACCOUNTRECEIVABLE
            ACCOUNTTAX           = LT_ACCOUNTTAX
            CURRENCYAMOUNT       = LT_CURRENCYAMOUNT
            RETURN               = LT_RETURN.
        loop at LT_RETURN into WA_RETURN.
          if WA_RETURN-TYPE = 'E' or WA_RETURN-TYPE = 'A'.
            V_ERROR1 = 'Y'.
          endif.
          IS_ERROR-NODE_ID = L_SELECTED_NODE.
          concatenate WA_RETURN-TYPE WA_RETURN-MESSAGE into IS_ERROR-ERROR
            separated by '-'.
          append IS_ERROR to IT_ERROR.
        endloop.
    *--- Checking for 2nd Document
        if V_ERROR1 = 'N'.
    *---- Populating Bapi for Vendor
          L_REF-TOTAL = V_TOTAL.
          perform FILL_BAPI_VENDOR.
          IS_ERROR-NODE_ID = L_SELECTED_NODE.
          IS_ERROR-ERROR   = '*** Checking for Vendor Document ***'.
          append IS_ERROR to IT_ERROR.
          clear IS_ERROR.
          call function 'BAPI_ACC_DOCUMENT_CHECK'
            exporting
              DOCUMENTHEADER = WA_DOCUMENTHEADER2
            tables
              ACCOUNTGL      = LT_ACCOUNTGL2
              ACCOUNTPAYABLE = LT_ACCOUNTPAYABLE
              ACCOUNTTAX     = LT_ACCOUNTTAX2
              CURRENCYAMOUNT = LT_CURRENCYAMOUNT2
              RETURN         = LT_RETURN2.
          loop at LT_RETURN2 into WA_RETURN2.
            if WA_RETURN-TYPE = 'E' or WA_RETURN-TYPE = 'A'.
              V_ERROR2 = 'Y'.
            endif.
            IS_ERROR-NODE_ID = L_SELECTED_NODE.
            concatenate WA_RETURN2-TYPE WA_RETURN2-MESSAGE into
             IS_ERROR-ERROR separated by '-'.
            append IS_ERROR to IT_ERROR.
          endloop.
        endif.
    *--- CHECK WHETHER BOTH DOCUMENTS ARE CORRECT OR NOT returned SUCCESS
        if V_ERROR1 = 'N' and V_ERROR2 = 'N'.
    *--- Posting 1st Document - Customer
          IS_ERROR-NODE_ID = L_SELECTED_NODE.
          IS_ERROR-ERROR   = '*** Posting Customer Document ***'.
          append IS_ERROR to IT_ERROR.
          clear IS_ERROR.
          call function 'BAPI_ACC_DOCUMENT_POST'
            exporting
              DOCUMENTHEADER       = WA_DOCUMENTHEADER
            tables
              ACCOUNTGL            = LT_ACCOUNTGL
              ACCOUNTRECEIVABLE     =
              LT_ACCOUNTRECEIVABLE
              ACCOUNTTAX           = LT_ACCOUNTTAX
              CURRENCYAMOUNT       = LT_CURRENCYAMOUNT
              RETURN               = LT_RETURN.
          call function 'BAPI_TRANSACTION_COMMIT'.
          loop at LT_RETURN into WA_RETURN.
            IS_ERROR-NODE_ID = L_SELECTED_NODE.
           concatenate WA_RETURN-TYPE WA_RETURN-MESSAGE into IS_ERROR-ERROR
             separated by '-'.
            append IS_ERROR to IT_ERROR.
          endloop.
    *--- Posting 2nd Document - Vendor
          IS_ERROR-NODE_ID = L_SELECTED_NODE.
          IS_ERROR-ERROR   = '*** Posting Vendor Document ***'.
          append IS_ERROR to IT_ERROR.
          clear IS_ERROR.
          call function 'BAPI_ACC_DOCUMENT_POST'
            exporting
              DOCUMENTHEADER = WA_DOCUMENTHEADER2
            tables
              ACCOUNTGL      = LT_ACCOUNTGL2
              ACCOUNTPAYABLE = LT_ACCOUNTPAYABLE
              ACCOUNTTAX     = LT_ACCOUNTTAX2
              CURRENCYAMOUNT = LT_CURRENCYAMOUNT2
              RETURN         = LT_RETURN2.
          call function 'BAPI_TRANSACTION_COMMIT'.
          loop at LT_RETURN2 into WA_RETURN2.
            IS_ERROR-NODE_ID = L_SELECTED_NODE.
            concatenate WA_RETURN2-TYPE WA_RETURN2-MESSAGE into
             IS_ERROR-ERROR separated by '-'.
            append IS_ERROR to IT_ERROR.
          endloop.
        endif. "if V_ERROR1 = 'N' and V_ERROR2 = 'N'.
    *--- Setting colour of node.
        data:  LO_REF type ref to LCL_REF,
               IS_NODE_LAYOUT type LVC_S_LACN,
               L_NODE_TEXT type LVC_VALUE,
               WA_OREF type TY_REF.
        clear :IS_NODE_LAYOUT,L_NODE_TEXT, WA_OREF, LO_REF.
        create object LO_REF exporting IM_REF = LS_ZGF_ICO_RECHR.
        IS_NODE_LAYOUT = LO_REF->GET_DIVAC( ).
        read table GT_ZGF_ICO_RECHR into L_REF index L_SELECTED_NODE.
        L_NODE_TEXT = L_REF-REF.
        call method G_ALV_TREE->CHANGE_NODE
          exporting
            I_NODE_KEY     = L_SELECTED_NODE
            I_OUTTAB_LINE  = L_REF
            IS_NODE_LAYOUT = IS_NODE_LAYOUT
            I_NODE_TEXT    = L_NODE_TEXT
            I_U_NODE_TEXT  = 'X'
          exceptions
            NODE_NOT_FOUND = 1
            others         = 2.
        call method G_ALV_TREE->FRONTEND_UPDATE.
        call method CL_GUI_CFW=>FLUSH
          exceptions
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2.
      endmethod.                    "fill_int_tables
    endclass.                    "lcl_ref IMPLEMENTATION
          CLASS lcl_event_handler DEFINITION
    class LCL_EVENT_HANDLER definition.
      public section.
        class-methods : ON_NODE_CLICK for event
          NODE_DOUBLE_CLICK of CL_GUI_ALV_TREE
            importing NODE_KEY.
        methods: ON_FUNCTION_SELECTED
                   for event FUNCTION_SELECTED of CL_GUI_TOOLBAR
                     importing FCODE.
    endclass.                    "lcl_event_handler DEFINITION
          CLASS lcl_event_handler IMPLEMENTATION
    class LCL_EVENT_HANDLER implementation.
      method  ON_NODE_CLICK.
      endmethod.                    "on_node_click
      method ON_FUNCTION_SELECTED.
        data: LT_SELECTED_NODES type LVC_T_NKEY,
              L_RC              type C,
              L_CAN             type C,
              L_REC             type I,
              WA_OREF           type TY_REF,
              L_LINE            type SY-TABIX.
    Determine which line is selected
        call method G_ALV_TREE->GET_SELECTED_NODES
          changing
            CT_SELECTED_NODES = LT_SELECTED_NODES.
        call method CL_GUI_CFW=>FLUSH.
    remark: The user can not select more than one node since the
            default value of NODE_SELECTION_MODE is
            cl_gui_column_Tree=>NODE_SEL_MODE_SINGLE (see constructor).
        describe table LT_SELECTED_NODES lines L_REC.
        if L_REC = 0 and FCODE = 'ERROR'.
    *--- Show log for all if nothing is selected then.
          refresh LT_ERRORS.
          clear LT_ERRORS.
          loop at IT_ERROR into IS_ERROR.
            IS_ERRORS-LINE = IS_ERROR-ERROR.
            append IS_ERRORS to LT_ERRORS.
          endloop.
          call method G_LOGGER->SET_TEXT_AS_R3TABLE
            exporting
              TABLE = LT_ERRORS.
        endif.
        loop at  LT_SELECTED_NODES into L_SELECTED_NODE.
          clear : L_REF, WA_OREF.
          L_LINE = SY-TABIX.
          read table GT_OREF into WA_OREF index L_SELECTED_NODE.
          read table GT_ZGF_ICO_RECHR into L_REF index L_SELECTED_NODE.
          if SY-SUBRC = 0.
            case FCODE.
              when 'ERROR'.
                refresh LT_ERRORS.
                clear LT_ERRORS.
                loop at IT_ERROR into IS_ERROR where NODE_ID =
                                                      L_SELECTED_NODE.
                  IS_ERRORS-LINE = IS_ERROR-ERROR.
                  append IS_ERRORS to LT_ERRORS.
                endloop.
                call method G_LOGGER->SET_TEXT_AS_R3TABLE
                  exporting
                    TABLE = LT_ERRORS.
              when 'POST'.
                if L_LINE = 1.
                  if WA_OREF-O_REF->IS_VALID( ) = 'X'.
                    clear L_RC.
                    call function 'POPUP_TO_CONFIRM_STEP'
                      exporting
                        TEXTLINE1      = 'Do you want to post'  "(902)
                        TEXTLINE2      = '?'                    "(903)
                        TITEL          = 'Confirmation'         "(904)
                        CANCEL_DISPLAY = ' '
                      importing
                        ANSWER         = L_RC.
                  else.
                    call function 'POPUP_TO_INFORM'
                      exporting
                        TITEL = 'Select Another Record..'
                        TXT1  = 'Data Wrong,'
                        TXT2  = 'Posting Can Not be Done'.
                  endif.
                else.
                  L_RC = 'J'.
                endif.
                if L_RC eq 'J'.
    *---Post Invoice.
                  if WA_OREF-O_REF->CAN_POST( ) = 'X'.
                    call method WA_OREF-O_REF->POST_INVOICE.
    *---Printing Log.
                    refresh LT_ERRORS.
                    clear LT_ERRORS.
                    loop at IT_ERROR into IS_ERROR.
                      IS_ERRORS-LINE = IS_ERROR-ERROR.
                      append IS_ERRORS to LT_ERRORS.
                    endloop.
                    call method G_LOGGER->SET_TEXT_AS_R3TABLE
                      exporting
                        TABLE = LT_ERRORS.
                  endif.
                endif.
              when 'PRINT'.
                call method WA_OREF-O_REF->PRINT_INVOICE.
            endcase.
          else.
            message I000(0K) with 'Please select a node.'.
          endif.
        endloop.
      endmethod.                    "on_function_selected
    endclass.                    "lcl_event_handler IMPLEMENTATION
    START-OF-SELECTION.
    start-of-selection.
    end-of-selection.
      call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    module STATUS_0100 output.
      set pf-status 'MAIN100'.
      set titlebar 'MAINTITLE'.
      if G_ALV_TREE is initial.
        perform INIT_TREE.
        call method CL_GUI_CFW=>FLUSH
          exceptions
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2.
        if SY-SUBRC ne 0.
         call function 'POPUP_TO_INFORM'
           exporting
             titel = 'Automation Queue failure'(801)
             txt1  = 'Internal error:'(802)
             txt2  = 'A method in the automation queue'(803)
             txt3  = 'caused a failure.'(804).
        endif.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Form  init_tree
          text
    -->  p1        text
    <--  p2        text
    form INIT_TREE .
      data: L_TREE_CONTAINER_NAME(30) type C.
    *Reference tree
      L_TREE_CONTAINER_NAME = 'ZCONTAINER'.
      create object G_CUSTOM_CONTAINER
         exporting
               CONTAINER_NAME = L_TREE_CONTAINER_NAME
         exceptions
               CNTL_ERROR                  = 1
               CNTL_SYSTEM_ERROR           = 2
               CREATE_ERROR                = 3
               LIFETIME_ERROR              = 4
               LIFETIME_DYNPRO_DYNPRO_LINK = 5.
      if SY-SUBRC <> 0.
       MESSAGE x208(00) WITH 'ERROR'(100).
      endif.
    create tree control
      create object G_ALV_TREE
        exporting
            PARENT              = G_CUSTOM_CONTAINER
            NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_MULTIPLE
           NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_SINGLE
            ITEM_SELECTION      = 'X'
            NO_HTML_HEADER      = ''
            NO_TOOLBAR          = ''
        exceptions
            CNTL_ERROR                   = 1
            CNTL_SYSTEM_ERROR            = 2
            CREATE_ERROR                 = 3
            LIFETIME_ERROR               = 4
            ILLEGAL_NODE_SELECTION_MODE  = 5
            FAILED                       = 6
            ILLEGAL_COLUMN_NAME          = 7.
      if SY-SUBRC <> 0.
        message X208(00) with 'ERROR'.                          "#EC NOTEXT
      endif.
    ****logger
      L_TREE_CONTAINER_NAME = 'ZLOGGER'.
      create object G_TEXT_CONTAINER
         exporting
               CONTAINER_NAME = L_TREE_CONTAINER_NAME
         exceptions
               CNTL_ERROR                  = 1
               CNTL_SYSTEM_ERROR           = 2
               CREATE_ERROR                = 3
               LIFETIME_ERROR              = 4
               LIFETIME_DYNPRO_DYNPRO_LINK = 5.
      create object G_LOGGER
          exporting PARENT = G_TEXT_CONTAINER
          NAME = 'Error Log'.
      call method G_LOGGER->SET_READONLY_MODE.
    endlogger
      data L_HIERARCHY_HEADER type TREEV_HHDR.
      data: LT_LIST_COMMENTARY type SLIS_T_LISTHEADER,
            L_LOGO             type SDYDO_VALUE.
      data : WA_FIELDCATALOG type LVC_S_FCAT.
      perform BUILD_HIERARCHY_HEADER changing L_HIERARCHY_HEADER.
      perform BUILD_COMMENT using LT_LIST_COMMENTARY
                                  L_LOGO.
      clear : WA_FIELDCATALOG, GT_FIELDCATALOG.
    get fieldcatalog
      call function 'LVC_FIELDCATALOG_MERGE'
        exporting
          I_STRUCTURE_NAME = 'ZGF_ICO_RECHR'
        changing
          CT_FIELDCAT      = GT_FIELDCATALOG.
      loop at GT_FIELDCATALOG into WA_FIELDCATALOG.
        case WA_FIELDCATALOG-FIELDNAME.
          when 'REF'.
            WA_FIELDCATALOG-NO_OUT = 'X'.
        endcase.
        WA_FIELDCATALOG-OUTPUTLEN = 15.
        modify GT_FIELDCATALOG from WA_FIELDCATALOG.
      endloop.
      call method G_ALV_TREE->SET_TABLE_FOR_FIRST_DISPLAY
        exporting
          IT_LIST_COMMENTARY  = LT_LIST_COMMENTARY
          I_LOGO              = L_LOGO
         i_structure_name    = 'ZGF_ICO_RECHR'
          IS_HIERARCHY_HEADER = L_HIERARCHY_HEADER
        changing
          IT_FIELDCATALOG     = GT_FIELDCATALOG
          IT_OUTTAB           = GT_ZGF_ICO_RECHR. "table must be empty !
      perform CREATE_HIERARCHY.
      perform CHANGE_TOOLBAR.
      perform REGISTER_EVENTS.
      call method G_ALV_TREE->FRONTEND_UPDATE.
    endform.                    " init_tree
    *&      Form  build_hierarchy_header
    form BUILD_HIERARCHY_HEADER  changing
            P_HIERARCHY_HEADER type TREEV_HHDR.
      P_HIERARCHY_HEADER-HEADING = 'Reference Number'(300).
      P_HIERARCHY_HEADER-TOOLTIP = 'Reference numbers for invoices'(400).
      P_HIERARCHY_HEADER-WIDTH = 30.
      P_HIERARCHY_HEADER-WIDTH_PIX = ' '.
    endform.                    " build_hierarchy_header
    *&      Form  create_hierarchy
    form CREATE_HIERARCHY .
      clear : LS_ZGF_ICO_RECHR, L_LAST_KEY.
    §4a. Select data
      refresh GT_ZGF_ICO_RECHR.
      select * from ZGF_ICO_RECHR into table LT_ZGF_ICO_RECHR
       where FREQ in SO_FREQ
         and  REF in SO_REF.
      sort LT_ZGF_ICO_RECHR by REF.
    Note: The top level nodes do not correspond to a field of the
    output table. Instead we use data of the table to invent another
    hierarchy level above the levels that can be build by sorting.
    §4c. Add data to tree
      G_CNTR = 1.
    sort by oref->get_diva->image .
      loop at LT_ZGF_ICO_RECHR into LS_ZGF_ICO_RECHR.
        perform ADD_COMPLETE_LINE using  LS_ZGF_ICO_RECHR
                                          changing L_LAST_KEY.
        G_CNTR = G_CNTR + 1.
    perform add_node using ls_zgf_ico_rechr-ref
                      changing l_last_key.
      endloop.
    endform.                    " create_hierarchy
    *&      Module  USER_COMMAND_0100  INPUT
    module USER_COMMAND_0100 input.
      SAVE_OK = OKCODE.
      clear OKCODE.
      case SAVE_OK.
        when 'EXIT' or 'BACK' or 'CANC'.
          perform EXIT_PROGRAM.
        when others.
    §6. Call dispatch to process toolbar functions
          call method CL_GUI_CFW=>DISPATCH.
      endcase.
      call method CL_GUI_CFW=>FLUSH.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  exit_program
          text
    form EXIT_PROGRAM .
      call method G_CUSTOM_CONTAINER->FREE.
      leave to screen 0.
    endform.                    " exit_program
    *&      Form  add_complete_line
    form ADD_COMPLETE_LINE  using    P_LS_ZGF_ICO_RECHR type ZGF_ICO_RECHR
                                     P_RELAT_KEY type LVC_NKEY
                            changing P_NODE_KEY type LVC_NKEY.
      data: L_NODE_TEXT type LVC_VALUE,
            LO_REF type ref to LCL_REF,
            L_NODE_LAYOUT type LVC_S_LAYN.
    add leaf:
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set.
    Since these nodes will never get children they stay leaves
    (as intended).
      clear L_NODE_LAYOUT.
      create object LO_REF exporting IM_REF = P_LS_ZGF_ICO_RECHR.
      data : WA_OREF type TY_REF.
      clear WA_OREF.
      WA_OREF-O_REF = LO_REF.
      append WA_OREF to GT_OREF.
      L_NODE_LAYOUT = LO_REF->GET_DIVA( ).
      L_NODE_TEXT = P_LS_ZGF_ICO_RECHR-REF.
      call method G_ALV_TREE->ADD_NODE
        exporting
          I_RELAT_NODE_KEY = P_RELAT_KEY
          I_RELATIONSHIP   = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          IS_OUTTAB_LINE   = P_LS_ZGF_ICO_RECHR   "_REF
          I_NODE_TEXT      = L_NODE_TEXT
          IS_NODE_LAYOUT   = L_NODE_LAYOUT
        importing
          E_NEW_NODE_KEY   = P_NODE_KEY.
    endform.                    " add_complete_line
    *&      Form  add_node
    form ADD_NODE  using    P_REF
                   changing P_NODE_KEY type LVC_NKEY.
      clear L_NODE_LAYOUT.
      L_NODE_LAYOUT-ISFOLDER = ''.
      L_NODE_LAYOUT-N_IMAGE = ICON_POSITIVE.
      L_NODE_TEXT =  'Reference1'. " ps_sflight-carrid.
      call method G_ALV_TREE->ADD_NODE
        exporting
          I_RELAT_NODE_KEY = '' " p_relat_key
          I_RELATIONSHIP   = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          I_NODE_TEXT      = L_NODE_TEXT
          IS_OUTTAB_LINE   = P_REF
          IS_NODE_LAYOUT   = L_NODE_LAYOUT
        importing
          E_NEW_NODE_KEY   = P_NODE_KEY.
    endform.                    " add_node
    *&      Form  register_events
    form REGISTER_EVENTS .
      data: LT_EVENTS type CNTL_SIMPLE_EVENTS,
            L_EVENT type CNTL_SIMPLE_EVENT,
            L_EVENT_RECEIVER type ref to LCL_EVENT_HANDLER.
      call method G_ALV_TREE->GET_REGISTERED_EVENTS
        importing
          EVENTS = LT_EVENTS.
    *NODE_DOUBLE_CLICK
      clear L_EVENT.
      move CL_GUI_COLUMN_TREE=>EVENTID_NODE_DOUBLE_CLICK to L_EVENT-EVENTID.
      append L_E

    Ok fine that can be acchived by setting the retention policy and by issuing delete obsolete command.That's perfect.If FRA is configured then even delete obsolete command is also not required.
    but i want to keep the last full backup for 15 days and archived logs only for one day.In this case can we set seperate retention policy for full backup and backup of archived logs
    for the time being i just want to modify my present existing OS script to acchive my task and i will conside changing RMAN script later on.Can u provide me the modified OS script so that my work gets finishes succesfully.
    Thank You...

  • UNION statement in ABAP SQL

    Hi,
    How to achieve the UNION SQL operation results in ABAP? To be specific, I want to retrieve STCD1 field value from vendor master table (LFA1) for all vendors (LIFNR) that exist in table BSIK or BSAK.
    And I want to achieve the results in single SQL statement. So in essence, the resultant SQL would be something like:
    SELECT STCD1
    INTO TABLE my_internal_table
    FROM LFA1
    WHERE LIFNR IN (SELECT DISTINCT LIFNR
                                                FROM BSIK
                                UNION
                                SELECT DISTINCT LIFNR
                                               FROM BSAK)
    But the UNION is not a valid keyword in ABAP. Any idea how to achieve this?
    Regards,
    Chetan

    hi chetan,
    do you have any where condition to filter the records from bsak and bsik?
    your requirement cannot be realized in a single statement.
    you have to use two separate selects from bsak and bsik, then, collect all the vendors in one internal table and at last you have to use this table to get the vendor info from lfa1.
    regards,
    ravi

Maybe you are looking for

  • How do I move from the 3/23 to the 6/28 iPod updater?

    I have an iPod that I got a couple weeks ago, which came with the 3/23 1.1.1 iPod software. I now see that there is a 1.1.2 version available, but the instructions on the web for moving to the new iPod updater are not very specific. Here are the inst

  • ABAP Program using Selection Screen in Process Chain

    Hi, I have included an ABAP Program in the Process Chain. The ABAP Program takes a selection screen value from user before execution. I have created a variant for both the ABAP Process (YPV_ABC) and a variant for the Selection Screen (YPV_XYZ). The A

  • Problem in deploying a migrated bpel process from 10.1.2 to 10.1.3

    Hi, I had migrated a bpel process developed 10.1.2 to 10.1.3. After migration I had modified a bpel process flow and tried to deploy it. But I am facing a following error: <B>Error: Failed to compile classes.Failed to compile the generated BPEL class

  • Performance monitoring by service operation

    Hi, We are using PI 7.1 I am drafting naming conventions for our company's PI development and using PI Best Practices : Naming Conventions as a starting point. Now one issue I have , and I beleive it is quite a big one, is that the best practice reco

  • How can i view third party charges to my account?

    I received  a text message that a third party charge was made to my account and I could view it online....how do I find it?