LSMW (ABAP Code Rule)

Hi All,
I have to upload data in transaction code MD61 (Planned Independent Requirement) for a year, that is, 12 months.
The requirement date and planned quantity have fields EDATU & PLNMG, respectively. If I'm going to input 12 months, the fields will become EDATU_01, EDATU_02... EDATU_12 and PLNMG_01 to PLNMG_12. However, the screen during background processing only has 10 rows, resulting to an incorrect session in SM35 with error: "Field RM60E-EDATU(11) does not exist in the screen SAPLM60E 0200".
Is there a way that I can use ABAP Code in LSMW's conversion rules for me to be able to upload 12 entries in MD61?
Thanks a lot in advance!
Best regards,
Olyn

Hi,
While recording did you come across the 11th and 12th row as well?
if not, once the recording is done try to insert those two in the  recording list manually. And then in the field mapping try to map this with the 11th and 12th field you have in your structure.

Similar Messages

  • Problem with abap code in lsmw.its urgent

    Hello guys iam migrating open ar line items using lsmwand i need to create reconciliation key automatically so iam using below code which is working fine in abap editor but i inserted in the lsmw abap code block at step 5 mapping fields iam getting error as that function module does not exits .can any body go through the code and give me suggestion.your will be greatly appreciate.
    types: begin of ty_fikey,
           fikey type fikey_kk,
           resob type resob_kk,
           end of ty_fikey.
    data: wa_fikey type ty_fikey.
    CALL FUNCTION 'FKK_FIKEY_CHECK'
      EXPORTING
        I_FIKEY                      = 'jana56481'
      I_OPEN_ON_REQUEST            =
      I_OPEN_WITHOUT_DIALOG        =
      I_FOR_MASS_POSTING           =
       I_RESOB                      = '24 '
      I_RESKY                      = ' '
      I_NON_EXISTING_ALLOWED       = ' '
      I_FOR_POSTING_IN_UPD         = ' '
    EXCEPTIONS
      NON_EXISTING                 = 1
      OTHERS                       = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    select single  fikey resob from dfkksumc into corresponding fields of wa_fikey where resob = '24'.
    e1bpdfkkko-fikey = wa_fikey-fikey.
    Regards
    Janapathi

    Hi,
    Refer link:
    <a href="http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc">http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc</a>
    Pls do reward points.
    Regards,
    Ameet

  • ABAP code which will use function module during field mapping in LSMW

    Hi,
    During field mapping in LSMW, for one of the field called field, I want to use a function module 'QF05_RANDOM_INTEGER', which will generate random numbers and map that random number to that field.
    How do I write ABAP code which uses function module, during filed mapping for a particluar field in LSMW ?
    Please help...
    Regards,
    Tushar.

    Hi Tushar,
    You can write in FORM ROUTINE and LSMW.
    I hope you know how to write ABAP code at field level.
    If not ...
    Come to change mode->select the field->Rule->ABAP Code
    write a perform statement in ABAP code at field level.
    <b>PERFORM test</b> using val
                 changing valu.
    Go to Utilities(at menu)->switch layout-> extras ->select Layout->check Form routine-> it will display a FORM Routine... at bottom
    this is the place where you can write some code for
    <b> FORM test</b> using value
              changing value1
      FM call....
    .ENDFORM  
    Get the value1 returned and use for the Field population.
    Reward points if this Helps.
    Manish
    Message was edited by:
            Manish Kumar

  • How to insert abap code in LSMW generated program?

    hi,
    i m working on LSMW for loading data in SAP
    i would like to insert abap code into the generated program....
    it's because i have 1 BKPF segment (header data), 2 BSEG segments, but i cannot define rules by customizing for the second BSEG segment(LSMW doesn't permitt).
    i already tried to insert code directly into the program, but obviously it disapears at each time i generate the program.
    i saw that apparently a code insertion has already be made into this program and the subject of this insertion is to define rules for the second BSEG (exactly what i want to do....) and this modification doesn't disapear at new prog generation.....
    Any idea ?

    Hi
    Why dont you use the FORM provided by LSMW
    To use this please do the following
    1.Goto option <b>Maintain Field Mapping and Conversion Rules</b>
    2.Goto menu <b>EXTRAS->LAYOUT->Form Routines</b>
      Here you will now get many options like
       Global Data
       Begin of Transaction
    Begin of Processing
    Begin of Record
      like wise the End of these also.
    Please put a breakpoint and check where you want to insert your code.
    Note:
    This is only for the Conversion Program and does not affect the main program used to update the Standard Tables
    Hi , I was reading your earlier post .. It seems that you have worked on EMIGALL. Consider a similar situation, it is like writing the code in the events till CALL01...
    Thanks
    DOminic
    Message was edited by: Dominic  Pappaly

  • ABAP code in update rules to convert the date

    Hi,
    Could any one send me the ABAP code that is written in the update rules to convert the date (DD/MM/YYYY  -- lenght 10) to YYYYMMDD ---  length 8  format.
    Also please let me know where I should write this code; while creating update rules or while creating infosource.
    Thanks,

    Hi Bharath,
    Hi Bharath,
    I suggest you do the conversion of dates in the transfer rules. Here is the correct code you need:
    * Assuming the source data field is called MYDATE
    * Place the ff. in the routine in the transfer rules:
    concatenate tran_structure-mydate+6(4) tran_structure-mydate+3(2) tran_structure-mydate(2) into result.
    replace MYDATE with the name of the source field (10 chars) in the transfer structure. Hope this helps.

  • Convert ABAP code in start routine/update rule to transform. start routine

    Dear BW ABAPers,
    I have created a custom purchasing info cube (YCP_PURC1) based on 0CP_PURC1 standard cube. I would like to convert this new data flow to BI7 (from 3.x), and convert the standard update rule to transformation. I would need to rewrite the below start routine from the standard update rule to a start routine ABAP code in the newly created  transformation / start routine. My ABAP knowledge is limited. Will you please help?
    *this is the start routine from the update rule. As a side note, the data source is 2LIS_02_SCL.
    LOOP AT SOURCE_PACKAGE.
        IF (     SOURCE_PACKAGE-cppvlc  EQ 0
             AND SOURCE_PACKAGE-cppvoc  EQ 0
             AND SOURCE_PACKAGE-cpquaou EQ 0 ).
          DELETE SOURCE_PACKAGE.
          CONTINUE.
        ENDIF.
    no_scl is initial ( e.g. for good receipts, billing)
    value has to be set depending on storno
        IF SOURCE_PACKAGE-no_scl IS INITIAL.
          IF SOURCE_PACKAGE-storno = 'X'.
            SOURCE_PACKAGE-no_scl = -1.
          ELSE.
            SOURCE_PACKAGE-no_scl = 1.
          ENDIF.
          MODIFY SOURCE_PACKAGE.
        ENDIF.
      ENDLOOP.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    Many thanks and look forward to your kind feedback.
    Kind regards,
    Csaba

    Dear All, Durgesh,
    thanks to you all for your valuable input. Mainly the ABAP part was more interesting for me.
    Durgesh, thanks for your input, it was useful. I just had to change the info objects to data source fields and add the lines before the loop:
    DATA: I_PACKAGE TYPE TYT_SC_1.
        FIELD-SYMBOLS <i_package> TYPE tys_sc_1.
        I_PACKAGE[] = SOURCE_PACKAGE[].
        LOOP AT SOURCE_PACKAGE assigning <i_package>.
          IF ( <i_package>-BWGEO EQ 0
          AND <i_package>-BWGEOO EQ 0
          AND <i_package>-BWMNG EQ 0 ).
            DELETE SOURCE_PACKAGE index sy-tabix.
            CONTINUE.
          ENDIF.
    no_scl is initial ( e.g. for good receipts, billing)
    value has to be set depending on storno
          IF <i_package>-NOSCL IS INITIAL.
            IF <i_package>-ROCANCEL = 'X'.
              <i_package>-NOSCL = -1.
            ELSE.
              <i_package>-NOSCL = 1.
            ENDIF.
          ENDIF.
        ENDLOOP.
    Points have been assigned accordingly.
    Thanks,
    Csaba

  • LSMW--- I am not seeing some variables, which r using in abap code!

    Hi Experts,
    Am enhancing the LSMW---> Create_Material, so I hv some basic doubts, pls. clarify,
    1 - In the following satemenrts of the code, the programmer used my_langu(variable?), so, Where the programmer has declared(attributes & value) the my_langu ? I searched in FIXED VALUES radio button, Global data, double clicking, abap code radio button, I culd not find it!
    Target Field: E1BP_MLTX-LANGU Language key
    E1BP_MLTX-LANGU = my_fv_langu. (like theses many variables r using in the abap code, but I culd not track them to see, thrier attributes!)
    2 - In abap code, the programmer is using <b><i>skip_transaction</i></b>! but, we dont hv skip_transaction in ABAP code?
    thanq.

    Hi,
    skip_transdaction is a LSMW Global Function and not an ABAP command:
    Global function     Description
    transfer_record.     Transfers the current record (i.e. for the current target structure) to the output buffer.
    transfer_this_record '...'.     Transfers a record of another target structure to the output buffer. The name of the target structure has to be specified as argument in single quotes.
    at_first_transfer_record.     Transfers the current record to the output buffer, if it is the first transaction.
    on_change_transfer_record.     Transfers the current record to the output buffer, if it has changed compared to the last record.
    transfer_transaction.     Writes the current transaction to an output file. All records of the output buffer are transferred to the output file.
    skip_record.     The current record is not transferred to the output buffer.
    skip_transaction.     The current transaction is not written to the output file.
    I'm not sure about the my_langu(variable?).
    Hope it helps some.

  • ABAP code for calculation rule in transaction M/08

    Hi,
    In M/08 transaction, we need to do this:
    When maintaining a PO, the user manually creates a condition like this:
    ZXXX Value (+10 %) positive value.
    However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
    Automatic at the same time:
    ZYYY Value (- 10 %) negative value.
    In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
    Any help is appreciated.

    Hi Peter,
    This calculations rules are know as routines you can create with them using T code VOFM and then go the menu option -
    > Formula---->Condition value.Double click on that and you will get the ABAP code.
    Here you can amend the existing one or can create the way you like your logic to move and assign it to M/08 T code.
    Hope this will help you.
    Thanks,
    Birender Agnihotri

  • ABAP code for calculation rule in TK = M/08

    Hi,
    In M/08 transaction, we need the following:
    When maintaining a PO, the user manually creates a condition like this:
    ZXXX    Value (+10 %) positive value.
    However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
    Automatic at the same time:
    ZYYY  Value (- 10 %) negative value.
    In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
    Any help is appreciated.

    Irrelevant

  • ABAP code (Update rule)

    Hi Gurus,
    I need to load data from R/3 to infocube A. In update rule  I need to do a small calculation that is A.KF1  x  B.KF1  =  A.ZKF1. B.KF1 is a key figure in Infocube B. In update rule I need to read Infocube B and get B.KF1 and multiply with A.KF1(Infocube A) to fill the value in A.ZKF1. Please help me how to write ABAP code to do this calculation.
    Thanks
    Liza

    Liza,
    Check whether the function module RSDPL_CUBE_DATA_READ which will help  to read data from cube B.
    I guess, APD will be useful for your scenario.
    Thanks
    Viswa

  • Abap Code help in update rule

    Hi Gurus,
    I have  a requiement, that is if there are 5 line items with in a document and each one has diffeerent tax jurisdiction code, then we should be showing only one tax jurisdiction code for a document. Line items are not displayed in report. The condition to pick up tax jurisdiction code is the one which has least ending zeros among all the lime items with in a document.
    Supppose
    Doc1 Item Tax Jurisdiction code
    1800000002 1 CNQC00000000000
    1800000002 2 CNQC00000000000
    1800000002 3 CN0000000000000
    1800000002 4 CNQC00000000000
    1800000002 5 TXJOHNCLEBUR000
    So here the value of Tax Jurisdiction code is TXJOHNCLEBUR000 as it has least ending zeros compared to other values with in a document.
    Any help how to use the string function and acheive the desired result.
    Thanks,
    Raj.

    Hi Anand,
    Thanks for the reply. we don't expect any non-zeros after seeing first zero. Now i have added another z object which will contain only least zeros for a doc. What I am doing is now after loading the data into the cube from ods  i am doing loop back and updating the new z object. Below is the code I am trying to do
    TABLES: /BIC/AZFGLO10100.
    Defining an internal table as ods table****
    Types: BEGIN OF ITAB_01,
    doc_no LIKE /BIC/AZFGLO10100-AC_DOC_NO,
    item_no LIKE /BIC/AZFGLO10100-ITEM_NUM,
    taxjur LIKE /BIC/AZFGLO10100-TAXJURCODE,
    length like num,  ***** this will hold the length of the zeros
    END OF ITAB_01.
    loading the data from active ods table into defined internal table*****
    select AC_DOC_NO ITEM_NUM TAXJURCODE  from /BIC/AZFGLO10100 into table
      Itab_01 where AC_DOC_NO = /BIC/AZFGLO10100-AC_DOC_NO and
      item_num = /BIC/AZFGLO10100-ITEM_NUM.
    sort itab_01 doc_no item_no
    now I want to use code too populate the vlaue of length field in internal table (which shows how many zeros a tax jurisdiction code has for every corresponding line item)
    then in the update rule of z tax jurisdiction i will wirte a routine such that
    select taxjur into result from itab_01 where doc_no = COMM_STRUCTURE-doc_no and length = min(length).
    now I have one more doubt , the number of items in a document will be varying so how to takecare of this...
    If possible can you please provide me with the abap code that you have mentioned in earlier post.
    Any more help on this is really appreciated.
    Thanks,
    Raj

  • Update Routine - ABAP code

    Hi,
    I am trying to write an update routine to calculate and populate fields in my ODS infoprovider.
    one of the key figure field in my update rules is 'No. of Days'. Based on the 'No. of Days' range, I want to send a key figure(Infoobject:Due amount) value to another infoobject(Bucket1, Bucket2, Bucket3 ect.)in my ODS infoprovider. For example, let's say,
    IF NO. OF DAYS = >0 AND <=30
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET1
    ENDIF.
    ELSE IF
       NO. OF DAYS = >31 AND <=60
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET2
    ENDIF.
    ELSE IF
       NO. OF DAYS = >61 AND <=90
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET3
    ENDIF.
    I think, I know the data flow logic but I don't know how to code in ABAP language. If someone can give me some psuedo like ABAP code, I would appreciate your help with points.

    Hi Roa,
    I would do this in the start routine of the update rule.
    Here is a sample on how do this. You could use a case statement for this code also.
    Loop at Data_Packet.
    IF NO. OF DAYS = >0 AND <=30
    Data_Packet-BUCKET1 = DUE AMOUNT
    ELSEIF
    NO. OF DAYS = >31 AND <=60
    Data_Packet-BUCKET2 = DUE AMOUNT
    ENDIF.
    ELSEIF
    NO. OF DAYS = >61 AND <=90
    Data_Packet-BUCKET3 = DUE AMOUNT
    ENDIF.
    modify data_packet.
    endlloop.
    Cheers! Bill

  • Schedule a background job for a program using ABAP code.

    Hi,
    I have to write a program to schedule a background job for another program.
    Need your help to understand how we can achieve this functionality.Any example of an abap code would be of great help.
    Need it urgently.
    Thanks in advance.
    Sandeep.

    Hi Sandeep,
    Here is the demo program regarding the BDC For the background job.
    report zprprbdc1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    ***data: begin of itab occurs 0 ,
    ***       matnr(20) type c,
    ***       mbrsh(30) type c,
    ***       mtart(30) type c,
    ***       kzsel(20) type c,
    ***       maktx(40) type c,
    ***       meins(5) type c,
    ***       end of itab.
    data: begin of record occurs 0,
    * data element: MATNR
            matnr_001(018),
    * data element: MBRSH
            mbrsh_002(001),
    * data element: MTART
            mtart_003(004),
    * data element: XFELD
            kzsel_01_004(001),
    * data element: MAKTX
            maktx_005(040),
    * data element: MEINS
            meins_006(003),
    * data element: MTPOS_MARA
            mtpos_mara_007(004),
          end of record.
    *** End generated data section ***
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    **do.
    **read dataset dataset into record.
    **if sy-subrc <> 0. exit. endif.
    call function 'GUI_UPLOAD'
      exporting
        filename                      = 'c:\jitu\bdc\10002.txt'
       filetype                      = 'ASC'
       has_field_separator           = 'x'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      tables
        data_tab                      = record
    * EXCEPTIONS
    *   FILE_OPEN_ERROR               = 1
    *   FILE_READ_ERROR               = 2
    *   NO_BATCH                      = 3
    *   GUI_REFUSE_FILETRANSFER       = 4
    *   INVALID_TYPE                  = 5
    *   NO_AUTHORITY                  = 6
    *   UNKNOWN_ERROR                 = 7
    *   BAD_DATA_FORMAT               = 8
    *   HEADER_NOT_ALLOWED            = 9
    *   SEPARATOR_NOT_ALLOWED         = 10
    *   HEADER_TOO_LONG               = 11
    *   UNKNOWN_DP_ERROR              = 12
    *   ACCESS_DENIED                 = 13
    *   DP_OUT_OF_MEMORY              = 14
    *   DISK_FULL                     = 15
    *   DP_TIMEOUT                    = 16
    *   OTHERS                        = 17
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    loop at record .
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-matnr_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-mbrsh_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-mtart_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-kzsel_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-maktx_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-meins_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-mtpos_mara_007.
    perform bdc_transaction using 'MM01'.
    **enddo.
    endloop.
    perform close_group.
    *perform close_dataset using dataset.
    &*****************Reward point if helpful************&

  • How to insert a new line item in VA01/VA02 by using ABAP code?

    Hi Gurus
    i have a very tough requirement. the customer wants to insert a free goods after an item has been populated in VA01/VA02 automatically according to some certain rules. the input material may be a main material of a sales BOM.
    for example. let's suppose there is a material A who has two sub-material B and C which is maintained in a sales BOM via CS01/CS02. when the material A has been input in the line item in VA01/VA02, its quantity input and after the ENTER key has been clicked, another material D may be displayed in a new line as a gift if the condition met.  the condition relates to customer/material/quanity and these information are stored in a Z-table.
    on the other hand, if the material A is only a single material(not a BOM), the gift(material D) will also be filled automatically if the condition met.
    i have already enhance the FM cs_bom_explosion to filfill the requirment for BOM materials. whereas it is very hard to find the enhanment point for the single material.
    so my question is where is the correct place for me to insert the ABAP code, which decides whether the gift should be given or not and furthermore inserts the new line item into XVBAP. i tried to use MV45AFZZ, whereas the data is always inconsistant if a new line has been inserted. it is very strange that there is no temperary internal table storing line item data input in the table controal of VA01/VA02. system reads the line item data , line by line, via a system kernal function call.
    any hints are welcome. thanks

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • ABAP Code Problem in Start Routine to Fill the value from Look-up Table ???

    Hi all,
         I am trying to fill the values of DOC_NUMBER & PLANT from look-up table /BIC/AZSD_O0700 (Billing Item ODS) for each BILL_NUM in Start Routine for Update Rules of Billing Header ODS and modify the data_package.
    What is wrong with the below ABAP code, PLEASE ???
    data: it_data type standard table of data_package_structure
            with header line
            with non-unique default key initial size 0.
    types: begin of billing_item_type,
                 BILL_NUM          like /BIC/AZSD_O0700-BILL_NUM,
                 DOC_NUMBER   like /BIC/AZSD_O0700-DOC_NUMBER,
                 PLANT               like /BIC/AZSD_O0700-PLANT,
             end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data[] = DATA_PACKAGE[].
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
        select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
               from /BIC/AZSD_O0700
               where  BILL_NUM  = it_data-BILL_NUM
               and    FISCVARNT = it_data-fiscvarnt.
        endselect.
        if sy-subrc = 0.
           move-corresponding it_data to DATA_PACKAGE.
        endif.
      endloop.
      modify DATA_PACKAGE.
    Thanks,
    Venkat.

    Hi Venkat,
      Two things -One is the performance and the other ... there is no Append  within the loop.
      Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
       Let me know if you need more help.
    Best regards,
    Kazmi
    data: it_data type standard table of data_package_structure
    with header line
    with non-unique default key initial size 0.
    types: begin of billing_item_type,
    BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
    DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
    PLANT like /BIC/AZSD_O0700-PLANT,
    end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data] = DATA_PACKAGE[.
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
    select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
    from /BIC/AZSD_O0700
    where BILL_NUM = it_data-BILL_NUM
    and FISCVARNT = it_data-fiscvarnt.
    endselect.
    if sy-subrc = 0.
    move-corresponding it_data to DATA_PACKAGE.
    Append DATA_PACKAGE.
    endif.
    endloop.

Maybe you are looking for