Skip to Content
author's profile photo Former Member
Former Member

Logic for Populating a Work Area

Hi Gurus,

I have a standard sap structure KNWEV. In the structure the values will get populated as give below.

For an Unloading point for different days ie for Monday the times for unloading will be

Monday 8 30 12 30 14 30 16 30.

Tuesday 9 30 12 30 14 30 16 30

The values will get populated for all the days for an unloading point. and its stored in structure as below.

KNWEV Field names and Field Values

Unloading_point Monday1 Monday2 Monday3 Monday4 Tuesday1 Tuesday2 Tuesday3 Tuesday4 etc

-


.

Dock A 8 30 12 30 14 30 16 30 9 30 12 30 14 30 16 30

Suppose for a unloading date let it be 18 / March / 2009 , it is a Tuesday

I want to populate work area in my program with Unloading point and Time for Tuesday taking values from KNWEV

Work Area

Unloading point Tuesday1 Tuesday2 Tuesday3 Tuesday4 .

-


Dock A 9 30 12 30 14 30 16 30

Please let me know how can i move fields from structure to my work area taking the field names as Monday1 Monday2 .. and so on

Edited by: Avi on Mar 18, 2009 12:11 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Mar 17, 2009 at 08:11 PM

    Hi,

    Use the code below...

    data weekday type DTRESR-WEEKDAY
    data string type string.
    
    call function date_to_day
    exporting
    date = sy-datum
    importing
    weekday = weekday.
    
    if weekday CS 'WED'.
       string = 'WEDNESDAY'.
    elseif weekday CS 'SAT'.
       string = 'SATURDAY'.
    endif.                                       " For all other days it takes it automatically....
    
    read table itab into wa_knwev with key unloading_point = weekday.
    " I don't know whether which variable contains the weekday in the internal table so i have used the variabel unloading point...
    " The above read statement will get the record in the work area for the date you mention in the FM...

    I hope this is what you required ...

    if this is not meeting the requirement please do specify a bit more on your requirement

    Regards,

    Siddarth

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Ah!!!!

      Apologize for misunderstanding the requirement...

      I got your requirement...

      use the code given below...

      data weekday type DTRESR-WEEKDAY
      data string type string.
       
      call function date_to_day
      exporting
      date = sy-datum
      importing
      weekday = weekday.
      
      if weekday CS 'MONDAY'.
        read table itab into wa_knwev with key unloading_point = value_for_unloading_point
             transporting unloading_point MOAB1 MOBI1 MOAB2 MOBI2. 
      elseif weekday cs 'TUESDAY'.
        read table itab into wa_knwev with key unloading_point = value_for_unloading_point
             transporting unloading_point DIAB1 DIBI1 DIAB2 DIBI2.
       
      "like wise for other days you can do it this way....
      elseif weekday CS 'WED'.
        
      elseif weekday CS 'SAT'.
         string = 'SATURDAY'.
      endif.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.