cancel
Showing results for 
Search instead for 
Did you mean: 

Loop at Material Description in Smartform Driver

Former Member
0 Kudos

Hi Gurus/Experts,

i have create a print report about work order.

And want to display Material Component (PR)

Like in my report. (i will post it).

*&---------------------------------------------------------------------*

*& Report  Z_SF_PO_ESLT_3

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  Z_SF_PR_ESLT5.

TABLES : resb.

DATA: e_eban TYPE eban. " Purchase Requisition Table

DATA: e_resb TYPE resb. " PR Dependent Material

DATA: e_makt TYPE makt. " Material Description

DATA: it_eban TYPE STANDARD TABLE OF eban WITH HEADER LINE. "Purchase Requisition Internal Table

DATA: it_resb TYPE STANDARD TABLE OF resb WITH HEADER LINE. "PR Dependent Material Internal Table

DATA: it_makt TYPE STANDARD TABLE OF makt WITH HEADER LINE. "Material Description Internal Table

DATA: i_func TYPE char30.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: PR_NO TYPE eban-banfn.

SELECTION-SCREEN END OF BLOCK B1.

SELECT SINGLE * FROM eban INTO e_eban

   WHERE banfn = pr_no.

SELECT * FROM eban INTO TABLE it_eban

   WHERE banfn = pr_no.

SELECT SINGLE * FROM resb INTO e_resb

   WHERE banfn = pr_no.

SELECT * FROM resb INTO TABLE it_resb

   WHERE banfn = pr_no.

SELECT * FROM makt INTO TABLE it_makt.

* Dynamic function call using smartform name

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

   EXPORTING

     FORMNAME                 = 'Z_SF_PR_ESLT_23'

*   VARIANT                  = ' '

*   DIRECT_CALL              = ' '

  IMPORTING

    FM_NAME                  = i_func

* EXCEPTIONS

*   NO_FORM                  = 1

*   NO_FUNCTION_MODULE       = 2

*   OTHERS                   = 3

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

CALL FUNCTION i_func

   EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

     I_EBAN                     = e_eban

     I_RESB                     = e_resb

     PR_NO                      = pr_no

     I_MAKT                     = e_makt

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

   TABLES

     IT_eban                    = it_eban

     IT_resb                    = it_resb

     IT_makt                    = it_makt

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

I want to show the material description by field MAKTX in table MAKT.

but in my report it just appear like this.

( In the smartforms i use where condition in loop, MATNR = wa_resb-matnr).

Can we make the description for every material ? Because in my report rightnow it just appear 1 of the material in Material Component (PR).

Accepted Solutions (0)

Answers (1)

Answers (1)

arivazhagan_sivasamy
Active Contributor
0 Kudos

Yes.. You can bring all the values using code.

Using program lines.. pass the material to makt and get the desc..

Arivu.

Former Member
0 Kudos

Hi Ariva,

Must we use loop to after programlines?

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi,

You can write the values within Loop and endloop.

Pass the material to makt table using read table statement.

Arivazhagan S

Former Member
0 Kudos

Hi Ariva,

can you give me an example ? because i am new in ABAP .

arivazhagan_sivasamy
Active Contributor
0 Kudos

Right click on material description field in smartforms under table control main area, create the program line.

Each and every line material number will be coming, pass this material number to makt table like below

Read table i_makt with key matnr = wa_itab-matnr.

Now you will get the material description.

Hope this will resolve the issue.

Arivazhagan S

Former Member
0 Kudos

Hi Ariva,

ok i'll try to fix this with your suggestion. Thank you.