Reg Header in loop

hi All,
i want to Print Header in multiple pages using Folder in loop. and that loop contains multiple folders and loops in side. in Folder events i selected Header and Start of table and at Page break. but it is triggering only Start of table event not the at Page break event.. if any body encountered same problem let me know soltution.
Exact Requirement is :
i want to print Header(like material no, desc ...etc) per each page. my materials are displayed using the loops and inside the loops and folders. i am not using table here. so i used a folder at first position in the main loop. in that folder i checked Header with Start of table and at page break. thing is here only top of page event is triggered but at page break is not triggered eventhouh materails are scrolled to multiple pages. but i want materail no, desc in all pages by using loop->folder but not table.
Thanks
Ashok P
Message was edited by:
        Ashok Parupalli

Hi,
Still if your are lokking for the solution here is the one.
you can print the header details you havementioned in every page by just placing the window defined with htese details in the next page and with in the loop where multiole pages are trigered.
REgards,
Raghu.
Please allocate points if this servers you requirement.

Similar Messages

  • Header section looping for EDI 214 schema

    Hi,
    I have an input schema in the below format.
    <RootNode>
    <Header>
    <Milestone/>
    <Details>
    <Detail>
    </Detail>
    <Detail>
    </Detail>
    </Details>
    </Header>
    <Header>
    <Milestone/>
    <Details>
    <Detail>
    </Detail>
    <Detail>
    </Detail>
    </Details>
    </Header>
    </RootNode>
    And for output,I am using the standard EDI X12 214 schema.
    For detail level looping, i have mapped "Details" node to "LXLoop1" which supports looping. And hence when i place a file with single header and multiple details, i am getting the desired output.
    But I also need to handle header level looping, So i tried mapping "RootNode" from input schema to "X12_00401_214" node which is a root node for output schema. But when I place input file with multiple headers, I am getting the below
    error.
    Unable to read the stream produced by the pipeline.
     Details: Error: 1 (Segment level error)
     SegmentID: B10
     Position in TS: 1
     5: Segment Exceeds Maximum Use Description 
    Please suggest on how to proceed with the outer looping part as soon as possible.
    Thanks in advance,
    Anand

    So, if those header details are different, different shipments I presume, then you have some more work to do.
    You can't use a single ST for your batch because, as you've noticed, B10 doesn't loop.
    Here's the steps you have to take:
    Debatch the incoming message to individual Header messages.
    Map each to Header to an individual 214.
    At this point, you have another choice:
    Send each 214 individually by routing it directly to the Send Port.  This will give you one ISA/GS/ST per outbound message/Interchange.  Some receivers are perfectly fine with that.
    Batch the indivisual 214's to create a single Interchagne, ISA/GS, with multiple ST's using the Batching Service.  Details here:
    http://msdn.microsoft.com/en-us/library/bb226413.aspx

  • Reg:HEADER MAPPING

    I really want to know the use of HEADER MAPPING IN IDOC based scenarios : for what purpose do we need to specify the fields
    sender service:
    sender party:
    receiver service:
    receiver party:
    in header mapping,if header mapping is not specified do IDOC based scenarios works?

    HI,
    You need not specify the header mapping in IDOC based scenarios. If its idoc to file then you have maintain adpater specific identifiers in your business system. If its file to idoc then too header mapping is not necessary.
    Follow these links.
    https://wiki.sdn.sap.com/wiki/display/XI/FileToIDOC
    https://wiki.sdn.sap.com/wiki/display/profile/2007/05/11/FileToIDOC
    https://wiki.sdn.sap.com/wiki/display/profile/2007/05/11/FileToIDOC-Part2+%28Configuration%29
    https://wiki.sdn.sap.com/wiki/display/profile/2007/05/11/FileToIDOC-Part3%28StepsrequiredinXIandR3%29
    https://wiki.sdn.sap.com/wiki/display/XI/StepbyStepProcedureofIDOCtoFileScenariousingBPM
    Regards,
    Merrilly

  • Reg: Header text updation in VL02n transaction

    Hi Experts,
    i have one requirement in return delivery.
    I am executing one customizing trasaction, and it displays screen.
    In that screen i am editing the fileds and when i click on the save button i need to update in delivery transaction header texts (VL02n transaction goto header texts).

    Hi,
    Use the SAVE-TEXT FM as below.
      CALL FUNCTION 'SAVE_TEXT'
           EXPORTING
                HEADER    = LS_THEAD
           IMPORTING
                NEWHEADER = LS_THEAD
           TABLES
                LINES     = TLINETAB
           EXCEPTIONS
                ID        = 1
                LANGUAGE  = 2
                NAME      = 3
                OBJECT    = 4
                OTHERS    = 5.
      IF SY-SUBRC = 0.
    Where LS_THEAD, CONTAINS:
                                            TDOBJECT                                             VBBK
                                            TDNAME                                             00999999(Your delivery no)
                                            TDID                                                         Z950
                                            TDSPRAS                                             E.
    You can find this details, when you go to the transaction(VL02N) and enter some text and do the debug on  SAVE_TEXT FM, then get the values it uses to save the text, use the same in you program.
    Hope this helps,
    Cheers,
    Srini.

  • Reg : Heading display in Adobe Forms

    I have Created an appln using Adobe Forms.
    In Body Pages Data is displayed with Heading. I have given Flowed Option for mulitple pages display.I want the Heading
    to be reflected in all the body pages.
    I  don't want to display it in Master Page bcos I am displaying some text in first body pages continued by the table.
    Any option is there for getting Heading in all the Table display pages only. Thnks in advance...

    Hi
        Go to the Table in the body page  -> then select the Header row only -> right click on the header  row -> Go to Palletes -> Object -> Under pagination tab -> Check the check box Include Header Row in Subsequent Pages .
    Then save and active it. Try this one. I think it will solve your problem.
    Thanks
    Sriiiiiiiiiiii(Srikanth)

  • Smart form-table header-box

    Moved to correct forum by moderator
    Hello All,
    in my smartform iam displaying the data by looping a table. i ahve put a header inside loop.
    and for each new sales order , ia m going explicitly to new page, and when more number of items are there, that can fit in one page, then the smartform implicitly going to new page.
    my problem is, when smart form implicitly going to new page, the MAIN WINDOW is not called, so my header is not displayed. iam displaying this header using a template.
    the other windows, like date etc...are displayed, even if it goes to new page implicitly.
    is there any way i can show the header (in template), in page that called implicitely.
    Thanks in advance
    Best Regards,
    Amarender Reddy B
    Edited by: Matt on Dec 17, 2008 9:59 AM

    >
    Amarender Reddy Busireddy wrote:
    > Hello chenna
    > thanks for your answer
    > can you let em know, how to check that, i am getting that check box in display mode, even if enter the smart form in change mode.
    >   i tried many ways but i could not make that check box editable
    Thats because your table is not in the MAIN window I suppose. Keep your table in the MAIN window of the smartform and then Chenna's solution would work fine.
    Vishwa.

  • Having header line in the structure inside another structure

    How can I have a header line in a structure within a structure?
    (I have posted a question before...but seems to be unclear..so I closed that thread and open a new one)
    Thanks!
    When compiling the below codes, I got error message stating that 'The internal table "IT_SALES_ORDER-DETAIL" has no header line - explicit specification of an output area with "INTO wa" or "ASSIGNING <fs>" is required'.
    I know that the problem can be solved by using field symbols... but I wonder I can have a header line declared in a structure within another structure.
    types: begin of ty_header,
             vbeln like vbak-vbeln,
             erdat like vbak-erdat,
             audat like vbak-audat,
             vkorg like vbak-vkorg,
             vtweg like vbak-vtweg,
             spart like vbak-spart,
             kunnr like vbak-kunnr,
             netwr like vbak-netwr,
             end of ty_header.
    types: begin of ty_detail,
             posnr like vbep-posnr,
             edatu like vbep-edatu,
             etenr like vbep-etenr,
             ettyp like vbep-ettyp,
             wmeng like vbep-wmeng,
             bmeng like vbep-bmeng,
             vrkme like vbep-vrkme,
             mbdat like vbep-mbdat,
             lddat like vbep-lddat,
           end of ty_detail.
    types: begin of ty_sales_order,
               header type ty_header,
               detail type ty_detail occurs 0,
           end of ty_sales_order.
    data: it_sales_order type standard table of ty_sales_order
          with header line initial size 0.
    data: it_selected_order type standard table of ty_header
          with header line initial size 0.
    select *
      into corresponding fields of table it_selected_order
      from vbak
    where erdat > '01.01.2005' and erdat < '31.12.2005'.
    write :/ sy-subrc.
    loop at it_selected_order.
      clear: it_sales_order-header, it_sales_order-detail.
      move-corresponding it_selected_order to it_sales_order-header.
      select *
        into corresponding fields of table it_sales_order-detail
        from vbep
       where vbeln = it_sales_order-header-vbeln.
      append it_sales_order.
    endloop.
    loop at it_sales_order.
      write :/ it_sales_order-header-vbeln.
      loop at it_sales_order-detail.
      endloop.
    endloop.

    You have to use a work area here, no header lines.
    report zrich_0002 no standard page heading.
    types: begin of ty_header,
    vbeln like vbak-vbeln,
    erdat like vbak-erdat,
    audat like vbak-audat,
    vkorg like vbak-vkorg,
    vtweg like vbak-vtweg,
    spart like vbak-spart,
    kunnr like vbak-kunnr,
    netwr like vbak-netwr,
    end of ty_header.
    types: begin of ty_detail,
    posnr like vbep-posnr,
    edatu like vbep-edatu,
    etenr like vbep-etenr,
    ettyp like vbep-ettyp,
    wmeng like vbep-wmeng,
    bmeng like vbep-bmeng,
    vrkme like vbep-vrkme,
    mbdat like vbep-mbdat,
    lddat like vbep-lddat,
    end of ty_detail.
    types: begin of ty_sales_order,
    header type ty_header,
    detail type ty_detail occurs 0,
    end of ty_sales_order.
    data: it_sales_order type standard table of ty_sales_order
    with header line initial size 0.
    data: it_selected_order type standard table of ty_header
    with header line initial size 0.
    <b>data: wa_detail type ty_detail.</b>
    select *
    into corresponding fields of table it_selected_order
    from vbak
    where erdat > '01.01.2005' and erdat < '31.12.2005'.
    write :/ sy-subrc.
    loop at it_selected_order.
      clear: it_sales_order-header, it_sales_order-detail.
      move-corresponding it_selected_order to it_sales_order-header.
      select *
      into corresponding fields of table it_sales_order-detail
      from vbep
      where vbeln = it_sales_order-header-vbeln.
      append it_sales_order.
    endloop.
    loop at it_sales_order.
      write :/ it_sales_order-header-vbeln.
    <b> loop at it_sales_order-detail into wa_detail.</b>
      endloop.
    endloop.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • Heading for Report appearing more than once

    Hi All,
    I am running a report, the report contain more than 1 lakhs records, how can I avoid the heading of the report to repeat, because as of now heading information is repeating for 50 records.
    Please advice how to proceed on this issue.
    Thanks,
    Mohan R

    write the code like
    top-of-page.
    keep page condition..
    here write the heading
    or
    loop at itab.
    at first .
    here write the heading . This event will trigger only once ;i mean first record of the internal table
    endat.
    endloop.

  • Header Mapping in Idoc scenarios

    What is the use of Header Mapping in IDOC based scenarios?

    Hi,
    Header maping can be used to determine the destination in the interface based upon any particular field .If the field is populated with the value then that value can be used for receiver determination to send message for example you have one file that can be mapped to any one pf the multiple IDOCs then based upon the header value you can determine the destination or the IDOC goin to be used
    Ckeck this link this will help you a lot
    reg:HEADER MAPPING
    Check these links also
    Header Mapping in File to IDoc
    Header mapping while using IDoc as receiver communication
    Thanks
    Vikranth
    Edited by: Khimavath Vikranth on May 28, 2008 9:30 PM

  • LSMW Sales Order BAPI : Header & Item Text

    Hi frenz,
           I'm migrating Sales Order data using LSMW with BAPI method. We got four files...
    one for header, one for item, one for header text, one for item text.
    Now my problem is how do i update both header and item text.
    B'cos while assigning structural relations we got only one text structure(E1BPSDTEXT) common for both header and item. So which source structure(whether header_text or item_text) should be assigned to this segment(E1BPSDTEXT)?
    Else is there any other way to update both header and item texts?
    With regards,
    praveen.

    Unfortunately, you cannot assign more than one source structure to a target structure. But you can still manipulate the code. Here is how.
    Let us say your source structure defined for item texts is ITEM_TEXTS. In your field mapping section for E1BPSDTEXT, double click the '__BEGIN_OF_RECORD__' in change mode. It will pop-up a warning message, say 'yes' and proceed. Remove all the coding that is there in this section, but copy the lines to somewhere(say x buffer) before you do that. You will need those lines below. Just add the following lines there.
    if v_transferred_texts = 'X'.
    *-- all the texts are transferred, don't need to process again.
      skip_record.
    endif.
    You need to define 'v_transferred_texts' in the
    '__GLOBAL_DATA__' section as follows.
    data: v_transferred_texts type c.
    Now double click on '_END_OF_RECORD_' in change mode. It will pop-up a warning, but you can say 'yes' and proceed. This will open up the coding window with one line of code in it 'transfer_record.'. Here you need to add your coding as follows.
    *-- move the header texts
    LOOP AT HEADER_TEXTS.
    *-- This should <b>ALWAYS</b> be there
      g_edidd_segnam = 'E2BPSDTEXT000'.
      g_edidd_segnum = '0021'.         
      g_edidd_psgnum = '000001'.       
      g_edidd_hlevel = '02'.           
      clear E1BPSDTEXT.                
    *-- fill each field of the following fields
      E1BPSDTEXT-DOC_NUMBER = SALESHEADER-ORDERNUMBER.
      E1BPSDTEXT-ITM_NUMBER = '000000'.
      E1BPSDTEXT-TEXT_ID    = HEADER_TEXTS-TEXTID.
      E1BPSDTEXT-LANGU      = SY-LANGU.
      E1BPSDTEXT-LANGU_ISO 
      E1BPSDTEXT-FORMAT_COL
      E1BPSDTEXT-TEXT_LINE  = HEADER_TEXTS-TEXT.
      E1BPSDTEXT-FUNCTION   = '005'.
      transfer_record.
    ENDLOOP.
    *-- Now move the item texts
    LOOP AT ITEM_TEXTS.
    *-- This should <b>ALWAYS</b> be there
      g_edidd_segnam = 'E2BPSDTEXT000'.
      g_edidd_segnum = '0021'.         
      g_edidd_psgnum = '000001'.       
      g_edidd_hlevel = '02'.           
      clear E1BPSDTEXT.                
    *-- fill each field of the following fields
      E1BPSDTEXT-DOC_NUMBER = SALESHEADER-ORDERNUMBER.
      E1BPSDTEXT-ITM_NUMBER = ITEM_TEXTS-ITM_NUMBER.
      E1BPSDTEXT-TEXT_ID    = ITEM_TEXTS-TEXTID.
      E1BPSDTEXT-LANGU      = SY-LANGU.
    *  E1BPSDTEXT-LANGU_ISO  =
    *  E1BPSDTEXT-FORMAT_COL
      E1BPSDTEXT-TEXT_LINE  = ITEM_TEXTS-TEXT.
      E1BPSDTEXT-FUNCTION   = '005'.
      transfer_record.
    ENDLOOP.
    *-- set the flag that the texts have been transferred
    v_transferred_texts = 'X'.
    Please let me know how it goes.
    Srinivas

  • Loop structures

    Hi
    I was wondering, if there exists a while-loop in LV. Now don't think "what kind of problem has this guy - there is a while-loop" - I know there is, but compared to a textual language it's a do-while-loop (footer controled).
    I want to know if a header-controled loop exists or if it may come with a future release of LV.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

    If you just want a while loop where the termination condition is checked before each code iteration, use something like in the attached image. I don't think we need an entirely new loop species.
    Message Edited by altenbach on 05-19-2005 07:54 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    WhileLoopCheckFirst.gif ‏5 KB

  • How to work with loops if certain condition to be fulfill.

    Hi,
    I have following conditions.
    itab1
    seq  plant storage loc  material
    01    p1      s1                m1
    02    p2      s2                 m1
    03   p3      s3                m1 
    itab2
    material   plant   storage loc.      date                      qty.            mrp area
    m1              p1       s1                00000000          0 or q1          mr1
    m1              p1       s1                20140102           0 or q1         mr1
    m1              p1       s2               00000000            0 or q1          mr1
    m1              p1       s3                00000000           0 or q1          mr2
    m1              p1       s3                20140102          0 or q1           mr2
    now I have to pick the qty from itab 2 as follow.
    I need to see first seq (01) in itab1 first and for that I have to pick the desired qty (suppose 6). first with the storage loc s1.
    it should search in itab2 for s1 with date 000000.this belongs to mrp area mr1.if it finds the sufficient qty then process the remaing logic otherwise
    it should search with other storage loc s2 in same mrp area MR1 where date is 000000.if not then go with s3 but as s3 has diff mrp area.so now it should come back and search with s1 where date is not 0000000. then with s2 with same condition.after that it should go with other mrp area.
    I am trying but not able to achieve it completely. please help me to code this.

    Hi Prashant,
    Please find the below code.
    "Loop the Header table
    LOOP AT ITAB1 INTO WA_TAB1.
    "Read the Item table
    READ TABLE ITAB2
           INTO WA_TAB2
           WITH KEY MATERIAL = WA_TAB1-MATERIAL
                           PLANT = WA_TAB1-PLANT
                          STORAGE_LOC = WA_TAB1-STORAGE_LOC.
    IF SY-SUBRC = 0.
       IF WA_TAB2-QTY = 0.
         "Copy the Internal Table
         ITAB2_COPY[] = ITAB2[].
        "Delete Internal Table for different MRP
         DELETE ITAB2_COPY WHERE MRP NE WA_TAB2-MRP.
         "Sort the Internal Table
         SORT ITAB2_COPY
             BY MATERIAL
                   PLANT
                   MRP
                   STORAGE_LOC.
         "Delete the Adjacent record for Storage location
         DELETE ADJACENT DUPLICATES ITAB2_COPY COMPARING MATERIAL
                                                                                                         PLANT
                                                                                                         MRP
                                                                                                         STORAGE_LOC.
         "Using Parallel cursor read the next records from Item table
        LOOP AT ITAB2_COPY INTO WA_TAB_CP.
         "Check condition for different materials
           IF MATERIAL = WA_TAB2-MATERIAL
               PLANT    = WA_TAB2-PLANT
               MRP = WA_TAB2-MRP.
              "Exit from the Loop
                EXIT.
      ENDIF.
      "Check Quantity
      IF WA_TAB_CP-QTY <> 0.
         "Move the corresponding value
           MOVE-CORRESPONDING WA_TAB_CP TO WA_FINAL.
          "Assign Quantity
           WA_FINAL-QTY = WA_TAB_CP-QTY.
          "Append Internal Table
           APPEND WA_FINAL TO IT_FINAL.
         "Clear WA
          CLEAR WA_FINAL.
         "Come out from the Loop
           EXIT.
      ELSE.
            "Continue the next Record
           CONTINUE.
      ENDIF.
    ENDLOOP.
    ELSE.
          "Move the corresponding value
           MOVE-CORRESPONDING WA_TAB2 TO WA_FINAL.
         "Assign Quantity
           WA_FINAL-QTY = WA_TAB2-QTY.
          "Append Internal Table
           APPEND WA_FINAL TO IT_FINAL.
          "Clear WA
          CLEAR WA_FINAL.
          "Continue the next Record
           CONTINUE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    Regards
    Rajkumar Narasimman
    Message was edited by: Rajkumar N

  • -6531 Error on cursor

    Hi all,
    I am receiving the following error:
    ERROR: Exiting P_S_GENERATE_CONFIRMS with SQLCODE error: -6531:ORA-06531: Reference to uninitialized collection
    When I attempt to run the following:
    CURSOR owner_payee_cur IS
    SELECT DISTINCT TT_POL_NUM, TT_CVG_ID, TT_CLIENT_TYPE, TT_NM_ID, TT_DISB_NUM
    FROM T_TEMP_CONFIRMS
    WHERE TT_ROLE_ID = -8
    AND TT_CONF_TBL_TYPE = 'REG';
    ls_owner_payee_rec owner_payee_cur%ROWTYPE;
    DBMS_OUTPUT.PUT_LINE('Opening cursor!!!');
    OPEN owner_payee_cur;
    DBMS_OUTPUT.PUT_LINE('Fetching cursor!!!');
    FETCH owner_payee_cur INTO ls_owner_payee_rec;
    DBMS_OUTPUT.PUT_LINE('Heading into LOOP!!!');
    WHILE owner_payee_cur%FOUND
    LOOP
    DBMS_OUTPUT.PUT_LINE('IN owner_payee_cur LOOP!!!');
    FETCH owner_payee_cur INTO ls_owner_payee_rec;
    END LOOP;
    CLOSE owner_payee_cur;
    This is the output...
    Opening cursor!!!
    Fetching cursor!!!
    Heading into LOOP!!!
    ERROR: Exiting P_S_GENERATE_CONFIRMS... (error message above).
    I thought that if no records were returned, the %FOUND would evaluate to false and I would continue to process, but apparently this throws the above error? Is there any way around this?
    Thanks, Pete
    Message was edited by:
    thePetester

    how about :
    DECLARE
      cursor my_cur is ..... ;
      my_rec  my_cur%rowtype ;
    BEGIN
      open my_cur ;
      LOOP
            fetch my_cur into my_rec ;
            exit when my_cur%notfound ;
            -- do whatever
      END LOOP ;
      close my_cur ;
    END ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Simplel complex report query

    hi guru's
    i had prepared two complex reports seperately having the same Selection-screen , internal tables and declerations...now i have to combine both the reports into one single report....based upon <b>one field (i.e, filed PROCESS_TYPE)</b> of Selection-criteria(i.e, S_PR_TYP ) i have to display 2 outputs..One for SHC and another for CONF.....But the Logic  and Header display for the 2 output's is different   ........please let me know where should i write the logic ....and how the logic should be build....
    the code is as follows :
    <u><b>The code which is common for both the reports:</b></u>
    $$********************************************************************
    $$    TABLES DECLERATION
    $$********************************************************************
    TABLES: crmd_orderadm_h,
            crmd_orderadm_i,
            bbp_pdigp.
    $$********************************************************************
    $$  TYPE-POOLS
    $$********************************************************************
    TYPE-POOLS: slis, list.
    $$********************************************************************
    $$    GLOBAL TYPES
    $$********************************************************************
    TYPES: BEGIN OF y_str1,
           CLIENT         TYPE CRMD_ORDERADM_H-CLIENT,
           guid           TYPE crmd_orderadm_h-guid,
           object_id      TYPE crmd_orderadm_h-object_id,
           object_type    TYPE crmd_orderadm_h-object_type,
           process_type   TYPE crmd_orderadm_h-process_type,
           created_at     TYPE crmd_orderadm_h-created_at,
           changed_at     TYPE crmd_orderadm_h-changed_at,
           archiving_flag TYPE crmd_orderadm_h-archiving_flag,
           deliv_date     TYPE bbp_pdigp-deliv_date,
           final_entry    TYPE bbp_pdigp-final_entry,
           del_ind        TYPE bbp_pdigp-del_ind,
           END OF y_str1.
    TYPES: BEGIN OF y_str2,
           guid1          TYPE crmd_orderadm_h-guid,
           object_id      TYPE crmd_orderadm_h-object_id,
           object_type    TYPE crmd_orderadm_h-object_type,
           process_type   TYPE crmd_orderadm_h-process_type,
           created_at     TYPE crmd_orderadm_h-created_at,
           changed_at     TYPE crmd_orderadm_h-changed_at,
           archiving_flag TYPE crmd_orderadm_h-archiving_flag,
           guid2          TYPE crmd_orderadm_i-guid,
           header         TYPE crmd_orderadm_i-header,
           guid3          TYPE bbp_pdigp-guid,
           deliv_date     TYPE bbp_pdigp-deliv_date,
           final_entry    TYPE bbp_pdigp-final_entry,
           del_ind        TYPE bbp_pdigp-del_ind,
           END OF y_str2.
    $$********************************************************************
    $$    GLOBAL CONSTANTS
    $$********************************************************************
    CONSTANTS: C_BLANK_F(1)           TYPE C VALUE 'X',
               C_DEL_IND_F(1)         TYPE C VALUE 'X',
               C_ARCHIVING_FLAG(1)    TYPE C VALUE 'X',
               C_FINAL_ENTRY_F(1)     TYPE C VALUE 'X',
               C_FINAL_ENTRY_SPACE(1) TYPE C VALUE ' ',
               C_CBA_SPACE(1)         TYPE C VALUE ' ',
               C_DEL_SPACE(1)         TYPE C VALUE ' '.
    $$********************************************************************
    $$    Global Elementary Variables
    $$********************************************************************
    DATA: w_ld_lines                 TYPE i,
          w_ld_linesc(10)            TYPE c,
          w_del_ind                  TYPE c,
          w_final_entry              TYPE c,
          w_COUNT_cba                TYPE I VALUE 0,
          w_count_f                  TYPE I VALUE 0,
          W_BLANK_F                  TYPE C,
          W_FINAL_ENTRY_F            TYPE C,
          W_DEL_COUNT                TYPE I VALUE 0,
          W_PER_CBA1                 TYPE P decimals 3,
          W_PER_CBA                  TYPE P decimals 2,
          W_PER_E_LINE               TYPE I,
          W_N                        TYPE I.
    $$********************************************************************
    $$    GLOBAL INTERNAL TABLES (custom structure)
    $$********************************************************************
    DATA:   t_str_sc1 TYPE STANDARD TABLE OF y_str1 INITIAL SIZE 1.
    DATA:   t_str_sc2 TYPE STANDARD TABLE OF y_str2 INITIAL SIZE 1.
    DATA:   t_header      TYPE   slis_t_listheader,
            w_header      TYPE   slis_listheader,
            e_line        LIKE   w_header-info.
    DATA:   v_index       LIKE SY-TABIX.
            v_index = '1'.
    $$********************************************************************
    $$    GLOBAL FIELD-SYMBOLS
    $$********************************************************************
    FIELD-SYMBOLS: <FS_STR1> TYPE Y_STR1,
                   <FS_STR2> TYPE Y_STR2.
    $$********************************************************************
    $$    PARAMETERS & SELECT-OPTIONS
    $$********************************************************************
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_scno   FOR crmd_orderadm_h-object_id,
                    s_pr_typ FOR crmd_orderadm_h-process_type NO INTERVALS NO DATABASE SELECTION NO-EXTENSION DEFAULT 'SHC',
                    s_change FOR crmd_orderadm_h-changed_at.
    SELECTION-SCREEN END OF BLOCK b1.
    $$********************************************************************
    $$    START-OF-SELECTION
    $$********************************************************************
    START-OF-SELECTION.
      REFRESH t_str_sc1.
      SELECT client
             guid
             object_id
             object_type
             process_type
             created_at
             changed_at
             archiving_flag
             FROM crmd_orderadm_h INTO TABLE t_str_sc1
             WHERE object_id IN s_scno AND  changed_at IN s_change AND process_type IN s_pr_typ.
      IF sy-subrc <> 0.
        MESSAGE I002.
      ENDIF.
      LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
        REFRESH t_str_sc2.
        SELECT a~guid
               a~object_id
               a~object_type
               a~process_type
               a~created_at
               a~changed_at
               a~archiving_flag
               b~guid
               b~header
               c~guid
               c~deliv_date
               c~final_entry
               c~del_ind
          INTO TABLE t_str_sc2
          FROM crmd_orderadm_h AS a INNER JOIN crmd_orderadm_i AS b
            ON aguid eq bheader INNER JOIN bbp_pdigp AS c
            ON bguid eq cguid
         WHERE a~guid eq <FS_STR1>-guid.
    <u><b>THE LOGIC FOR FIRST REPORT:</b></u>
    *"logic for displaying Delivery date at Header level
          SORT T_STR_SC2 BY DELIV_DATE.
          DESCRIBE TABLE T_STR_SC2 LINES W_N.
         READ TABLE T_STR_SC2 WITH KEY DELIV_DATE = T_STR_SC2-DELIV_DATE INTO <FS_STR2>-deliv_date.
          READ TABLE T_STR_SC2 INDEX v_index ASSIGNING <FS_STR2>.
          IF SY-SUBRC = 0.
            <FS_STR1>-deliv_date = <FS_STR2>-deliv_date.
            MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DELIV_DATE.
          ENDIF.
    *"Setting up the flags for the entire items in CRMD_ORDERADM_H as per the scenario
        LOOP AT T_STR_SC2 ASSIGNING <FS_STR2> WHERE HEADER EQ <FS_STR1>-GUID.
          IF <FS_STR2>-DEL_IND NE 'X'.
            IF <FS_STR2>-FINAL_ENTRY NE 'X'.
              W_BLANK_f = C_BLANK_F.
            ELSE.
              W_FINAL_ENTRY_F = C_FINAL_ENTRY_F.
            ENDIF.
          ENDIF.
        ENDLOOP.
    *"Logic started at item level
        LOOP AT T_STR_SC2 ASSIGNING <FS_STR2> WHERE HEADER EQ <FS_STR1>-GUID.
          IF W_BLANK_F NE 'X'.
            IF W_FINAL_ENTRY_F NE 'X'.
    *" Displaying the status for Del 'X' , Final_entry ' ', Archive_flag 'X'.
              <FS_STR1>-DEL_IND = C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
              <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_SPACE.
              <FS_STR1>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
             w_COUNT_cba = w_COUNT_cba + 1.
              MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DEL_IND FINAL_ENTRY ARCHIVING_FLAG.
            ELSE.
    *" Displaying the status for Del ' ' , Final_entry 'X', Archive_flag 'X'.
              <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_F.
             w_count_f  = w_count_f  + 1.
              <FS_STR1>-DEL_IND = C_DEL_SPACE.
              <FS_STR1>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
             w_COUNT_cba = w_COUNT_cba + 1.
              MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING FINAL_ENTRY DEL_IND ARCHIVING_FLAG.
            ENDIF.
          ELSE.
    *" Displaying the status for Del ' ' , Final_entry ' ', Archive_flag ' '.
            <FS_STR1>-DEL_IND = C_DEL_SPACE.
            <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_SPACE.
            <FS_STR1>-ARCHIVING_FLAG = C_CBA_SPACE.
            MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DEL_IND FINAL_ENTRY ARCHIVING_FLAG .
          ENDIF.
        ENDLOOP.    "end of t_str_sc2
        if  <FS_STR1>-DEL_IND eq C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
        endif.
       if <FS_STR1>-FINAL_ENTRY eq C_FINAL_ENTRY_F.
                w_count_f  = w_count_f  + 1.
       endif.
      if  <FS_STR1>-ARCHIVING_FLAG eq C_ARCHIVING_FLAG.
               w_COUNT_cba = w_COUNT_cba + 1.
        endif.
        CLEAR: W_BLANK_F , W_FINAL_ENTRY_F.
    *"Logic ended at item level
      ENDLOOP.    "end of t_str_sc1
    *" when Transaction type is SHC
    IF <FS_STR1>-process_type EQ 'SHC'.
    DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
      WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
    *" Displaying Headings for the Report
    NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
             85       'Delivery date',                           99  sy-vline,
            100       'Final Entry Ind',                        115  sy-vline,
            116       'Deletion Ind',                           129  sy-vline,
            130       'Can be Archived',                        146  sy-vline.
    SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    $$********************************************************************
    $$    DISPLAY DATA AT HEADER LEVEL FOR SHC
    $$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
      WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
             19       <FS_STR1>-process_type,                    36  sy-vline,
             37       <FS_STR1>-object_type,                     56  sy-vline,
             57       <FS_STR1>-created_at,                      68  sy-vline,
             69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
             85       <FS_STR1>-deliv_date,                      99  sy-vline,
            100       <FS_STR1>-final_entry,                    115  sy-vline,
            116       <FS_STR1>-del_ind,                        129  sy-vline,
            130       <FS_STR1>-archiving_flag,                 146  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying at header level
      ENDIF.    "End of SY-SUBRC
    *ENDCASE.
    ENDIF.   "End of displaying Transaction type as SHC
    *" when Transaction type is CONF
    IF <FS_STR1>-process_type EQ 'CONF'.
      DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying Headings for the Report
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
    WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
    NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
             85       'Delivery date',                           99  sy-vline,
           100       'Final Entry Ind',                        115  sy-vline,
            100       'Deletion Ind',                           112  sy-vline,
            113       'Can be Archived',                        129  sy-vline.
    SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    *$$********************************************************************
    *$$    DISPLAY DATA AT HEADER LEVEL
    *$$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
      WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
             19       <FS_STR1>-process_type,                    36  sy-vline,
             37       <FS_STR1>-object_type,                     56  sy-vline,
             57       <FS_STR1>-created_at,                      68  sy-vline,
             69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
             85       <FS_STR1>-deliv_date,                      99  sy-vline,
           100       <FS_STR1>-final_entry,                    115  sy-vline,
            100       <FS_STR1>-del_ind,                        112  sy-vline,
            113       <FS_STR1>-archiving_flag,                 129  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying
      ENDIF.  "End of SY-SUBRC
    ENDIF.  "End of displaying Transaction type as CONF
    <b><u>
    THE LOGIC FOR THE SECOND REPORT</u></b>
    LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          REFRESH t_str_sc2.
          SELECT a~guid
                 a~object_id
                 a~object_type
                 a~process_type
                 a~created_at
                 a~changed_at
                 a~archiving_flag
                 b~guid
                 b~header
                 c~guid
                 c~deliv_date
                 c~final_entry
                 c~del_ind
            INTO TABLE t_str_sc2
            FROM crmd_orderadm_h AS a INNER JOIN crmd_orderadm_i AS b
              ON aguid eq bheader INNER JOIN bbp_pdigp AS c
              ON bguid eq cguid
           WHERE a~guid eq <FS_STR1>-guid.
           IF NOT t_str_sc2[] is INITIAL.
          LOOP AT T_STR_SC2 ASSIGNING <FS_STR2>.
           IF <FS_STR2>-DEL_IND NE C_DEL_SPACE.        " if x
              <FS_STR2>-DEL_IND = C_DEL_IND_F.
              <FS_STR2>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
              MODIFY T_STR_SC2 FROM <FS_STR2> .
            ELSE.         "if ' '
              EXIT.
            ENDIF.
          ENDLOOP.    "End loop of t_str_sc2
          MOVE <FS_STR2>-DEL_IND TO <FS_STR1>-DEL_IND.
          MOVE <FS_STR2>-ARCHIVING_FLAG TO <FS_STR1>-ARCHIVING_FLAG.
          MODIFY T_STR_SC1 FROM <FS_STR1>.
        ELSE.   " For sy-subrc
          <FS_STR1>-REMARKS = c_itnf.
          MODIFY T_STR_SC1 FROM <FS_STR1>.
        ENDIF.    " End of sy-subrc
      IF <FS_STR1>-DEL_IND eq C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
      ENDIF.
      IF  <FS_STR1>-ARCHIVING_FLAG eq C_ARCHIVING_FLAG.
            w_COUNT_cba = w_COUNT_cba + 1.
      ENDIF.
      ENDLOOP.  "End loop of t_str_sc1
    ********************************" when Transaction type is CONF
    *******************************IF <FS_STR1>-process_type EQ 'CONF'.
      DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying Headings for the Report
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
    WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
      NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
            100       'Deletion Ind',                           112  sy-vline,
            113       'Can be Archived',                        129  sy-vline,
            130       'Remarks',                                 150  sy-vline.
      SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    *$$********************************************************************
    *$$    DISPLAY DATA AT HEADER LEVEL
    *$$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
          WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
                 19       <FS_STR1>-process_type,                    36  sy-vline,
                 37       <FS_STR1>-object_type,                     56  sy-vline,
                 57       <FS_STR1>-created_at,                      68  sy-vline,
                 69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
                100       <FS_STR1>-del_ind,                        112  sy-vline,
                113       <FS_STR1>-archiving_flag,                 129  sy-vline,
                130       <FS_STR1>-REMARKS,                        150  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying
      ENDIF.  "End of SY-SUBRC
    **********************ENDIF.  "End of displaying Transaction type as CONF

    Very difficult to give you a solution without having access to the actual data and tables and some basic relationship model to explain the entities of the tables.
    But one thing I found that makes dealing complex queries a lot easier - easier to code and to read and to maintain - is to use the WITH clause. This allows the type of modularisation of code that we're using in other languages.
    The basic syntax is:WITH <alias1> AS(
      SELECT ...
    <alias2> AS(
      SELECT ...
    <aliasn> AS(
      SELECT ...
    SELECT
    FROM alias1, .. aliasnThis allows you to create distinct query sets once - and then re-use these again in joins, selects, and even other sub-sets.
    The resulting SQL is a lot les stressful on the eye and makes the whole "processing logic" of getting to the results much easier to analyse, follow and understand.

  • Upload purchase order

    Hai,
    how to upload the purchase order when one PO has three line items,
    another has 100 line items, and so on.
    can i use BAPI_PO_Create FM for this ?
    if it possible ,how to use ?
    Thanks & regards,
    Manikandan

    Check the following ex:
    Data Declaration for BAPI *****************
    data: begin of pohead occurs 10.
            include structure BAPIMEPOHEADER.
    data: end of pohead.
    data: begin of poheadx occurs 10.
            include structure BAPIMEPOHEADERX.
    data: end of poheadx.
    *EXPPURCHASEORDER
    data: BEGIN OF ponum.
            include structure BAPIMEPOHEADER.
    data: end of ponum.
    data: begin of poitem occurs 100.
            include structure BAPIMEPOITEM.
    data: end of poitem.
    data: begin of poitemx occurs 100.
            include structure BAPIMEPOITEMX.
    data: end of poitemx.
    data: begin of errmsg occurs 10.
            include structure bapiret2.
    data: end of errmsg.
    data : errflag.
    START-OF-SELECTION.
    PERFORM UPLOAD_DATA.
    *&      Form  UPLOAD_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD_DATA .
      data: p_fdir(200) type c .
      p_fdir = gfile.
      data: begin of it_filedir occurs 10.
              include structure salfldir.
      data: end of it_filedir.
    Get Current Directory Listing for OUT Dir
      call function 'RZL_READ_DIR_LOCAL'
        EXPORTING
          name     = p_fdir
        TABLES
          file_tbl = it_filedir.
      data: it_filedir1 like it_filedir occurs 0 with header line.
      loop at it_filedir.
        if it_filedir-name(4) = 'CPOR' or it_filedir-name(4) = 'cpor'.
          move it_filedir-name to it_filedir1-name.
          append it_filedir1.
        endif.
      endloop.
      IF IT_FILEDIR1[] IS INITIAL.
        STOP.
      ENDIF.
      REFRESH I_MSG1.
      CLEAR I_MSG1.
      loop at it_filedir1.
        REFRESH I_TAB.
        REFRESH I_TAB2.
        REFRESH I_TAB1.
        data: g_file(100) type c .
        name = it_filedir1-name.
        concatenate: gfile '\' name into g_file.
        data : i_tab1(200).
        OPEN DATASET g_file FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          DO.
            READ DATASET g_file INTO i_tab1.
            if sy-subrc = 0.
              split i_tab1 at ',' into i_tab-verkf i_tab-verkf1 i_tab-lifnr
                        i_tab-ebelp1 i_tab-werks
                     i_tab-matnr i_tab-idnlf
                     i_tab-menge i_tab-bprme i_tab-lewed i_tab-netpr.
            else.
              exit.
            endif.
            APPEND i_tab.
            clear i_tab.
          ENDDO.
        ENDIF.
    *************** error testing*******************
        LOOP AT i_tab.
          MOVE-CORRESPONDING i_tab TO etab1.
          append etab1.
          clear etab1.
        ENDLOOP.
    *************** end error testing*******************
       DELETE DATASET g_file.
        CLOSE DATASET g_file.
        concatenate:
                    hfile '\' date1 '\' name into h_file.
        OPEN DATASET h_file FOR OUTPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          LOOP AT I_TAB.
            CONCATENATE I_TAB-VERKF ',' I_TAB-VERKF1 ',' I_TAB-LIFNR ','
                        I_TAB-EBELP1 ',' I_TAB-WERKS ','  I_TAB-MATNR ','
                        I_TAB-IDNLF ',' I_TAB-MENGE ',' I_TAB-BPRME ','
                        I_TAB-LEWED ',' I_TAB-NETPR INTO I_TAB2.
            TRANSFER i_tab2 TO h_file.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET h_file.
      MOVE I_TAB[] TO I_TAB3[].
      DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING VERKF.
      loop at i_tab.
        refresh pohead.
        refresh poheadx.
        refresh poitem.
        refresh poitemX.
        pohead-DOC_TYPE = i_tab-bsart.
        pohead-VENDOR = i_tab-lifnr.
        pohead-PURCH_ORG = c_ekorg.
        pohead-CREAT_DATE = i_tab-verkf1.
        pohead-PUR_GROUP = c_ekgrp.
        pohead-COMP_CODE = c_bukrs.
        pohead-SALES_PERS = I_TAB-VERKF2.
        pohead-doc_date = sy-datum.
        pohead-langu = sy-langu.
        append pohead.
        poheadx-DOC_TYPE = c_x.
        poheadx-VENDOR = c_x.
        poheadx-PURCH_ORG = c_x.
        poheadx-PUR_GROUP = c_x.
        poheadx-COMP_CODE = c_x.
        poheadx-SALES_PERS = c_x.
        poheadx-doc_date = c_x.
        poheadx-langu = c_x.
        append poheadx.
        loop at i_tab3 WHERE VERKF = I_TAB-VERKF.
          poitem-PO_ITEM = i_tab3-ebelp1.
          poitem-MATERIAL = i_tab3-MATNR.
          poitem-QUANTITY = i_tab3-MENGE.
          poitem-PO_UNIT = i_tab3-BPRME.
          poitem-NET_PRICE = i_tab3-NETPR.
          poitem-PLANT = i_tab3-WERKS.
          poitem-GR_TO_DATE = i_tab3-LEWED.
         poitem-tax_code = c_x.
         poitem-item_cat = c_x.
         POITEM-ACCTASSCAT = c_x.
         poitem-AGREEMENT = i_tab3-ebeln.
         poitem-AGMT_ITEM = i_tab3-ebelp1.
          poitem-VEND_MAT = i_tab3-IDNLF.
          append poitem.
          poitemx-PO_ITEM = i_tab3-ebelp1.
          poitemx-MATERIAL = c_x.
          poitemx-QUANTITY = c_x.
          poitemx-PO_UNIT = c_x.
          poitemx-NET_PRICE = c_x.
          poitemx-PLANT = c_x.
          poitemx-GR_TO_DATE = c_x.
          poitemx-tax_code = c_x.
          poitemx-item_cat = c_x.
        POITEMx-ACCTASSCAT = c_x.
         poitemx-AGREEMENT = 'X'.
         poitemx-AGMT_ITEM = 'X'.
          poitemx-VEND_MAT = c_x.
          append poitemx.
        endloop.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            POHEADER                    = pohead
       POHEADERX                    = poheadx
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
         IMPORTING
      EXPPURCHASEORDER             =
           EXPHEADER                    = ponum
      EXPPOEXPIMPHEADER            =
         TABLES
           RETURN                       = errmsg
           POITEM                       = poitem
       POITEMX                      = poitemx
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
      POACCOUNT                    =
      POACCOUNTPROFITSEGMENT       =
      POACCOUNTX                   =
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
      POSERVICES                   =
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
        clear errflag.
        loop at errmsg.
          if errmsg-type eq 'E'.
            write:/'Error in function', errmsg-message.
            errflag = 'X'.
          else.
            write:/ errmsg-message.
          endif.
        endloop.
        if errflag is initial.
          commit work and wait.
          if sy-subrc ne 0.
            write:/ 'Error in updating'.
            exit.
          else.
            write:/ ponum-PO_NUMBER, ponum-comp_code.
          endif.
        endif.
      endloop.
    ENDFORM.                    " UPLOAD_DATA

Maybe you are looking for

  • Get the Dell EVDO Express Card working on a Macbook Pro - here's how

    I found this here: http://svenontech.com/2006/06/11/get-ev-do-access-on-your-macbook-pro-now-from-v erizon-via-your-xv6700/ On the Mac side, you'll first need to pair your XV6700 and Mac to each other. You should be able to do this easily, but if you

  • Please help! Officejet Pro L7380 refusing to print

    Hi, My officejet pro had a strange power outage (nothing else, computer etc affected) and since then has been flashing and displaying the message "The following printheads has a problem: magenta/cyan" and refuses to print. I have used the HP diagnost

  • Oracle data to web service in ODI

    Hi Experts, Please help me on "Oracle data should move to web service (odiInvokewebservice tool)" in ODI eg: Table EMP have 10 records, when I execute package, for each record webservice should call(webservice should call 10 time) if Table EMP have 2

  • Accessing instance variables from container

    I am new to Flash. I am a programmer, not a designer so this is my first foray into Actionscript. I am creating a slide show player in Flash. It retrieves an XML file containing other .swf files that should be played, the order in which they should b

  • The new update makes it impossible for me to connect to any website

    The update to Firefox 35 was made automatically when I opened the browser and now not a single website can appear. The browser says it can't connect to the website and that the "waiting delay is over". Usually I get this page when my Internet is off,