Incorrect nesting in smartfroms program-line

Hi .
when i have use code in different program it's work fine .
but when same code use in smartforms program-lines it's give me following error.
Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION" must be concluded by "ENDFUNCTION" . . .
Regards.
Sam.

HI
My code
DATA mwsbp TYPE komp-mwsbp .
data : p_ebeln TYPE ekpo-ebeln ,
p_ebelp TYPE ekpo-ebelp .
*data: p_mwsbp TYPE komp-mwsbp .
PERFORM calculate_tax USING p_ebeln p_ebelp CHANGING mwsbp .
FORM calculate_tax USING p_ebeln TYPE ekpo-ebeln
p_ebelp TYPE ekpo-ebelp
CHANGING p_mwsbp TYPE komp-mwsbp .
CONSTANTS: bstyp_info VALUE 'I',
bstyp_ordr VALUE 'W',
bstyp_banf VALUE 'B',
bstyp_best VALUE 'F',
bstyp_anfr VALUE 'A',
bstyp_kont VALUE 'K',
bstyp_lfpl VALUE 'L',
bstyp_lerf VALUE 'Q'.
DATA : taxcom TYPE taxcom ,
t_konv TYPE TABLE OF komv WITH HEADER LINE .
DATA: BEGIN OF tkomv OCCURS 50.
INCLUDE STRUCTURE komv.
DATA: END OF tkomv.
DATA: BEGIN OF tkomvd OCCURS 50. "Belegkonditionen
INCLUDE STRUCTURE komvd.
DATA: END OF tkomvd.
DATA : BEGIN OF tkomvh OCCURS 50.
INCLUDE STRUCTURE komv.
DATA : vtext LIKE t685t-vtext.
DATA : END OF tkomvh.
SELECT SINGLE *
INTO ekko
FROM ekko
WHERE ebeln = p_ebeln .
SELECT SINGLE *
INTO ekpo
FROM ekpo
WHERE ebeln = p_ebeln
AND ebelp = p_ebelp .
SELECT SINGLE *
INTO t001
FROM t001
WHERE bukrs = ekko-bukrs .
taxcom-bukrs = ekpo-bukrs.
taxcom-budat = ekko-bedat.
taxcom-waers = ekko-waers.
taxcom-kposn = ekpo-ebelp.
taxcom-mwskz = ekpo-mwskz.
taxcom-txjcd = ekpo-txjcd.
taxcom-shkzg = 'H'.
taxcom-xmwst = 'X'.
IF ekko-bstyp EQ bstyp_best.
taxcom-wrbtr = ekpo-netwr.
ELSE.
taxcom-wrbtr = ekpo-zwert.
ENDIF.
taxcom-lifnr = ekko-lifnr.
taxcom-land1 = ekko-lands.
taxcom-ekorg = ekko-ekorg.
taxcom-hwaer = t001-waers.
taxcom-llief = ekko-llief.
taxcom-bldat = ekko-bedat.
taxcom-matnr = ekpo-ematn.
taxcom-werks = ekpo-werks.
taxcom-bwtar = ekpo-bwtar.
taxcom-matkl = ekpo-matkl.
taxcom-meins = ekpo-meins.
IF ekko-bstyp EQ bstyp_best.
taxcom-mglme = ekpo-menge.
ELSE.
IF ekko-bstyp EQ bstyp_kont AND ekpo-abmng GT 0.
taxcom-mglme = ekpo-abmng.
ELSE.
taxcom-mglme = ekpo-ktmng.
ENDIF.
ENDIF.
IF taxcom-mglme EQ 0.
taxcom-mglme = 1000.
ENDIF.
taxcom-mtart = ekpo-mtart.
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 'J_1BSA_COMPONENT_ACTIVE'
EXPORTING
bukrs = ekko-bukrs
component = 'BR'
EXCEPTIONS
component_not_active = 1
OTHERS = 2.
*endfunction.
IF sy-subrc IS INITIAL.
komk-mandt = ekko-mandt.
komk-kalsm = ekko-kalsm.
IF ekko-kalsm = ''.
komk-kalsm = 'RM0000'.
ENDIF.
komk-kappl = 'M'.
komk-waerk = ekko-waers.
komk-knumv = ekko-knumv.
komk-lifnr = ekko-lifnr.
komp-kposn = ekpo-ebelp.
komp-matnr = ekpo-matnr.
komp-werks = ekpo-werks.
komp-matkl = ekpo-matkl.
komp-infnr = ekpo-infnr.
komp-evrtn = ekpo-konnr.
komp-evrtp = ekpo-ktpnr.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
comm_head_i = komk
comm_item_i = komp
language = 'E'
TABLES
tkomv = tkomv
tkomvd = tkomvd.
CALL FUNCTION 'J_1B_NF_PO_DISCOUNTS'
EXPORTING
i_kalsm = ekko-kalsm
i_ekpo = ekpo
IMPORTING
e_ekpo = ekpo
TABLES
i_konv = t_konv.
IF NOT ekko-llief IS INITIAL.
taxcom-lifnr = ekko-llief.
ENDIF.
ENDIF.
CALL FUNCTION 'FIND_TAX_SPREADSHEET'
EXPORTING
buchungskreis = t001-bukrs
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
i_taxcom = taxcom
IMPORTING
e_taxcom = taxcom
EXCEPTIONS
mwskz_not_defined = 1
mwskz_not_found = 2
mwskz_not_valid = 3
steuerbetrag_falsch = 4
country_not_found = 5
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.
p_mwsbp = taxcom-wmwst .
WRITE:/  mwsbp .
ENDFORM. " calculate_tax
Regard
Sam

