Routine1

Hi please help me,
In Perform  and  form i have to give some logic. For this  inside the form logic i have given logic  like this, Now the problem is when i am calling the routine i have to give logic .Please help me here . When calling perform with which passing parameter i have to call .This is uregent please help me.
DATA: BEGIN OF t_table OCCURS 0,
       tnum LIKE zpricontab-tnum,
      END OF t_table.
CLEAR sel_list.
  CLEAR t_table.
  SORT t_table.
  DELETE ADJACENT DUPLICATES FROM t_table.
  PERFORM extract_table_a700.(this is that perform what i have to pass here for this logic which is given below
  DESCRIBE TABLE t_data_tab LINES linenr.
  IF linenr > 0.
    SORT t_data_tab.
FORM extract_table_a700
CLEAR a700.
SELECT        * FROM  a700
          WHERE  kappl    = 'V'
          AND    kschl    IN s_kschlr
          AND    vkorgau  IN s_vkorg
          AND    vtweg    IN s_vtweg
          AND    kunnr    IN s_kunnr
          AND    zzkvgr2  IN s_kvgr2
          AND    spart    IN s_spart
          AND    kdatu    IN s_kdatu
          AND    datbi    >= p_valid
          AND    datab    <= p_valid.
    CLEAR t_data_tab.
    MOVE : tname        TO t_data_tab-tnum,
           a700-kschl   TO t_data_tab-kschl,
           a700-vkorgau TO t_data_tab-vkorg,
           a700-vtweg   TO t_data_tab-vtweg,
           a700-kunnr   TO t_data_tab-cust,
           a700-zzkvgr2 TO t_data_tab-zzkvgr2,
           a700-spart   TO t_data_tab-spart,
           a700-kdatu   TO t_data_tab-kdatu,
           a700-datbi   TO t_data_tab-datbi,
           a700-datab   TO t_data_tab-datab,
           a700-knumh   TO t_data_tab-knumh.
    APPEND t_data_tab.
  ENDSELECT.

Hi,
No need to give any paramters to the Perform as you are not using any of the paramters in the select statement. You are using all the global parameters which belongs to selection screen.Just declare an internal table for a700 and fetch the data into that, and remove the ENDSELECT from last, since I am using into table in select statement.
You have to write the form statements in the last.
DATA: BEGIN OF t_table OCCURS 0,
tnum LIKE zpricontab-tnum,
END OF t_table.
<b>Data:i_a700 like a700 occurs 0 with header line.</b>
CLEAR sel_list.
CLEAR t_table.
SORT t_table.
DELETE ADJACENT DUPLICATES FROM t_table.
PERFORM extract_table_a700.(this is that perform what i have to pass here for this logic which is given below
DESCRIBE TABLE t_data_tab LINES linenr.
IF linenr > 0.
SORT t_data_tab.
loop at t_data_tab.
  < display the data or do whatever you wants to do>
endloop.
FORM extract_table_a700
CLEAR a700.
SELECT * FROM a700 <b>into table i_a700</b>
WHERE kappl = 'V'
AND kschl IN s_kschlr
AND vkorgau IN s_vkorg
AND vtweg IN s_vtweg
AND kunnr IN s_kunnr
AND zzkvgr2 IN s_kvgr2
AND spart IN s_spart
AND kdatu IN s_kdatu
AND datbi >= p_valid
AND datab <= p_valid.
CLEAR t_data_tab.
loop at i_a700.
MOVE : tname TO t_data_tab-tnum,
i_a700-kschl TO t_data_tab-kschl,
i_a700-vkorgau TO t_data_tab-vkorg,
i_a700-vtweg TO t_data_tab-vtweg,
i_a700-kunnr TO t_data_tab-cust,
i_a700-zzkvgr2 TO t_data_tab-zzkvgr2,
i_a700-spart TO t_data_tab-spart,
i_a700-kdatu TO t_data_tab-kdatu,
i_a700-datbi TO t_data_tab-datbi,
i_a700-datab TO t_data_tab-datab,
i_a700-knumh TO t_data_tab-knumh.
APPEND t_data_tab.
clear t_data_tab.
endloop.
endform.
Regards,
Anji
Message was edited by:
        Anji Reddy Vangala

Similar Messages

  • Unwanted ABAP Code Block Triggering - IF condition not working

    Friends,
    I am facing weird issue in my production system i.e. one of the code block which was bounded in IF condition is getting triggered. However, as per the data that I have in my system this IF condition should skip that code block.
    Let me give you code and execution flow here:
    I have Program A in which I am submitting Program B in background mode to selected server. This Program A will be executed by end user in Background mode.
    call function 'JOB_OPEN'
         exporting
           jobname          = job_name
         importing
           jobcount         = job_number
         exceptions
           cant_create_job  = 01
           invalid_job_data = 02
           jobname_missing  = 03.
    if sy-subrc = 0.
         submit program B
                  via job job_name number job_number
                  with p_sched  = sched
                  with period_p = period
                  with fyear_p  = fyear
                  with username = ruser
    and return.
    call function 'JOB_CLOSE'
         exporting
           jobcount             = job_number
           jobname              = job_name
           sdlstrtdt            = start_date
           sdlstrttm            = start_time
          targetserver          = l_targetserver          "V05++
         exceptions
           cant_start_immediate = 01
           invalid_startdate    = 02
           jobname_missing      = 03
           job_close_failed     = 04
           job_nosteps          = 05
           job_notex            = 06
           lock_failed          = 07.
    endif.
    As you can see in code, I am passing job to run on l_targetserver. This program also releases some other jobs on other programs.
    In Program B, I have code like this:
    Top Include.
    start-of-selection.
    perform routine1 using p_fyear. "THIS HAS SOME SELECT QUERIES  AND  OTHER CODE and THERE IS NO ISSUE WITH IT. THIS ROUTINE IS
    ALSO HAVING ONE AND ONLY 'CLEAR' statement on DELTA_FLAG.
    perrform routine2.
    form routine2.
    loop itab into wa.  " This itab was populated in routine1
      perform get_flag." WE ARE PASSING VALUE TO DELTA_FLAG VARIABLE HERE. YOU CAN CHECK CODE BELOW.
    perform process_data. "CHECK THIS ROUTINE
    peform update_records.
    endloop.
    endform.
    Form Get_FLag.
    select * from dbtable into localtable where <condition>. " THIS QUERY RETURNS SOME DATA AND MY FLAG WILL BE SET AS 'X'.
    if sy-subrc = 0.
    delta_flag = 'X'. "THis one declared in top include.
    endif.
    EndForm.
    Form Process_Data.
    Perform get_dataset1.
    while counter <> 0. " Variable Counter declared in top include and default value is 20. Value will be decreased in side this loop. No issues with it.
    if wa-fld1 = '1'. "Check value of one of the field.
      continue.
    endif.
    perform get_delta_data. " We have Unwanted ABAP code (for my scenario) here.
    endwhile.
    Endform.
    form update_records.
    call function 'FUNCTION' in update task exporting par1 = itab.
    commitwork
    endform.
    form get_delta_data.
    if delta_flag is initial.
    select data from BSEG into i_bseg where <condition>. " This query is getting triggered in my system.
    endif.
    endform.
    All my data objects were declared in Top include of the program. Subroutines with their parameters were same as above code. I am not using any sub-routine second time or out-side of this program. As shown, this program updates records to one of the table with UPDATE function module IN UPDATE TASK and there is COMMITWORK after that. This task is part of
    As you could understand, DELTA_FLAG is having 'X' but query on BSEG is getting triggered. We are not clearing this variable after populating 'X' to it. I can see this query from Program B captured in ST12 trace results. (Verified it multiple times)
    I did this analysis:
    1. Ran this process in foreground with debugging, then there is no issue.
    2. Debugged 'Finished' job of my production system, but I dont see this code triggered in Debug mode.
    3. Replicated same execution process in our non-production environments, but there is no issue.
    Let me know if you need any other details.
    Thanks for your time.
    Regards,
    Naveen

    I forgot the one bit, which might actually have been useful: I'd be moving the if delta_flag is initial. out of form get_delta_data, before perform get_delta_data.Since you are calling in nested loops there, every little bit of run-time counts, and "philosophically" I feel - procedure should do what its name promises it will, and not check whether it's "appropriate time" to do it
    cheers and good luck
    Jānis

  • Rtsora linked to a c object

    Environment:
    Oracle 11.2.0.4
    Aix 7.1
    Cobol Microfocus v5.1.00
    We have linked in the makefile a c object (that contains routine1) compiled by gcc and the rtsora has been generated without errors
    When we run rtsora <pgm.gnt> when there is the instruction CALL "routine1" we have the error "Called program file not found in drive/directory"
    The same situation in Oracle 9 (32 bit) with an old version of cobol works fine
    Content of env_precomp.mk:
    RFSG=<pathname>/rfsgi.o
    RTSORA_LINKLINE=$(COB) -o $(LOC_RTSORA) -t -xe "" $(RTSPORTFLAGS) $(RESOLVE_SQLROWIDGET) $(COBSQLINTF) \
           $(SCOREPT) $(SSCOREED) $(DEF_ON) -L $(LIBHOME) $(LLIBSQL) $(NAETTOBJS) \
    $(LLIBXSD) $(COBTTLIBS) $(RFSG)

    hi,
    The solution is not just for travel requests but any approval of any workflow . The rejector enters a comment giving the rejection reason . This could be entered on the Portal / as a note attaching to the workflow. (For the travel requests it could be multilevel approval .The rejection is only done by one level and workflow returns normally to the creator) My problem is to get the comment that is sitting in the workflow container as Attachment  and normally a SOFM type object -> to the generic object services attachment list on the Business entity eg on the travel request itself . This will then live with the travel request, available for multiple wf rounds of changes done to the trip.
    With every new comment it must add the comment onto the travel request itself.
    Currently the comment will just be available for the duration of one round of approval workflow.
    Hope this makes sence .
    Thanks very much for been interested in my problem.
    Christine

  • Field length having morethan 1000 Characters

    Hi ,
    From R/3 one field name is Text (Description :ObjectValue )it is LCHR datatype .We have to extract this field to BW.
    But in BW we have maximum 60 Char length we can do.For this field I have to create 17 Infoobjects
    Like Zobjval1,Zobjval2,..........Zobjval17  .All infoobjects having 60 length and last infoobject will 40 Char.
    What ABAP code I have to write at start routine?And how to concatenate these 17 onfobjects?
    Thanks,
    Sridhar

    Milan,
    Iam having these blog and liinks.I need step by step for this example.
    Example Error Message r/3 filed having 220 Char length
    I have to 1)create 4 infoobjects ex Zerrmsg1 having 60 ,zerrmsg2 having 60,zerrmsg3 having 60,zerrmsg4 having 40.
    2)I have to do mapping error message field to these 4 infoobjects?
    3)and I have to field routine or start routine ???????
    If it is field routine1 result =  Zerrmsg1(60).
    routine2 result =  Zerrmsg1+60(60).
    routine3 result =  Zerrmsg1+120(60).
    routine4 result =  Zerrmsg1+180(40).
    Is it correct for field routines
    If I use start routine what ABAP code I have to use for that example.
    Please don't send any weblogs and links.Please answer above ABAP code.
    Thanks,
    Sridhar

  • SAPScript ampersand (&) substitution in PERFORM

    Hi all,
    My SAPScript has a PERFORM
    PERFORM ROUTINE1 IN PROGRAM ZPROG
    USING &VAR1&
    CHANGING &VAR2&
    ENDPERFORM
    In the ABAP debugger I see the value of VAR2 as A&B&C, but when I go back to the form, the SAPScript debugger is showing the value as AC. My guess is that &B& is considered to be a symbol with a null value. How can I format VAR2 so it would come back as A&B&C?
    Thanks and Regards.

    Hi,
    If a text like this was entered via the graphical Sapscript editor, it would have masked the text as A<(>&<)>B<(>&<)>C. If it was originally entered with the non-graphical Sapscript editor(line editor) and the masking characters were not used, then it would interpret the &B& as a symbol.
    So VAR2 should contain A<(>&<)>B<(>&<)>C. i.e. the & characters need to be masked if they are to be interpreted as real ampersand characters rather thant he beginning of a symbol.
    Regards,
    Aidan

  • Debugging the script.

    Hi All,
    I need to debug a script and i am facing a challenge like when i checked the nace transaction for a particular Tcode i am able to c two processing routines.
    When i c the output i am able to see a form which has got attached to the first routine and when i press the back button from the form output i am able to c the form which is attached to the processing routine2.( this is what i need to debugg)
    Now my problem is when i make activate debugger in the second script the debugger is calling only the first form not the second one..
    Can any one suggest me how to debugg it.
    Thanks in Advance,
    Joe

    Hi meetjoe,
    Basically u want to debug the 2nd form attached to the 2nd routine right?
    But always when u activate debugger and start debugging u can see the 1st form.
    See as per what u have said i feel the flow of your program is as follows...
    your routine1 calls the form1...it displays it and then returns to your routine2 which then calls the
    form2...thats why when u go back from output of form1...u directly reach the form2.
    I feel your form2 is taking some values / data from form1...so always before displaying form2, it is going in sequence  and showing form1 1st and then form2.
    do one thing...activate debugger for form2...start debugging..if it starts debugging form1...continue doing it, come to form output.....then click on BACK button as u said...then when u come to the form2, which u wanted to debug....then just put a breakpoint there in the script of form2 in the debugger and simply save it...
    so the breakpoint will be saved at a position in form2...and next time when u start debugging the control will directly come to the breakpoint in ur form2, or even if it goes to form1 first, then definitely next it'll move to breakpoint in form2....and i guess thats wat u wanted to do
    Hope this helps u...All The Best
    Regards,
    Radhika

Maybe you are looking for