cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in populating and internal table's data into a SAP-Script Form

Former Member
0 Kudos

Dear Guru

here i have encountered an issue in populating and internal table's data into a SAP-Script Form.

char1_val_tab_1 is an internal table and i am trying to populate its

char1_val_tab_1-atnam -->> characteristics names

char1_val_tab_1-atflv --->> characteristics value

into a sap-script form.

so in sapscript's from i have passed this two variable

like below

&char1_val_tab_1-atnam&

&char1_val_tab_1-atflv&

and in driver prog of that sap-script form i have written code like below in order to populate all the lines of these internal table char1_val_tab_1

LOOP at char1_val_tab_1.
   
   PERFORM write_form USING 'ITEM' ' ' ' ' 'MAIN'.


ENDLOOP.

But the issue i am facing this looping only printing the last line of that internal table but i want from 1st line to last line.

so guru i want to know what are the necessary changes i should make in to above looping in order to print 1st line to last line of that internal table char1_val_tab_1.

Pls help

Thanx & Regards

Saifur Rahaman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think you need to have a work area in your print program and then in text element use the workarea to display the fields.

All other code lines are fine but use the statement .

LOOP AT itab INTO workarea.

I believe it is printing the last line due to lack of the workarea.

Regards,

Ram

Former Member
0 Kudos

Hi Ramkrishna

That means my code should be like below ??

LOOP at char1_val_tab_1 into wa_char1_val_tab_1.

   PERFORM write_form USING 'ITEM' ' ' ' ' 'MAIN'.


ENDLOOP.

any neccessary coding i have to add apart from this inorder to populate all lines ??

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Now use the workarea and its fields in the text element to display the contents.

Let me know the result.

It should work.

Regards,

Ram

Former Member
0 Kudos

Dear sir,

just wait for some time i will give you feedback.

Thanks & regards

Saifur Rahaman

Former Member
0 Kudos

Dear Dada,

I have solved the problem using line index.

Thanks a lot for ur kind co-opearation

Thanks & Regards

Saifur Rahaman

Former Member
0 Kudos

Hi Saifur,

Try to write this way :

LOOP at char1_val_tab_1.
   
   PERFORM write_form.
 
ENDLOOP.

FORM write_form .

  CALL FUNCTION 'WRITE_FORM'
   EXPORTING
     element                        = ' <Text element Name> '
   EXCEPTIONS
     element                        = 1
     function                       = 2
     type                           = 3
     unopened                       = 4
     unstarted                      = 5
     window                         = 6
     bad_pageformat_for_print       = 7
     spool_error                    = 8
     codepage                       = 9
     OTHERS                         = 10
            .
  IF sy-subrc <> 0.

    WRITE 'Write_Error'.

  ENDIF.


ENDFORM.                    " write_form

Now for all the values the loop runs and fetches you all the records.

Regards,

Swapna.

Former Member
0 Kudos

I did PERFORM write_form USING 'ITEM' ' ' ' ' 'MAIN'.

with following code and its not coming... it is showing only last line of that internal table into sap-scripts o/p

FORM write_form USING p_element
                      p_function
                      p_type
                      p_window.
  CALL FUNCTION 'WRITE_FORM'
      EXPORTING
           element                  = p_element
*            function                 = p_function
*            type                     = p_type
           window                   = p_window
*       IMPORTING
*            PENDING_LINES            =
       EXCEPTIONS
            element                  = 1
            function                 = 2
            type                     = 3
            unopened                 = 4
            unstarted                = 5
            window                   = 6
            bad_pageformat_for_print = 7
            OTHERS                   = 8.
ENDFORM.                               " WRITE_FORM

Former Member
0 Kudos

so guru what might be the probs ?