Similar Messages

  • Change the value of parameter in smartfrom by program lines...!

    Hi experts.........!
    i want to change the value of parameter 'x1' which i import from program has a value 'ECNC' and want to display in output of smartfrom as 'ECNEC'. how i change it from program lines.
    I use program lines to change its value....... use input parameter 'x1' and output paramter 'x1'
    and program lines are
    IF x1 = 'ECNC'.
    x1 = 'ECNEC'.
    ENDIF.
    and in condition i use
    x1 = 'ECNC'
    but it doesn't effect output is same as it show the value of x1 = 'ECNC' when i execute the program.
    How i change the value of x1 to 'ECNEC'
    Plz help me.......!
    Thanx in advance....!

    Hi ,
    Have you declared the Variable X1 under Global Definitions ?
    please debug the Smartform by the following way.
    Goto the generated Function module - > Search for your Variable X1 ( Choose Main program )- >  Set Break point
    Debugger will be called after giving printing parameter automatically. Check it whether value get changed ( Your Code is working or not ).

  • Incorrect Nesting, before the statement ENDFUNCTION

    Hello:
    I have this simple ABAP program, but I don't seem to make it work:
    FUNCTION Z_SAP_GET_CREDIT.
    ""Interfase local
    *"  IMPORTING
    *"     VALUE(CLIENT_ID) TYPE  Z_CLIENT_ID OPTIONAL
    *"  EXPORTING
    *"     VALUE(CREDIT_LIMIT) TYPE  STRING
    *"     VALUE(CONDITIONS) TYPE  STRING
    *"  EXCEPTIONS
    *"      USER_DOES_NOT_EXIST
    TYPES: BEGIN OF credit_eq_type,
             WEBTR  TYPE string,
             ZTERM  TYPE int4,
           END OF credit_eq_type .
    DATA: credit_eq TYPE credit_eq_type.
    SELECT SINGLE *
    FROM KNB1
    INTO CORRESPONDING FIELDS OF credit_eq
    WHERE KUNNR = CLIENT_ID.
    *CREDIT_LIMIT = credit_eq-WEBTR.
    ENDFUNCTION
    I get this error:
    Incorrect Nesting, before the statement "ENDFUNCTION", the structure introduced by SELECT must conclude with "END SELECT"
    I've done selects before and it wasn't needed.... what is this?
    Thanks
    Alex

    Even though you are specifying SELECT SINGLE * in your code, you are not providing the full key of KNB1 which also includes company code BUKRS. So system expects either a ENDSELECT or your INTO statement to be followed by TABLE itab instead of just INTO strcuture. That is why you got this error. So either do option 1 or 2 as follows.
    <u>Option 1</u>
    TYPES: BEGIN OF credit_eq_type,
             WEBTR LIKE KNB1-WEBTR,
             ZTERM LIKE KNB1-ZTERM,
           END OF credit_eq_type .
    DATA: credit_eq TYPE TABLE OF credit_eq_type with header line.
    SELECT SINGLE webtr zterm FROM KNB1
                              INTO TABLE credit_eq
                             WHERE KUNNR = CLIENT_ID.
    *CREDIT_LIMIT = credit_eq-WEBTR.
    <u>Option 2</u>
    TYPES: BEGIN OF credit_eq_type,
             WEBTR LIKE KNB1-WEBTR,
             ZTERM LIKE KNB1-ZTERM,
           END OF credit_eq_type .
    DATA: credit_eq TYPE credit_eq_type.
    SELECT webtr zterm FROM KNB1 UP TO 1 ROWS
                       INTO credit_eq
                      WHERE KUNNR = CLIENT_ID.
    ENDSELECT.
    *CREDIT_LIMIT = credit_eq-WEBTR.
    <u>Option 3</u>
    TYPES: BEGIN OF credit_eq_type,
             WEBTR LIKE KNB1-WEBTR,
             ZTERM LIKE KNB1-ZTERM,
           END OF credit_eq_type .
    DATA: credit_eq TYPE credit_eq_type.
    SELECT SINGLE webtr zterm FROM KNB1
                              INTO Credit_eq
                             WHERE KUNNR = CLIENT_ID
                               AND BUKRS = <either constant
    or another import parameter from the function module>.
    *CREDIT_LIMIT = credit_eq-WEBTR.
    3rd option is the best one if you have BUKRS. In the case where you don't have BUKRS, use the option 1. Option 2 is least efficient. <b>But in any case, please do not use SELECT * with INTO CORRESPONDING FIELDS when you need only two fields. Instead specify the fields AND yes you cannot use INTO with incompatable fields. They have to be compatible.
    Srinivas
    Message was edited by: Srinivas Adavi

  • Smartform error: Incorrect nesting

    Hi,
       I have been trying to use Spell_Amount in smartform. The code I have used is working fine in report but giving following error in smartform :
    Incorrect nesting: Before statement "Form", the structure introduced by "Function" must be concluded with "Endfunction".
    Code I have used is:
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    Data : S_WRBTR LIKE BSEG-WRBTR.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING s_wrbtr 'inr'.
    FORM spell_amount USING s_wrbtr pwaers.
      CALL FUNCTION 'SPELL_AMOUNT'
           EXPORTING
                amount    = s_wrbtr
                currency  = pwaers
                filler    = space
                language  = 'E'
           IMPORTING
                in_words  = t_spell
           EXCEPTIONS
                not_found = 1
                too_large = 2
                OTHERS    = 3.
    endform.
    Can I have some help?
    Thnx

    Try the following code:
    it worked for me.
    In Global Definitions --> Global Data Define:
    WORDS type Spell
    wt_total type tablename-fieldname " wt_total is the field you want in words.
    Create a Window Words and place it after you have the value of wt_total.
    In Window Words:
    Rt. Click--> Create --> flow Logic --> Program Lines
    Output Parameters --> wt_total,
                                         Words.
    call function 'SPELL_AMOUNT'
    exporting
       amount          = wt_total
    *   CURRENCY        = ' '
    *   FILLER          = ' '
    *   LANGUAGE        = SY-LANGU
    importing
       in_words        = words
    * EXCEPTIONS
    *   NOT_FOUND       = 1
    *   TOO_LARGE       = 2
    *   OTHERS          = 3
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    3. Create a text and put value
    &Words-word& in it.
    Let me know if it worked...
    <removed by moderator>
    Edited by: Thomas Zloch on Feb 17, 2012

  • Incorrect nesting upgrade from 4.5b to ecc 6.0

    Hi All,
    Please let me know when ever try to activate the program  i got incorrect nesting:Before start-of-selection the structure introduced by if must be concluded by endif, even if and endif exists also.
    If i removed start-of-selection it showed statement is not accessble.
    Please go through the following code and give suggestions regarding this.
    Thanks in Advance,
    Padmaja.
      INCLUDE MZF112F81RS001                                             *
    update zhotelrep_log of latest changes RS001
         tp_cchangemade = 'X'.
         IMPORT TP_CCATCH_CUR_VBAP FROM MEMORY ID 'catch'.      "RS001
         IF TP_CCATCH_CUR_VBAP = ' '.
    get all item.
           SELECT *
            FROM VBAP
            INTO CORRESPONDING FIELDS OF TABLE TA_VBAP_NEW
           WHERE VBELN EQ WA_RB_VBAK-VBELN
             AND MATKL IN RA_MATKL.
            and VGTYP eq wa_rb_vbak-vbtyp.
           PERFORM PROCESS_ACTIVITY_LOG.
           PERFORM ZHOTELREP_LOG_UPDATE.
           TP_CCATCH_CUR_VBAP = 'X'.
           EXPORT TP_CCATCH_CUR_VBAP TO MEMORY ID 'catch'.      "RS001
          perform zhotelrep_log_update.
         ENDIF.

    You will have to look for SAP Release Notes for version 4.7 (Enterprise) and also SAP ERP 5.0 + 6.0
    Yes that's a lot, but a big upgrade jump too.

  • Automatic Payment program -line item cleared not displaying in table

    automatic Payment program -line item cleared not displaying in table
    i have re run the APP program DUSR1 same earlier it has run twice but table dose not show double payment to vendors how to resolve the issue.
    Can some one please guide me on this.

    Hi Priyanka,
    First, which table are you referring to.  If your fist APP run clears the line item, it will no longer be available in the open item. 
    Please be more specific on the problem so that we can try to help you.  If possible, please provide screenshots.
    Regards,
    Ganesh

  • How to use SUBROUTINE in ' PROGRAMMING LINES'code of a smartform

    Hi all,
    i used a subroutine (PERFORM statement ) in 'Programming Line' node of a smartform .
    Then i put the 'FORM ENDFORM ' in 'SUBROUTINES' node of GLOBAL data.
    In Programming line i used
       PERFORM READ_TEXT using p_id p_lan p_obj.
    In SUBROUTINE node of GLOBAL data, i used
    FORM READ_TEXT using p_id p_lan p_obj.
    ENDFORM.
    While executing, my control is going to FORM ENDFORM  & i can see the data in the
    table T_TDLINE while my control is inside the FORM ENDFORM.
    When it comes back to my Programming NODE, there is no data in T_TDLINE table.
    can anyone tell me how & where to define this table T_TDLINE so that i can get the data
    in in my coding lines after PERFORM statement.
    ur Idea is highly appreciated. correct answers will be rewarded.
    Thanks
    pabitra

    1. Define a table in the Global Definiation > GLOBAL data:
    T_TDLINE TYPE TTTEXT.
    2. PERFORM READ_TEXT tables T_TDLINE using p_id p_lan p_obj.
    3. FORM READ_TEXT table IT_TDLINE type TTTEXT
    using p_id p_lan p_obj.
    ENDFORM.
    Now, you will be able access your data in T_TDLINE.
    Regards,
    Naimesh Patel

  • In Adobe Forms where to write to write Program lines

    Hi All,
    In Adobe Interactive Forms , in SFP transaction where do we write Program lines.
    In smar forms , roight clik flow logic and program lines creates an area for program line, what is the euqualiant to this in adobe forms.
    Please help me out on this.
    Thanks,
    Praveen

    Hi,
    Please check the following links,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d4fe7fca-0b01-0010-569a-9a9c1ddf4132
    https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/7c3bc67e-0c01-0010-dbb3-908315896909 [original link is broken] [original link is broken]
    https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/7c3bc67e-0c01-0010-dbb3-908315896909 [original link is broken] [original link is broken]
    /people/vani.krishnamoorthy/blog/2006/05/17/fillable-adobe-forms-using-abap

  • The ABAP program lines are wider than the internal table.

    Hello;
    i use FM REUSE_ALV_FIELDCATALOG_MERGE to fill in fieldcat from an internal table but i receive dump message  READ_REPORT_LINE_TOO_LONG. Is there smt. like a type mismatch or waht can that be?
    detail explanation of the dump is
    The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72 characters wide. The program line is                                              
    81 characters wide.                                                                
    source of the call is like:
    DATA: ALV_FIELDCAT     TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          ALV_HEADER       TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
          ALV_EVENTS       TYPE SLIS_T_EVENT WITH HEADER LINE,
          ALV_LAYOUT       TYPE SLIS_LAYOUT_ALV,
          ALV_PRINT        TYPE SLIS_PRINT_ALV,
          ALV_REPID        LIKE SY-REPID,    " program name
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = alv_repid
          I_INTERNAL_TABNAME = 'ITAB'
          I_INCLNAME         = alv_repid
        CHANGING
          CT_FIELDCAT        = alv_fieldcat[]
        EXCEPTIONS
          OTHERS             = 3.
    thx in advance
    Ali

    Hi,
    At least one line of the source text is longer than the lines of the internal table itab then,
    READ_REPORT_LINE_TOO_LONG.  error occurs.
    Cause: At least one line of the source text is longer than the lines of the internal table itab.
    Runtime Error: READ_REPORT_LINE_TOO_LONG
    check the link below for further info
    http://www.s001.org/ABAP-Hlp/abapread_report.htm
    one more thing, whether u have given report name
    ALV_REPID = 'ZXYZ'.  
    if ZXYZ is u r program name

  • How to use parameter option in smartform program line.

    HI all,
    how can i give parameter for matnr directly in smartform program line, it wont take gives a dump
    i don wanna create a separate driver program for that.
    Error in the ABAP Application Program
    The current ABAP program "/1BCDWB/SF00000001============FT" had to be
    terminated because it has
    come across a statement that unfortunately cannot be executed.
    The following syntax error occurred in program "/1BCDWB/SAPLSF00000001 " in
    include "/1BCDWB/LSF00000001F01 " in
    line 539:
    "You can only use "PARAMETERS" for programs other than type 1 between B"
    "EGIN/END OF SCREEN."
    The include has been created and last changed by:
    Created by: "SAPUSER "
    Last changed by: "SAPUSER "
    how can i solved this.
    Kavinath B.

    Hi,
    You can not code
    SELECTION-SCREEN BEGIN OF BLOCK.
    SELECT-OPTIONS selcrit FOR (name).
    SELECTION-SCREEN END OF BLOCK.
    like this in smartform  program line it wont allow
    all you have to do is create a driver program
    for smartform create a selection screen and call smartform by
    n pass variables or internal tables.
    call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
          formname                 =
    *     VARIANT                  = ' '
    *     DIRECT_CALL              = ' '
    *   IMPORTING
    *     FM_NAME                  =
    *   EXCEPTIONS
    *     NO_FORM                  = 1
    *     NO_FUNCTION_MODULE       = 2
    *     OTHERS                   = 3
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    I hope it will help u
    Ketan.P

  • Unable to insert program lines in event sort begin and sort end

    Hello friends,
    I am developing a smartform where in I have to print subtotal for every currencies. So I am unsing the sort criteria option and giving the WAERS in 'Data' tab of the Table . And I select 'Event on Sort Begin' which creates a node in the tree under the table. And I need to clear the total variable in this event so that for every new currency, the total is reset. But I am unable to create a program lines here. When I right click and under  flow logic, only Loop and Command options are available. I am using ECC 6.0 . Kindly help me in achieving the solution.
    Thanks & regards,
    Ratheesh

    Hi Sripaleshwar,
    I tried that.. I am able to create a program lines when I right click on the table. But it always gets placed outside the table node. When I try to drag it also to under the sort begin event node, it says 'Unable to insert program lines at the selected position'. Basically for my logic to work , it has to execute this program lines when the sort begin event occurs.
    regards,
    ratheesh

  • In HP16522A Applicatio​n Build Program.vi​, can I create a Program Line Array in a text editor, and then download it directly to the VI?

    I basically would like to insert a few extra instructions into a previously created Progam Line Array without having to re-enter the entire program again.

    Andrew,
    I just took a look at the HP16522A Instrument Driver, and it looks like that Program Line Array is handled programmatically as an array of clusters, that is then parsed out and formatted as strings to send to the instrument. I can see two ways of getting the data from your text editor into LabVIEW in a useable format. You could use the File I/O VIs to read the string data from the file, then parse and format it appropriately to add to the Program Line Array...I can also see getting that text data in, formatting it as strings, then simply adding it into the command string you send to the instrument right before the Write function.
    I think both of these methods would work, although I think the first one will probably be easier for you to deal with, since you wo
    uld be using the Program Line Array cluster format the entire time.
    I wish you luck with your application. Have a pleasant day.
    Sincerely,
    Darren Nattinger
    Applications Engineer
    National Instruments
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Runtime error:ABAP program lines are longer than the internal table

    Hi all,
    Below is the code I have written,when Iam running it Iam getting
    'ABAP program lines are longer than the internal table' runtime error.How can I resolve it.
    REPORT  ZTEST1  NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES:MARC,CDHDR,CDPOS.
    TYPE-POOLS:SLIS.
    DATA:HEADER TYPE SLIS_T_FIELDCAT_ALV,
         WA TYPE SLIS_FIELDCAT_ALV,
         LAYOUT TYPE SLIS_LAYOUT_ALV.
    TYPES:BEGIN OF MARC_TY,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            EKGRP LIKE MARC-EKGRP,
            MINBE LIKE MARC-MINBE,
            EISBE LIKE MARC-EISBE,
            MABST LIKE MARC-MABST,
           END OF MARC_TY.
    TYPES:BEGIN OF MATNR1_TY,
            MATNR1 LIKE CDHDR-OBJECTID,
          END OF MATNR1_TY.
    TYPES:BEGIN OF CDHDR_TY,
             OBJECTCLAS LIKE CDHDR-OBJECTCLAS,
             OBJECTID   LIKE CDHDR-OBJECTID,
             CHANGENR   LIKE CDHDR-CHANGENR,
             USERNAME   LIKE CDHDR-USERNAME,
             UDATE      LIKE CDHDR-UDATE,
            END OF CDHDR_TY.
    TYPES:BEGIN OF CDPOS_TY,
             OBJECTCLAS LIKE CDPOS-OBJECTCLAS,
             OBJECTID   LIKE CDPOS-OBJECTID,
             CHANGENR   LIKE CDPOS-CHANGENR,
             TABNAME    LIKE CDPOS-TABNAME,
             FNAME      LIKE CDPOS-FNAME,
             CHNGIND    LIKE CDPOS-CHNGIND,
             VALUE_NEW  LIKE CDPOS-VALUE_NEW,
             VALUE_OLD  LIKE CDPOS-VALUE_OLD,
            END OF CDPOS_TY.
    **************TABLE TYPES********************************************
    TYPES: MARC_TAB   TYPE TABLE OF MARC_TY,
           MATNR1_TAB TYPE TABLE OF MATNR1_TY,
           CDHDR_TAB  TYPE TABLE OF CDHDR_TY,
           CDPOS_TAB  TYPE TABLE OF CDPOS_TY.
    *******************INTERNAL TABLES************************************
    DATA:MARC_ITAB   TYPE MARC_TAB,
         MATNR1_ITAB TYPE MATNR1_TAB,
         CDHDR_ITAB  TYPE CDHDR_TAB,
         CDPOS_ITAB  TYPE CDPOS_TAB.
    ****************WORK AREAS********************************************
    DATA:MARC_WA   TYPE MARC_TY,
         MATNR1_WA TYPE MATNR1_TY,
         CDHDR_WA  TYPE CDHDR_TY,
         CDPOS_WA  TYPE CDPOS_TY.
    *******************SELECTION-SCREEN***********************************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
      PARAMETERS:PLANT LIKE MARC-WERKS.
      SELECT-OPTIONS:MATERIAL FOR MARC-MATNR.
      SELECT-OPTIONS:DATE FOR CDHDR-UDATE.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
    SELECT MATNR
            WERKS
            EKGRP
            MINBE
            EISBE
            MABST
            FROM MARC INTO TABLE MARC_ITAB
            WHERE MATNR IN MATERIAL
            AND WERKS = PLANT.
      CHECK MARC_ITAB[] IS NOT INITIAL.
      LOOP AT MARC_ITAB INTO MARC_WA.
       MATNR1_WA-MATNR1 = MARC_WA-MATNR.
       APPEND MATNR1_WA TO MATNR1_ITAB.
       CLEAR MATNR1_WA.
    ENDLOOP.
    CHECK MATNR1_ITAB[] IS NOT INITIAL.
    SELECT OBJECTCLAS
            OBJECTID
            CHANGENR
            USERNAME
            UDATE
            FROM CDHDR INTO TABLE CDHDR_ITAB
            FOR ALL ENTRIES IN MATNR1_ITAB
            WHERE OBJECTCLAS = 'MATERIAL'
            AND OBJECTID = MATNR1_ITAB-MATNR1
            AND UDATE IN DATE.
    CHECK CDHDR_ITAB[] IS NOT INITIAL.
    SORT CDHDR_ITAB[]  DESCENDING BY OBJECTID  CHANGENR.
    DELETE ADJACENT DUPLICATES FROM CDHDR_ITAB[] COMPARING OBJECTID.
    SELECT OBJECTCLAS
           OBJECTID
           CHANGENR
           TABNAME
           FNAME
           CHNGIND
           VALUE_NEW
           VALUE_OLD
           FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
           FOR ALL ENTRIES IN CDHDR_ITAB
           WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
           AND OBJECTID = CDHDR_ITAB-OBJECTID
           AND CHANGENR = CDHDR_ITAB-CHANGENR
           AND TABNAME  = 'MARC'
           AND FNAME    IN ('MINBE','EISBE','MABST','LVORM')
           AND CHNGIND  = 'U'.
    CHECK CDPOS_ITAB[] IS NOT INITIAL.
    *LOOP AT CDPOS_ITAB INTO CDPOS_WA.
    WRITE: / CDPOS_WA-OBJECTCLAS,
             CDPOS_WA-OBJECTID,
             CDPOS_WA-CHANGENR,
             CDPOS_WA-TABNAME,
             CDPOS_WA-FNAME,
             CDPOS_WA-CHNGIND,
             CDPOS_WA-VALUE_NEW,
             CDPOS_WA-VALUE_OLD.
    *ENDLOOP.
    WA-SELTEXT_L = 'OBJECTCLAS'.
    WA-COL_POS   = '1'.
    WA-FIELDNAME = 'OBJECTCLAS'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '15'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'OBJECTID'.
    WA-COL_POS   = '2'.
    WA-FIELDNAME = 'OBJECTID'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '20'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'CHANGENR'.
    WA-COL_POS   = '3'.
    WA-FIELDNAME = 'CHANGENR'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '8'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'TABNAME'.
    WA-COL_POS   = '4'.
    WA-FIELDNAME = 'TABNAME'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'FNAME'.
    WA-COL_POS   = '5'.
    WA-FIELDNAME = 'FNAME'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '7'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'CHANGING'.
    WA-COL_POS   = '6'.
    WA-FIELDNAME = 'CHANGING'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '1'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'VALUE_NEW'.
    WA-COL_POS   = '7'.
    WA-FIELDNAME = 'VALUE_NEW'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    WA-SELTEXT_L = 'VALUE_OLD'.
    WA-COL_POS   = '8'.
    WA-FIELDNAME = 'VALUE_OLD'.
    WA-TABNAME   = 'CDPOS_ITAB'.
    WA-OUTPUTLEN = '5'.
    APPEND WA TO HEADER.
    CLEAR WA.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
        I_PROGRAM_NAME               = SY-REPID
        I_INTERNAL_TABNAME           = 'CDPOS_ITAB'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   = SY-REPID
      CHANGING
        CT_FIELDCAT                  = HEADER[]
    EXCEPTIONS
    IF SY-SUBRC <> 0.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = SY-REPID
        IT_FIELDCAT                       = HEADER[]
      TABLES
        T_OUTTAB                          = CDPOS_ITAB[]
    IF SY-SUBRC <> 0.
    ENDIF.

    Your select querry on MARC is not matching with MARC_TY.
    The field in the MARC table and MARC_TY should be same.
    and also, when you are making select querry on CDPOS table
    with all entries.
    When ever you are using all entries select statement, you should check whether the internal table is having value.
    you should check
    if CDPOS_IT[] is not initial.
    SELECT OBJECTCLAS
    OBJECTID
    CHANGENR
    TABNAME
    FNAME
    CHNGIND
    VALUE_NEW
    VALUE_OLD
    FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
    FOR ALL ENTRIES IN CDHDR_ITAB
    WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
    AND OBJECTID = CDHDR_ITAB-OBJECTID
    AND CHANGENR = CDHDR_ITAB-CHANGENR
    AND TABNAME = 'MARC'
    AND FNAME IN ('MINBE','EISBE','MABST','LVORM')
    AND CHNGIND = 'U'.
    endif.
    Regards
    Madhan D

  • How to pass Tables through program line.

    Hi All,
    I have requirment in smart forms.
    I need to execute smartforms in form itself. means no chance to run with driver program.
    So i created program line which where write our logic for internal table. My question is how to pass created internal table from program line. i need to display the internal table data using loop.
    Thanks,
    Subbu

    Hi,
    Try this :
    code
    REPORT report2.
    DATA: text TYPE c LENGTH 10,
    rspar_tab TYPE TABLE OF rsparams,
    rspar_line LIKE LINE OF rspar_tab,
    range_tab LIKE RANGE OF text,
    range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'EQ'.
    rspar_line-low = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign = 'E'.
    range_line-option = 'EQ'.
    range_line-low = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign = 'E'.
    range_line-option = 'EQ'.
    range_line-low = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
    WITH SELECTION-TABLE rspar_tab
    WITH selcrit2 BETWEEN 'H' AND 'K'
    WITH selcrit2 IN range_tab
    AND RETURN.
    [/code]
    Reward points if found helpful.....
    Cheers,
    Chandra Sekhar.

  • Message: The ABAP program lines are wider than the internal table.

    sorry for stupid question.... can you please tell me what I need to check?
    The internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" is 72
    characters wide. The program line is
    75 characters wide.
    Uf, I can't find the mistake
    BR

    Hi,
    please try to change some settings and see ...
    SE38->program->Display->Utilities->Settings->Abapeditor->editor, check the last check box (downwards-Comp Line Length)...
    If you are using merge fundtion module try to delcare the final internal table like this
    data : BEGIN OF i_final OCCURS 0,
            matnr LIKE mara-matnr,       "Material Number
            maktx LIKE makt-maktx,       "Material Description
            END OF i_final.
    Regards,
    Nagaraj

Maybe you are looking for

  • Need help in distributing Master Folder (all my original pics), Aperture Library, Aperture Back-up, Vault and Time Machine

    I have a desktop iMac and three external HDs. One HD called Aperture Library (2T) now has Aperture Library, Time Machine backups and Master Folder, which is where I put my RAW files of pictures I want to keep. A second HD called Aperture back-up (1T)

  • How to pass DB link dynamically

    Hi, I need to pass DB link dynamically to SQL i.e, if I run in stage DB then I wanted to pass @DBSTAGE , if I run in prod DB then I wanted to pass @DBPROD to my report SQL. How can I achieve this? Thanks in advance for your help.

  • Displaying TOOL TIP message over an applet

    Hi, How to display a tooltip(hint) like message when the mouse moves over an applet. Here is the rough source code, Please do the needful. import java.applet.*; import java.awt.*; public class Dis extends Applet implements MouseListner      public vo

  • SAP SRM - Purchasing Org Structure

    Hi, Pls can anybody let me know, how do we assign a user as a buyer to more than one purchasing group. I had used to the attribute "Is Purchaser of" to assign the position of the user to one purchasing group. but I could not assign to more than one p

  • Compiling error on Java I/O

    My first time to write a very simple Java progam. Any one could help me on this comipling error? Thanks in advance! Compiling ERROR: ================ C:\java\class>javac hw01.java hw01.java:43: cannot resolve symbol symbol : variable in location: cla